Updates PhysicsFS to latest stable-3.0

This should solve issues related to a crash on windows update 1809
This commit is contained in:
Linus Probert 2018-12-04 14:07:05 +01:00
parent cb2510cf77
commit 9299087b44
14 changed files with 58 additions and 46 deletions

View File

@ -25,6 +25,10 @@ configure_file(
"${PROJECT_BINARY_DIR}/config.h" "${PROJECT_BINARY_DIR}/config.h"
) )
macro(set_option option value)
set(${option} ${value} CACHE INTERNAL "" FORCE)
endmacro()
if (EXISTS "${PROJECT_SOURCE_DIR}/steamworks_c_wrapper/sdk") if (EXISTS "${PROJECT_SOURCE_DIR}/steamworks_c_wrapper/sdk")
MESSAGE ( STATUS "Steam SDK located, Steam build enabled") MESSAGE ( STATUS "Steam SDK located, Steam build enabled")
set(STEAM 1) set(STEAM 1)
@ -105,6 +109,8 @@ if (NOT LUA_FOUND OR STEAM)
endif () endif ()
if (NOT PHYSFS_FOUND OR STEAM) if (NOT PHYSFS_FOUND OR STEAM)
set_option(PHYSFS_BUILD_SHARED off)
set_option(PHYSFS_BUILD_TEST off)
add_subdirectory(physfs-3.0) add_subdirectory(physfs-3.0)
include_directories(physfs-3.0/src) include_directories(physfs-3.0/src)
set(PHYSFS_LIBRARY physfs-static) set(PHYSFS_LIBRARY physfs-static)

View File

@ -1,4 +0,0 @@
repo: 7672c9962ce627edaaa67ff54fe4ad8f9a46dc2b
node: fa8e38bcc3545000a38704b65b604a2c1b764d10
branch: stable-3.0
tag: release-3.0.1

View File

@ -1,2 +0,0 @@
syntax:glob
cmake-build

View File

@ -1,15 +0,0 @@
0bb92a5f0fffd2452cc737346e8b796c213a5688 release-0.1.1
2f2afcbd8abd784f738ac45b0368044763d63748 release-0.1.0
3c7cf50a58fbf220154acd4bdfdf00a21f259eb7 release-0.1.8
473b50402f55b2340fc286775d1b78d18a810362 release-0.1.3
60b5f566a2585d78b2ffadd8d9c16299d0340820 release-1.0.0
67aff4091bf129f7167ed87f937b15f31093e19e release-0.1.9
6ad1722bbcaec1265cb74c9b7be13fe02a547d37 release-0.1.7
8f3ccaaea1cd5dc19235882494d6102e5e9176fb release-0.1.2
c966316c89981bea6ccaa2c2909bb303bfeeb82b release-0.1.6
d2f04ab4b4127757234af6b30bfc98ad4ee9cb15 release-0.1.4
d94f1ccac8095509c57ad640d54796aea0d260f0 release-0.1.5
fe0c1d6f40afa6fca09a277a1ade59231f16c66f release-1.1.1
5d70fca3be361258edfb59c3edaba5abe75a1e88 release-2.0.0
df04959950eb3830c39adfa983789f70f86062d7 release-1.1.0
3396e6dd19fbb52a3fa7e171ffb38ed9acb285a4 release-2.1.1

View File

@ -168,7 +168,7 @@ if(PHYSFS_BUILD_STATIC)
set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
endif() endif()
option(PHYSFS_BUILD_SHARED "Build shared library" FALSE) option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
if(PHYSFS_BUILD_SHARED) if(PHYSFS_BUILD_SHARED)
add_library(physfs SHARED ${PHYSFS_SRCS}) add_library(physfs SHARED ${PHYSFS_SRCS})
set_target_properties(physfs PROPERTIES MACOSX_RPATH 1) set_target_properties(physfs PROPERTIES MACOSX_RPATH 1)
@ -192,7 +192,7 @@ if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC AND NOT WINDOWS)
set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
endif() endif()
option(PHYSFS_BUILD_TEST "Build stdio test program." FALSE) option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
mark_as_advanced(PHYSFS_BUILD_TEST) mark_as_advanced(PHYSFS_BUILD_TEST)
if(PHYSFS_BUILD_TEST) if(PHYSFS_BUILD_TEST)
find_path(READLINE_H readline/readline.h) find_path(READLINE_H readline/readline.h)

