Ver Fonte

updated physfs to version 2.0.3

fysx há 13 anos atrás
pai
commit
da22cf589a

+ 0 - 17
assets/testfile.lua

@@ -1,17 +0,0 @@
-engine.log("Log Message from Lua ;D")
-engine.set_color (1., 0., 0.)
-
-function on_touch(x, y)
-  engine.log ("got touch at " .. tostring(x) .. "," .. tostring(y))
-  engine.set_color (0., 1., 0.)
-end
-
-function update(dt)
-  r,g,b = engine.get_color()
-
-  r = math.max(0., r - dt * 0.4)
-  g = math.max(0., g - dt * 0.4)
-  b = math.max(0., b - dt * 0.4)
-  
-  engine.set_color (r, g, b)
-end

+ 1 - 1
jni/love/Android.mk

@@ -28,7 +28,7 @@ LOCAL_C_INCLUDES  :=  \
 	${LOCAL_PATH}/../openal-soft-android/OpenAL32/Include \
 	${LOCAL_PATH}/../openal-soft-android/OpenAL32/Include \
 	${LOCAL_PATH}/../freetype2-android/include \
 	${LOCAL_PATH}/../freetype2-android/include \
 	${LOCAL_PATH}/../freetype2-android/src \
 	${LOCAL_PATH}/../freetype2-android/src \
-	${LOCAL_PATH}/../physfs-2.0.2 \
+	${LOCAL_PATH}/../physfs-2.0.3 \
 	${LOCAL_PATH}/../mpg123-1.13.4/src/libmpg123 \
 	${LOCAL_PATH}/../mpg123-1.13.4/src/libmpg123 \
 	${LOCAL_PATH}/../libmodplug-0.8.8.4/src \
 	${LOCAL_PATH}/../libmodplug-0.8.8.4/src \
 	${LOCAL_PATH}/../libvorbis-1.3.2/include \
 	${LOCAL_PATH}/../libvorbis-1.3.2/include \

+ 2 - 2
jni/physfs-2.0.3/.hg_archival.txt

@@ -1,5 +1,5 @@
 repo: 7672c9962ce627edaaa67ff54fe4ad8f9a46dc2b
 repo: 7672c9962ce627edaaa67ff54fe4ad8f9a46dc2b
-node: 92a35b8603186c536e4cc126458dfc2d2809b19c
+node: f94eec5e90540889a42c34a27931b8266f4af52c
 branch: stable-2.0
 branch: stable-2.0
-latesttag: release-2.0.2
+latesttag: release-2.0.3
 latesttagdistance: 1
 latesttagdistance: 1

+ 1 - 0
jni/physfs-2.0.3/.hgtags

@@ -14,3 +14,4 @@ fe0c1d6f40afa6fca09a277a1ade59231f16c66f release-1.1.1
 df04959950eb3830c39adfa983789f70f86062d7 release-1.1.0
 df04959950eb3830c39adfa983789f70f86062d7 release-1.1.0
 94771621792f838aa4cacf9a1e1f4f86c1cb0711 release-2.0.1
 94771621792f838aa4cacf9a1e1f4f86c1cb0711 release-2.0.1
 236afd18dd8cae34adb9897024bdcecc1dc8ca5d release-2.0.2
 236afd18dd8cae34adb9897024bdcecc1dc8ca5d release-2.0.2
+bf155bd2127befa399105194e13737d7c3496be0 release-2.0.3

+ 0 - 1
jni/physfs-2.0.3/Android.mk

@@ -7,7 +7,6 @@ LOCAL_MODULE    := libphysfs
 LOCAL_CFLAGS    := -fexceptions -g -Dlinux -Dunix \
 LOCAL_CFLAGS    := -fexceptions -g -Dlinux -Dunix \
 	-DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 \
 	-DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 \
 	-DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT \
 	-DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT \
-	-DPHYSFS_SUPPORTS_APK=1 -DPHYSFS_SUPPORTS_ZIP=1 \
 	-DPHYSFS_SUPPORTS_ZIP=1 -DPHYSFS_SUPPORTS_7Z=1 \
 	-DPHYSFS_SUPPORTS_ZIP=1 -DPHYSFS_SUPPORTS_7Z=1 \
 	-DPHYSFS_SUPPORTS_GRP=1 -DPHYSFS_SUPPORTS_QPAK=1 \
 	-DPHYSFS_SUPPORTS_GRP=1 -DPHYSFS_SUPPORTS_QPAK=1 \
 	-DPHYSFS_SUPPORTS_HOG=1 -DPHYSFS_SUPPORTS_MVL=1 \
 	-DPHYSFS_SUPPORTS_HOG=1 -DPHYSFS_SUPPORTS_MVL=1 \

+ 28 - 9
jni/physfs-2.0.3/CMakeLists.txt

@@ -6,7 +6,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
 
 
 PROJECT(PhysicsFS)
 PROJECT(PhysicsFS)
-SET(PHYSFS_VERSION 2.0.2)
+SET(PHYSFS_VERSION 2.0.3)
 
 
 # Increment this if/when we break backwards compatibility.
 # Increment this if/when we break backwards compatibility.
 SET(PHYSFS_SOVERSION 1)
 SET(PHYSFS_SOVERSION 1)
@@ -21,6 +21,11 @@ IF(APPLE AND NOT MACOSX)
     SET(MACOSX TRUE)
     SET(MACOSX TRUE)
 ENDIF(APPLE AND NOT MACOSX)
 ENDIF(APPLE AND NOT MACOSX)
 
 
+# For now, Haiku and BeOS are the same, as far as the build system cares.
+IF(HAIKU AND NOT BEOS)
+    SET(BEOS TRUE)
+ENDIF(HAIKU AND NOT BEOS)
+
 INCLUDE(CheckIncludeFile)
 INCLUDE(CheckIncludeFile)
 INCLUDE(CheckLibraryExists)
 INCLUDE(CheckLibraryExists)
 INCLUDE(CheckCSourceCompiles)
 INCLUDE(CheckCSourceCompiles)
