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:
parent
19935cfa55
commit
1d296c01e3
1 changed files with 26 additions and 10 deletions
|
@ -22,13 +22,13 @@
|
|||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
#include <direct.h>
|
||||
#include <process.h>
|
||||
#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
#ifndef HAVE_CONFIG_H
|
||||
#define HAVE_CONFIG_H
|
||||
#endif
|
||||
|
@ -60,42 +60,58 @@ static char *strndup(const char *str, int len)
|
|||
|
||||
#endif
|
||||
|
||||
// Apple platform ---------------------------------------------------
|
||||
#ifdef __APPLE__
|
||||
|
||||
#define isnan(x) ((x) != (x))
|
||||
|
||||
#endif
|
||||
|
||||
// Windows platform -------------------------------------------------
|
||||
// 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 snprintf _snprintf
|
||||
|
||||
//MSVC 2008 already has this
|
||||
#if _MSC_VER <= 1400
|
||||
// For MSVC 2005 and older (2008 already defines these)
|
||||
#if _MSC_VER < 1500
|
||||
|
||||
#define vsnprintf _vsnprintf
|
||||
#define isnan _isnan
|
||||
#endif
|
||||
|
||||
#endif // _MSC_VER < 1500
|
||||
|
||||
// For MSVC 2005 and newer
|
||||
#if _MSC_VER >= 1400
|
||||
|
||||
#ifdef strdup
|
||||
#undef strdup
|
||||
#endif
|
||||
#define strdup _strdup
|
||||
|
||||
#define stricmp _stricmp
|
||||
#define strnicmp _strnicmp
|
||||
#define chdir _chdir
|
||||
#define getcwd _getcwd
|
||||
#define chmod _chmod
|
||||
|
||||
#ifdef mkdir
|
||||
#undef mkdir
|
||||
#endif
|
||||
#define mkdir(x) _mkdir(x)
|
||||
#define execvp _execvp
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#define execvp _execvp
|
||||
|
||||
#endif // _MSC_VER >= 1400
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _SD_PORTABILITY_H_
|
||||
|
||||
|
|
Loading…
Reference in a new issue