View File

@ -1,5 +1,5 @@
Copyright (c) 2001-2017 Ryan C. Gordon and others. Copyright (c) 2001-2018 Ryan C. Gordon and others.
This software is provided 'as-is', without any express or implied warranty. This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from In no event will the authors be held liable for any damages arising from

View File

@ -164,6 +164,9 @@ CMake fixes:
Bug fixes, Bug fixes,
Rémi Verschelde Rémi Verschelde
Bug fixes:
Rob Loach
Other stuff: Other stuff:
Your name here! Patches go to icculus@icculus.org ... Your name here! Patches go to icculus@icculus.org ...

View File

@ -50,18 +50,22 @@ static int locateOneElement(char *buf)
ptr++; /* point past dirsep to entry itself. */ ptr++; /* point past dirsep to entry itself. */
} /* else */ } /* else */
for (i = rc; *i != NULL; i++) if (rc != NULL)
{ {
if (PHYSFS_utf8stricmp(*i, ptr) == 0) for (i = rc; *i != NULL; i++)
{ {
strcpy(ptr, *i); /* found a match. Overwrite with this case. */ if (PHYSFS_utf8stricmp(*i, ptr) == 0)
PHYSFS_freeList(rc); {
return 1; strcpy(ptr, *i); /* found a match. Overwrite with this case. */
} /* if */ PHYSFS_freeList(rc);
} /* for */ return 1;
} /* if */
} /* for */
PHYSFS_freeList(rc);
} /* if */
/* no match at all... */ /* no match at all... */
PHYSFS_freeList(rc);
return 0; return 0;
} /* locateOneElement */ } /* locateOneElement */

View File

@ -32,10 +32,16 @@
#endif #endif
#if !TARGET_SDL2 #if !TARGET_SDL2
#ifndef RW_SEEK_SET
#define RW_SEEK_SET SEEK_SET #define RW_SEEK_SET SEEK_SET
#endif
#ifndef RW_SEEK_CUR
#define RW_SEEK_CUR SEEK_CUR #define RW_SEEK_CUR SEEK_CUR
#endif
#ifndef RW_SEEK_END
#define RW_SEEK_END SEEK_END #define RW_SEEK_END SEEK_END
#endif #endif
#endif
#if TARGET_SDL2 #if TARGET_SDL2
static Sint64 SDLCALL physfsrwops_size(struct SDL_RWops *rw) static Sint64 SDLCALL physfsrwops_size(struct SDL_RWops *rw)

View File