@@ -303,20 +308,19 @@ IF(PHYSFS_BUILD_TEST)
         FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses)
         FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses)
         SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
         SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
         FIND_LIBRARY(READLINE_LIBRARY readline)
         FIND_LIBRARY(READLINE_LIBRARY readline)
-        FIND_LIBRARY(HISTORY_LIBRARY history)
-        IF(READLINE_LIBRARY AND HISTORY_LIBRARY)
+        IF(READLINE_LIBRARY)
             SET(HAVE_SYSTEM_READLINE TRUE)
             SET(HAVE_SYSTEM_READLINE TRUE)
             SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
             SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
             INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H})
             INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H})
             ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
             ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
-        ENDIF(READLINE_LIBRARY AND HISTORY_LIBRARY)
+        ENDIF(READLINE_LIBRARY)
     ENDIF(READLINE_H AND HISTORY_H)
     ENDIF(READLINE_H AND HISTORY_H)
     ADD_EXECUTABLE(test_physfs test/test_physfs.c)
     ADD_EXECUTABLE(test_physfs test/test_physfs.c)
     TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
     TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
     SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
     SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
 ENDIF(PHYSFS_BUILD_TEST)
 ENDIF(PHYSFS_BUILD_TEST)
 
 
-OPTION(PHYSFS_BUILD_WX_TEST "Build wxWidgets test program." TRUE)
+OPTION(PHYSFS_BUILD_WX_TEST "Build wxWidgets test program." FALSE)
 MARK_AS_ADVANCED(PHYSFS_BUILD_WX_TEST)
 MARK_AS_ADVANCED(PHYSFS_BUILD_WX_TEST)
 IF(PHYSFS_BUILD_WX_TEST)
 IF(PHYSFS_BUILD_WX_TEST)
     SET(wxWidgets_USE_LIBS base core adv)
     SET(wxWidgets_USE_LIBS base core adv)
@@ -342,16 +346,32 @@ INSTALL(FILES physfs.h DESTINATION include)
 
 
 FIND_PACKAGE(Doxygen)
 FIND_PACKAGE(Doxygen)
 IF(DOXYGEN_FOUND)
 IF(DOXYGEN_FOUND)
-    ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation")
+    SET(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
+    CONFIGURE_FILE(
+        "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile"
+        "${PHYSFS_OUTPUT_DOXYFILE}"
+        COPYONLY
+    )
+    FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
+    FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = ${PHYSFS_VERSION}\n")
+    FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = ${CMAKE_CURRENT_BINARY_DIR}/docs\n")
+    FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
+
+    ADD_CUSTOM_TARGET(
+        docs
+        ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
+        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+        COMMENT "Building documentation in 'docs' directory..."
+    )
 ELSE(DOXYGEN_FOUND)
 ELSE(DOXYGEN_FOUND)
     MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.")
     MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.")
 ENDIF(DOXYGEN_FOUND)
 ENDIF(DOXYGEN_FOUND)
 
 
 IF(UNIX)
 IF(UNIX)
-    SET(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
+    SET(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.bz2")
     ADD_CUSTOM_TARGET(
     ADD_CUSTOM_TARGET(
         dist
         dist
-        hg archive -t tgz "${PHYSFS_TARBALL}"
+        hg archive -t tbz2 "${PHYSFS_TARBALL}"
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
         COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
         COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
     )
     )
@@ -385,4 +405,3 @@ IF(PHYSFS_BUILD_TEST)
 ENDIF(PHYSFS_BUILD_TEST)
 ENDIF(PHYSFS_BUILD_TEST)
 
 
 # end of CMakeLists.txt ...
 # end of CMakeLists.txt ...
-

+ 3 - 0
jni/physfs-2.0.3/CREDITS.txt

@@ -106,6 +106,9 @@ OS/2 updates:
 Bug fixes:
 Bug fixes:
     Patrice Mandin
     Patrice Mandin
 
 
+Bug fixes:
+    Lauri Kasanen
+
 Other stuff:
 Other stuff:
     Your name here! Patches go to icculus@icculus.org ...
     Your name here! Patches go to icculus@icculus.org ...
 
 

+ 2 - 2
jni/physfs-2.0.3/Doxyfile

@@ -22,8 +22,8 @@ PROJECT_NAME           = physfs
 # The PROJECT_NUMBER tag can be used to enter a project or revision number. 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number. 
 # This could be handy for archiving the generated documentation or 
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 # if some version control system is used.
-
-PROJECT_NUMBER         = 2.0.2
+# (CMake will set this properly at build time. --ryan.)
+PROJECT_NUMBER         = "unknown version (build with 'make docs' next time!)"
 
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
 # base path where the generated documentation will be put. 

+ 1 - 1
jni/physfs-2.0.3/LICENSE.txt

@@ -1,5 +1,5 @@
 
 
-   Copyright (c) 2001-2011 Ryan C. Gordon and others.
+   Copyright (c) 2001-2012 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

+ 0 - 3
jni/physfs-2.0.3/archivers/wad.c

@@ -245,9 +245,6 @@ static int wad_load_entries(const char *name, int forWriting, WADinfo *info)
     PHYSFS_uint32 fileCount;
     PHYSFS_uint32 fileCount;
     PHYSFS_uint32 directoryOffset;
     PHYSFS_uint32 directoryOffset;
     WADentry *entry;
     WADentry *entry;
-    char lastDirectory[9];
-
-    lastDirectory[8] = 0; /* Make sure lastDirectory stays null-terminated. */
 
 
     BAIL_IF_MACRO(!wad_open(name, forWriting, &fh, &fileCount,&directoryOffset), NULL, 0);
     BAIL_IF_MACRO(!wad_open(name, forWriting, &fh, &fileCount,&directoryOffset), NULL, 0);
     info->entryCount = fileCount;
     info->entryCount = fileCount;

+ 24 - 6
jni/physfs-2.0.3/archivers/zip.c

@@ -535,6 +535,8 @@ static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path, int *isDir)
 
 
         else /* substring match...might be dir or entry or nothing. */
         else /* substring match...might be dir or entry or nothing. */
         {
         {
+            int i;
+
             if (isDir != NULL)
             if (isDir != NULL)
             {
             {
                 *isDir = (thispath[pathlen] == '/');
                 *isDir = (thispath[pathlen] == '/');
@@ -544,12 +546,27 @@ static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path, int *isDir)
 
 
             if (thispath[pathlen] == '\0') /* found entry? */
             if (thispath[pathlen] == '\0') /* found entry? */
                 return(&a[middle]);
                 return(&a[middle]);
-            /* adjust search params, try again. */
-            else if (thispath[pathlen] > '/')
-                hi = middle - 1;
-            else
-                lo = middle + 1;
-        } /* if */
+
+            /* substring match; search remaining space to find it... */
+            for (i = lo; i < hi; i++)
+            {
+                thispath = a[i].name;
+                if (strncmp(path, thispath, pathlen) == 0)
+                {
+                    if (isDir != NULL)
+                    {
+                        *isDir = (thispath[pathlen] == '/');
+                        if (*isDir)
+                            return(NULL);
+                    } /* if */
+
+                    if (thispath[pathlen] == '\0') /* found entry? */
+                        return(&a[i]);
+                } /* if */
+            } /* for */
+            break;
+
+        } /* else */
     } /* while */
     } /* while */
 
 
     if (isDir != NULL)
     if (isDir != NULL)
@@ -628,6 +645,7 @@ static void zip_expand_symlink_path(char *path)
         else
         else
         {
         {
             prevptr = ptr;
             prevptr = ptr;
+            ptr++;
         } /* else */
         } /* else */
     } /* while */
     } /* while */
 } /* zip_expand_symlink_path */
 } /* zip_expand_symlink_path */

