diff options
Diffstat (limited to 'dep/CascLib/src/common')
-rw-r--r-- | dep/CascLib/src/common/Common.cpp | 8 | ||||
-rw-r--r-- | dep/CascLib/src/common/Directory.cpp | 10 | ||||
-rw-r--r-- | dep/CascLib/src/common/FileStream.cpp | 36 | ||||
-rw-r--r-- | dep/CascLib/src/common/Sockets.cpp | 4 |
4 files changed, 29 insertions, 29 deletions
diff --git a/dep/CascLib/src/common/Common.cpp b/dep/CascLib/src/common/Common.cpp index 953a4f0b129..ac06e8df53e 100644 --- a/dep/CascLib/src/common/Common.cpp +++ b/dep/CascLib/src/common/Common.cpp @@ -81,7 +81,7 @@ static DWORD dwLastError = ERROR_SUCCESS; DWORD GetCascError() { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS return GetLastError(); #else return dwLastError; @@ -90,7 +90,7 @@ DWORD GetCascError() void SetCascError(DWORD dwErrCode) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS SetLastError(dwErrCode); #endif dwLastError = dwErrCode; @@ -301,7 +301,7 @@ size_t CascStrPrintf(char * buffer, size_t nCount, const char * format, ...) // Start the argument list va_start(argList, format); -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS StringCchVPrintfExA(buffer, nCount, &buffend, NULL, 0, format, argList); // buffend = buffer + vsnprintf(buffer, nCount, format, argList); #else @@ -321,7 +321,7 @@ size_t CascStrPrintf(wchar_t * buffer, size_t nCount, const wchar_t * format, .. // Start the argument list va_start(argList, format); -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS StringCchVPrintfExW(buffer, nCount, &buffend, NULL, 0, format, argList); // buffend = buffer + vswprintf(buffer, nCount, format, argList); #else diff --git a/dep/CascLib/src/common/Directory.cpp b/dep/CascLib/src/common/Directory.cpp index a306e54a91e..efabda45171 100644 --- a/dep/CascLib/src/common/Directory.cpp +++ b/dep/CascLib/src/common/Directory.cpp @@ -17,13 +17,13 @@ bool DirectoryExists(LPCTSTR szDirectory) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS DWORD dwAttributes = GetFileAttributes(szDirectory); if((dwAttributes != INVALID_FILE_ATTRIBUTES) && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return true; -#else // PLATFORM_WINDOWS +#else // CASCLIB_PLATFORM_WINDOWS DIR * dir = opendir(szDirectory); @@ -40,7 +40,7 @@ bool DirectoryExists(LPCTSTR szDirectory) bool MakeDirectory(LPCTSTR szDirectory) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS BOOL bResult = CreateDirectory(szDirectory, NULL); return (bResult) ? true : false; @@ -57,7 +57,7 @@ int ScanIndexDirectory( INDEX_FILE_FOUND pfnOnFileFound, void * pvContext) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS WIN32_FIND_DATA wf; HANDLE hFind; @@ -85,7 +85,7 @@ int ScanIndexDirectory( FindClose(hFind); } -#else // PLATFORM_WINDOWS +#else // CASCLIB_PLATFORM_WINDOWS struct dirent * dir_entry; DIR * dir; diff --git a/dep/CascLib/src/common/FileStream.cpp b/dep/CascLib/src/common/FileStream.cpp index e84c7cc3c4b..498729bab6f 100644 --- a/dep/CascLib/src/common/FileStream.cpp +++ b/dep/CascLib/src/common/FileStream.cpp @@ -55,7 +55,7 @@ static void BaseNone_Init(TFileStream *) static bool BaseFile_Create(TFileStream * pStream) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS { DWORD dwWriteShare = (pStream->dwFlags & STREAM_FLAG_WRITE_SHARE) ? FILE_SHARE_WRITE : 0; @@ -71,7 +71,7 @@ static bool BaseFile_Create(TFileStream * pStream) } #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) { intptr_t handle; @@ -95,7 +95,7 @@ static bool BaseFile_Create(TFileStream * pStream) static bool BaseFile_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStreamFlags) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS { ULARGE_INTEGER FileSize; DWORD dwWriteAccess = (dwStreamFlags & STREAM_FLAG_READ_ONLY) ? 0 : FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES; @@ -121,7 +121,7 @@ static bool BaseFile_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStr } #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) { struct stat64 fileinfo; int oflag = (dwStreamFlags & STREAM_FLAG_READ_ONLY) ? O_RDONLY : O_RDWR; @@ -171,7 +171,7 @@ static bool BaseFile_Read( { ULONGLONG ByteOffset = GetByteOffset(pByteOffset, pStream->Base.File.FilePos); -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS { // Note: We no longer support Windows 9x. // Thus, we can use the OVERLAPPED structure to specify @@ -198,7 +198,7 @@ static bool BaseFile_Read( } #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) { ssize_t bytes_read; @@ -271,7 +271,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const { ULONGLONG ByteOffset = GetByteOffset(pByteOffset, pStream->Base.File.FilePos); -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS { // Note: We no longer support Windows 9x. // Thus, we can use the OVERLAPPED structure to specify @@ -298,7 +298,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const } #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) { ssize_t bytes_written; @@ -348,7 +348,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const */ static bool BaseFile_Resize(TFileStream * pStream, ULONGLONG NewFileSize) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS { LONG FileSizeHi = (LONG)(NewFileSize >> 32); LONG FileSizeLo; @@ -373,7 +373,7 @@ static bool BaseFile_Resize(TFileStream * pStream, ULONGLONG NewFileSize) } #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) { if(ftruncate64((intptr_t)pStream->Base.File.hFile, (off64_t)NewFileSize) == -1) { @@ -408,12 +408,12 @@ static bool BaseFile_GetPos(TFileStream * pStream, ULONGLONG * pByteOffset) // Renames the file pointed by pStream so that it contains data from pNewStream static bool BaseFile_Replace(TFileStream * pStream, TFileStream * pNewStream) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS // Rename the new file to the old stream's file return (bool)MoveFileEx(pNewStream->szFileName, pStream->szFileName, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) // "rename" on Linux also works if the target file exists if(rename(pNewStream->szFileName, pStream->szFileName) == -1) { @@ -432,11 +432,11 @@ static void BaseFile_Close(TFileStream * pStream) { if(pStream->Base.File.hFile != INVALID_HANDLE_VALUE) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS CloseHandle(pStream->Base.File.hFile); #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) close((intptr_t)pStream->Base.File.hFile); #endif } @@ -465,7 +465,7 @@ static void BaseFile_Init(TFileStream * pStream) static bool BaseMap_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStreamFlags) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS ULARGE_INTEGER FileSize; HANDLE hFile; @@ -517,7 +517,7 @@ static bool BaseMap_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStre return false; #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) struct stat64 fileinfo; intptr_t handle; bool bResult = false; @@ -581,12 +581,12 @@ static bool BaseMap_Read( static void BaseMap_Close(TFileStream * pStream) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS if(pStream->Base.Map.pbFile != NULL) UnmapViewOfFile(pStream->Base.Map.pbFile); #endif -#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#if defined(CASCLIB_PLATFORM_MAC) || defined(CASCLIB_PLATFORM_LINUX) if(pStream->Base.Map.pbFile != NULL) munmap(pStream->Base.Map.pbFile, (size_t )pStream->Base.Map.FileSize); #endif diff --git a/dep/CascLib/src/common/Sockets.cpp b/dep/CascLib/src/common/Sockets.cpp index e1f58f6f79c..dee5643d42e 100644 --- a/dep/CascLib/src/common/Sockets.cpp +++ b/dep/CascLib/src/common/Sockets.cpp @@ -111,7 +111,7 @@ void CASC_SOCKET::Release() int CASC_SOCKET::GetSockError() { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS return WSAGetLastError(); #else return errno; @@ -134,7 +134,7 @@ DWORD CASC_SOCKET::GetAddrInfoWrapper(const char * hostName, unsigned portNum, P // Error-specific handling switch(dwErrCode) { -#ifdef PLATFORM_WINDOWS +#ifdef CASCLIB_PLATFORM_WINDOWS case WSANOTINITIALISED: // Windows-specific: WSAStartup not called { WSADATA wsd; |