From: ShadowFlare Date: Mon, 14 Mar 2011 11:11:43 +0000 (-0600) Subject: Various Linux compatibility updates. X-Git-Url: https://sfsrealm.hopto.org/projects/?a=commitdiff_plain;h=1b459fd54695b623207e9b518010c69345b94836;p=SFmpqapi.git Various Linux compatibility updates. --- diff --git a/SFmpqapi.cpp b/SFmpqapi.cpp index 0f5acaf..c6d1eac 100644 --- a/SFmpqapi.cpp +++ b/SFmpqapi.cpp @@ -1124,7 +1124,7 @@ DWORD SFMPQAPI WINAPI SFileGetFileInfo(MPQHANDLE hFile, DWORD dwInfoType) return (DWORD)-1; } -DWORD SFMPQAPI WINAPI SFileSetFilePointer(MPQHANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod) +DWORD SFMPQAPI WINAPI SFileSetFilePointer(MPQHANDLE hFile, LONG lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod) { if (!hFile) { SetLastError(ERROR_INVALID_PARAMETER); @@ -1176,7 +1176,7 @@ BOOL SFMPQAPI WINAPI SFileReadFile(MPQHANDLE hFile,LPVOID lpBuffer,DWORD nNumber } if (lpOverlapped) if (lpOverlapped->Internal || lpOverlapped->InternalHigh || lpOverlapped->Offset || lpOverlapped->OffsetHigh || lpOverlapped->hEvent) - SFileSetFilePointer(hFile,lpOverlapped->Offset,(long *)&lpOverlapped->OffsetHigh,FILE_BEGIN); + SFileSetFilePointer(hFile,lpOverlapped->Offset,(LONG *)&lpOverlapped->OffsetHigh,FILE_BEGIN); if (nNumberOfBytesToRead==0) { if (lpNumberOfBytesRead) *lpNumberOfBytesRead = 0; if (lpOverlapped) lpOverlapped->InternalHigh = 0; diff --git a/linux/windows.cpp b/linux/windows.cpp index e9329e2..815f8ab 100644 --- a/linux/windows.cpp +++ b/linux/windows.cpp @@ -157,14 +157,14 @@ char * strupr(char *lpString) return lpString; } -char * strdup(const char *lpString) +/*char * strdup(const char *lpString) { if (lpString==0) return 0; char *lpStrCopy = (char *)malloc(strlen(lpString)+1); if (lpStrCopy==0) return 0; strcpy(lpStrCopy,lpString); return lpStrCopy; -} +}*/ int memicmp(const char *lpString1, const char *lpString2, size_t dwSize) { diff --git a/linux/windows.h b/linux/windows.h index a4ace25..f377310 100644 --- a/linux/windows.h +++ b/linux/windows.h @@ -9,6 +9,7 @@ #include #include #include +#include #define LINUX_PORT @@ -21,21 +22,20 @@ extern "C" { #define __stdcall #define WINAPI __stdcall #define APIENTRY __stdcall -#define __declspec(dllimport) -#define __declspec(dllexport) +#define __declspec(x) #define __inline inline #define __forceinline inline #define CONST const // Type defines -typedef unsigned char BYTE; -typedef unsigned short int WORD; -typedef unsigned long int DWORD; -typedef short int SHORT; -typedef unsigned short int USHORT; +typedef uint8_t BYTE; +typedef uint16_t WORD; +typedef uint32_t DWORD; +typedef int16_t SHORT; +typedef uint16_t USHORT; typedef DWORD LCID; -typedef long int LONG; +typedef int32_t LONG; typedef LONG * PLONG; typedef int BOOL; typedef void * LPVOID; @@ -67,6 +67,8 @@ typedef struct _SECURITY_ATTRIBUTES { #define TRUE 1 #define MAX_PATH 260 #define INVALID_HANDLE_VALUE ((HANDLE)-1) +#define INVALID_FILE_SIZE ((DWORD)-1) +#define INVALID_SET_FILE_POINTER ((DWORD)-1) #define DLL_PROCESS_ATTACH 1 #define DLL_THREAD_ATTACH 2 #define DLL_THREAD_DETACH 3 @@ -114,6 +116,7 @@ typedef struct _SECURITY_ATTRIBUTES { #define FILE_BEGIN 0 #define FILE_CURRENT 1 #define FILE_END 2 +#define NO_ERROR 0L #define ERROR_FILE_NOT_FOUND 2L #define ERROR_ACCESS_DENIED 5L #define ERROR_INVALID_PARAMETER 87L // dderror @@ -138,7 +141,7 @@ BOOL WINAPI DeleteFile(LPCSTR lpFileName); // Declarations for C runtime functions char * strlwr(char *lpString); char * strupr(char *lpString); -char * strdup(const char *lpString); +//char * strdup(const char *lpString); #define stricmp strcasecmp #define strnicmp strncasecmp int memicmp(const char *lpString1, const char *lpString2, size_t dwSize);