1/* Copyright (c) 2009, Google Inc. 2 * All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * --- 31 * Author: Craig Silverstein 32 * 33 * These are some portability typedefs and defines to make it a bit 34 * easier to compile this code under VC++. 35 * 36 * Several of these are taken from glib: 37 * http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html 38 */ 39 40#ifndef GOOGLE_GFLAGS_WINDOWS_PORT_H_ 41#define GOOGLE_GFLAGS_WINDOWS_PORT_H_ 42 43// You should never include this file directly, but always include it 44// from either config.h (MSVC) or mingw.h (MinGW/msys). 45#if !defined(GOOGLE_GFLAGS_WINDOWS_CONFIG_H_) 46# error "port.h should only be included from config.h" 47#endif 48 49#ifdef _WIN32 50 51#ifndef WIN32_LEAN_AND_MEAN 52#define WIN32_LEAN_AND_MEAN /* We always want minimal includes */ 53#endif 54#include <windows.h> 55#include <direct.h> /* for mkdir */ 56#include <stdio.h> /* need this to override stdio's snprintf */ 57 58#define putenv _putenv 59 60// ----------------------------------- STRING ROUTINES 61 62// We can't just use _snprintf as a drop-in-replacement, because it 63// doesn't always NUL-terminate. :-( 64extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size, 65 const char *format, ...); 66 67#define strcasecmp _stricmp 68 69#define PRId32 "d" 70#define PRIu32 "u" 71#define PRId64 "I64d" 72#define PRIu64 "I64u" 73 74#ifndef __MINGW32__ 75#define strtoq _strtoi64 76#define strtouq _strtoui64 77#define strtoll _strtoi64 78#define strtoull _strtoui64 79#define atoll _atoi64 80#endif 81 82#ifndef PATH_MAX 83#define PATH_MAX 1024 84#endif 85 86#endif /* _WIN32 */ 87 88#endif /* GOOGLE_GFLAGS_WINDOWS_PORT_H_ */ 89