diff options
Diffstat (limited to 'dep/CascLib/src/CascPort.h')
-rw-r--r-- | dep/CascLib/src/CascPort.h | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/dep/CascLib/src/CascPort.h b/dep/CascLib/src/CascPort.h index da11fccd677..419384045cc 100644 --- a/dep/CascLib/src/CascPort.h +++ b/dep/CascLib/src/CascPort.h @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- // Defines for Windows -#if !defined(PLATFORM_DEFINED) && (defined(_WIN32) || defined(_WIN64)) +#if !defined(CASCLIB_PLATFORM_DEFINED) && (defined(_WIN32) || defined(_WIN64)) // In MSVC 8.0, there are some functions declared as deprecated. #define _CRT_SECURE_NO_DEPRECATE @@ -46,7 +46,7 @@ #include <ws2tcpip.h> #include <strsafe.h> - #define PLATFORM_LITTLE_ENDIAN + #define CASCLIB_PLATFORM_LITTLE_ENDIAN #pragma intrinsic(memset, memcmp, memcpy) // Make these functions intrinsic (inline) @@ -54,8 +54,8 @@ #define PATH_SEP_CHAR '\\' #define PATH_SEP_STRING "\\" - #define PLATFORM_WINDOWS - #define PLATFORM_DEFINED // The platform is known now + #define CASCLIB_PLATFORM_WINDOWS + #define CASCLIB_PLATFORM_DEFINED // The platform is known now #endif @@ -66,7 +66,7 @@ //----------------------------------------------------------------------------- // Defines for Mac -#if !defined(PLATFORM_DEFINED) && defined(__APPLE__) // Mac BSD API +#if !defined(CASCLIB_PLATFORM_DEFINED) && defined(__APPLE__) // Mac BSD API // Macintosh #include <sys/types.h> @@ -96,11 +96,13 @@ #endif #define PKEXPORT - #define __SYS_ZLIB - #define __SYS_BZLIB + + #ifndef __SYS_ZLIB + #define __SYS_ZLIB + #endif #ifndef __BIG_ENDIAN__ - #define PLATFORM_LITTLE_ENDIAN + #define CASCLIB_PLATFORM_LITTLE_ENDIAN #endif #define URL_SEP_CHAR '/' @@ -109,15 +111,15 @@ typedef int SOCKET; - #define PLATFORM_MAC - #define PLATFORM_DEFINED // The platform is known now + #define CASCLIB_PLATFORM_MAC + #define CASCLIB_PLATFORM_DEFINED // The platform is known now #endif //----------------------------------------------------------------------------- // Assumption: we are not on Windows nor Macintosh, so this must be linux *grin* -#if !defined(PLATFORM_DEFINED) +#if !defined(CASCLIB_PLATFORM_DEFINED) #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> @@ -144,16 +146,16 @@ typedef int SOCKET; - #define PLATFORM_LITTLE_ENDIAN - #define PLATFORM_LINUX - #define PLATFORM_DEFINED + #define CASCLIB_PLATFORM_LITTLE_ENDIAN + #define CASCLIB_PLATFORM_LINUX + #define CASCLIB_PLATFORM_DEFINED #endif //----------------------------------------------------------------------------- // Definition of Windows-specific types for non-Windows platforms -#ifndef PLATFORM_WINDOWS +#ifndef CASCLIB_PLATFORM_WINDOWS // Typedefs for ANSI C typedef unsigned char BYTE; @@ -213,10 +215,10 @@ #define closesocket close -#endif // !PLATFORM_WINDOWS +#endif // !CASCLIB_PLATFORM_WINDOWS // 64-bit calls are supplied by "normal" calls on Mac -#if defined(PLATFORM_MAC) +#if defined(CASCLIB_PLATFORM_MAC) #define stat64 stat #define fstat64 fstat #define lseek64 lseek @@ -226,7 +228,7 @@ #endif // Platform-specific error codes for UNIX-based platforms -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) #define ERROR_SUCCESS 0 #define ERROR_FILE_NOT_FOUND ENOENT #define ERROR_PATH_NOT_FOUND ENOENT @@ -276,7 +278,7 @@ //----------------------------------------------------------------------------- // Swapping functions -#ifdef PLATFORM_LITTLE_ENDIAN +#ifdef CASCLIB_PLATFORM_LITTLE_ENDIAN #define BSWAP_INT16_UNSIGNED(a) (a) #define BSWAP_INT16_SIGNED(a) (a) #define BSWAP_INT32_UNSIGNED(a) (a) @@ -319,7 +321,7 @@ inline DWORD CascInterlockedIncrement(DWORD * PtrValue) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS return (DWORD)InterlockedIncrement((LONG *)(PtrValue)); #elif defined(__GNUC__) return __sync_add_and_fetch(PtrValue, 1); @@ -331,7 +333,7 @@ inline DWORD CascInterlockedIncrement(DWORD * PtrValue) inline DWORD CascInterlockedDecrement(DWORD * PtrValue) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS return (DWORD)InterlockedDecrement((LONG *)(PtrValue)); #elif defined(__GNUC__) return __sync_sub_and_fetch(PtrValue, 1); @@ -343,7 +345,7 @@ inline DWORD CascInterlockedDecrement(DWORD * PtrValue) //----------------------------------------------------------------------------- // Lock functions -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS typedef RTL_CRITICAL_SECTION CASC_LOCK; #define CascInitLock(Lock) InitializeCriticalSection(&Lock); |