+ 12 - 0
jni/physfs-2.0.3/extras/globbing.h

@@ -1,3 +1,6 @@
+#ifndef INCL_PHYSFSEXT_GLOBBING_H
+#define INCL_PHYSFSEXT_GLOBBING_H
+
 /** \file globbing.h */
 /** \file globbing.h */
 
 
 /**
 /**
@@ -30,6 +33,9 @@
  *  \author Ryan C. Gordon.
  *  \author Ryan C. Gordon.
  */
  */
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 /**
 /**
  * \fn char **PHYSFS_enumerateFilesWildcard(const char *dir, const char *wildcard, int caseSensitive)
  * \fn char **PHYSFS_enumerateFilesWildcard(const char *dir, const char *wildcard, int caseSensitive)
@@ -73,5 +79,11 @@ __EXPORT__ char **PHYSFSEXT_enumerateFilesWildcard(const char *dir,
                                                    const char *wildcard,
                                                    const char *wildcard,
                                                    int caseSensitive);
                                                    int caseSensitive);
 
 
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* include-once blocker. */
+
 /* end of globbing.h ... */
 /* end of globbing.h ... */
 
 

+ 1 - 1
jni/physfs-2.0.3/extras/ignorecase.c

@@ -98,7 +98,7 @@ int PHYSFSEXT_locateCorrectCase(char *buf)
     if (*ptr == '\0')
     if (*ptr == '\0')
         return(0);  /* Uh...I guess that's success. */
         return(0);  /* Uh...I guess that's success. */
 
 
