From b16c30b89632a70e876743d0b05cf028fba739f2 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 28 Oct 2017 22:23:17 -0300 Subject: [PATCH] Update physfs to 3.0.1 --- CMakeLists.txt | 2 +- libs/physfs-3.0.0/.hg_archival.txt | 6 -- libs/physfs-3.0.1/.hg_archival.txt | 4 ++ libs/{physfs-3.0.0 => physfs-3.0.1}/.hgignore | 0 libs/{physfs-3.0.0 => physfs-3.0.1}/.hgtags | 0 .../CMakeLists.txt | 16 ++--- .../LICENSE.txt | 0 .../{physfs-3.0.0 => physfs-3.0.1}/README.txt | 0 .../docs/CHANGELOG.txt | 0 .../docs/CREDITS.txt | 0 .../docs/Doxyfile | 0 .../docs/INSTALL.txt | 0 .../docs/README-API-documentation.txt | 0 .../docs/TODO.txt | 0 .../extras/README-CSharp.txt | 0 .../extras/abs-file.h | 0 .../extras/buildbot-checker.sh | 0 .../extras/buildbot-emscripten.sh | 0 .../extras/buildbot-os2.sh | 0 .../extras/buildbot-raspberrypi.sh | 0 .../extras/casefolding.txt | 0 .../extras/globbing.c | 0 .../extras/globbing.h | 0 .../extras/ignorecase.c | 0 .../extras/ignorecase.h | 0 .../extras/makecasefoldhashtable.pl | 0 .../extras/physfs.pc.in | 0 .../extras/physfshttpd.c | 0 .../extras/physfsrwops.c | 0 .../extras/physfsrwops.h | 0 .../extras/physfsunpack.c | 0 .../extras/selfextract.c | 0 .../extras/uninstall.sh | 0 .../src/physfs.c | 44 ++++++------ .../src/physfs.h | 71 ++++++++++++------- .../src/physfs_archiver_7z.c | 0 .../src/physfs_archiver_dir.c | 7 +- .../src/physfs_archiver_grp.c | 0 .../src/physfs_archiver_hog.c | 0 .../src/physfs_archiver_iso9660.c | 21 ++++-- .../src/physfs_archiver_mvl.c | 0 .../src/physfs_archiver_qpak.c | 0 .../src/physfs_archiver_slb.c | 0 .../src/physfs_archiver_unpacked.c | 0 .../src/physfs_archiver_vdf.c | 0 .../src/physfs_archiver_wad.c | 0 .../src/physfs_archiver_zip.c | 1 + .../src/physfs_byteorder.c | 0 .../src/physfs_casefolding.h | 0 .../src/physfs_internal.h | 5 +- .../src/physfs_lzmasdk.h | 0 .../src/physfs_miniz.h | 0 .../src/physfs_platform_apple.m | 0 .../src/physfs_platform_haiku.cpp | 0 .../src/physfs_platform_os2.c | 2 +- .../src/physfs_platform_posix.c | 8 +-- .../src/physfs_platform_qnx.c | 0 .../src/physfs_platform_unix.c | 0 .../src/physfs_platform_windows.c | 4 +- .../src/physfs_platform_winrt.cpp | 0 .../src/physfs_platforms.h | 0 .../src/physfs_unicode.c | 0 .../test/test_physfs.c | 2 +- 63 files changed, 111 insertions(+), 82 deletions(-) delete mode 100644 libs/physfs-3.0.0/.hg_archival.txt create mode 100644 libs/physfs-3.0.1/.hg_archival.txt rename libs/{physfs-3.0.0 => physfs-3.0.1}/.hgignore (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/.hgtags (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/CMakeLists.txt (96%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/LICENSE.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/README.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/docs/CHANGELOG.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/docs/CREDITS.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/docs/Doxyfile (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/docs/INSTALL.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/docs/README-API-documentation.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/docs/TODO.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/README-CSharp.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/abs-file.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/buildbot-checker.sh (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/buildbot-emscripten.sh (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/buildbot-os2.sh (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/buildbot-raspberrypi.sh (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/casefolding.txt (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/globbing.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/globbing.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/ignorecase.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/ignorecase.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/makecasefoldhashtable.pl (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/physfs.pc.in (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/physfshttpd.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/physfsrwops.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/physfsrwops.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/physfsunpack.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/selfextract.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/extras/uninstall.sh (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs.c (98%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs.h (98%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_7z.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_dir.c (95%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_grp.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_hog.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_iso9660.c (96%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_mvl.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_qpak.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_slb.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_unpacked.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_vdf.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_wad.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_archiver_zip.c (99%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_byteorder.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_casefolding.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_internal.h (99%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_lzmasdk.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_miniz.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_apple.m (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_haiku.cpp (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_os2.c (99%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_posix.c (97%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_qnx.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_unix.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_windows.c (99%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platform_winrt.cpp (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_platforms.h (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/src/physfs_unicode.c (100%) rename libs/{physfs-3.0.0 => physfs-3.0.1}/test/test_physfs.c (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 191c4f8d..ee313890 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,7 +139,7 @@ endif() set(MEGA_ZLIB_VER "1.2.8") -set(MEGA_PHYSFS_VER "3.0.0") +set(MEGA_PHYSFS_VER "3.0.1") set(MEGA_LUA51_VER "5.1.5") set(MEGA_LUAJIT_VER "2.0.5") set(MEGA_LIBOGG_VER "1.3.2") diff --git a/libs/physfs-3.0.0/.hg_archival.txt b/libs/physfs-3.0.0/.hg_archival.txt deleted file mode 100644 index 052f9a12..00000000 --- a/libs/physfs-3.0.0/.hg_archival.txt +++ /dev/null @@ -1,6 +0,0 @@ -repo: 7672c9962ce627edaaa67ff54fe4ad8f9a46dc2b -node: 3d5a84dd1ebe26e4ad4da1051a9153a06b9949a3 -branch: stable-3.0 -latesttag: release-3.0.0 -latesttagdistance: 1 -changessincelatesttag: 1 diff --git a/libs/physfs-3.0.1/.hg_archival.txt b/libs/physfs-3.0.1/.hg_archival.txt new file mode 100644 index 00000000..f119afa5 --- /dev/null +++ b/libs/physfs-3.0.1/.hg_archival.txt @@ -0,0 +1,4 @@ +repo: 7672c9962ce627edaaa67ff54fe4ad8f9a46dc2b +node: fa8e38bcc3545000a38704b65b604a2c1b764d10 +branch: stable-3.0 +tag: release-3.0.1 diff --git a/libs/physfs-3.0.0/.hgignore b/libs/physfs-3.0.1/.hgignore similarity index 100% rename from libs/physfs-3.0.0/.hgignore rename to libs/physfs-3.0.1/.hgignore diff --git a/libs/physfs-3.0.0/.hgtags b/libs/physfs-3.0.1/.hgtags similarity index 100% rename from libs/physfs-3.0.0/.hgtags rename to libs/physfs-3.0.1/.hgtags diff --git a/libs/physfs-3.0.0/CMakeLists.txt b/libs/physfs-3.0.1/CMakeLists.txt similarity index 96% rename from libs/physfs-3.0.0/CMakeLists.txt rename to libs/physfs-3.0.1/CMakeLists.txt index 760a874a..9373a037 100644 --- a/libs/physfs-3.0.0/CMakeLists.txt +++ b/libs/physfs-3.0.1/CMakeLists.txt @@ -12,7 +12,7 @@ cmake_minimum_required(VERSION 2.8.4) project(PhysicsFS) -set(PHYSFS_VERSION 3.0.0) +set(PHYSFS_VERSION 3.0.1) # Increment this if/when we break backwards compatibility. set(PHYSFS_SOVERSION 1) @@ -164,7 +164,6 @@ if(PHYSFS_BUILD_STATIC) set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264") endif() - target_include_directories(physfs-static PUBLIC src) set(PHYSFS_LIB_TARGET physfs-static) set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") endif() @@ -178,7 +177,6 @@ if(PHYSFS_BUILD_SHARED) if(WINRT) set_target_properties(physfs PROPERTIES VS_WINRT_COMPONENT True) endif() - target_include_directories(physfs PUBLIC src) target_link_libraries(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) set(PHYSFS_LIB_TARGET physfs) set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs") @@ -215,13 +213,11 @@ if(PHYSFS_BUILD_TEST) set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs") endif() -if(NOT MEGA) - install(TARGETS ${PHYSFS_INSTALL_TARGETS} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX}) - install(FILES src/physfs.h DESTINATION include) -endif() +install(TARGETS ${PHYSFS_INSTALL_TARGETS} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX}) +install(FILES src/physfs.h DESTINATION include) find_package(Doxygen) if(DOXYGEN_FOUND) diff --git a/libs/physfs-3.0.0/LICENSE.txt b/libs/physfs-3.0.1/LICENSE.txt similarity index 100% rename from libs/physfs-3.0.0/LICENSE.txt rename to libs/physfs-3.0.1/LICENSE.txt diff --git a/libs/physfs-3.0.0/README.txt b/libs/physfs-3.0.1/README.txt similarity index 100% rename from libs/physfs-3.0.0/README.txt rename to libs/physfs-3.0.1/README.txt diff --git a/libs/physfs-3.0.0/docs/CHANGELOG.txt b/libs/physfs-3.0.1/docs/CHANGELOG.txt similarity index 100% rename from libs/physfs-3.0.0/docs/CHANGELOG.txt rename to libs/physfs-3.0.1/docs/CHANGELOG.txt diff --git a/libs/physfs-3.0.0/docs/CREDITS.txt b/libs/physfs-3.0.1/docs/CREDITS.txt similarity index 100% rename from libs/physfs-3.0.0/docs/CREDITS.txt rename to libs/physfs-3.0.1/docs/CREDITS.txt diff --git a/libs/physfs-3.0.0/docs/Doxyfile b/libs/physfs-3.0.1/docs/Doxyfile similarity index 100% rename from libs/physfs-3.0.0/docs/Doxyfile rename to libs/physfs-3.0.1/docs/Doxyfile diff --git a/libs/physfs-3.0.0/docs/INSTALL.txt b/libs/physfs-3.0.1/docs/INSTALL.txt similarity index 100% rename from libs/physfs-3.0.0/docs/INSTALL.txt rename to libs/physfs-3.0.1/docs/INSTALL.txt diff --git a/libs/physfs-3.0.0/docs/README-API-documentation.txt b/libs/physfs-3.0.1/docs/README-API-documentation.txt similarity index 100% rename from libs/physfs-3.0.0/docs/README-API-documentation.txt rename to libs/physfs-3.0.1/docs/README-API-documentation.txt diff --git a/libs/physfs-3.0.0/docs/TODO.txt b/libs/physfs-3.0.1/docs/TODO.txt similarity index 100% rename from libs/physfs-3.0.0/docs/TODO.txt rename to libs/physfs-3.0.1/docs/TODO.txt diff --git a/libs/physfs-3.0.0/extras/README-CSharp.txt b/libs/physfs-3.0.1/extras/README-CSharp.txt similarity index 100% rename from libs/physfs-3.0.0/extras/README-CSharp.txt rename to libs/physfs-3.0.1/extras/README-CSharp.txt diff --git a/libs/physfs-3.0.0/extras/abs-file.h b/libs/physfs-3.0.1/extras/abs-file.h similarity index 100% rename from libs/physfs-3.0.0/extras/abs-file.h rename to libs/physfs-3.0.1/extras/abs-file.h diff --git a/libs/physfs-3.0.0/extras/buildbot-checker.sh b/libs/physfs-3.0.1/extras/buildbot-checker.sh similarity index 100% rename from libs/physfs-3.0.0/extras/buildbot-checker.sh rename to libs/physfs-3.0.1/extras/buildbot-checker.sh diff --git a/libs/physfs-3.0.0/extras/buildbot-emscripten.sh b/libs/physfs-3.0.1/extras/buildbot-emscripten.sh similarity index 100% rename from libs/physfs-3.0.0/extras/buildbot-emscripten.sh rename to libs/physfs-3.0.1/extras/buildbot-emscripten.sh diff --git a/libs/physfs-3.0.0/extras/buildbot-os2.sh b/libs/physfs-3.0.1/extras/buildbot-os2.sh similarity index 100% rename from libs/physfs-3.0.0/extras/buildbot-os2.sh rename to libs/physfs-3.0.1/extras/buildbot-os2.sh diff --git a/libs/physfs-3.0.0/extras/buildbot-raspberrypi.sh b/libs/physfs-3.0.1/extras/buildbot-raspberrypi.sh similarity index 100% rename from libs/physfs-3.0.0/extras/buildbot-raspberrypi.sh rename to libs/physfs-3.0.1/extras/buildbot-raspberrypi.sh diff --git a/libs/physfs-3.0.0/extras/casefolding.txt b/libs/physfs-3.0.1/extras/casefolding.txt similarity index 100% rename from libs/physfs-3.0.0/extras/casefolding.txt rename to libs/physfs-3.0.1/extras/casefolding.txt diff --git a/libs/physfs-3.0.0/extras/globbing.c b/libs/physfs-3.0.1/extras/globbing.c similarity index 100% rename from libs/physfs-3.0.0/extras/globbing.c rename to libs/physfs-3.0.1/extras/globbing.c diff --git a/libs/physfs-3.0.0/extras/globbing.h b/libs/physfs-3.0.1/extras/globbing.h similarity index 100% rename from libs/physfs-3.0.0/extras/globbing.h rename to libs/physfs-3.0.1/extras/globbing.h diff --git a/libs/physfs-3.0.0/extras/ignorecase.c b/libs/physfs-3.0.1/extras/ignorecase.c similarity index 100% rename from libs/physfs-3.0.0/extras/ignorecase.c rename to libs/physfs-3.0.1/extras/ignorecase.c diff --git a/libs/physfs-3.0.0/extras/ignorecase.h b/libs/physfs-3.0.1/extras/ignorecase.h similarity index 100% rename from libs/physfs-3.0.0/extras/ignorecase.h rename to libs/physfs-3.0.1/extras/ignorecase.h diff --git a/libs/physfs-3.0.0/extras/makecasefoldhashtable.pl b/libs/physfs-3.0.1/extras/makecasefoldhashtable.pl similarity index 100% rename from libs/physfs-3.0.0/extras/makecasefoldhashtable.pl rename to libs/physfs-3.0.1/extras/makecasefoldhashtable.pl diff --git a/libs/physfs-3.0.0/extras/physfs.pc.in b/libs/physfs-3.0.1/extras/physfs.pc.in similarity index 100% rename from libs/physfs-3.0.0/extras/physfs.pc.in rename to libs/physfs-3.0.1/extras/physfs.pc.in diff --git a/libs/physfs-3.0.0/extras/physfshttpd.c b/libs/physfs-3.0.1/extras/physfshttpd.c similarity index 100% rename from libs/physfs-3.0.0/extras/physfshttpd.c rename to libs/physfs-3.0.1/extras/physfshttpd.c diff --git a/libs/physfs-3.0.0/extras/physfsrwops.c b/libs/physfs-3.0.1/extras/physfsrwops.c similarity index 100% rename from libs/physfs-3.0.0/extras/physfsrwops.c rename to libs/physfs-3.0.1/extras/physfsrwops.c diff --git a/libs/physfs-3.0.0/extras/physfsrwops.h b/libs/physfs-3.0.1/extras/physfsrwops.h similarity index 100% rename from libs/physfs-3.0.0/extras/physfsrwops.h rename to libs/physfs-3.0.1/extras/physfsrwops.h diff --git a/libs/physfs-3.0.0/extras/physfsunpack.c b/libs/physfs-3.0.1/extras/physfsunpack.c similarity index 100% rename from libs/physfs-3.0.0/extras/physfsunpack.c rename to libs/physfs-3.0.1/extras/physfsunpack.c diff --git a/libs/physfs-3.0.0/extras/selfextract.c b/libs/physfs-3.0.1/extras/selfextract.c similarity index 100% rename from libs/physfs-3.0.0/extras/selfextract.c rename to libs/physfs-3.0.1/extras/selfextract.c diff --git a/libs/physfs-3.0.0/extras/uninstall.sh b/libs/physfs-3.0.1/extras/uninstall.sh similarity index 100% rename from libs/physfs-3.0.0/extras/uninstall.sh rename to libs/physfs-3.0.1/extras/uninstall.sh diff --git a/libs/physfs-3.0.0/src/physfs.c b/libs/physfs-3.0.1/src/physfs.c similarity index 98% rename from libs/physfs-3.0.0/src/physfs.c rename to libs/physfs-3.0.1/src/physfs.c index 9ea904b5..19148ad5 100644 --- a/libs/physfs-3.0.0/src/physfs.c +++ b/libs/physfs-3.0.1/src/physfs.c @@ -939,6 +939,10 @@ static int sanitizePlatformIndependentPath(const char *src, char *dst) while (*src == '/') /* skip initial '/' chars... */ src++; + /* Make sure the entire string isn't "." or ".." */ + if ((strcmp(src, ".") == 0) || (strcmp(src, "..") == 0)) + BAIL(PHYSFS_ERR_BAD_FILENAME, 0); + prev = dst; do { @@ -1012,6 +1016,8 @@ static DirHandle *createDirHandle(PHYSFS_Io *io, const char *newDir, DirHandle *dirHandle = NULL; char *tmpmntpnt = NULL; + assert(newDir != NULL); /* should have caught this higher up. */ + if (mountPoint != NULL) { const size_t len = strlen(mountPoint) + 1; @@ -1025,15 +1031,9 @@ static DirHandle *createDirHandle(PHYSFS_Io *io, const char *newDir, dirHandle = openDirectory(io, newDir, forWriting); GOTO_IF_ERRPASS(!dirHandle, badDirHandle); - if (newDir == NULL) - dirHandle->dirName = NULL; - else - { - dirHandle->dirName = (char *) allocator.Malloc(strlen(newDir) + 1); - if (!dirHandle->dirName) - GOTO(PHYSFS_ERR_OUT_OF_MEMORY, badDirHandle); - strcpy(dirHandle->dirName, newDir); - } /* else */ + dirHandle->dirName = (char *) allocator.Malloc(strlen(newDir) + 1); + GOTO_IF(!dirHandle->dirName, PHYSFS_ERR_OUT_OF_MEMORY, badDirHandle); + strcpy(dirHandle->dirName, newDir); if ((mountPoint != NULL) && (*mountPoint != '\0')) { @@ -1599,7 +1599,7 @@ const char *PHYSFS_getPrefDir(const char *org, const char *app) assert(*endstr == dirsep); *endstr = '\0'; /* mask out the final dirsep for now. */ - if (!__PHYSFS_platformStat(prefDir, &statbuf)) + if (!__PHYSFS_platformStat(prefDir, &statbuf, 1)) { for (ptr = strchr(prefDir, dirsep); ptr; ptr = strchr(ptr+1, dirsep)) { @@ -1684,21 +1684,20 @@ static int doMount(PHYSFS_Io *io, const char *fname, DirHandle *prev = NULL; DirHandle *i; + BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); + if (mountPoint == NULL) mountPoint = "/"; __PHYSFS_platformGrabMutex(stateLock); - if (fname != NULL) + for (i = searchPath; i != NULL; i = i->next) { - for (i = searchPath; i != NULL; i = i->next) - { - /* already in search path? */ - if ((i->dirName != NULL) && (strcmp(fname, i->dirName) == 0)) - BAIL_MUTEX_ERRPASS(stateLock, 1); - prev = i; - } /* for */ - } /* if */ + /* already in search path? */ + if ((i->dirName != NULL) && (strcmp(fname, i->dirName) == 0)) + BAIL_MUTEX_ERRPASS(stateLock, 1); + prev = i; + } /* for */ dh = createDirHandle(io, fname, mountPoint, 0); BAIL_IF_MUTEX_ERRPASS(!dh, stateLock, 0); @@ -1725,6 +1724,7 @@ int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, const char *mountPoint, int appendToPath) { BAIL_IF(!io, PHYSFS_ERR_INVALID_ARGUMENT, 0); + BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); BAIL_IF(io->version != 0, PHYSFS_ERR_UNSUPPORTED, 0); return doMount(io, fname, mountPoint, appendToPath); } /* PHYSFS_mountIo */ @@ -1738,6 +1738,7 @@ int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, void (*del)(void *), PHYSFS_Io *io = NULL; BAIL_IF(!buf, PHYSFS_ERR_INVALID_ARGUMENT, 0); + BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); io = __PHYSFS_createMemoryIo(buf, len, del); BAIL_IF_ERRPASS(!io, 0); @@ -1760,7 +1761,8 @@ int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, int retval = 0; PHYSFS_Io *io = NULL; - BAIL_IF(file == NULL, PHYSFS_ERR_INVALID_ARGUMENT, 0); + BAIL_IF(!file, PHYSFS_ERR_INVALID_ARGUMENT, 0); + BAIL_IF(!fname, PHYSFS_ERR_INVALID_ARGUMENT, 0); io = __PHYSFS_createHandleIo(file); BAIL_IF_ERRPASS(!io, 0); @@ -1785,7 +1787,7 @@ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath) int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) { - return doMount(NULL, newDir, NULL, appendToPath); + return PHYSFS_mount(newDir, NULL, appendToPath); } /* PHYSFS_addToSearchPath */ diff --git a/libs/physfs-3.0.0/src/physfs.h b/libs/physfs-3.0.1/src/physfs.h similarity index 98% rename from libs/physfs-3.0.0/src/physfs.h rename to libs/physfs-3.0.1/src/physfs.h index 1abd2b0e..91696075 100644 --- a/libs/physfs-3.0.0/src/physfs.h +++ b/libs/physfs-3.0.1/src/physfs.h @@ -434,7 +434,7 @@ typedef struct PHYSFS_Version #ifndef DOXYGEN_SHOULD_IGNORE_THIS #define PHYSFS_VER_MAJOR 3 #define PHYSFS_VER_MINOR 0 -#define PHYSFS_VER_PATCH 0 +#define PHYSFS_VER_PATCH 1 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ @@ -2176,11 +2176,15 @@ PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator); * or each other, for example. * * The mountpoint does not need to exist prior to mounting, which is different - * than those familiar with the Unix concept of "mounting" may not expect. + * than those familiar with the Unix concept of "mounting" may expect. * As well, more than one archive can be mounted to the same mountpoint, or * mountpoints and archive contents can overlap...the interpolation mechanism * still functions as usual. * + * Specifying a symbolic link to an archive or directory is allowed here, + * regardless of the state of PHYSFS_permitSymbolicLinks(). That function + * only deals with symlinks inside the mounted directory or archive. + * * \param newDir directory or archive to add to the path, in * platform-dependent notation. * \param mountPoint Location in the interpolated tree that this archive @@ -2760,6 +2764,12 @@ PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c, * This call will fail (and fail to remove from the path) if the element still * has files open in it. * + * \warning This function wants the path to the archive or directory that was + * mounted (the same string used for the "newDir" argument of + * PHYSFS_addToSearchPath or any of the mount functions), not the + * path where it is mounted in the tree (the "mountPoint" argument + * to any of the mount functions). + * * \param oldDir dir/archive to remove. * \return nonzero on success, zero on failure. Use * PHYSFS_getLastErrorCode() to obtain the specific error. @@ -3188,7 +3198,7 @@ typedef struct PHYSFS_Io /** - * \fn int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, const char *mountPoint, int appendToPath) + * \fn int PHYSFS_mountIo(PHYSFS_Io *io, const char *newDir, const char *mountPoint, int appendToPath) * \brief Add an archive, built on a PHYSFS_Io, to the search path. * * \warning Unless you have some special, low-level need, you should be using @@ -3198,11 +3208,14 @@ typedef struct PHYSFS_Io * instead of a pathname. Behind the scenes, PHYSFS_mount() calls this * function with a physical-filesystem-based PHYSFS_Io. * - * (filename) is only used here to optimize archiver selection (if you name it - * XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't - * need to refer to a real file at all, and can even be NULL. If the filename - * isn't helpful, the system will try every archiver until one works or none - * of them do. + * (newDir) must be a unique string to identify this archive. It is used + * to optimize archiver selection (if you name it XXXXX.zip, we might try + * the ZIP archiver first, for example, or directly choose an archiver that + * can only trust the data is valid by filename extension). It doesn't + * need to refer to a real file at all. If the filename extension isn't + * helpful, the system will try every archiver until one works or none + * of them do. This filename must be unique, as the system won't allow you + * to have two archives with the same name. * * (io) must remain until the archive is unmounted. When the archive is * unmounted, the system will call (io)->destroy(io), which will give you @@ -3211,7 +3224,7 @@ typedef struct PHYSFS_Io * If this function fails, (io)->destroy(io) is not called. * * \param io i/o instance for archive to add to the path. - * \param fname Filename that can represent this stream. Can be NULL. + * \param newDir Filename that can represent this stream. * \param mountPoint Location in the interpolated tree that this archive * will be "mounted", in platform-independent notation. * NULL or "" is equivalent to "/". @@ -3224,12 +3237,12 @@ typedef struct PHYSFS_Io * \sa PHYSFS_getSearchPath * \sa PHYSFS_getMountPoint */ -PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, +PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *newDir, const char *mountPoint, int appendToPath); /** - * \fn int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, void (*del)(void *), const char *fname, const char *mountPoint, int appendToPath) + * \fn int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, void (*del)(void *), const char *newDir, const char *mountPoint, int appendToPath) * \brief Add an archive, contained in a memory buffer, to the search path. * * \warning Unless you have some special, low-level need, you should be using @@ -3239,11 +3252,14 @@ PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, * instead of a pathname. This buffer contains all the data of the archive, * and is used instead of a real file in the physical filesystem. * - * (filename) is only used here to optimize archiver selection (if you name it - * XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't - * need to refer to a real file at all, and can even be NULL. If the filename - * isn't helpful, the system will try every archiver until one works or none - * of them do. + * (newDir) must be a unique string to identify this archive. It is used + * to optimize archiver selection (if you name it XXXXX.zip, we might try + * the ZIP archiver first, for example, or directly choose an archiver that + * can only trust the data is valid by filename extension). It doesn't + * need to refer to a real file at all. If the filename extension isn't + * helpful, the system will try every archiver until one works or none + * of them do. This filename must be unique, as the system won't allow you + * to have two archives with the same name. * * (ptr) must remain until the archive is unmounted. When the archive is * unmounted, the system will call (del)(ptr), which will notify you that @@ -3256,7 +3272,7 @@ PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, * \param buf Address of the memory buffer containing the archive data. * \param len Size of memory buffer, in bytes. * \param del A callback that triggers upon unmount. Can be NULL. - * \param fname Filename that can represent this stream. Can be NULL. + * \param newDir Filename that can represent this stream. * \param mountPoint Location in the interpolated tree that this archive * will be "mounted", in platform-independent notation. * NULL or "" is equivalent to "/". @@ -3269,12 +3285,12 @@ PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, * \sa PHYSFS_getMountPoint */ PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, - void (*del)(void *), const char *fname, + void (*del)(void *), const char *newDir, const char *mountPoint, int appendToPath); /** - * \fn int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, const char *mountPoint, int appendToPath) + * \fn int PHYSFS_mountHandle(PHYSFS_File *file, const char *newDir, const char *mountPoint, int appendToPath) * \brief Add an archive, contained in a PHYSFS_File handle, to the search path. * * \warning Unless you have some special, low-level need, you should be using @@ -3297,11 +3313,14 @@ PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, * but isn't necessarily. The most popular use for this is likely to mount * archives stored inside other archives. * - * (filename) is only used here to optimize archiver selection (if you name it - * XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't - * need to refer to a real file at all, and can even be NULL. If the filename - * isn't helpful, the system will try every archiver until one works or none - * of them do. + * (newDir) must be a unique string to identify this archive. It is used + * to optimize archiver selection (if you name it XXXXX.zip, we might try + * the ZIP archiver first, for example, or directly choose an archiver that + * can only trust the data is valid by filename extension). It doesn't + * need to refer to a real file at all. If the filename extension isn't + * helpful, the system will try every archiver until one works or none + * of them do. This filename must be unique, as the system won't allow you + * to have two archives with the same name. * * (file) must remain until the archive is unmounted. When the archive is * unmounted, the system will call PHYSFS_close(file). If you need this @@ -3311,7 +3330,7 @@ PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, * If this function fails, PHYSFS_close(file) is not called. * * \param file The PHYSFS_File handle containing archive data. - * \param fname Filename that can represent this stream. Can be NULL. + * \param newDir Filename that can represent this stream. * \param mountPoint Location in the interpolated tree that this archive * will be "mounted", in platform-independent notation. * NULL or "" is equivalent to "/". @@ -3323,7 +3342,7 @@ PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, * \sa PHYSFS_getSearchPath * \sa PHYSFS_getMountPoint */ -PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, +PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *newDir, const char *mountPoint, int appendToPath); diff --git a/libs/physfs-3.0.0/src/physfs_archiver_7z.c b/libs/physfs-3.0.1/src/physfs_archiver_7z.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_7z.c rename to libs/physfs-3.0.1/src/physfs_archiver_7z.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_dir.c b/libs/physfs-3.0.1/src/physfs_archiver_dir.c similarity index 95% rename from libs/physfs-3.0.0/src/physfs_archiver_dir.c rename to libs/physfs-3.0.1/src/physfs_archiver_dir.c index 582ef8ce..61c0da3f 100644 --- a/libs/physfs-3.0.0/src/physfs_archiver_dir.c +++ b/libs/physfs-3.0.1/src/physfs_archiver_dir.c @@ -49,7 +49,8 @@ static void *DIR_openArchive(PHYSFS_Io *io, const char *name, const size_t seplen = 1; assert(io == NULL); /* shouldn't create an Io for these. */ - BAIL_IF_ERRPASS(!__PHYSFS_platformStat(name, &st), NULL); + BAIL_IF_ERRPASS(!__PHYSFS_platformStat(name, &st, 1), NULL); + if (st.filetype != PHYSFS_FILETYPE_DIRECTORY) BAIL(PHYSFS_ERR_UNSUPPORTED, NULL); @@ -97,7 +98,7 @@ static PHYSFS_Io *doOpen(void *opaque, const char *name, const int mode) { const PHYSFS_ErrorCode err = PHYSFS_getLastErrorCode(); PHYSFS_Stat statbuf; - __PHYSFS_platformStat(f, &statbuf); + __PHYSFS_platformStat(f, &statbuf, 0); /* !!! FIXME: why are we stating here? */ PHYSFS_setErrorCode(err); } /* if */ @@ -164,7 +165,7 @@ static int DIR_stat(void *opaque, const char *name, PHYSFS_Stat *stat) CVT_TO_DEPENDENT(d, opaque, name); BAIL_IF_ERRPASS(!d, 0); - retval = __PHYSFS_platformStat(d, stat); + retval = __PHYSFS_platformStat(d, stat, 0); __PHYSFS_smallFree(d); return retval; } /* DIR_stat */ diff --git a/libs/physfs-3.0.0/src/physfs_archiver_grp.c b/libs/physfs-3.0.1/src/physfs_archiver_grp.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_grp.c rename to libs/physfs-3.0.1/src/physfs_archiver_grp.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_hog.c b/libs/physfs-3.0.1/src/physfs_archiver_hog.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_hog.c rename to libs/physfs-3.0.1/src/physfs_archiver_hog.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_iso9660.c b/libs/physfs-3.0.1/src/physfs_archiver_iso9660.c similarity index 96% rename from libs/physfs-3.0.0/src/physfs_archiver_iso9660.c rename to libs/physfs-3.0.1/src/physfs_archiver_iso9660.c index e72a7ad9..965c83f6 100644 --- a/libs/physfs-3.0.0/src/physfs_archiver_iso9660.c +++ b/libs/physfs-3.0.1/src/physfs_archiver_iso9660.c @@ -151,18 +151,25 @@ static int iso9660LoadEntries(PHYSFS_Io *io, const int joliet, /* recordlen = 0 -> no more entries or fill entry */ BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &recordlen, 1), 0); - if (recordlen == 0) + if (recordlen > 0) + readpos += recordlen; /* ready to seek to next record. */ + else { + PHYSFS_uint64 nextpos; + /* if we are in the last sector of the directory & it's 0 -> end */ if ((dirend - 2048) <= (readpos - 1)) break; /* finished */ /* else skip to the next sector & continue; */ - readpos = (((readpos - 1) / 2048) + 1) * 2048; - continue; - } /* if */ + nextpos = (((readpos - 1) / 2048) + 1) * 2048; - readpos += recordlen; /* ready to seek to next record. */ + /* whoops, can't make forward progress! */ + BAIL_IF(nextpos == readpos, PHYSFS_ERR_CORRUPT, 0); + + readpos = nextpos; + continue; /* start back at upper loop. */ + } /* else */ BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &extattrlen, 1), 0); BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &extent, 4), 0); @@ -203,6 +210,10 @@ static int iso9660LoadEntries(PHYSFS_Io *io, const int joliet, timestamp = (PHYSFS_sint64) mktime(&t); extent += extattrlen; /* skip extended attribute record. */ + + /* infinite loop, corrupt file? */ + BAIL_IF((extent * 2048) == dirstart, PHYSFS_ERR_CORRUPT, 0); + if (!iso9660AddEntry(io, joliet, isdir, base, fname, fnamelen, timestamp, extent * 2048, datalen, unpkarc)) { diff --git a/libs/physfs-3.0.0/src/physfs_archiver_mvl.c b/libs/physfs-3.0.1/src/physfs_archiver_mvl.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_mvl.c rename to libs/physfs-3.0.1/src/physfs_archiver_mvl.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_qpak.c b/libs/physfs-3.0.1/src/physfs_archiver_qpak.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_qpak.c rename to libs/physfs-3.0.1/src/physfs_archiver_qpak.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_slb.c b/libs/physfs-3.0.1/src/physfs_archiver_slb.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_slb.c rename to libs/physfs-3.0.1/src/physfs_archiver_slb.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_unpacked.c b/libs/physfs-3.0.1/src/physfs_archiver_unpacked.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_unpacked.c rename to libs/physfs-3.0.1/src/physfs_archiver_unpacked.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_vdf.c b/libs/physfs-3.0.1/src/physfs_archiver_vdf.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_vdf.c rename to libs/physfs-3.0.1/src/physfs_archiver_vdf.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_wad.c b/libs/physfs-3.0.1/src/physfs_archiver_wad.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_archiver_wad.c rename to libs/physfs-3.0.1/src/physfs_archiver_wad.c diff --git a/libs/physfs-3.0.0/src/physfs_archiver_zip.c b/libs/physfs-3.0.1/src/physfs_archiver_zip.c similarity index 99% rename from libs/physfs-3.0.0/src/physfs_archiver_zip.c rename to libs/physfs-3.0.1/src/physfs_archiver_zip.c index 18249154..9972628f 100644 --- a/libs/physfs-3.0.0/src/physfs_archiver_zip.c +++ b/libs/physfs-3.0.1/src/physfs_archiver_zip.c @@ -455,6 +455,7 @@ static PHYSFS_Io *ZIP_duplicate(PHYSFS_Io *io) finfo->io = zip_get_io(origfinfo->io, NULL, finfo->entry); GOTO_IF_ERRPASS(!finfo->io, failed); + initializeZStream(&finfo->stream); if (finfo->entry->compression_method != COMPMETH_NONE) { finfo->buffer = (PHYSFS_uint8 *) allocator.Malloc(ZIP_READBUFSIZE); diff --git a/libs/physfs-3.0.0/src/physfs_byteorder.c b/libs/physfs-3.0.1/src/physfs_byteorder.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_byteorder.c rename to libs/physfs-3.0.1/src/physfs_byteorder.c diff --git a/libs/physfs-3.0.0/src/physfs_casefolding.h b/libs/physfs-3.0.1/src/physfs_casefolding.h similarity index 100% rename from libs/physfs-3.0.0/src/physfs_casefolding.h rename to libs/physfs-3.0.1/src/physfs_casefolding.h diff --git a/libs/physfs-3.0.0/src/physfs_internal.h b/libs/physfs-3.0.1/src/physfs_internal.h similarity index 99% rename from libs/physfs-3.0.0/src/physfs_internal.h rename to libs/physfs-3.0.1/src/physfs_internal.h index 62e83355..003ecc58 100644 --- a/libs/physfs-3.0.0/src/physfs_internal.h +++ b/libs/physfs-3.0.1/src/physfs_internal.h @@ -549,11 +549,12 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *handle); * * This needs to fill in all the fields of (stat). For fields that might not * mean anything on a platform (access time, perhaps), choose a reasonable - * default. + * default. if (follow), we want to follow symlinks and stat what they + * link to and not the link itself. * * Return zero on failure, non-zero on success. */ -int __PHYSFS_platformStat(const char *fn, PHYSFS_Stat *stat); +int __PHYSFS_platformStat(const char *fn, PHYSFS_Stat *stat, const int follow); /* * Flush any pending writes to disk. (opaque) should be cast to whatever data diff --git a/libs/physfs-3.0.0/src/physfs_lzmasdk.h b/libs/physfs-3.0.1/src/physfs_lzmasdk.h similarity index 100% rename from libs/physfs-3.0.0/src/physfs_lzmasdk.h rename to libs/physfs-3.0.1/src/physfs_lzmasdk.h diff --git a/libs/physfs-3.0.0/src/physfs_miniz.h b/libs/physfs-3.0.1/src/physfs_miniz.h similarity index 100% rename from libs/physfs-3.0.0/src/physfs_miniz.h rename to libs/physfs-3.0.1/src/physfs_miniz.h diff --git a/libs/physfs-3.0.0/src/physfs_platform_apple.m b/libs/physfs-3.0.1/src/physfs_platform_apple.m similarity index 100% rename from libs/physfs-3.0.0/src/physfs_platform_apple.m rename to libs/physfs-3.0.1/src/physfs_platform_apple.m diff --git a/libs/physfs-3.0.0/src/physfs_platform_haiku.cpp b/libs/physfs-3.0.1/src/physfs_platform_haiku.cpp similarity index 100% rename from libs/physfs-3.0.0/src/physfs_platform_haiku.cpp rename to libs/physfs-3.0.1/src/physfs_platform_haiku.cpp diff --git a/libs/physfs-3.0.0/src/physfs_platform_os2.c b/libs/physfs-3.0.1/src/physfs_platform_os2.c similarity index 99% rename from libs/physfs-3.0.0/src/physfs_platform_os2.c rename to libs/physfs-3.0.1/src/physfs_platform_os2.c index c6c472d8..8cc8044c 100644 --- a/libs/physfs-3.0.0/src/physfs_platform_os2.c +++ b/libs/physfs-3.0.1/src/physfs_platform_os2.c @@ -721,7 +721,7 @@ PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time) } /* os2TimeToUnixTime */ -int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *stat) +int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *stat, const int follow) { char *cpfname = cvtUtf8ToCodepage(filename); FILESTATUS3 fs; diff --git a/libs/physfs-3.0.0/src/physfs_platform_posix.c b/libs/physfs-3.0.1/src/physfs_platform_posix.c similarity index 97% rename from libs/physfs-3.0.0/src/physfs_platform_posix.c rename to libs/physfs-3.0.1/src/physfs_platform_posix.c index 0ecc8824..fa2159cd 100644 --- a/libs/physfs-3.0.0/src/physfs_platform_posix.c +++ b/libs/physfs-3.0.1/src/physfs_platform_posix.c @@ -296,11 +296,11 @@ int __PHYSFS_platformDelete(const char *path) } /* __PHYSFS_platformDelete */ -int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st) +int __PHYSFS_platformStat(const char *fname, PHYSFS_Stat *st, const int follow) { struct stat statbuf; - - BAIL_IF(lstat(filename, &statbuf) == -1, errcodeFromErrno(), 0); + const int rc = follow ? stat(fname, &statbuf) : lstat(fname, &statbuf); + BAIL_IF(rc == -1, errcodeFromErrno(), 0); if (S_ISREG(statbuf.st_mode)) { @@ -330,7 +330,7 @@ int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st) st->createtime = statbuf.st_ctime; st->accesstime = statbuf.st_atime; - st->readonly = (access(filename, W_OK) == -1); + st->readonly = (access(fname, W_OK) == -1); return 1; } /* __PHYSFS_platformStat */ diff --git a/libs/physfs-3.0.0/src/physfs_platform_qnx.c b/libs/physfs-3.0.1/src/physfs_platform_qnx.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_platform_qnx.c rename to libs/physfs-3.0.1/src/physfs_platform_qnx.c diff --git a/libs/physfs-3.0.0/src/physfs_platform_unix.c b/libs/physfs-3.0.1/src/physfs_platform_unix.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_platform_unix.c rename to libs/physfs-3.0.1/src/physfs_platform_unix.c diff --git a/libs/physfs-3.0.0/src/physfs_platform_windows.c b/libs/physfs-3.0.1/src/physfs_platform_windows.c similarity index 99% rename from libs/physfs-3.0.0/src/physfs_platform_windows.c rename to libs/physfs-3.0.1/src/physfs_platform_windows.c index a490c2ff..e777235d 100644 --- a/libs/physfs-3.0.0/src/physfs_platform_windows.c +++ b/libs/physfs-3.0.1/src/physfs_platform_windows.c @@ -960,7 +960,7 @@ static int isSymlink(const WCHAR *wpath, const DWORD attr) } /* isSymlink */ -int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st) +int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st, const int follow) { WIN32_FILE_ATTRIBUTE_DATA winstat; WCHAR *wstr = NULL; @@ -975,7 +975,7 @@ int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st) if (!rc) err = GetLastError(); else /* check for symlink while wstr is still available */ - issymlink = isSymlink(wstr, winstat.dwFileAttributes); + issymlink = !follow && isSymlink(wstr, winstat.dwFileAttributes); __PHYSFS_smallFree(wstr); BAIL_IF(!rc, errcodeFromWinApiError(err), 0); diff --git a/libs/physfs-3.0.0/src/physfs_platform_winrt.cpp b/libs/physfs-3.0.1/src/physfs_platform_winrt.cpp similarity index 100% rename from libs/physfs-3.0.0/src/physfs_platform_winrt.cpp rename to libs/physfs-3.0.1/src/physfs_platform_winrt.cpp diff --git a/libs/physfs-3.0.0/src/physfs_platforms.h b/libs/physfs-3.0.1/src/physfs_platforms.h similarity index 100% rename from libs/physfs-3.0.0/src/physfs_platforms.h rename to libs/physfs-3.0.1/src/physfs_platforms.h diff --git a/libs/physfs-3.0.0/src/physfs_unicode.c b/libs/physfs-3.0.1/src/physfs_unicode.c similarity index 100% rename from libs/physfs-3.0.0/src/physfs_unicode.c rename to libs/physfs-3.0.1/src/physfs_unicode.c diff --git a/libs/physfs-3.0.0/test/test_physfs.c b/libs/physfs-3.0.1/test/test_physfs.c similarity index 99% rename from libs/physfs-3.0.0/test/test_physfs.c rename to libs/physfs-3.0.1/test/test_physfs.c index cab8f5ac..797cf821 100644 --- a/libs/physfs-3.0.0/test/test_physfs.c +++ b/libs/physfs-3.0.1/test/test_physfs.c @@ -32,7 +32,7 @@ #define TEST_VERSION_MAJOR 3 #define TEST_VERSION_MINOR 0 -#define TEST_VERSION_PATCH 0 +#define TEST_VERSION_PATCH 1 static FILE *history_file = NULL; static PHYSFS_uint32 do_buffer_size = 0;