@ -879,13 +879,20 @@ static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting)
if (io == NULL) if (io == NULL)
{ {
/* file doesn't exist, etc? Just fail out. */
PHYSFS_Stat statbuf;
BAIL_IF_ERRPASS(!__PHYSFS_platformStat(d, &statbuf, 1), NULL);
/* DIR gets first shot (unlike the rest, it doesn't deal with files). */ /* DIR gets first shot (unlike the rest, it doesn't deal with files). */
retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed); if (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY)
if (retval || claimed) {
return retval; retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed);
if (retval || claimed)
return retval;
} /* if */
io = __PHYSFS_createNativeIo(d, forWriting ? 'w' : 'r'); io = __PHYSFS_createNativeIo(d, forWriting ? 'w' : 'r');
BAIL_IF_ERRPASS(!io, 0); BAIL_IF_ERRPASS(!io, NULL);
created_io = 1; created_io = 1;
} /* if */ } /* if */
@ -2662,7 +2669,6 @@ static int closeHandleInOpenList(FileHandle **list, FileHandle *handle)
{ {
FileHandle *prev = NULL; FileHandle *prev = NULL;
FileHandle *i; FileHandle *i;
int rc = 1;
for (i = *list; i != NULL; i = i->next) for (i = *list; i != NULL; i = i->next)
{ {
@ -2670,9 +2676,16 @@ static int closeHandleInOpenList(FileHandle **list, FileHandle *handle)
{ {
PHYSFS_Io *io = handle->io; PHYSFS_Io *io = handle->io;
PHYSFS_uint8 *tmp = handle->buffer; PHYSFS_uint8 *tmp = handle->buffer;
rc = PHYSFS_flush((PHYSFS_File *) handle);
if (!rc) /* send our buffer to io... */
if (!PHYSFS_flush((PHYSFS_File *) handle))
return -1; return -1;
/* ...then have io send it to the disk... */
else if (io->flush && !io->flush(io))
return -1;
/* ...then close the underlying file. */
io->destroy(io); io->destroy(io);
if (tmp != NULL) /* free any associated buffer. */ if (tmp != NULL) /* free any associated buffer. */
@ -2970,7 +2983,7 @@ int PHYSFS_flush(PHYSFS_File *handle)
rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos); rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos);
BAIL_IF_ERRPASS(rc <= 0, 0); BAIL_IF_ERRPASS(rc <= 0, 0);
fh->bufpos = fh->buffill = 0; fh->bufpos = fh->buffill = 0;
return io->flush ? io->flush(io) : 1; return 1;
} /* PHYSFS_flush */ } /* PHYSFS_flush */

View File

@ -225,11 +225,11 @@ extern "C" {
#if defined(PHYSFS_DECL) #if defined(PHYSFS_DECL)
/* do nothing. */ /* do nothing. */
#elif (defined _MSC_VER) #elif defined(_MSC_VER)
#define PHYSFS_DECL __declspec(dllexport) #define PHYSFS_DECL __declspec(dllexport)
#elif (defined __SUNPRO_C) #elif defined(__SUNPRO_C)
#define PHYSFS_DECL __global #define PHYSFS_DECL __global
#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun)) #elif ((__GNUC__ >= 3) && (!defined(__EMX__)) && (!defined(sun)))
#define PHYSFS_DECL __attribute__((visibility("default"))) #define PHYSFS_DECL __attribute__((visibility("default")))
#else #else
#define PHYSFS_DECL #define PHYSFS_DECL

View File

@ -203,6 +203,8 @@ static void SZIP_closeArchive(void *opaque)
SZIPinfo *info = (SZIPinfo *) opaque; SZIPinfo *info = (SZIPinfo *) opaque;
if (info) if (info)
{ {
if (info->io)
info->io->destroy(info->io);
SzArEx_Free(&info->db, &SZIP_SzAlloc); SzArEx_Free(&info->db, &SZIP_SzAlloc);
__PHYSFS_DirTreeDeinit(&info->tree); __PHYSFS_DirTreeDeinit(&info->tree);
allocator.Free(info); allocator.Free(info);

View File

@ -50,7 +50,7 @@ char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
{ {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, TRUE); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, TRUE);
BAIL_IF(!paths, PHYSFS_ERR_OS_ERROR, NULL); BAIL_IF(!paths, PHYSFS_ERR_OS_ERROR, NULL);
NSString *path = (NSString *) paths[0]; NSString *path = (NSString *) [paths objectAtIndex:0];
BAIL_IF(!path, PHYSFS_ERR_OS_ERROR, NULL); BAIL_IF(!path, PHYSFS_ERR_OS_ERROR, NULL);
size_t len = [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; size_t len = [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
const size_t applen = strlen(app); const size_t applen = strlen(app);

View File

@ -566,7 +566,6 @@ char *__PHYSFS_platformCalcUserDir(void)
else else
{ {
DWORD psize = 0; DWORD psize = 0;
WCHAR dummy = 0;
LPWSTR wstr = NULL; LPWSTR wstr = NULL;
BOOL rc = 0; BOOL rc = 0;
@ -575,7 +574,7 @@ char *__PHYSFS_platformCalcUserDir(void)
* psize. Also note that the second parameter can't be * psize. Also note that the second parameter can't be
* NULL or the function fails. * NULL or the function fails.
*/ */
rc = pGetDir(accessToken, &dummy, &psize); rc = pGetDir(accessToken, NULL, &psize);
GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */ GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */
/* Allocate memory for the profile directory */ /* Allocate memory for the profile directory */