cleaned up portability.h

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3138 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 7c16be115e5c0a6a7efe219b735ea0b8a6dbcdde
Former-commit-id: ac48c358b73bd5f2679f4225f988b998907975de
This commit is contained in:
pouillot 2010-11-21 18:03:30 +00:00
parent 19935cfa55
commit 1d296c01e3

View file

@ -22,13 +22,13 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#ifdef WIN32 #ifdef _MSC_VER
#include <direct.h> #include <direct.h>
#include <process.h> #include <process.h>
#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ #define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
#endif #endif
#ifdef WIN32 #ifdef _MSC_VER
#ifndef HAVE_CONFIG_H #ifndef HAVE_CONFIG_H
#define HAVE_CONFIG_H #define HAVE_CONFIG_H
#endif #endif
@ -60,42 +60,58 @@ static char *strndup(const char *str, int len)
#endif #endif
// Apple platform ---------------------------------------------------
#ifdef __APPLE__ #ifdef __APPLE__
#define isnan(x) ((x) != (x)) #define isnan(x) ((x) != (x))
#endif #endif
// Windows platform -------------------------------------------------
// Posix functions special names with MS compilers. // Posix functions special names with MS compilers.
#if defined(WIN32) // Notes on MSVC compilers detection :
// * _MSC_VER define should be prefered to WIN32/_WIN32
// * MSVC 6 : 1200 <= _MSC_VER < 1300
// * MSVC 2003 : 1300 <= _MSC_VER < 1400
// * MSVC 2005 : 1400 <= _MSC_VER < 1500
// * MSVC 2008 : 1500 <= _MSC_VER
#ifdef _MSC_VER
#define isnan _isnan #define isnan _isnan
#define snprintf _snprintf #define snprintf _snprintf
//MSVC 2008 already has this // For MSVC 2005 and older (2008 already defines these)
#if _MSC_VER <= 1400 #if _MSC_VER < 1500
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define isnan _isnan
#endif #endif // _MSC_VER < 1500
// For MSVC 2005 and newer // For MSVC 2005 and newer
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
#ifdef strdup #ifdef strdup
#undef strdup #undef strdup
#endif #endif
#define strdup _strdup #define strdup _strdup
#define stricmp _stricmp #define stricmp _stricmp
#define strnicmp _strnicmp #define strnicmp _strnicmp
#define chdir _chdir #define chdir _chdir
#define getcwd _getcwd #define getcwd _getcwd
#define chmod _chmod #define chmod _chmod
#ifdef mkdir #ifdef mkdir
#undef mkdir #undef mkdir
#endif #endif
#define mkdir(x) _mkdir(x) #define mkdir(x) _mkdir(x)
#define execvp _execvp
#endif
#endif #define execvp _execvp
#endif // _MSC_VER >= 1400
#endif // _MSC_VER
#endif // _SD_PORTABILITY_H_ #endif // _SD_PORTABILITY_H_