Patched to compile with latest Platform SDK.
This commit is contained in:
parent
f6c383ff24
commit
6fe37fd840
|
@ -62,6 +62,11 @@ IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
ENDIF(PHYSFS_IS_GCC4)
|
ENDIF(PHYSFS_IS_GCC4)
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
|
IF(MSVC)
|
||||||
|
# VS.NET 8.0 got really really anal about strcpy, etc, which even if we
|
||||||
|
# cleaned up our code, zlib, etc still use...so disable the warning.
|
||||||
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
|
||||||
|
ENDIF(MSVC)
|
||||||
|
|
||||||
# Basic chunks of source code ...
|
# Basic chunks of source code ...
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ typedef struct _LZMAentry
|
||||||
PHYSFS_uint32 fileIndex; /* Index of file in archive */
|
PHYSFS_uint32 fileIndex; /* Index of file in archive */
|
||||||
PHYSFS_uint32 folderIndex; /* Index of folder in archive */
|
PHYSFS_uint32 folderIndex; /* Index of folder in archive */
|
||||||
size_t offset; /* Offset in folder */
|
size_t offset; /* Offset in folder */
|
||||||
PHYSFS_uint32 position; /* Current "virtual" position in file */
|
PHYSFS_uint64 position; /* Current "virtual" position in file */
|
||||||
} LZMAentry;
|
} LZMAentry;
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,13 +116,13 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
|
||||||
size_t *processedSize)
|
size_t *processedSize)
|
||||||
{
|
{
|
||||||
CFileInStream *s = (CFileInStream *)object;
|
CFileInStream *s = (CFileInStream *)object;
|
||||||
size_t processedSizeLoc;
|
PHYSFS_sint64 processedSizeLoc;
|
||||||
if (maxReqSize > kBufferSize)
|
if (maxReqSize > kBufferSize)
|
||||||
maxReqSize = kBufferSize;
|
maxReqSize = kBufferSize;
|
||||||
processedSizeLoc = __PHYSFS_platformRead(s->File, g_Buffer, 1, maxReqSize);
|
processedSizeLoc = __PHYSFS_platformRead(s->File, g_Buffer, 1, maxReqSize);
|
||||||
*buffer = g_Buffer;
|
*buffer = g_Buffer;
|
||||||
if (processedSize != 0)
|
if (processedSize != NULL)
|
||||||
*processedSize = processedSizeLoc;
|
*processedSize = (size_t) processedSizeLoc;
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
} /* SzFileReadImp */
|
} /* SzFileReadImp */
|
||||||
|
|
||||||
|
@ -313,10 +313,11 @@ static PHYSFS_sint64 LZMA_read(fvoid *opaque, void *outBuffer,
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
/* Copy wanted bytes over from cache to outBuffer */
|
/* Copy wanted bytes over from cache to outBuffer */
|
||||||
|
/* !!! FIXME: strncpy for non-string data? */
|
||||||
strncpy(outBuffer,
|
strncpy(outBuffer,
|
||||||
(void*) (entry->archive->folder[entry->folderIndex].cache +
|
(void*) (entry->archive->folder[entry->folderIndex].cache +
|
||||||
entry->offset + entry->position),
|
entry->offset + entry->position),
|
||||||
wantedSize);
|
(size_t) wantedSize);
|
||||||
entry->position += wantedSize;
|
entry->position += wantedSize;
|
||||||
return objCount;
|
return objCount;
|
||||||
} /* LZMA_read */
|
} /* LZMA_read */
|
||||||
|
@ -465,7 +466,7 @@ static void *LZMA_openArchive(const char *name, int forWriting)
|
||||||
* Init with 0 so we know when a folder is already cached
|
* Init with 0 so we know when a folder is already cached
|
||||||
* Values will be set by LZMA_read()
|
* Values will be set by LZMA_read()
|
||||||
*/
|
*/
|
||||||
memset(archive->folder, 0, len);
|
memset(archive->folder, 0, (size_t) len);
|
||||||
|
|
||||||
return(archive);
|
return(archive);
|
||||||
} /* LZMA_openArchive */
|
} /* LZMA_openArchive */
|
||||||
|
|
|
@ -188,7 +188,8 @@ SZ_RESULT SafeReadDirect(ISzInStream *inStream, Byte *data, size_t size)
|
||||||
size -= processedSize;
|
size -= processedSize;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
*data++ = *(Byte*)inBuffer++;
|
*(data++) = *((Byte*)inBuffer);
|
||||||
|
inBuffer = ((Byte*) inBuffer) + 1;
|
||||||
}
|
}
|
||||||
while (--processedSize != 0);
|
while (--processedSize != 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
#define assert(x)
|
#define assert(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* !!! FIXME: remove this when revamping stack allocation code... */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,7 +37,7 @@ extern "C" {
|
||||||
#define malloc(x) Do not use malloc() directly.
|
#define malloc(x) Do not use malloc() directly.
|
||||||
#define realloc(x, y) Do not use realloc() directly.
|
#define realloc(x, y) Do not use realloc() directly.
|
||||||
#define free(x) Do not use free() directly.
|
#define free(x) Do not use free() directly.
|
||||||
|
/* !!! FIXME: add alloca check here. */
|
||||||
|
|
||||||
/* The LANG section. */
|
/* The LANG section. */
|
||||||
/* please send questions/translations to Ryan: icculus@icculus.org. */
|
/* please send questions/translations to Ryan: icculus@icculus.org. */
|
||||||
|
|
|
@ -21,11 +21,13 @@
|
||||||
|
|
||||||
#include "physfs_internal.h"
|
#include "physfs_internal.h"
|
||||||
|
|
||||||
#if (defined _MSC_VER)
|
#if (!defined alloca)
|
||||||
|
#if ((defined _MSC_VER)
|
||||||
#define alloca(x) _alloca(x)
|
#define alloca(x) _alloca(x)
|
||||||
#elif (defined __MINGW32__) /* scary...hopefully this is okay. */
|
#elif (defined __MINGW32__) /* scary...hopefully this is okay. */
|
||||||
#define alloca(x) __builtin_alloca(x)
|
#define alloca(x) __builtin_alloca(x)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOWORDER_UINT64(pos) (PHYSFS_uint32) \
|
#define LOWORDER_UINT64(pos) (PHYSFS_uint32) \
|
||||||
(pos & 0x00000000FFFFFFFF)
|
(pos & 0x00000000FFFFFFFF)
|
||||||
|
|
Loading…
Reference in New Issue