-    while (ptr = strchr(ptr + 1, '/'))
+    while ( (ptr = strchr(ptr + 1, '/')) != NULL )
     {
     {
         *ptr = '\0';  /* block this path section off */
         *ptr = '\0';  /* block this path section off */
         rc = locateOneElement(buf);
         rc = locateOneElement(buf);

+ 12 - 0
jni/physfs-2.0.3/extras/ignorecase.h

@@ -1,3 +1,6 @@
+#ifndef INCL_PHYSFSEXT_IGNORECASE_H
+#define INCL_PHYSFSEXT_IGNORECASE_H
+
 /** \file ignorecase.h */
 /** \file ignorecase.h */
 
 
 /**
 /**
@@ -44,6 +47,9 @@
  *  \author Ryan C. Gordon.
  *  \author Ryan C. Gordon.
  */
  */
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 /**
 /**
  * \fn int PHYSFSEXT_locateCorrectCase(char *buf)
  * \fn int PHYSFSEXT_locateCorrectCase(char *buf)
@@ -71,5 +77,11 @@
  */
  */
 int PHYSFSEXT_locateCorrectCase(char *buf);
 int PHYSFSEXT_locateCorrectCase(char *buf);
 
 
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* include-once blocker. */
+
 /* end of ignorecase.h ... */
 /* end of ignorecase.h ... */
 
 

+ 6 - 13
jni/physfs-2.0.3/physfs.c

@@ -43,7 +43,7 @@ typedef struct __PHYSFS_FILEHANDLE__
 
 
 typedef struct __PHYSFS_ERRMSGTYPE__
 typedef struct __PHYSFS_ERRMSGTYPE__
 {
 {
-    PHYSFS_uint64 tid;
+    void *tid;
     int errorAvailable;
     int errorAvailable;
     char errorString[80];
     char errorString[80];
     struct __PHYSFS_ERRMSGTYPE__ *next;
     struct __PHYSFS_ERRMSGTYPE__ *next;
@@ -51,8 +51,6 @@ typedef struct __PHYSFS_ERRMSGTYPE__
 
 
 
 
 /* The various i/o drivers...some of these may not be compiled in. */
 /* The various i/o drivers...some of these may not be compiled in. */
-extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_APK;
-extern const PHYSFS_Archiver       __PHYSFS_Archiver_APK;
 extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_ZIP;
 extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_ZIP;
 extern const PHYSFS_Archiver       __PHYSFS_Archiver_ZIP;
 extern const PHYSFS_Archiver       __PHYSFS_Archiver_ZIP;
 extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_LZMA;
 extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_LZMA;
@@ -72,9 +70,6 @@ extern const PHYSFS_Archiver       __PHYSFS_Archiver_DIR;
 
 
 static const PHYSFS_ArchiveInfo *supported_types[] =
 static const PHYSFS_ArchiveInfo *supported_types[] =
 {
 {
-#if (defined PHYSFS_SUPPORTS_APK)
-    &__PHYSFS_ArchiveInfo_APK,
-#endif
 #if (defined PHYSFS_SUPPORTS_ZIP)
 #if (defined PHYSFS_SUPPORTS_ZIP)
     &__PHYSFS_ArchiveInfo_ZIP,
     &__PHYSFS_ArchiveInfo_ZIP,
 #endif
 #endif
@@ -99,12 +94,9 @@ static const PHYSFS_ArchiveInfo *supported_types[] =
     NULL
     NULL
 };
 };
 
 
-static const PHYSFS_Archiver *archivers[] =
+static const PHYSFS_Archiver * const archivers[] =
 {
 {
     &__PHYSFS_Archiver_DIR,
     &__PHYSFS_Archiver_DIR,
-#if (defined PHYSFS_SUPPORTS_APK)
-    &__PHYSFS_Archiver_APK,
-#endif
 #if (defined PHYSFS_SUPPORTS_ZIP)
 #if (defined PHYSFS_SUPPORTS_ZIP)
     &__PHYSFS_Archiver_ZIP,
     &__PHYSFS_Archiver_ZIP,
 #endif
 #endif
@@ -269,14 +261,15 @@ void __PHYSFS_sort(void *entries, PHYSFS_uint32 max,
      * Quicksort w/ Bubblesort fallback algorithm inspired by code from here:
      * Quicksort w/ Bubblesort fallback algorithm inspired by code from here:
      *   http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html
      *   http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html
      */
      */
-    __PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn);
+    if (max > 0)
+        __PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn);
 } /* __PHYSFS_sort */
 } /* __PHYSFS_sort */
 
 
 
 
 static ErrMsg *findErrorForCurrentThread(void)
 static ErrMsg *findErrorForCurrentThread(void)
 {
 {
     ErrMsg *i;
     ErrMsg *i;
-    PHYSFS_uint64 tid;
+    void *tid;
 
 
     if (errorLock != NULL)
     if (errorLock != NULL)
         __PHYSFS_platformGrabMutex(errorLock);
         __PHYSFS_platformGrabMutex(errorLock);
@@ -424,7 +417,7 @@ static DirHandle *tryOpenDir(const PHYSFS_Archiver *funcs,
 static DirHandle *openDirectory(const char *d, int forWriting)
 static DirHandle *openDirectory(const char *d, int forWriting)
 {
 {
     DirHandle *retval = NULL;
     DirHandle *retval = NULL;
-    const PHYSFS_Archiver **i;
+    const PHYSFS_Archiver * const *i;
     const char *ext;
     const char *ext;
 
 
     BAIL_IF_MACRO(!__PHYSFS_platformExists(d), ERR_NO_SUCH_FILE, NULL);
     BAIL_IF_MACRO(!__PHYSFS_platformExists(d), ERR_NO_SUCH_FILE, NULL);

+ 1 - 1
jni/physfs-2.0.3/physfs.h

@@ -405,7 +405,7 @@ typedef struct PHYSFS_Version
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 #define PHYSFS_VER_MAJOR 2
 #define PHYSFS_VER_MAJOR 2
 #define PHYSFS_VER_MINOR 0
 #define PHYSFS_VER_MINOR 0
-#define PHYSFS_VER_PATCH 2
+#define PHYSFS_VER_PATCH 3
 #endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
 #endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
 
 
 
 

+ 7 - 13
jni/physfs-2.0.3/physfs_internal.h

@@ -103,7 +103,6 @@ void __PHYSFS_smallFree(void *ptr);
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
  #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
- #define APK_ARCHIVE_DESCRIPTION  "APK compatible"
  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip compatible"
  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip compatible"
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format"
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format"
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format"
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format"
@@ -203,7 +202,6 @@ void __PHYSFS_smallFree(void *ptr);
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
  #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
- #define APK_ARCHIVE_DESCRIPTION  "APK kompatibel"
  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip kompatibel"
  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip kompatibel"
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
@@ -302,7 +300,6 @@ void __PHYSFS_smallFree(void *ptr);
  #define GRP_ARCHIVE_DESCRIPTION  "Формат группового файла Build engine"
  #define GRP_ARCHIVE_DESCRIPTION  "Формат группового файла Build engine"
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
- #define APK_ARCHIVE_DESCRIPTION  "APK совместимый"
  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip совместимый"
  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip совместимый"
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
@@ -403,7 +400,6 @@ void __PHYSFS_smallFree(void *ptr);
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define HOG_ARCHIVE_DESCRIPTION  "Descent I/II HOG file format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define MVL_ARCHIVE_DESCRIPTION  "Descent II Movielib format"
  #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
  #define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
- #define APK_ARCHIVE_DESCRIPTION  "Compatible APK"
  #define ZIP_ARCHIVE_DESCRIPTION  "Compatible PkZip/WinZip/Info-Zip"
  #define ZIP_ARCHIVE_DESCRIPTION  "Compatible PkZip/WinZip/Info-Zip"
  #define WAD_ARCHIVE_DESCRIPTION  "Format WAD du moteur DOOM"
  #define WAD_ARCHIVE_DESCRIPTION  "Format WAD du moteur DOOM"
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
@@ -503,7 +499,6 @@ void __PHYSFS_smallFree(void *ptr);
  #define HOG_ARCHIVE_DESCRIPTION  "Formato Descent I/II HOG file"
  #define HOG_ARCHIVE_DESCRIPTION  "Formato Descent I/II HOG file"
  #define MVL_ARCHIVE_DESCRIPTION  "Formato Descent II Movielib"
  #define MVL_ARCHIVE_DESCRIPTION  "Formato Descent II Movielib"
  #define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
  #define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
- #define APK_ARCHIVE_DESCRIPTION  "Formato compatível APK"
  #define ZIP_ARCHIVE_DESCRIPTION  "Formato compatível PkZip/WinZip/Info-Zip"
  #define ZIP_ARCHIVE_DESCRIPTION  "Formato compatível PkZip/WinZip/Info-Zip"
  #define WAD_ARCHIVE_DESCRIPTION  "Formato WAD do engine DOOM"
  #define WAD_ARCHIVE_DESCRIPTION  "Formato WAD do engine DOOM"
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
@@ -604,7 +599,6 @@ void __PHYSFS_smallFree(void *ptr);
  #define HOG_ARCHIVE_DESCRIPTION  "Formato Descent I/II HOG file"
  #define HOG_ARCHIVE_DESCRIPTION  "Formato Descent I/II HOG file"
  #define MVL_ARCHIVE_DESCRIPTION  "Formato Descent II Movielib"
  #define MVL_ARCHIVE_DESCRIPTION  "Formato Descent II Movielib"
  #define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
  #define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
- #define APK_ARCHIVE_DESCRIPTION  "Compatible con APK"
  #define ZIP_ARCHIVE_DESCRIPTION  "Compatible con PkZip/WinZip/Info-Zip"
  #define ZIP_ARCHIVE_DESCRIPTION  "Compatible con PkZip/WinZip/Info-Zip"
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define WAD_ARCHIVE_DESCRIPTION  "DOOM engine format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
  #define LZMA_ARCHIVE_DESCRIPTION "LZMA (7zip) format" /* !!! FIXME: translate this line if needed */
@@ -976,7 +970,8 @@ char *__PHYSFS_convertToDependent(const char *prepend,
 #define PHYSFS_LIL_ENDIAN  1234
 #define PHYSFS_LIL_ENDIAN  1234
 #define PHYSFS_BIG_ENDIAN  4321
 #define PHYSFS_BIG_ENDIAN  4321
 
 
-#if  defined(__i386__) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || \
+#if  defined(__i386__) || defined(__ia64__) || \
+     defined(_M_IX86) || defined(_M_IA64) || defined(_M_X64) || \
     (defined(__alpha__) || defined(__alpha)) || \
     (defined(__alpha__) || defined(__alpha)) || \
      defined(__arm__) || defined(ARM) || \
      defined(__arm__) || defined(ARM) || \
     (defined(__mips__) && defined(__MIPSEL__)) || \
     (defined(__mips__) && defined(__MIPSEL__)) || \
@@ -1231,8 +1226,7 @@ int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos);
  *
  *
  * Not all file types can "tell"; this is to be expected by the caller.
  * Not all file types can "tell"; this is to be expected by the caller.
  *
  *
- * On error, call __PHYSFS_setError() and return zero. On success, return
- *  a non-zero value.
+ * On error, call __PHYSFS_setError() and return -1. On success, return >= 0.
  */
  */
 PHYSFS_sint64 __PHYSFS_platformTell(void *opaque);
 PHYSFS_sint64 __PHYSFS_platformTell(void *opaque);
 
 
@@ -1311,12 +1305,12 @@ char *__PHYSFS_platformGetUserName(void);
 char *__PHYSFS_platformGetUserDir(void);
 char *__PHYSFS_platformGetUserDir(void);
 
 
 /*
 /*
- * Return a number that uniquely identifies the current thread.
- *  On a platform without threading, (1) will suffice. These numbers are
+ * Return a pointer that uniquely identifies the current thread.
+ *  On a platform without threading, (0x1) will suffice. These numbers are
  *  arbitrary; the only requirement is that no two threads have the same
  *  arbitrary; the only requirement is that no two threads have the same
- *  number.
+ *  pointer.
  */
  */
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void);
+void *__PHYSFS_platformGetThreadID(void);
 
 
 /*
 /*
  * Return non-zero if filename (in platform-dependent notation) exists.
  * Return non-zero if filename (in platform-dependent notation) exists.

+ 1 - 1
jni/physfs-2.0.3/physfs_platforms.h

@@ -38,7 +38,7 @@
 #  endif
 #  endif
 #elif defined(macintosh)
 #elif defined(macintosh)
 #  error Classic Mac OS support was dropped from PhysicsFS 2.0. Move to OS X.
 #  error Classic Mac OS support was dropped from PhysicsFS 2.0. Move to OS X.
-#elif defined(unix)
+#elif defined(unix) || defined(__unix__)
 #  define PHYSFS_PLATFORM_UNIX
 #  define PHYSFS_PLATFORM_UNIX
 #  define PHYSFS_PLATFORM_POSIX
 #  define PHYSFS_PLATFORM_POSIX
 #else
 #else

+ 10 - 5
jni/physfs-2.0.3/physfs_unicode.c

@@ -63,12 +63,13 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
 
 
     else if (octet < 224)  /* two octets */
     else if (octet < 224)  /* two octets */
     {
     {
+        (*_str)++;  /* advance at least one byte in case of an error */
         octet -= (128+64);
         octet -= (128+64);
         octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         if ((octet2 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet2 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
 
 
-        *_str += 2;  /* skip to next possible start of codepoint. */
+        *_str += 1;  /* skip to next possible start of codepoint. */
         retval = ((octet << 6) | (octet2 - 128));
         retval = ((octet << 6) | (octet2 - 128));
         if ((retval >= 0x80) && (retval <= 0x7FF))
         if ((retval >= 0x80) && (retval <= 0x7FF))
             return retval;
             return retval;
@@ -76,6 +77,7 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
 
 
     else if (octet < 240)  /* three octets */
     else if (octet < 240)  /* three octets */
     {
     {
+        (*_str)++;  // advance at least one byte in case of an error
         octet -= (128+64+32);
         octet -= (128+64+32);
         octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         if ((octet2 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet2 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
@@ -85,7 +87,7 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
         if ((octet3 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet3 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
 
 
-        *_str += 3;  /* skip to next possible start of codepoint. */
+        *_str += 2;  /* skip to next possible start of codepoint. */
         retval = ( ((octet << 12)) | ((octet2-128) << 6) | ((octet3-128)) );
         retval = ( ((octet << 12)) | ((octet2-128) << 6) | ((octet3-128)) );
 
 
         /* There are seven "UTF-16 surrogates" that are illegal in UTF-8. */
         /* There are seven "UTF-16 surrogates" that are illegal in UTF-8. */
@@ -108,6 +110,7 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
 
 
     else if (octet < 248)  /* four octets */
     else if (octet < 248)  /* four octets */
     {
     {
+        (*_str)++;  // advance at least one byte in case of an error
         octet -= (128+64+32+16);
         octet -= (128+64+32+16);
         octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         octet2 = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         if ((octet2 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet2 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
@@ -121,7 +124,7 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
         if ((octet4 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet4 & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
 
 
-        *_str += 4;  /* skip to next possible start of codepoint. */
+        *_str += 3;  /* skip to next possible start of codepoint. */
         retval = ( ((octet << 18)) | ((octet2 - 128) << 12) |
         retval = ( ((octet << 18)) | ((octet2 - 128) << 12) |
                    ((octet3 - 128) << 6) | ((octet4 - 128)) );
                    ((octet3 - 128) << 6) | ((octet4 - 128)) );
         if ((retval >= 0x10000) && (retval <= 0x10FFFF))
         if ((retval >= 0x10000) && (retval <= 0x10FFFF))
@@ -136,6 +139,7 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
 
 
     else if (octet < 252)  /* five octets */
     else if (octet < 252)  /* five octets */
     {
     {
+        (*_str)++;  // advance at least one byte in case of an error
         octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
@@ -152,12 +156,13 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
 
 
-        *_str += 5;  /* skip to next possible start of codepoint. */
+        *_str += 4;  /* skip to next possible start of codepoint. */
         return UNICODE_BOGUS_CHAR_VALUE;
         return UNICODE_BOGUS_CHAR_VALUE;
     } /* else if */
     } /* else if */
 
 
     else  /* six octets */
     else  /* six octets */
     {
     {
+        (*_str)++;  // advance at least one byte in case of an error
         octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         octet = (PHYSFS_uint32) ((PHYSFS_uint8) *(++str));
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
@@ -178,7 +183,7 @@ static PHYSFS_uint32 utf8codepoint(const char **_str)
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
         if ((octet & (128+64)) != 128)  /* Format isn't 10xxxxxx? */
             return UNICODE_BOGUS_CHAR_VALUE;
             return UNICODE_BOGUS_CHAR_VALUE;
 
 
-        *_str += 6;  /* skip to next possible start of codepoint. */
+        *_str += 5;  /* skip to next possible start of codepoint. */
         return UNICODE_BOGUS_CHAR_VALUE;
         return UNICODE_BOGUS_CHAR_VALUE;
     } /* else if */
     } /* else if */
 
 

+ 2 - 2
jni/physfs-2.0.3/platform/beos.cpp

@@ -197,9 +197,9 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
 } /* __PHYSFS_platformCalcBaseDir */
 } /* __PHYSFS_platformCalcBaseDir */
 
 
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+void *__PHYSFS_platformGetThreadID(void)
 {
 {
-    return((PHYSFS_uint64) find_thread(NULL));
+    return((void *) find_thread(NULL));
 } /* __PHYSFS_platformGetThreadID */
 } /* __PHYSFS_platformGetThreadID */
 
 
 
 

+ 39 - 16
jni/physfs-2.0.3/platform/macosx.c

@@ -16,6 +16,7 @@
 #include <IOKit/storage/IOCDMedia.h>
 #include <IOKit/storage/IOCDMedia.h>
 #include <IOKit/storage/IODVDMedia.h>
 #include <IOKit/storage/IODVDMedia.h>
 #include <sys/mount.h>
 #include <sys/mount.h>
+#include <sys/stat.h>
 
 
 /* Seems to get defined in some system header... */
 /* Seems to get defined in some system header... */
 #ifdef Free
 #ifdef Free
@@ -219,12 +220,15 @@ static char *convertCFString(CFStringRef cfstr)
 char *__PHYSFS_platformCalcBaseDir(const char *argv0)
 char *__PHYSFS_platformCalcBaseDir(const char *argv0)
 {
 {
     ProcessSerialNumber psn = { 0, kCurrentProcess };
     ProcessSerialNumber psn = { 0, kCurrentProcess };
+    struct stat statbuf;
     FSRef fsref;
     FSRef fsref;
     CFRange cfrange;
     CFRange cfrange;
     CFURLRef cfurl = NULL;
     CFURLRef cfurl = NULL;
     CFStringRef cfstr = NULL;
     CFStringRef cfstr = NULL;
     CFMutableStringRef cfmutstr = NULL;
     CFMutableStringRef cfmutstr = NULL;
     char *retval = NULL;
     char *retval = NULL;
+    char *cstr = NULL;
+    int rc = 0;
 
 
     BAIL_IF_MACRO(GetProcessBundleLocation(&psn, &fsref) != noErr, NULL, NULL);
     BAIL_IF_MACRO(GetProcessBundleLocation(&psn, &fsref) != noErr, NULL, NULL);
     cfurl = CFURLCreateFromFSRef(cfallocator, &fsref);
     cfurl = CFURLCreateFromFSRef(cfallocator, &fsref);
@@ -236,27 +240,46 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
     CFRelease(cfstr);
     CFRelease(cfstr);
     BAIL_IF_MACRO(cfmutstr == NULL, NULL, NULL);
     BAIL_IF_MACRO(cfmutstr == NULL, NULL, NULL);
 
 
-    /* Find last dirsep so we can chop the binary's filename from the path. */
-    cfrange = CFStringFind(cfmutstr, CFSTR("/"), kCFCompareBackwards);
-    if (cfrange.location == kCFNotFound)
+    /* we have to decide if we got a binary's path, or the .app dir... */
+    cstr = convertCFString(cfmutstr);
+    if (cstr == NULL)
     {
     {
-        assert(0);  /* shouldn't ever hit this... */
         CFRelease(cfmutstr);
         CFRelease(cfmutstr);
         return(NULL);
         return(NULL);
     } /* if */
     } /* if */
 
 
-    /* chop the "/exename" from the end of the path string... */
-    cfrange.length = CFStringGetLength(cfmutstr) - cfrange.location;
-    CFStringDelete(cfmutstr, cfrange);
+    rc = stat(cstr, &statbuf);
+    allocator.Free(cstr);  /* done with this. */
+    if (rc == -1)
+    {
+        CFRelease(cfmutstr);
+        return(NULL);  /* maybe default behaviour will work? */
+    } /* if */
 
 
-    /* If we're an Application Bundle, chop everything but the base. */
-    cfrange = CFStringFind(cfmutstr, CFSTR("/Contents/MacOS"),
-                           kCFCompareCaseInsensitive |
-                           kCFCompareBackwards |
-                           kCFCompareAnchored);
+    if (S_ISREG(statbuf.st_mode))
+    {
+        /* Find last dirsep so we can chop the filename from the path. */
+        cfrange = CFStringFind(cfmutstr, CFSTR("/"), kCFCompareBackwards);
+        if (cfrange.location == kCFNotFound)
+        {
+            assert(0);  /* shouldn't ever hit this... */
+            CFRelease(cfmutstr);
+            return(NULL);
+        } /* if */
+
+        /* chop the "/exename" from the end of the path string... */
+        cfrange.length = CFStringGetLength(cfmutstr) - cfrange.location;
+        CFStringDelete(cfmutstr, cfrange);
 
 
-    if (cfrange.location != kCFNotFound)
-        CFStringDelete(cfmutstr, cfrange);  /* chop that, too. */
+        /* If we're an Application Bundle, chop everything but the base. */
+        cfrange = CFStringFind(cfmutstr, CFSTR("/Contents/MacOS"),
+                               kCFCompareCaseInsensitive |
+                               kCFCompareBackwards |
+                               kCFCompareAnchored);
+
+        if (cfrange.location != kCFNotFound)
+            CFStringDelete(cfmutstr, cfrange);  /* chop that, too. */
+    } /* if */
 
 
     retval = convertCFString(cfmutstr);
     retval = convertCFString(cfmutstr);
     CFRelease(cfmutstr);
     CFRelease(cfmutstr);
@@ -353,9 +376,9 @@ int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
 } /* __PHYSFS_platformSetDefaultAllocator */
 } /* __PHYSFS_platformSetDefaultAllocator */
 
 
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+void *__PHYSFS_platformGetThreadID(void)
 {
 {
-    return( (PHYSFS_uint64) ((size_t) MPCurrentTaskID()) );
+    return( (void *) ((size_t) MPCurrentTaskID()) );
 } /* __PHYSFS_platformGetThreadID */
 } /* __PHYSFS_platformGetThreadID */
 
 
 
 

+ 2 - 2
jni/physfs-2.0.3/platform/os2.c

@@ -649,7 +649,7 @@ PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
 } /* __PHYSFS_platformGetLastModTime */
 } /* __PHYSFS_platformGetLastModTime */
 
 
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+void *__PHYSFS_platformGetThreadID(void)
 {
 {
     PTIB ptib;
     PTIB ptib;
     PPIB ppib;
     PPIB ppib;
@@ -659,7 +659,7 @@ PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
      *  default value (zero might as well do) if it does.
      *  default value (zero might as well do) if it does.
      */
      */
     BAIL_IF_MACRO(os2err(DosGetInfoBlocks(&ptib, &ppib)) != NO_ERROR, 0, 0);
     BAIL_IF_MACRO(os2err(DosGetInfoBlocks(&ptib, &ppib)) != NO_ERROR, 0, 0);
-    return((PHYSFS_uint64) ptib->tib_ordinal);
+    return((void *) ptib->tib_ordinal);
 } /* __PHYSFS_platformGetThreadID */
 } /* __PHYSFS_platformGetThreadID */
 
 
 
 

+ 9 - 5
jni/physfs-2.0.3/platform/pocketpc.c

@@ -161,9 +161,9 @@ char *__PHYSFS_platformGetUserDir(void)
 } /* __PHYSFS_platformGetUserDir */
 } /* __PHYSFS_platformGetUserDir */
 
 
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+void *__PHYSFS_platformGetThreadID(void)
 {
 {
-    return(1);  /* single threaded. */
+    return((void *)1);  /* single threaded. */
 } /* __PHYSFS_platformGetThreadID */
 } /* __PHYSFS_platformGetThreadID */
 
 
 
 
@@ -467,7 +467,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
     LowPos = SetFilePointer(Handle, 0, &HighPos, FILE_CURRENT);
     LowPos = SetFilePointer(Handle, 0, &HighPos, FILE_CURRENT);
     if ((LowPos == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
     if ((LowPos == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
     {
     {
-        BAIL_MACRO(win32strerror(), 0);
+        BAIL_MACRO(win32strerror(), -1);
     } /* if */
     } /* if */
     else
     else
     {
     {
@@ -505,14 +505,18 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
 
 
 int __PHYSFS_platformEOF(void *opaque)
 int __PHYSFS_platformEOF(void *opaque)
 {
 {
+    const PHYSFS_sint64 FileLength = __PHYSFS_platformFileLength(opaque);
     PHYSFS_sint64 FilePosition;
     PHYSFS_sint64 FilePosition;
     int retval = 0;
     int retval = 0;
 
 
+    if (FileLength == 0)
+        return 1;  /* we're definitely at EOF. */
+
     /* Get the current position in the file */
     /* Get the current position in the file */
-    if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
+    if ((FilePosition = __PHYSFS_platformTell(opaque)) != -1)
     {
     {
         /* Non-zero if EOF is equal to the file length */
         /* Non-zero if EOF is equal to the file length */
-        retval = FilePosition == __PHYSFS_platformFileLength(opaque);
+        retval = (FilePosition == FileLength);
     } /* if */
     } /* if */
 
 
     return(retval);
     return(retval);

+ 1 - 1
jni/physfs-2.0.3/platform/posix.c

@@ -383,7 +383,7 @@ int __PHYSFS_platformEOF(void *opaque)
 {
 {
     PHYSFS_sint64 pos = __PHYSFS_platformTell(opaque);
     PHYSFS_sint64 pos = __PHYSFS_platformTell(opaque);
     PHYSFS_sint64 len = __PHYSFS_platformFileLength(opaque);
     PHYSFS_sint64 len = __PHYSFS_platformFileLength(opaque);
-    return(pos >= len);
+    return((pos < 0) || (len < 0) || (pos >= len));
 } /* __PHYSFS_platformEOF */
 } /* __PHYSFS_platformEOF */
 
 
 
 

+ 3 - 18
jni/physfs-2.0.3/platform/unix.c

@@ -342,7 +342,7 @@ int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
 
 
 #if (defined PHYSFS_NO_THREAD_SUPPORT)
 #if (defined PHYSFS_NO_THREAD_SUPPORT)
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); }
+void *__PHYSFS_platformGetThreadID(void) { return((void *) 0x0001); }
 void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
 void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
 void __PHYSFS_platformDestroyMutex(void *mutex) {}
 void __PHYSFS_platformDestroyMutex(void *mutex) {}
 int __PHYSFS_platformGrabMutex(void *mutex) { return(1); }
 int __PHYSFS_platformGrabMutex(void *mutex) { return(1); }
@@ -357,24 +357,9 @@ typedef struct
     PHYSFS_uint32 count;
     PHYSFS_uint32 count;
 } PthreadMutex;
 } PthreadMutex;
 
 
-/* Just in case; this is a panic value. */
-#if ((!defined SIZEOF_INT) || (SIZEOF_INT <= 0))
-#  define SIZEOF_INT 4
-#endif
-
-#if (SIZEOF_INT == 4)
-#  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint32) (thr)) )
-#elif (SIZEOF_INT == 2)
-#  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint16) (thr)) )
-#elif (SIZEOF_INT == 1)
-#  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint8) (thr)) )
-#else
-#  define PHTREAD_TO_UI64(thr) ((PHYSFS_uint64) (thr))
-#endif
-
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+void *__PHYSFS_platformGetThreadID(void)
 {
 {
-    return(PHTREAD_TO_UI64(pthread_self()));
+    return( (void *) ((size_t) pthread_self()) );
 } /* __PHYSFS_platformGetThreadID */
 } /* __PHYSFS_platformGetThreadID */
 
 
 
 

+ 10 - 5
jni/physfs-2.0.3/platform/windows.c

@@ -462,6 +462,7 @@ static int determineUserDir(void)
              */	
              */	
     		rc = pGetUserProfileDirectoryW(accessToken, &dummy, &psize);
     		rc = pGetUserProfileDirectoryW(accessToken, &dummy, &psize);
             assert(!rc);  /* !!! FIXME: handle this gracefully. */
             assert(!rc);  /* !!! FIXME: handle this gracefully. */
+            (void)rc;
 
 
             /* Allocate memory for the profile directory */
             /* Allocate memory for the profile directory */
             wstr = (LPWSTR) __PHYSFS_smallAlloc(psize * sizeof (WCHAR));
             wstr = (LPWSTR) __PHYSFS_smallAlloc(psize * sizeof (WCHAR));
@@ -559,9 +560,9 @@ char *__PHYSFS_platformGetUserDir(void)
 } /* __PHYSFS_platformGetUserDir */
 } /* __PHYSFS_platformGetUserDir */
 
 
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+void *__PHYSFS_platformGetThreadID(void)
 {
 {
-    return((PHYSFS_uint64) GetCurrentThreadId());
+    return( (void *) ((size_t) GetCurrentThreadId()) );
 } /* __PHYSFS_platformGetThreadID */
 } /* __PHYSFS_platformGetThreadID */
 
 
 
 
@@ -1142,7 +1143,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
     if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) &&
     if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) &&
          (GetLastError() != NO_ERROR) )
          (GetLastError() != NO_ERROR) )
     {
     {
-        BAIL_MACRO(winApiStrError(), 0);
+        BAIL_MACRO(winApiStrError(), -1);
     } /* if */
     } /* if */
     else
     else
     {
     {
@@ -1181,14 +1182,18 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
 
 
 int __PHYSFS_platformEOF(void *opaque)
 int __PHYSFS_platformEOF(void *opaque)
 {
 {
+    const PHYSFS_sint64 FileLength = __PHYSFS_platformFileLength(opaque);
     PHYSFS_sint64 FilePosition;
     PHYSFS_sint64 FilePosition;
     int retval = 0;
     int retval = 0;
 
 
+    if (FileLength == 0)
+        return 1;  /* we're definitely at EOF. */
+
     /* Get the current position in the file */
     /* Get the current position in the file */
-    if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
+    if ((FilePosition = __PHYSFS_platformTell(opaque)) != -1)
     {
     {
         /* Non-zero if EOF is equal to the file length */
         /* Non-zero if EOF is equal to the file length */
-        retval = FilePosition == __PHYSFS_platformFileLength(opaque);
+        retval = (FilePosition == FileLength);
     } /* if */
     } /* if */
 
 
     return(retval);
     return(retval);

+ 1 - 1
jni/physfs-2.0.3/test/test_physfs.c

@@ -27,7 +27,7 @@
 
 
 #define TEST_VERSION_MAJOR  2
 #define TEST_VERSION_MAJOR  2
 #define TEST_VERSION_MINOR  0
 #define TEST_VERSION_MINOR  0
-#define TEST_VERSION_PATCH  2
+#define TEST_VERSION_PATCH  3
 
 
 static FILE *history_file = NULL;
 static FILE *history_file = NULL;
 static PHYSFS_uint32 do_buffer_size = 0;
 static PHYSFS_uint32 do_buffer_size = 0;

+ 1 - 1
jni/physfs-2.0.3/test/wxtest_physfs.cpp

@@ -24,7 +24,7 @@
 
 
 #define TEST_VER_MAJOR  2
 #define TEST_VER_MAJOR  2
 #define TEST_VER_MINOR  0
 #define TEST_VER_MINOR  0
-#define TEST_VER_PATCH  2
+#define TEST_VER_PATCH  3
 
 
 //static PHYSFS_uint32 do_buffer_size = 0;
 //static PHYSFS_uint32 do_buffer_size = 0;