Compare commits

...

706 Commits

Author SHA1 Message Date
Ryan C. Gordon 9266e773d3
unix: Better base dir calculation for Solaris.
This idea came from https://github.com/libsdl-org/SDL/pull/6681 (thanks!)
2022-11-27 21:45:11 -05:00
Ryan C. Gordon fdd38a3f8a
Bumped main branch to to 3.2.0!
(This will, hopefully, become PhysicsFS 4.0, eventually.)
2022-09-30 16:14:24 -04:00
Ryan C. Gordon 6a7625cd77 apple: macOS 12.0 deprecated things called "master" for "main".
Try to look for the new name in the process's namespace before falling back
to the old one (and giving up on CD-ROM detection if everything falls apart).

iOS has PHYSFS_NO_CDROM_SUPPORT defined, so this isn't used there.
2022-09-29 14:13:33 -04:00
Ozkan Sezer 49662cd826 minor update to endian macros from SDL. 2022-09-29 18:55:04 +03:00
Ryan C. Gordon 4d9bcc3d1a
atomic: __PHYSFS_ATOMIC_(DECR|INCR) should return final value.
Fixes #46.
2022-09-29 10:53:18 -04:00
Ryan C. Gordon 496817a9e8
PHYSFS_mkdir() should allow symlinks in the mounted writeDir itself.
Fixes #47.
2022-09-29 10:27:23 -04:00
Ozkan Sezer 0d4e9aac45 silenced a -Wunused-but-set-variable warning. 2022-06-16 14:55:50 +03:00
Ozkan Sezer 65195f9c1a define MINIZ_LITTLE_ENDIAN based on PHYSFS_BYTEORDER. 2022-06-15 23:10:00 +03:00
Ozkan Sezer fb0901b10f silence a -Wint-in-bool-context warning:
In file included from /home/runner/work/physfs/physfs/src/physfs.c:12:
/home/runner/work/physfs/physfs/src/physfs.c: In function ‘openDirectory’:
/home/runner/work/physfs/physfs/src/physfs.c:929:40: warning: ?: using integer constants in boolean context [-Wint-in-bool-context]
  929 |     BAIL_IF(!retval, claimed ? errcode : PHYSFS_ERR_UNSUPPORTED, NULL);
      |                      ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/physfs/physfs/src/physfs_internal.h:273:44: note: in definition of macro ‘BAIL_IF’
  273 | #define BAIL_IF(c, e, r) do { if (c) { if (e) PHYSFS_setErrorCode(e); return r; } } while (0)
      |                                            ^

Closes https://github.com/icculus/physfs/issues/44
2022-06-15 20:56:28 +03:00
Ryan C. Gordon f0c7367b0f
Update endian detection from latest in SDL2.
Fixes #43.
2022-06-15 13:54:21 -04:00
Ozkan Sezer e32221a104 cmake: add -Wall to CFLAGS for gcc and clang. 2022-06-15 08:56:28 +03:00
Ozkan Sezer cfbbb255a2 minor warning fixes 2022-06-15 08:56:02 +03:00
Anonymous Maarten 2a90b1f469 cmake: collapse MSVC and MINGW into WIN32 2022-06-15 08:29:50 +03:00
Anonymous Maarten 88ef84c053 Make sure `pthread is not linked against when building with MinGW
Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2022-06-15 08:29:50 +03:00
Anonymous Maarten 9bc66b6469 add Windows CI 2022-06-15 08:29:50 +03:00
Anonymous Maarten aabb732caf cmake: fix warnings + use target_include_directories 2022-06-15 08:29:50 +03:00
Ryan C. Gordon 6925c1067d
Bumped copyright for 2022. 2022-05-20 23:27:26 -04:00
Ryan C. Gordon 64807353df
cmake: Don't try to use readline if you don't also have curses.
Fixes #17.
2022-05-20 23:19:41 -04:00
Ryan C. Gordon ed4ab15524
zip: workaround Windows Explorer bug.
If you edit a zip file with Windows Explorer, it will rewrite the entire
central directory, setting all files version_needed field to 2.0/MS-DOS,
but it won't touch files that it doesn't plan to alter, so you might end
up with a local header that doesn't match the central directory details.

We aren't currently using the version_needed information, so now we just
favor the local header's copy of it in case we ever need it, and don't
complain if the central directory doesn't match.

Fixes #24.
2022-05-20 22:22:55 -04:00
Ryan C. Gordon 48e7c2e3af
root: Fix string handling of paths from PHYSFS_setRoot.
Fixes #4.
2022-05-20 22:06:33 -04:00
Ryan C. Gordon 497934818b
Fixed memory leak when closing a DirHandle with a root (thanks, jajiradai!).
Fixes #3.
2022-05-20 21:27:46 -04:00
Ryan C. Gordon 17b691b0ea
Let several archives be case-insensitive.
(and several more probably _should_ be but I don't have the details on
them at the moment. But now it's just changing a 1 to a 0 to fix those!)
2022-05-20 17:36:06 -04:00
Ozkan Sezer 14691399cd disable dllexport from static builds.
Closes https://github.com/icculus/physfs/pull/15 .
2022-04-16 20:10:02 +03:00
Ozkan Sezer 20e90ed3c4 fix wording in os2.yml 2022-04-16 20:08:20 +03:00
Ozkan Sezer eec3f7f79a cmake: set os2 dll name to 'physfs'
not libphysfs, because of os2 limitation.
2022-04-16 11:42:50 -04:00
Ryan C. Gordon 3a3c552e50
ci: Fix OS/2 building.
Copy and pasted from SDL a little too quickly.  :)
2022-04-16 11:30:19 -04:00
Ryan C. Gordon b975bb679b
ci: Wire up OS/2 builds to GitHub Actions. 2022-04-16 11:24:53 -04:00
Ozkan Sezer 0ae9467685 physfs_platform_os2.c: eliminated signedness warnings. 2022-04-16 10:52:01 -04:00
Ozkan Sezer cd2e055454 added __PHYSFS_ATOMIC_INCR and __PHYSFS_ATOMIC_DECR for watcom compiler 2022-04-16 10:52:01 -04:00
Ozkan Sezer 141dccb087 added a watcom makefile targeting os2 2022-04-16 10:52:01 -04:00
Ozkan Sezer 3abe069870 fixed os2 symbol exports 2022-04-16 10:52:01 -04:00
Ozkan Sezer 02b6a7f084 fixed windows symbol exports 2022-04-16 10:52:01 -04:00
Ryan C. Gordon 045ee2cb7f
cmake: Moved the install stuff around a little. 2022-04-15 20:45:21 -04:00
Ryan C. Gordon a329a35993
cmake: Don't use the oldschool `endif(SAME_THING_AS_IF_LINE)` syntax. 2022-04-15 20:39:39 -04:00
Semphris 7305ee92a2 Added option to disable the installer 2022-04-15 20:25:10 -04:00
past-due a0dfe220ff physfs_platform_windows.c: Use newer APIs when permitted by _WIN32_WINNT 2021-10-16 10:30:47 -04:00
alfadur b3cca6a026 add 0x10000 properly 2021-09-10 10:01:31 -04:00
alfadur 8eab55d173 add missing bit to UTF-16 surrogate pair conversion 2021-09-10 10:01:31 -04:00
Arthur Brianville (Ybalrid) 23690f316d Add option to turn off the build of the documentation if Doxygen was found 2021-09-02 22:15:03 -04:00
pastdue b8fa8fdcac physfs_platform_posix.c: Use O_CLOEXEC / FD_CLOEXEC 2021-07-12 11:52:35 -04:00
pastdue a9cb20772b physfs_platform_posix.c: Retry on EINTR 2021-07-12 11:52:35 -04:00
James Le Cuirot d8ba1a935c Use the GNUInstallDirs CMake module to respect installation locations
Apparently use of LIB_SUFFIX is now discouraged. GNUInstallDirs does a
better job of setting a default.

The libdir of ${prefix}/lib in the pkg-config file caused warnings,
and possibly even failures, when linking on multilib systems where
/usr/lib is for 32-bit libraries rather than 64-bit libraries.
2021-07-11 19:00:28 -04:00
Ryan C. Gordon 0145431345
cmake: fixed "dist" target to use git instead of Mercurial. 2021-06-30 23:53:21 -04:00
Ryan C. Gordon b7410d673e
Updated a URL to point to github.com 2021-06-30 23:39:12 -04:00
Ryan C. Gordon fdf308fa88
Renamed .hgignore -> .gitignore 2021-06-30 23:32:32 -04:00
Matthew Albrecht d24ce15922 Include alloca.h on Solaris and Linux platforms. 2021-06-30 08:52:57 -04:00
Ryan C. Gordon 69a7428787
Initial CI setup... 2021-06-29 13:22:39 -04:00
Ryan C. Gordon ebe02ceb02
Create FUNDING.yml 2021-06-29 13:20:53 -04:00
Ryan C. Gordon 9b83066716
Reformat LICENSE.txt so GitHub sees it as zlib. 2021-06-29 13:19:59 -04:00
Ryan C. Gordon 13f00546a9
Bumped copyright for 2021. 2021-06-29 13:18:47 -04:00
Ryan C. Gordon 5ea6ba7557 msvc: Move stdarg.h include ahead of __PHYSFS_msvc_vsnprintf declaration. 2021-04-29 15:00:16 -04:00
Ryan C. Gordon 009be5ab20 Enable arm64 for non-Windows targets (thanks, pastdue!).
Co-authored-by: Victor Romero <romerosanchezv@gmail.com>
2021-01-18 18:33:00 -05:00
Ryan C. Gordon 55c3d9f9d8 android: PhysicsFS now has actual Android support.
This compiled and worked on Android before, if you didn't care about
PHYSFS_getBaseDir() and PHYSFS_getPrefDir() being useful. Now you can pass
PHYSFS_init() some necessary Android objects to solve this. Passing NULL
to PHYSFS_init is acceptable and will simply report "/" for the base dir and
prefdir, under the assumption that the app queried the OS for these directly
instead.
2020-06-12 03:37:58 -04:00
Ryan C. Gordon 22297e7ea2 7z: Make error handling a little more robust. 2020-05-17 01:41:52 -04:00
Ryan C. Gordon 00599b7dac 7z: copy/paste error in error checking, found by static analysis.
This was clearly copied from a previous line but wasn't updated with the
correct condition to check, so if malloc() failed, it would dereference NULL
instead of reporting an error.
2020-05-17 01:26:31 -04:00
Ryan C. Gordon 3169a5e9d3 buildbot-emscripten.sh: Look for the SDK at /emsdk by default. 2020-05-16 23:30:16 -04:00
Ryan C. Gordon 101ec3c831 buildbot-checker.sh: Just require scan-build to be in the $PATH. 2020-05-16 23:29:44 -04:00
Ryan C. Gordon e3231d1cb0 Modern buildbot vocabulary is "worker," not "slave." 2020-05-16 23:29:03 -04:00
Ryan C. Gordon 9d61fadd3e Have static analysis script use Ninja. 2020-05-12 15:49:53 -04:00
Ryan C. Gordon 235e31c420 Fixed mishandling of an allocation failure in PHYSFS_openRead().
(Static analysis caught this one! Thanks clang!)
2020-05-12 15:19:01 -04:00
Ryan C. Gordon 291cad07b7 Testing a fix for emscripten buildbot script. 2020-05-12 13:49:46 -04:00
Ryan C. Gordon 0d1df744ba Minor style fix in docs/INSTALL.txt 2020-05-12 01:04:09 -04:00
Ryan C. Gordon 08dc47a72b Update copyright for 2020. 2020-05-12 00:52:56 -04:00
Ryan C. Gordon 1daf787fb2 extras: Cleaning up some scripts to work with the newly-recreated buildbot. 2020-05-12 00:32:00 -04:00
Ryan C. Gordon 56aaae4949 Corrected example code for PHYSFS_enumerate in physfs.h 2019-08-24 21:06:54 -04:00
Ryan C. Gordon 19ea59109d Fixed comment typo. 2019-06-07 23:46:55 -04:00
Ryan C. Gordon a8180f0e4c hog: Added support for HOG2 (Descent 3) archives. 2019-06-07 22:27:48 -04:00
Ryan C. Gordon 9cb45dc6cb cmake: Minimum CMake version is now 2.8.12.
(transplanted from de1ea3b2cfc45ce921b5571a637b3b747173184f)
2019-05-20 23:38:12 -04:00
Kevin d'Orange 8791811909 CMake: made install step export the targets 2019-04-19 12:33:08 +02:00
Ryan C. Gordon f94ce0613d Fixed compiler warning. 2019-03-18 14:28:46 -04:00
Ryan C. Gordon 6b0839051f windows: Workaround for WinXP systems.
(transplanted from c8f3bbd689d6b71b84c11db74275ea3d56fef961)
2019-03-18 13:36:16 -04:00
Ryan C. Gordon 5cbb460bcd Only flush file handles on close if they were opened for writing. 2019-03-18 11:27:26 -04:00
Ryan C. Gordon e549fe0e0f Added some whitespace to test a fix to revision control. 2019-02-10 16:00:39 -05:00
Ryan C. Gordon 736d0b371a Updated copyright year for 2019. 2019-02-10 15:56:21 -05:00
Ryan C. Gordon 28ac5794b1 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed. 2019-02-10 15:45:01 -05:00
Ryan C. Gordon 500033f37d Allow builds to opt-out or opt-in to specific archivers, whichever's easier. 2019-01-26 03:00:29 -05:00
Ryan C. Gordon b57d8960e8 Fixed some compiler warnings. 2018-11-28 00:23:08 -05:00
Ryan C. Gordon 5786a58628 PHYSFS_flush() shouldn't call PHYSFS_Io::flush().
The former is meant to send PhysicsFS-buffered data to the PHYSFS_Io's
implementation, the latter is meant to tell the OS to definitely make sure the
data is safely written to disk (or at least, that's what it does in practice).

This was making PHYSFS_setBuffer()'d handles _slower_, since they would end
up blocking whenever the buffer was full until the data made the full trip to
physical media, instead of just letting the OS do its own buffering.

Now we still PHYSFS_Io::flush() on PHYSFS_close(), like this has always
worked. That might also be overkill, but that remains a historical artifact
of trying to keep the underlying file handle usable if pending writes fail
for possibly-recoverable reasons (which isn't guaranteed if you just close()
it, at least as far as I remember).
2018-11-27 23:53:33 -05:00
Ryan C. Gordon 73d66441e3 Added PHYSFS_setRoot(). 2018-10-17 23:44:02 -04:00
Ryan C. Gordon 7d194a8a62 windows: Workaround GetUserProfileDirectory's API change in Win10 build 1809.
(transplanted from ece6769c0676c2d4e8a5893a1acebd0f65456817)
2018-10-03 22:40:57 -04:00
Ryan C. Gordon 8ce294a458 PHYSFS_setWriteDir() shouldn't create an empty file if the dir doesn't exist. 2018-05-16 19:54:51 -04:00
Ryan C. Gordon 15dd00659a Fix up physfs.h for compilers that are sensitive about preprocessor defines.
(transplanted from db8f944df5c56f0244229813203fb5b24e8d9968)
2018-04-19 10:06:38 -04:00
Ryan C. Gordon 7394c07d6b apple: Patched to compile with older (mac 10.7) SDKs (thanks, Ken and Ryan!). 2018-03-24 00:19:59 -04:00
Ryan C. Gordon 0bad12d401 ignorecase: Don't crash if enumeration returned a NULL pointer.
(transplanted from f83d05e87212a5c7e377f3b205e6d70fc42772d4)
2018-03-09 14:50:37 -05:00
Ryan C. Gordon 89d4809f28 Updated copyright date. 2018-03-08 12:21:45 -05:00
Ryan C. Gordon ea90a92016 7zip: don't forget to destroy the PHYSFS_Io when closing the archive! 2018-03-08 11:47:42 -05:00
Ryan C. Gordon 3597a7b69a Call the default branch "3.1.0" to avoid confusion.
This way, if someone builds the default branch instead of stable-3.0, we'll
be able to distinguish.

No immediate plans for a format 3.1 effort at the moment, though.
2018-03-08 11:51:46 -05:00
Ryan C. Gordon c86895264b Remove deprecated PHYSFS_getLastError() from all the extras (thanks, Rob!). 2018-02-20 10:26:33 -05:00
Ryan C. Gordon 47b0e834dc Patched physfsrwops to compile against SDL 1.2 (thanks, Rob!).
(transplanted from 540be489d50f9fe29f1f517202b6a9d199f36a2a)
2017-11-11 08:53:23 -05:00
Ryan C. Gordon 90dfc49f6d Added tag release-3.0.1 for changeset fa8e38bcc354 2017-10-26 14:38:35 -04:00
Ryan C. Gordon a45afc5d50 Catch access to paths that are just "." or ".." without any path separator. 2017-10-26 14:37:16 -04:00
Ryan C. Gordon 62d24e228f Fixed mounting a symlink to a real directory. 2017-10-26 14:21:36 -04:00
Ryan C. Gordon 26db9376da Fixed some infinite loops that a maliciously-crafted .iso can trigger.
These bugs exposed by American Fuzzy Lop (AFL), a powerful fuzzer.

http://lcamtuf.coredump.cx/afl/
2017-10-23 14:58:54 -04:00
Ryan C. Gordon 1c7945461d Don't allow NULL filenames to be mounted.
Regardless of what the 3.0.0 documentation says, PhysicsFS never handled this
correctly, so now we check for it so you can't get into crashy situations.

Corrected documentation to reflect reality.
2017-10-23 12:40:59 -04:00
Ryan C. Gordon f5e5b586c7 Fixed crash when duplicating PHYSFS_Io for zipfiles. 2017-10-23 12:16:51 -04:00
Ryan C. Gordon fbb8ce7e2d Added some notes on API documentation. 2017-09-27 16:13:00 -04:00
Ryan C. Gordon 347bb7b6c8 Tagging 3.0.0 release 2017-09-27 15:58:44 -04:00
Ryan C. Gordon 9e756312d5 Bumped version to 3.0.0! 2017-09-27 11:54:25 -04:00
Ryan C. Gordon 975b7a577b Added R?mi Verschelde to the credits. 2017-09-27 15:57:29 -04:00
R?mi Verschelde 3167a48675 CMake: Honor LIB_SUFFIX for pkgconfig install path 2017-09-27 21:04:15 +02:00
Ryan C. Gordon bb2c38cdea Added SLB to list of supported archives. 2017-09-27 12:33:36 -04:00
Ryan C. Gordon 9b42fe23fd Fixed doxygen comment. 2017-09-27 12:07:55 -04:00
Ryan C. Gordon 300beeda72 Tagging 2.1.1 release 2017-09-27 11:45:34 -04:00
Ryan C. Gordon 1722e9ba92 Added Tobias Markus to CREDITS.txt. 2017-09-25 17:08:08 -04:00
Ryan C. Gordon 4ca60a090b cmake: mark readline include directories as SYSTEM (thanks, Tobias!). 2017-09-25 17:07:08 -04:00
Ryan C. Gordon 3d8817346d Fixed seeking within read buffers. 2017-09-25 16:32:52 -04:00
Ryan C. Gordon 425131ccda Simplified doBufferedRead().
No longer recurses, and deals with EOF correctly.
2017-09-25 16:19:59 -04:00
Ryan C. Gordon 2b78f64c11 Fixed PHYSFS_flush(). 2017-09-25 16:19:30 -04:00
Ryan C. Gordon 395b2b02dd OS/2: Patched to compile. 2017-09-15 19:52:24 -04:00
Ryan C. Gordon 69d3df3286 OS/2: Deal with UTF-8 -> codepage conversion on older OS/2 installs.
(untested attempt.)
2017-09-15 19:49:40 -04:00
Ryan C. Gordon 7a26b83733 OS/2: don't report failures on Unicode conversion on older OS/2 installs. 2017-09-14 23:36:51 -04:00
Francesco Bertolaccini e728c65912 vdf: Don't add directories; UNPK_addEntry()/DirTree will fill in parents. 2017-09-03 13:13:51 -04:00
Marty Plummer db700fd327 Allow physfs.pc generation on mingw-w64 and osx homebrew/etc,
Rename physfs-static to physfs on mingw-w64
2017-07-16 23:03:07 -05:00
Ryan C. Gordon 21b2fd39f2 Made PHYSFS_caseFold() a public API. 2017-08-20 02:02:08 -04:00
Ryan C. Gordon bc2ddf0a53 Added some warnings to the docs about converting bad Unicode strings. 2017-08-20 02:01:50 -04:00
Ryan C. Gordon 9f8ecb91cb unicode: Added UTF-16 and UCS-4 stricmp functions. 2017-08-20 01:18:41 -04:00
Ryan C. Gordon eb75883226 OS/2: Fixed NULL pointer dereference. 2017-08-20 01:18:05 -04:00
Ryan C. Gordon 689333dc8f Clarified some documentation. 2017-08-20 00:35:25 -04:00
Ryan C. Gordon 6ad71878fe Updated PHYSFS_Archiver with PHYSFS_EnumerateCallbackResult change. 2017-08-19 11:19:28 -04:00
Ryan C. Gordon 4e0d3d55e9 Make PHYSFS_EnumerateCallback return an enum instead of an int. 2017-08-19 10:40:27 -04:00
Ryan C. Gordon 5fb9119ebc windows: Disable _CRT_SECURE_NO_WARNINGS again. 2017-08-16 21:19:16 -04:00
Ryan C. Gordon 7607eeeb00 Cleaned up some header inclusion politics. 2017-08-16 20:03:24 -04:00
Ryan C. Gordon e19422cc06 qnx: Added more proper support for QNX. 2017-08-16 20:02:54 -04:00
Ryan C. Gordon cd0ccf64ed Bump version to 2.1.1, since we've been at 2.1.0 for 8.5 years. :)
There isn't going to be an official 2.1.1 (or 2.1.0) release; we'll let this
marinate a little and jump to 3.0!
2017-08-15 02:08:24 -04:00
Ryan C. Gordon 98278f787b physfshttpd: serve up directory listings, a few other cleanups. 2017-08-14 22:47:02 -04:00
Ryan C. Gordon 2270b3c3c2 physfshttpd: removed deprecated PHYSFS_getLastError() calls. 2017-08-14 21:59:56 -04:00
Ryan C. Gordon b311ee44ad Fixed one more Visual Studio compiler warning. 2017-08-14 21:22:30 -04:00
Ryan C. Gordon 735fd14ea4 Whoops, patched to compile. 2017-08-14 21:17:22 -04:00
Ryan C. Gordon 8dfd3cff8d Fixed some compiler warnings on Visual Studio.
(and maybe made a few new ones...)
2017-08-14 21:15:58 -04:00
Ryan C. Gordon 692d5e8219 Fixed some warnings that Xcode brought up. 2017-08-14 19:58:56 -04:00
Ryan C. Gordon a65a7ed7a5 Updated TODO.txt 2017-08-14 17:10:01 -04:00
Ryan C. Gordon 0d1a73fce4 zip: add some zip_resolve() calls, deal with DirTree-inserted parent dirs. 2017-08-14 16:24:19 -04:00
Ryan C. Gordon 395ea71990 This appears to have been fixed at some point. 2017-08-14 14:06:43 -04:00
Ryan C. Gordon 660171f79f Don't fail enumeration if a directory isn't available in a given archive.
That shouldn't be a fatal error, that's a normal case.
2017-08-14 14:05:06 -04:00
Ryan C. Gordon f425f051db Little tweaks to __PHYSFS_initSmallAlloc(). 2017-08-14 13:57:57 -04:00
Ryan C. Gordon 8db27a1236 Fix symlink filtering for enumeration under a virtual mount point. 2017-08-14 11:43:18 -04:00
Ryan C. Gordon cfe3f0180b Make PHYSFS_exists() work with mounts from PHYSFS_mountIo(io, NULL, ...)
(Actually, from any mount function that accepts a bogus/NULL filename.)
2017-08-14 03:06:42 -04:00
Ryan C. Gordon 3b7ee3974c Don't set readonly if PHYSFS_stat()'ing something not in the write dir.
This API is meant to report what the archivers think about an item and not
actually tell you if a PHYSFS_openWrite() will succeed on it.
2017-08-14 02:46:07 -04:00
Ryan C. Gordon 63277e500c Turns out we were doing this for a (maybe not good, but reasonable) reason. 2017-08-14 02:42:13 -04:00
Ryan C. Gordon 3078acd1eb Archivers can now specify whether an archive definitely was intended for them.
So if a zip file goes to the zip archiver but is corrupted, the system can now
know not to bother trying other archivers once the zip archiver has had a shot
at it, and just as important: it can report the real error from that archiver
instead of a generic "unsupported."
2017-08-14 02:28:00 -04:00
Ryan C. Gordon 2a6215394b Reduced some FIXME-3.0 tags to normal FIXME. They can wait. 2017-08-14 01:35:10 -04:00
Ryan C. Gordon 88e7f3eb0f Sanity check archivers that should only have low-ASCII filename. 2017-08-14 01:29:45 -04:00
Ryan C. Gordon 9c9325c2c5 Filled in more documentation. 2017-08-14 01:28:30 -04:00
Ryan C. Gordon dd68246737 7z: do global initialization once without risking a race condition. 2017-08-13 22:53:38 -04:00
Ryan C. Gordon 1364f6a915 PHYSFS_setSaneConfig uses enum callbacks now. 2017-08-13 19:45:31 -04:00
Ryan C. Gordon 0d61295781 Improved some documentation. 2017-08-13 17:11:14 -04:00
Ryan C. Gordon cc3ac9539e Patched to compile on various platforms and compilers. 2017-08-12 03:10:19 -04:00
Ryan C. Gordon 7fcddfb741 Don't mark the PHYSFS_EnumFilesCallback _typedef_ as deprecated.
It upsets several compilers when building PhysicsFS itself.
2017-08-12 03:06:06 -04:00
Ryan C. Gordon 6da5bea804 Updated docs to use PHYSFS_getLastErrorCode() instead of PHYSFS_getLastError().
(a few other documentation fixes probably slipped in here, too.)
2017-08-12 02:39:24 -04:00
Ryan C. Gordon f6a8533ba2 FIXME removal: document enumerateFiles() sorting promises. 2017-08-12 02:24:38 -04:00
Ryan C. Gordon db2201e4e1 Added some FIXMEs and deprecated PHYSFS_getLastError(). 2017-08-12 02:21:11 -04:00
Ryan C. Gordon ee9687bca9 Reworked enumeration to be more powerful.
Now callbacks can stop further enumeration and report errors, if they had a
catastrophic issue or just found what they needed and don't need to process
any more items.

Also, the actual enumerators can report errors instead of silently dropping
items. This led to several other fixes as all these implementations got
audited and reworked.

The original, non-callback enumerator now returns NULL if it can't produce a
complete list instead of dropping items and returning a partial list.
2017-08-12 02:19:22 -04:00
Ryan C. Gordon b082bc3432 Removed __PHYSFS_stricmpASCII functions.
Nothing was using them, except one OS/2 thing that could live with stricmp.
2017-08-11 01:45:29 -04:00
Ryan C. Gordon 78c1a985ec Made physfs_lzmasdk.h's include-once blockers match other files' formatting. 2017-08-11 01:29:38 -04:00
Ryan C. Gordon 15048fbb1d ignorecase.c: use PHYSFS_utf8stricmp() now. 2017-08-11 01:39:58 -04:00
Ryan C. Gordon d1f2637ca8 utf8: big improvements to case-insensitive UTF-8 string compare.
- Dramatically reduce RAM usage: uses between 8 and 11 kilobytes less static
memory for its internal case-folding tables.
- Actually works now. It would fail unconditionally if a codepoint folded
into multiple codepoints, even if the compared string contained those exact
codepoints.
- Now a public API!
- Removed __PHYSFS_utf8strnicmp(): nothing was using it, it was incorrect
anyhow, and what does 'n' represent when either string might case-fold to
something larger in-flight, anyhow?
2017-08-11 01:39:22 -04:00
Ryan C. Gordon 587ec88a0d FIXME removal: this code is fine, I guess. 2017-08-10 12:31:41 -04:00
Ryan C. Gordon 1efdb62a8f haiku: CD-ROM detection should report any mounted volume on a B_CD device.
Most discs only use the "raw" device, but it turns out the Haiku installation
"anyboot" images don't, and those would fail to detect here. If there's
some multi-partition disc thing and the OS mounted each separately, we should
report each of them.
2017-08-10 12:31:06 -04:00
Ryan C. Gordon 0e778b0b16 FIXME removal: it's okay for the PHYSFS_Io to be NULL here.
We use this technique in several other places, too.
2017-08-08 15:27:32 -04:00
Ryan C. Gordon 961c0604dc apple: Patched to compile on XCode versions < 7. 2017-08-08 11:57:44 -04:00
Ryan C. Gordon c52be25d1e windows: minor cleanup. 2017-08-08 03:37:09 -04:00
Ryan C. Gordon 982411ec8a apple: Start using some Cocoa APIs, clean up a few related things. 2017-08-08 03:36:56 -04:00
Ryan C. Gordon 0a730433ae Rename physfs_platform_macos.c to physfs_platform_apple.m
It's not really "macOS," it's all of Apple's platforms (iOS, watchOS,
tvOS...AppleCarOS? heh), and second...we're about to need access to Cocoa
APIs, so we need it to be Objective-C. I fought as long as I could.  :/
2017-08-08 02:34:25 -04:00
Ryan C. Gordon ca4d5be5f8 cmake: Pacify warning about Policy CMP0042 not being set. 2017-08-08 02:27:47 -04:00
Ryan C. Gordon eb46d82500 Fixed compiler warnings on GCC. 2017-08-06 15:59:46 -04:00
Ryan C. Gordon af555317b9 Fixed compiler warnings on Visual Studio. 2017-08-06 15:58:39 -04:00
Ryan C. Gordon f0eb5c0db9 Marked a bunch of things as "FIXME-3.0" that I want resolved before 3.0 ships. 2017-08-06 15:54:44 -04:00
Ryan C. Gordon 0287160f3c Removed some FIXMEs that aren't valid. 2017-08-06 13:56:45 -04:00
Ryan C. Gordon 1d6c519c5e windows: Patched to compile! (...?) 2017-08-06 12:27:18 -04:00
Ryan C. Gordon 2176364a16 windows: (maybe) patched to compile on Visual Studio. 2017-08-06 12:19:33 -04:00
Ryan C. Gordon 36c51d40d1 PHYSFS_File buffering now uses size_t.
This lets you have the full address space but not take up unnecessary space
on 32-bit platforms...not to mention removes a bunch of typecasting.
2017-08-06 10:33:21 -04:00
Ryan C. Gordon 114bfd1b21 windows: PHYSFS_FILETYPE_OTHER files now report real filesize in PHYSFS_stat().
I don't know if it's _meaningful_, but if the OS reports it, so do we.
2017-08-06 09:25:05 -04:00
Ryan C. Gordon a7ce178eec Add basic atomic operations for refcounting, etc. 2017-08-06 09:21:38 -04:00
Ryan C. Gordon 121ee38fde physfshttpd: deal with write errors on the socket. 2017-08-06 01:34:18 -04:00
Ryan C. Gordon 61bdee4d78 __PHYSFS_platformDeinit() should return void.
What are you going to do if this fails, anyhow?
2017-08-06 01:30:58 -04:00
Ryan C. Gordon 248167af40 windows: Removed (what I think is) a copy/paste error. 2017-08-05 01:26:07 -04:00
Ryan C. Gordon be9bf023d0 windows: Use a real synchronization primitive for CD detection thread init.
Before we were waiting on a volatile int in a tight loop with a Sleep(50).
2017-08-05 01:24:53 -04:00
Ryan C. Gordon befc894b1f More FIXME cleanups. 2017-08-04 22:35:49 -04:00
Ryan C. Gordon b6e139fc22 Make compile-time asserts more readable. 2017-08-04 22:32:57 -04:00
Ryan C. Gordon 0d249cae36 FIXME removal: This is an appropriate error code already. 2017-08-04 22:32:34 -04:00
Ryan C. Gordon cc2c29b207 Removed FIXME: this was already fixed at some point. 2017-08-04 22:31:56 -04:00
Ryan C. Gordon 093dcb555b os/2: Patched to compile (?). 2017-08-02 16:40:07 -04:00
Ryan C. Gordon 3f9ffddc83 os/2: attempt to get cpuid support on OpenWatcom builds. 2017-08-02 16:34:02 -04:00
Ryan C. Gordon 1e850d32ea windows: Patched to compile. 2017-08-02 13:06:56 -04:00
Ryan C. Gordon 007c2fc037 windows: Just pass HANDLEs around instead of wrapping in a struct.
We don't need the "readonly" field of this struct, because it was only used
to protect flushes on non-writable handles, but PHYSFS_flush() also keeps
track of what's read-only and won't call into the platform layer anyhow.

HANDLEs are typedef'd to be "void *" on Windows, so this is safe (so long as
we check for INVALID_HANDLE_VALUE, which is ((void*)-1), when creating new
handles.
2017-08-02 13:02:43 -04:00
Ryan C. Gordon bea510def0 windows: Fixed logic bug. 2017-08-02 12:48:40 -04:00
Ryan C. Gordon 02c2c4736e windows: better test for WinRT vs win32 (...I think...?) 2017-08-02 12:48:31 -04:00
Ryan C. Gordon 5ab8df339d Updated Unicode case folding support to something 10 years newer. :) 2017-07-31 16:32:47 -04:00
Ryan C. Gordon 32930ef41d Fixed compiler warning. 2017-07-26 16:08:32 -04:00
Ryan C. Gordon 99992bb1d5 WinRT: Disable harmless (in our case) linker warning. 2017-07-26 09:03:04 -04:00
Ryan C. Gordon 0e7f3ee6a1 Added an assert for a FIXME that is now handled elsewhere. 2017-07-25 19:55:58 -04:00
Ryan C. Gordon f578f85557 Fixed building for WinRT via CMake. 2017-07-25 19:55:08 -04:00
Ryan C. Gordon 1e2650b6fc Serious cleanup and update of Windows RT support.
This compiles for WinRT, but isn't otherwise tested at all yet.
2017-07-24 03:29:33 -04:00
Ryan C. Gordon c74f4cb007 Minor cleanup. 2017-07-24 02:37:22 -04:00
Ryan C. Gordon a5461ddcd9 Some minor preprocessor nitpicks. 2017-07-24 02:36:58 -04:00
Ryan C. Gordon 8c13bd27d6 unix: getmntinfo() should proabably be set to MNT_NOWAIT to avoid blocking. 2017-07-22 20:05:17 -04:00
Ryan C. Gordon bc28fb74b4 Minor QNX fix; don't warn about CD-ROM support (for now). 2017-07-22 20:04:38 -04:00
Ryan C. Gordon e2750bff62 Apple refers to "Mac OS X" as "macOS" now. 2017-07-22 13:50:40 -04:00
Ryan C. Gordon 6d91dde273 Rename __PHYSFS_Archiver_SZIP to __PHYSFS_Archiver_7Z. 2017-07-22 13:50:03 -04:00
Ryan C. Gordon 1fa4be6f66 Minor documentation updates. 2017-07-22 13:48:31 -04:00
Ryan C. Gordon f10b861036 A couple of fixes for physfshttpd.c. 2017-07-22 13:35:14 -04:00
Ryan C. Gordon e75d38adf5 Fixed a comment about SDL licensing. 2017-07-22 13:22:37 -04:00
Ryan C. Gordon ea29339a8b Removed SWIG bindings. 2017-07-22 13:20:15 -04:00
Ryan C. Gordon db349bd067 Update filename comments. 2017-07-22 13:19:57 -04:00
Ryan C. Gordon 18c89c1cbc Renamed all the sources to start with "physfs_"
So now you can drop this into your program and not worry about filename
conflicts, or where "platform_unix.c" came from in the debugger, etc.

Also renamed the "beos" sources to "haiku" and "macosx" to "macos" to match
modern platform names.
2017-07-22 12:59:06 -04:00
Ryan C. Gordon d9f040cb6a Add platform_os2.c to the CMake file. 2017-07-22 12:55:50 -04:00
Ryan C. Gordon ace324cdc8 Minor code cleanups: whitespace fixes, 80-column overflows, wrong comments. 2017-07-22 12:47:32 -04:00
Ryan C. Gordon c1defd3ec4 vdf: Migrated to new, improved unpacked archiver infrastructure. 2017-07-22 12:42:34 -04:00
Ryan C. Gordon eefc757398 Added some TODOs to the ISO9660 code. 2017-07-22 12:16:37 -04:00
Ryan C. Gordon 6ed2bf1478 Some improvements to INSTALL.txt. 2017-07-21 23:02:10 -04:00
Ryan C. Gordon 8ee7f5d351 Fixed compiler warnings. 2017-07-21 22:38:50 -04:00
Ryan C. Gordon a7616f3960 Removed unused variable. 2017-07-21 22:35:30 -04:00
Ryan C. Gordon 03097332ca unpacked: let archivers specify create and modified times, hook up to iso9660. 2017-07-21 22:01:51 -04:00
Ryan C. Gordon 3c9351c0ad unpacked: let archivers "abandon" the archive instead of closing it.
This lets you preserve the PHYSFS_Io in case of error during archive opening.
2017-07-21 19:01:41 -04:00
Ryan C. Gordon 91a19982ca iso9660: rewritten and simplified.
This now builds on top of the "unpacked" archiver and reads only the
structures it needs, serializing the parts it cares about. Lots of other
cleanups.

Lost a little bit of functionality, to be restored later.
2017-07-21 13:56:21 -04:00
Ryan C. Gordon 2dd3d7c28a unpacked: Don't list a position or length for directory entries. 2017-07-21 13:55:03 -04:00
Ryan C. Gordon d3ac612b61 DirTrees and unpacked archives shouldn't demand a count of entries for init. 2017-07-21 13:54:42 -04:00
Ryan C. Gordon 32ed71db48 slb: be more aggressive about rejecting non-SLB files. 2017-07-20 17:00:21 -04:00
Ryan C. Gordon 7e30657f54 Attempt to fix compilation against the latest Windows SDK. 2017-07-18 09:59:23 -04:00
Ryan C. Gordon adb7ea4dfc It's not messy to compile NOW. :) 2017-07-17 16:39:15 -04:00
Ryan C. Gordon 28f32ad240 Removed C++ single-line comments from LZMA SDK. 2017-07-17 16:25:17 -04:00
Ryan C. Gordon 823061758b Disable unaligned reads in LZMA SDK; it upsets GCC's strict-aliasing rules. 2017-07-17 16:22:29 -04:00
Ryan C. Gordon f130714e92 Fixed another compiler warning. 2017-07-17 15:53:09 -04:00
Ryan C. Gordon 0bda50c276 More unused LZMA SDK code. 2017-07-17 15:50:04 -04:00
Ryan C. Gordon 1d616dcaf1 Fixed compiler warning. 2017-07-17 15:43:39 -04:00
Ryan C. Gordon 4557dbf0f7 Another LZMA SDK trim. 2017-07-17 14:57:02 -04:00
Ryan C. Gordon 7ab5cc52ce Fixed 64-bit ints in LZMA SDK on Watcom C. 2017-07-17 14:56:52 -04:00
Ryan C. Gordon f6c830968c Workaround strict-aliasing warnings on some versions of GCC. 2017-07-17 14:46:36 -04:00
Ryan C. Gordon 3765efb652 Still more LZMA SDK trimming. 2017-07-17 14:43:36 -04:00
Ryan C. Gordon 8ebecded22 Fixed Visual Studio compiler warning. 2017-07-17 14:41:48 -04:00
Ryan C. Gordon a28a01c124 Patched to compile on Visual Studio. 2017-07-17 14:37:02 -04:00
Ryan C. Gordon 8553113870 Patched to compile on OpenWatcom. 2017-07-17 14:35:47 -04:00
Ryan C. Gordon 7fed370cfd Chopped more unused pieces out of the LZMA SDK. 2017-07-17 14:35:36 -04:00
Ryan C. Gordon 43f8ffcd2d Chopped out some unused code from the LZMA SDK. 2017-07-17 14:27:51 -04:00
Ryan C. Gordon afacf0395e Static analysis fix. 2017-07-17 14:19:29 -04:00
Ryan C. Gordon d38c10dea7 Removed unused variables. 2017-07-17 12:42:09 -04:00
Ryan C. Gordon f83e36a8be Static analysis fix (maybe?). 2017-07-17 12:41:28 -04:00
Ryan C. Gordon c375504463 Removed unused variable. 2017-07-17 12:39:43 -04:00
Ryan C. Gordon cdba81f5c4 Static analysis fix. 2017-07-17 12:38:19 -04:00
Ryan C. Gordon 8c3501491c Whoops, forgot to add the file. :) 2017-07-17 12:35:35 -04:00
Ryan C. Gordon 6d42436270 Removed warning in LICENSE.txt about PhysicsFS 0.1.9 being LGPL code.
The license was changed in 1.0.0, on January 8th, 2004. I think it's time to
stop worrying about a prerelease version from almost 14 years ago.
2017-07-17 12:29:13 -04:00
Ryan C. Gordon 820109cc1d LZMA SDK is now public domain, remove the LGPL warning in LICENSE.txt. 2017-07-17 12:27:25 -04:00
Ryan C. Gordon da1561a09f Removed ancient LZMA SDK. 2017-07-17 12:20:14 -04:00
Ryan C. Gordon a5d3dd498e Rewrote the 7zip archiver.
This also updates the LZMA SDK to something more modern, which is now public
domain code, and squashed it into a single header for easier building.
2017-07-17 12:26:50 -04:00
Ryan C. Gordon 63de092cb7 zip: fail with correct error code if opening a directory. 2017-07-17 12:21:26 -04:00
Ryan C. Gordon e84277a1df Corrected reported value for unknown PHYSFS_stat() access times. 2017-07-17 12:21:02 -04:00
Ryan C. Gordon de444a9866 test_physfs: added a "cat2" command to read from two open file handles at once. 2017-07-17 12:18:20 -04:00
Ryan C. Gordon 62ad133862 Reworked the "unpacked" archivers to use DirTree.
This cleaned up a lot of code and improved things, and also allowed a lot of
the restrictions on unpacked archivers to be removed.
2017-07-16 04:39:14 -04:00
Ryan C. Gordon ffa1836335 Moved ZIP tree management up to a higher level, to be reused elsewhere. 2017-07-15 15:59:55 -04:00
Ryan C. Gordon 56bddb0b78 Fixed some comments. 2017-07-16 04:35:46 -04:00
Ryan C. Gordon 5afd9754e2 Reenable QPAK support by default. 2017-07-16 04:34:52 -04:00
Ryan C. Gordon 9cec66be3e Removed SWIG ifdefs in physfs.h 2017-07-16 04:36:40 -04:00
Ryan C. Gordon 53225ca62c Fixed more Visual Studio compiler warnings. 2017-07-13 00:21:25 -04:00
Ryan C. Gordon 1bacc6d6af Fixed some compiler warnings with Visual Studio. 2017-07-13 00:16:24 -04:00
Ryan C. Gordon bf9999af2d Fixed compiler warnings on Visual Studio about const qualifiers. 2017-07-12 23:54:45 -04:00
Ryan C. Gordon 4438fe14cf Turn off MSVC anti-portability propaganda in test program. 2017-07-12 20:59:37 -04:00
Ryan C. Gordon a25569ba14 Removed leftover test scripts from removed SWIG bindings. 2017-07-12 20:58:44 -04:00
Ryan C. Gordon efd71e08f6 Move headers around to get those MSVC anti-portability nags to go away. 2017-07-12 20:55:58 -04:00
Ryan C. Gordon a681fe258d unix: OS-specific paths should also chop filename off base path. 2017-07-12 20:52:51 -04:00
Ryan C. Gordon 187d04ae9e Debian/kFreeBSD should use the FreeBSD-specific codepaths, not generic Unix. 2017-07-12 20:49:53 -04:00
Ryan C. Gordon 46db289145 Fix lzma option in CMakeLists.txt 2017-07-12 20:39:03 -04:00
Ryan C. Gordon 19b15d34a1 Cleaned up what symbols are exported from the library. 2017-07-12 15:41:12 -04:00
Ryan C. Gordon 2cb1f73737 Cygwin has mntent.h, and no need to check for CMake tests now. 2017-07-12 02:41:28 -04:00
Ryan C. Gordon 9ae6fc9e87 Maybe macOS needs -fno-common ...? 2017-07-12 02:40:16 -04:00
Ryan C. Gordon 4b2180dd17 unix: Don't #error if no CD-ROM support, because we already give a #warning. 2017-07-12 02:33:15 -04:00
Ryan C. Gordon 5f5eca8d01 Remove -pthread argument. 2017-07-12 00:33:47 -04:00
Ryan C. Gordon 0f514bbae3 Updated INSTALL.txt to more closely reflect reality. 2017-07-12 00:16:34 -04:00
Ryan C. Gordon 68ad1fa8c5 Removed BeOS support (Haiku still supported, though!).
Since Haiku has pthread support, dropped the BLocker code and use the pthread
code from platform_posix.c instead.
2017-07-12 00:16:57 -04:00
Ryan C. Gordon c2c1c7ac30 Removed __PHYSFS_platformSetDefaultAllocator(); nothing uses it now.
We can pull it back from revision control if something needs it later.
2017-07-11 23:52:13 -04:00
Ryan C. Gordon 0be0e3fd33 mac: Removed Carbon header include and custom allocator (just use malloc). 2017-07-11 23:47:48 -04:00
Ryan C. Gordon 73070339a4 Simplify CMakeLists.txt, etc.
Try to test things with preprocessor macros instead of CMake, and get rid of
silly options like turning off thread safety.
2017-07-11 23:32:46 -04:00
Ryan C. Gordon fe55814681 vdf: make private functions static. 2017-07-11 23:25:20 -04:00
Ryan C. Gordon 4ae17a5d60 The archiver options in the CMake file should disable, not enable.
We now try to compile all archivers by default unless one explicit disables
them individually, so these options needed to be handled differently.
2017-07-11 00:40:51 -04:00
Ryan C. Gordon 3b5091ba9f macOS only needs to link against CoreFoundation, not Carbon. 2017-07-11 00:39:18 -04:00
Ryan C. Gordon f2cbac7479 Don't rename the static library on Windows.
"physfs.lib" will also be the import library's name, so it's best to leave it
separate on that platform.
2017-07-10 23:32:54 -04:00
Ryan C. Gordon a7f5ebf684 Added some option information to the CMake output. 2017-07-10 22:56:49 -04:00
Ryan C. Gordon ebb00f0520 Fixed building on MingW. 2017-07-10 17:50:27 -04:00
Ryan C. Gordon 4015689068 Patched to compile on BeOS/Haiku. 2017-07-09 20:50:48 -04:00
Ryan C. Gordon 53c81e216a Checking if this #pragma pack works better on gcc 2.95. 2017-07-09 20:46:31 -04:00
Ryan C. Gordon 2dbd784cc1 Fixed some DOS newlines. 2017-07-09 20:45:34 -04:00
Ryan C. Gordon 3324ec88a9 Maybe fix compiler warnings on Cygwin. 2017-07-09 18:21:54 -04:00
Ryan C. Gordon f5c6383b4b Patched to compile on Visual Studio. 2017-07-09 18:17:33 -04:00
Ryan C. Gordon cf11d2ec99 Workaround snprintf() deficiencies on Visual Studio. 2017-07-09 17:46:53 -04:00
Ryan C. Gordon c057f2d7dd Fixed compiler warnings on FreeBSD. 2017-07-09 17:31:27 -04:00
Ryan C. Gordon 083940aef1 Don't try to build CD-ROM support on Emscripten. 2017-07-09 17:28:33 -04:00
Ryan C. Gordon ffdc55f1e5 Fix some buildbot warnings about jobserver mode if $MAKE had a -j2, etc. 2017-07-09 17:09:40 -04:00
Ryan C. Gordon f8ed5c6f7e Replaced sprintf() calls with snprintf(). 2017-07-09 17:06:37 -04:00
Ryan C. Gordon e4c035a99f Pacify compiler warning. 2017-07-09 17:02:13 -04:00
Ryan C. Gordon 7cb89ce454 Updated TODO: zip64 support has been in for awhile now. 2017-07-09 16:57:56 -04:00
Ryan C. Gordon bae1f440ba Patched to compile on Windows. 2017-07-09 15:03:12 -04:00
Ryan C. Gordon 84231feb0f windows: (re)added support for symbolic links. 2017-07-09 15:01:17 -04:00
Ryan C. Gordon 3e5f92d756 Added buildbot-raspberrypi.sh and fixed some other buildbot script things. 2017-07-08 22:20:43 -04:00
Ryan C. Gordon bbd1fd4b38 Added buildbot-emscripten.sh, fixed up some minor things in buildbot-os2.sh. 2017-07-08 20:52:12 -04:00
Ryan C. Gordon d1f8c9df35 buildbot-os2: zip to subdir to avoid tarbombing. 2017-07-08 20:20:03 -04:00
Ryan C. Gordon e9e0ca81de buildbot-os2.sh: still trying to get this path right... 2017-07-08 20:09:34 -04:00
Ryan C. Gordon fc1687cc2d buildbot-os2.sh: fixed some paths. 2017-07-08 20:02:54 -04:00
Ryan C. Gordon 35ab010a7b buildbot-os2.sh: Zip to a specific filename. 2017-07-08 19:56:05 -04:00
Ryan C. Gordon 3776e50310 buildbot-os2.sh: build with full optimizations, zip up final library. 2017-07-08 19:45:35 -04:00
Ryan C. Gordon 16850b0a9c buildbot-os2.sh: actually report an error code. 2017-07-08 19:25:59 -04:00
Ryan C. Gordon b2e9cbf004 Added script to run Clang static analysis. 2017-07-08 19:16:47 -04:00
Ryan C. Gordon 3346eb24c6 Added a quick script to cross-compile to OS/2 from Linux with OpenWatcom. 2017-07-08 18:26:04 -04:00
Ryan C. Gordon 59a07020a8 Turn on all the archivers by default.
(Except for the lzma archiver, since it needs a bunch of external code.)

The difference in binary size, for Linux/amd64 compiled for size (-Os),
is 4 kilobytes. It's senseless to not just compile them all in.
2017-07-08 18:25:20 -04:00
Ryan C. Gordon d3237eba1f Added Francesco Bertolaccini to the credits. 2017-07-07 14:04:58 -04:00
Ryan C. Gordon 377b420a18 Updated TODO. 2017-07-07 13:57:21 -04:00
Ryan C. Gordon 4cbffd39e8 OS/2: actually working again, now. 2017-07-07 13:55:52 -04:00
Ryan C. Gordon 683216def8 OS/2: more work on getting this to compile. 2017-07-07 13:06:44 -04:00
Ryan C. Gordon 9a19eba065 Patched to compile with C89 compilers. 2017-07-07 09:21:06 -04:00
Ryan C. Gordon 2bd8c33fe5 OS/2: implemented Unicode support, modernized platform_os2.c's code.
(untested.)
Implemented Unicode support, ripped out old APIs that aren't used any more,
corrected some things.
2017-07-06 21:34:24 -04:00
Ryan C. Gordon 32da097a55 Cleanup BAIL_* and GOTO_* macros to be less cluttered.
This also fixes really aggressive compiler warnings about the "if (!ERRPASS)"
construct producing unreachable code.
2017-07-06 11:51:41 -04:00
Ryan C. Gordon 9aebcff5ba OS/2: base dir needs to end with a path separator. 2017-07-06 00:47:36 -04:00
Ryan C. Gordon 34009cf762 Fix some endlines. 2017-07-06 00:04:10 -04:00
Ryan C. Gordon d1e40af4e3 OS/2: fix up the base/user/pref dir code.
There might be better ways to do this in modern times than shove it all into
the base dir, though.
2017-07-06 00:03:49 -04:00
Ryan C. Gordon 062bdc2c5b Patched to compile with OpenWatcom. 2017-07-05 23:49:10 -04:00
Ryan C. Gordon 9ca88e3794 Patched platform_os2.c to compile. 2017-07-05 23:48:21 -04:00
Ryan C. Gordon 58bca6ae05 Watcom C should include malloc.h to make the alloca macro available. 2017-07-05 21:30:39 -04:00
Ryan C. Gordon 15c18b0c04 os2: added OS/2 support back in.
With the release of ArcaOS, this is a live platform again.

This code probably doesn't compile yet; I've just given it a first shot at
resolving the changes between the last OS/2-supported revision and now.

This still needs Unicode support added in any case.
2017-07-05 21:29:37 -04:00
Francesco Bertolaccini 4b80422a79 vdf: Remove unused chunks of code, fix endianness. 2017-07-03 14:47:25 -04:00
Francesco Bertolaccini dc5958ec71 Remove unused variable. 2017-07-03 14:41:08 -04:00
Ryan C. Gordon 656a9b92c0 Changed some URLs from http:// to https://, where supported. 2017-06-20 14:06:13 -04:00
Francesco Bertolaccini e4206408e5 Add support for VDF 2017-06-20 13:22:41 -04:00
Ryan C. Gordon cf18d4f2c6 Updated copyright to 2017. 2017-02-17 20:39:45 -05:00
Ryan C. Gordon 468edd80eb Removed unused variable in extras/ignorecase.c ... 2016-10-06 15:39:49 -04:00
Ryan C. Gordon 2777b5efe2 Added a mostly-harmless FIXME. 2016-09-12 15:39:35 -04:00
Ryan C. Gordon 66b7767cec Added support for password-protected .zip files.
To use: mount a .zip file as usual, open a file as usual, but append '$' plus
the password to the end of the path, like so:

    PHYSFS_File *f = PHYSFS_openRead("/path/to/my/file.txt$MyPassword");

Note that this is the "traditional" PKWARE crypto, like you might get from
PkZip 2.04g or Info-ZIP. They have more advanced cryptography in the modern
.zip spec, but that's not implemented here. If you've ever tried to unzip
an archive and were prompted for a password, you probably saw the traditional
crypto at work.

Note that this is NOT a secure thing: if you ship an app that contains a
password, someone with a debugger can retrieve it. Note also that this
password could be available to any code registered as a PHYSFS_Archiver, and
that due to how archives combine into a single file tree, the wrong archiver
can get the password, at a minimum causing it to fail because passwords don't
match.

In short: make sure you know what you're doing before you use this!
2016-09-12 15:38:30 -04:00
Ryan C. Gordon ab7eb81a4a Platform deinit should happen last, since other deinit bits might depend on it. 2016-09-07 21:21:59 -04:00
Ryan C. Gordon dfd658ff92 Fixed miniz code that triggers recent GCCs' -Wmisleading-indentation. 2016-08-26 18:46:11 -04:00
Ryan C. Gordon e05d1acc76 Removed one more rude thing from the comments. :/ 2016-08-17 20:43:36 -04:00
Ryan C. Gordon 84f27f8fb5 extras/ignorecase.h: Fixed some typos. 2016-08-17 20:40:19 -04:00
Ryan C. Gordon 8363d15439 Fixed some documentation typos (thanks, Paul!). 2016-08-17 17:19:50 -04:00
Ryan C. Gordon b66b2d4563 Replace unsigned long cast with cast to size_t (thanks, David!).
When targeting MinGW-w64's x86_64 target, unsigned long is 4 bytes but void* is
8 bytes. This mismatch triggers the pointer-to-int-cast warning.

(This patch was originally David Yip's work, with uintptr_t instead of size_t).
2016-08-16 14:46:53 -04:00
David Yip 51f0807cb3 Remove unused functions and variables in platform_windows.
Under gcc 5.3.0, the presence of these functions and variables generate unused
function / unused variable warnings, which in combination with -Werror causes
a compile error.
2016-08-15 05:41:36 -05:00
David Yip 9293c3dc8d Remove unused variable in zip_hash_ancestors.
Under gcc 5.4.0, this generates unused variable warnings, which in combination
with -Werror causes a compile error.
2016-08-15 00:50:58 -05:00
Ryan C. Gordon c3cc732a70 Updated byte order tests to match what SDL does now.
That is: you're more likely to be on Linux or a little-endian machine,
so deal with the non-Linux bigendian as the exceptional case.
2016-02-25 02:55:11 -05:00
Ryan C. Gordon 32d4f4541e HTTPS all the things. 2016-02-25 02:51:28 -05:00
Ryan C. Gordon b479c57bcb zip: Reworked how we organize ZIP entries.
We now use a hashtable for lookups of specific paths, and organize the
entries into a directory tree. The end result is fast lookup and fast
enumeration without having to search a sorted array or tapdance with
substrings...which means the rare, mysterious bug where we failed
to find an existing file should be gone now, too.
2016-02-25 02:20:52 -05:00
Ryan C. Gordon acd00dda94 Fixed a comment. 2016-02-25 01:16:42 -05:00
Ryan C. Gordon e608c5c3de Move __PHYSFS_strdup() declaration up with other string helpers. 2016-02-25 00:40:17 -05:00
Ryan C. Gordon 0278c30776 zip: Don't allocate a 256k buffer on the stack for zip64 parsing. 2016-02-24 11:15:00 -05:00
Ryan C. Gordon ce85702893 Added a minor comment. 2016-02-24 11:14:10 -05:00
Ryan C. Gordon cec3dad0aa Replaced PhysFS.NET with a README pointing to more modern C# bindings. 2016-01-29 15:16:15 -05:00
Ryan C. Gordon 2b060f8127 Updated Copyright. 2016-01-01 12:53:26 -05:00
Ryan C. Gordon c4deb67883 Fixes to SDL_RWops bridge code.
- Correct return values (number of objects, not bytes), thanks Reto!
- Updated for SDL 2.0 RWops interface. Threw away SDL 1.3 support.
- 1.2 support remains. For now!
2015-07-28 15:13:35 -04:00
Ryan C. Gordon 57bbcc3eb3 Fixed compiler warning about unused variable because assert() is awful. 2015-07-02 23:36:33 -04:00
Ryan C. Gordon 1ab2afda15 Removed a few tabstops to test something on the Mercurial server. 2015-06-18 00:12:15 -04:00
Ryan C. Gordon fb31167e11 Fixed incorrect logic ("!x != 5" instead of "x != 5").
Thanks to Xian Nox for pointing this out!
2015-06-16 10:46:56 -04:00
Ryan C. Gordon 6cafcc4bc7 Added some FIXMEs. 2015-04-19 23:28:14 -04:00
Ryan C. Gordon 3d38708088 dos2unix'd platform_winrt.cpp 2015-04-19 23:26:02 -04:00
Ryan C. Gordon e13803c101 Removed some tabs and an extra semicolon. 2015-04-19 23:25:29 -04:00
Ryan C. Gordon 0c4d9ec68f Added Martin Ahrnbom to the credits. 2015-04-19 23:24:41 -04:00
Martin Ahrnbom 9d55f3f099 Added support for WinRT 8.1 Universal Apps.
Hopefully this will work on Win10 as well... Only time will tell!
Here's what's changed:
1. Added a platform_winrt.cpp file. It's based on platform_windows.c but has some WinRT-specific changes.
2. Changed physfs_platforms.h to define PHYSFS_PLATFORM_WINRT when running on WinRT. PHYSFS_PLATFORM_WINDOWS should also be defined, as WinRT behaves a lot like "normal" Windows and this flag is tested against in multiple parts of the PhysFS source code.
3. Changed platform_windows.c to not be used when PHYSFS_PLATFORM_WINRT is defined.
4. In order to work on Windows ARM devices, I had to change in physfs_internal.h, to include _M_ARM as a flag for running on ARM as "ARM" and "__arm__" aren't defined when running on a Windows ARM device.

What I've tested:
* Setting up a "sane folder configuration"
* Reading and writing files
* Mounting zip files
* Using seek & tell
* Checking file length

All of these work fine. I couldn't get the actual test software to run on WinRT, but it seems like eveyrthing's working. I've tested these things on my Windows 8.1 computer, as well as my Lumia 920 which is currently running Windows 8.1.
2015-03-29 07:03:30 +02:00
Ryan C. Gordon f6a62ecad1 Make sure read buffers get reinitialized before refilling (thanks, Michael!). 2014-09-11 00:07:23 -04:00
Ryan C. Gordon c9f40346bc Make static analysis happy. 2014-08-19 10:55:56 -04:00
Ryan C. Gordon 53ef674270 Fixed resource leak when failing to mount a file that isn't an archive. 2014-08-19 02:28:13 -04:00
Ryan C. Gordon 4b906c1e5f Short circuit case-insensitive compare of two equal Unicode codepoints. 2014-08-14 21:33:24 -04:00
Ryan C. Gordon 628b88f112 PHYSFS_enumerateFiles() actually promises sorting order, and always has. 2014-08-14 21:17:04 -04:00
Willi Schinmeyer 9df22f4bf5 Fix NULL flush() in PHYSFS_Io crash 2014-07-20 13:36:56 +02:00
Ryan C. Gordon 2091eccad3 This returns -1 on error, not zero. :/ 2014-02-07 16:23:12 -05:00
Ryan C. Gordon 016394067c PHYSFS_stat() returns zero on error, not -1. 2014-02-07 16:22:43 -05:00
Ryan C. Gordon 8e065c08f7 We always use miniz now. 2014-02-07 16:22:54 -05:00
Ryan C. Gordon 44fb6d5e2d Renamed a function to make Clang static analysis happy.
"Object leaked: allocated object is returned from a function whose
 name ('cfallocDesc') does not contain 'Copy' or 'Create'.  This violates
 the naming convention rules given in the Memory Management Guide for
 Core Foundation"

(it doesn't actually leak, but okay, it's a reasonable naming convention.)
2014-02-07 16:17:48 -05:00
Ryan C. Gordon 5aa0dae5e2 Added a FIXME. 2014-01-16 07:03:42 -08:00
Ryan C. Gordon 5dd2cfce35 Fixed a single-line comment. 2014-01-16 07:03:34 -08:00
Ryan C. Gordon 61d931fecc Updated installation notes. 2014-01-16 07:03:09 -08:00
Ryan C. Gordon 6d9923706d Added pkg-config support (thanks, Jonas!). 2013-11-13 00:38:35 -05:00
Ryan C. Gordon 4046759f61 Better basedir detection for various Unix platforms. 2013-08-23 23:41:35 -04:00
Ryan C. Gordon 09baf99aa4 Don't fsync() read-only filehandles (thanks, Andreas!).
This sounds harmless, but it actually forces a write of the inode's atime,
 which means a lot of painful and unnecessary disk i/o on some filesystems.

Should be a good speedup on games that read a lot of small files on Unix.
2013-08-21 23:30:33 -04:00
Ryan C. Gordon 26f5eb481e Fixed memory leak. 2013-08-20 13:36:34 -04:00
Ryan C. Gordon 7a42f7dd41 Fixed off-by-one error in findBinaryInPath() (thanks, Dmitry!).
This bug is new to the development branch, and doesn't exist in either the
 stable-1.0 or stable-2.0 branches.
2013-07-16 12:51:54 -04:00
Ryan C. Gordon 4eafb44817 Get rid of array of static archivers. 2012-11-30 14:37:37 -05:00
Ryan C. Gordon 2dd99ccbb2 Rearranged PHYSFS_Archiver struct. 2012-11-30 14:09:56 -05:00
Ryan C. Gordon f5c746967f Removed comments added by Captain Obvious. 2012-11-30 14:06:21 -05:00
Ryan C. Gordon 36b542ee7f Cleaned out "exists" nonsense in openRead() API. 2012-11-30 13:00:08 -05:00
Ryan C. Gordon 697c31e81b Remove __PHYSFS_setError(), use the new public API instead. 2012-11-30 12:49:25 -05:00
Ryan C. Gordon 7824a093fb Cleaned out the "exists" nonsense in the stat() API. 2012-11-30 12:43:56 -05:00
Ryan C. Gordon ada24e9c5d Moved supportsSymlinks into PHYSFS_ArchiveInfo. 2012-11-30 00:04:52 -05:00
Ryan C. Gordon 1ed8bc07c0 Comment tweaks (FIXME additions, typo corrections, etc). 2012-11-29 11:48:48 -05:00
Ryan C. Gordon 16ee8355db Centralize responsibility for filtering symlinks during enumeration. 2012-11-29 11:47:16 -05:00
Ryan C. Gordon 259399124a POSIX version of __PHYSFS_platformStat() now reports symlinks correctly. 2012-11-29 11:45:01 -05:00
Ryan C. Gordon e40d80b00f Allow application-supplied archivers.
This lets an application supply its own archivers, where they will work like
 any built-in archiver. This allows abstract directory interfaces the same
 way that PHYSFS_Io allows stream implementations.

This is a work in progress still. The API is still changing, and will remain
 at version 0 until it is finalized (a theoretical future version 1 will be
 for when the final public interface changes, not when we evolve the initial
 API design).
2012-11-28 01:36:13 -05:00
Ryan C. Gordon 123313c3cd Make __PHYSFS_utf8stricmp() work like you'd expect. 2012-11-28 01:30:29 -05:00
Ryan C. Gordon 9826c8b073 Cleaned up some simple comments. 2012-11-27 00:12:39 -05:00
Ryan C. Gordon e61ade0062 Perhaps the note about Quake 3 is getting a little dated. 2012-11-26 14:11:19 -05:00
Ryan C. Gordon 8156bd219c Only check for pthread library if pthread.h was found. 2012-11-25 21:52:36 -05:00
Ryan C. Gordon 06edd385fc From stable-2.0: explicitly check for pthread library, and link against it. 2012-11-25 21:51:43 -05:00
Ryan C. Gordon 7be76515a5 Updated TODO 2012-11-24 17:27:19 -05:00
Aleksi Nurmi fd137cba42 SLB archiver 2012-11-12 23:40:29 +02:00
Ryan C. Gordon 7bd05972c7 Turn off CD-ROM support on Android. 2012-11-02 00:47:50 -04:00
Ryan C. Gordon 72430427c8 Updated TODO.txt. 2012-10-23 15:08:57 -04:00
Ryan C. Gordon de59afc5a2 Remove SWIG stuff from build.
This is never going to work well everywhere. I'll leave the SWIG stuff
elsewhere, though, for those that want to build their own bindings.
2012-10-23 15:02:30 -04:00
Ryan C. Gordon 1c48a28166 Use .tar.bz2 on this branch, too. 2012-10-23 14:59:29 -04:00
Ryan C. Gordon 3f212a8a44 Lowercased most of the CMake project file. 2012-10-23 14:58:54 -04:00
Sam Lantinga 724b71a657 Fixed warning on iOS 2012-09-04 23:25:37 -07:00
Ryan C. Gordon 13855849e6 Fixed infinite loop (thanks, Sam!) 2012-09-08 22:18:52 -04:00
Ryan C. Gordon 986c40ac6a Don't look for libhistory.
Apparently libreadline provides this now (maybe it always did?), and it fixes
 things on OpenBSD.
2012-08-20 14:39:46 -04:00
Ryan C. Gordon e38b5e9cb7 An attempt to make this more Unix-friendly. 2012-08-02 03:03:06 -04:00
Ryan C. Gordon e70c6847a9 Turns out the CoreFoundation API is way simpler.
Fixed assertion, too.
2012-06-25 15:50:20 -04:00
Ryan C. Gordon c59105bd03 Patched to compile on Mac OS X. 2012-06-25 15:25:55 -04:00
Ryan C. Gordon bbbbb17258 For iOS, build the Mac OS X platform code, not the generic Unix code.
Also removed some Carbon calls; use CoreFoundation instead. These functions
 exist in all versions of Mac OS X and iOS, and replace the Mac OS Classic
 APIs we were previously depending upon.
2012-06-25 14:40:03 -04:00
Ryan C. Gordon 2a4d891ac5 Fixed logic bug (thanks, Sam!). 2012-06-20 20:16:11 -04:00
Ryan C. Gordon 9159717a27 Fixed non-Zip64 .zip files. 2012-06-07 10:42:19 -04:00
Ryan C. Gordon 5c18db7fe9 Don't sort if there's nothing to do (prevents array underflow, too). 2012-06-07 10:21:43 -04:00
Ryan C. Gordon 4d9f2534f2 Fixed var that should be 64 bits instead of 32 now. 2012-06-01 06:07:12 -04:00
Ryan C. Gordon 2b39e47fda Removed a '//' comment. 2012-06-01 05:59:12 -04:00
Ryan C. Gordon a865b14bec Added Zip64 support to the .zip archiver.
Now we can handle .zip files > 4 gigabytes, etc.
2012-06-01 05:44:50 -04:00
Ryan C. Gordon 3e750a903f Added getmointpoint command to test_physfs. 2012-04-07 21:33:18 -04:00
Ryan C. Gordon 758e5beedb Moved PHYSFS_ArchiveInfo into PHYSFS_Archiver. 2012-03-25 17:17:56 -04:00
Ryan C. Gordon 6222a4a92d Add binary compatibility to PHYSFS_Io. 2012-03-25 17:18:24 -04:00
Ryan C. Gordon a7383c295f Moved some functions around.
We want the #undef malloc, etc, lines as close to the end of the file as
 possible, and __PHYSFS_readAll() not in the middle of the allocator code.
2012-03-25 16:15:10 -04:00
Ryan C. Gordon 107f07da97 Better cleanup if PHYSFS_init() fails halfway through. 2012-03-25 16:13:23 -04:00
Ryan C. Gordon 4cfd7277f3 Made archiver list dynamic, in preparation for external archivers. 2012-03-25 15:59:29 -04:00
Ryan C. Gordon b3fbba7af0 Removed "dvoid" typedef. 2012-03-25 14:52:24 -04:00
Ryan C. Gordon 716ea0522f Fixed Doxygen typo. 2012-03-24 15:06:28 -04:00
Ryan C. Gordon de54065b31 Updated docs on PHYSFS_setSaneConfig(). 2012-03-24 15:02:18 -04:00
Ryan C. Gordon af4bf8419f Changed enum typedef to make this Doxygen-friendly. 2012-03-24 14:57:30 -04:00
Ryan C. Gordon d4a99cc204 Fixed comment. 2012-03-24 14:55:32 -04:00
Ryan C. Gordon fed8e331a5 Make Doxygen ignore PHYSFS_DEPRECATED. 2012-03-24 14:55:26 -04:00
Ryan C. Gordon 0de337eb75 Renamed PHYSFS_Archiver::dirClose() to PHYSFS_Archiver::closeArchive(). 2012-03-24 10:36:11 -04:00
Ryan C. Gordon 24aef83ead More FIXME cleanup. 2012-03-24 00:49:34 -04:00
Ryan C. Gordon b2e6882f52 Another FIXME. 2012-03-24 00:32:22 -04:00
Ryan C. Gordon 14d723c316 FIXME cleanup. 2012-03-24 00:29:47 -04:00
Ryan C. Gordon dda627412c More FIXME cleanup. 2012-03-24 00:26:04 -04:00
Ryan C. Gordon 2392ca1aa3 Favor /proc/self/exe over argv[0] on Linux, to match other platforms.
We don't favor searching the $PATH, though, since that relies on argv[0] too.
2012-03-23 04:54:20 -04:00
Ryan C. Gordon 9d01a645ed Make sure base dir always has a dirsep at the end of it.
Now the higher level doesn't have to check for this and realloc the string.
2012-03-23 04:14:01 -04:00
Ryan C. Gordon c306437ece test_physfs's "stat" command now respects unknown file times (-1). 2012-03-23 03:30:16 -04:00
Ryan C. Gordon a6ff95c6aa Updated TODO.txt 2012-03-23 03:29:48 -04:00
Ryan C. Gordon 0360899357 Moved QPAK support into archiver_unpacked.c
More dupe code removal, and more functional generic backend code!
2012-03-23 02:45:38 -04:00
Ryan C. Gordon a688d5c686 Minor tweak. 2012-03-23 02:43:22 -04:00
Ryan C. Gordon 320b154a11 Removed archive description macros, moved those strings inline. 2012-03-23 00:55:56 -04:00
Ryan C. Gordon 0584117f85 Changed so that this builds a reasonable default with no command line #defines.
That is, it now builds .zip and native dir support, and that's it.
2012-03-23 00:52:32 -04:00
Ryan C. Gordon cd5362cc57 Removed a bogus FIXME. 2012-03-22 03:15:50 -04:00
Ryan C. Gordon 66fbf41bc0 Allow Windows to read/write more than 4 gigs to a file in one shot.
Removes a FIXME, but the fix probably won't ever get used.  :)
2012-03-22 03:11:54 -04:00
Ryan C. Gordon 53fe6d360a Renamed __PHYSFS_utf8strcasecmp() to __PHYSFS_utf8stricmp().
This matches style of other function names we use.
2012-03-22 03:02:50 -04:00
Ryan C. Gordon 4aec77e618 Fixed a typo in the docs. 2012-03-22 03:00:16 -04:00
Ryan C. Gordon 76fdd9cab6 Removed a FIXME: actually, the code DOES set an error, as far as I can tell. 2012-03-22 02:58:45 -04:00
Ryan C. Gordon b7f3e5bd1e Removed a FIXME.
I assume that Win95 didn't allow large files, so this concern probably wasn't
 ever valid in any case. Still, Win95 support has been dropped, so it doesn't
 matter.
2012-03-22 02:38:10 -04:00
Ryan C. Gordon 46125c95b3 Removed a FIXME. 2012-03-22 02:57:29 -04:00
Ryan C. Gordon 0d8bf3a129 Windows: Use cross-thread Critical Sections instead of cross-process Mutexes. 2012-03-22 00:41:39 -04:00
Ryan C. Gordon a0af6bbb71 Removed fallback for systems that have no userdir.
This would try to build something under the basedir for Windows 95, OS/2, etc,
 but those targets are gone now. Modern systems provide this. If a given
 system can't in the future, they can pull this code out of revision control
 and use it in their implementation of __PHYSFS_platformCalcUserDir().

This change let me remove __PHYSFS_platformGetUserName(), too.
2012-03-22 00:27:46 -04:00
Ryan C. Gordon b1d4afcbd3 Cleaned up some FIXMEs. 2012-03-22 00:21:28 -04:00
Ryan C. Gordon 59c6310e92 Removed a FIXME: use correct error code for writing to read-only archives. 2012-03-22 00:05:10 -04:00
Ryan C. Gordon 60aa0e460c Make sure the prefdir has a final dirsep on it.
This matches the behaviour of PHYSFS_getBaseDir() and PHYSFS_getUserDir().
2012-03-21 23:59:43 -04:00
Ryan C. Gordon 43367c0c29 Fixed some brainfarts in the Windows version of PHYSFS_getPrefDir(). 2012-03-21 23:52:44 -04:00
Ryan C. Gordon 629614838a Patched to compile on Windows. 2012-03-21 23:51:11 -04:00
Ryan C. Gordon 3a5a780988 PHYSFS_setSaneConfig() now uses PHYSFS_getPrefDir(). 2012-03-21 23:31:21 -04:00
Ryan C. Gordon 24d6a925d1 Added PHYSFS_getPrefDir(). 2012-03-21 23:30:50 -04:00
Ryan C. Gordon 584119a4a0 Removed a FIXME. 2012-03-20 15:44:10 -04:00
Ryan C. Gordon ba676b23e5 Reworked the error reporting API. Now we use error codes instead of strings.
This is based on work originally done by Christoph Nelles.
2012-03-20 15:38:12 -04:00
Ryan C. Gordon 8d7cf56651 Fixed mutex misuse. 2012-03-20 15:28:19 -04:00
Ryan C. Gordon f5923f5cea Check for mutex bugs. 2012-03-20 15:24:50 -04:00
Ryan C. Gordon e34e67ff68 Use UTF-16 on Windows, not UCS-2. 2012-03-19 21:01:51 -04:00
Ryan C. Gordon 803730884a Try to make a sane default for CD detection path by platform.
This is so this can work even when dropping PhysicsFS into another project
 without CMake doing header tests and filling in the defines.
2012-03-19 20:42:41 -04:00
Ryan C. Gordon 2486105f4f Make physfs_platforms.h define with a 1, so "#if X" works.
Added a few other pertinent platforms.
2012-03-19 20:41:14 -04:00
Ryan C. Gordon d67e2c9207 Use our platform test macro for Solaris. 2012-03-19 20:40:22 -04:00
Ryan C. Gordon f49c122784 Added Linux and Solaris tests. 2012-03-19 20:31:50 -04:00
Ryan C. Gordon bb6c5e468c Let's gamble that everything has assert.h.
(and we'll mask out specific platforms if we find one that doesn't.)
2012-03-19 20:27:28 -04:00
Ryan C. Gordon e5fa9ab9fc Minor code style cleanup in platform_beos.cpp ... 2012-03-19 02:58:41 -04:00
Ryan C. Gordon 52267fe380 Removed some unused code. 2012-03-19 02:46:38 -04:00
Ryan C. Gordon 82a6ce0abf Use physfs_platforms.h in physfs_internal.h, to avoid repeated macro tests. 2012-03-19 02:04:27 -04:00
Ryan C. Gordon 1030e5d5ec Removed llseek().
Use Linux's off64_t support instead.
2012-03-18 12:31:29 -04:00
Ryan C. Gordon 391f94681c Fixed a comment. Cut and paste error, I guess? 2012-03-18 12:23:30 -04:00
Ryan C. Gordon be4ae4d401 Removed __PHYSFS_platformCvtToDependent().
It's only used by archive_dir.c, and it's trivial to make it into
 platform-independent code for that one module.

Bonus: less malloc() pressure...now every access to the native filesystem
 doesn't require a temporary heap allocation.
2012-03-15 01:58:39 -04:00
Ryan C. Gordon 03dbc3f758 Make __PHYSFS_platformDirSeparator into a single char.
This multichar thing was always stupid. Pull it out of revision control if
 you ever need it.
2012-03-15 01:54:57 -04:00
Ryan C. Gordon aaf8868c8d Removed __PHYSFS_convertToDependent(), as dead code. 2012-03-15 00:40:00 -04:00
Ryan C. Gordon 466f538926 Reworked BeOS CD detection code.
Cleaned up, removed a malloc(), removed unnecessary BAIL macros.
2012-03-14 21:24:32 -04:00
Ryan C. Gordon abd2624c59 Added Evgeny Podjachev to the credits. 2012-03-14 05:47:42 -04:00
Ryan C. Gordon 624d7f3a42 Fixed PHYSFS_read() and PHYSFS_write() in the dev branch.
PHYSFS_read() and PHYSFS_write() should return number of objects written,
 not object size.

Thanks to Evgeny Podjachev for the fix!
2012-03-14 05:47:15 -04:00
Ryan C. Gordon 519046db72 Removed check that .zip files are less than 4 gigabytes.
This would become a bogus check with zip64 support anyhow, but even here, if
 you have a .zip that's close to 4 gigabytes, and a self-extracting program
 prepended to it that pushes it over that limit, this test fails
 incorrectly.
2012-03-13 08:21:02 -04:00
Ryan C. Gordon a42ada1380 Fixed dereference of free()'d memory.
Thanks to Evgeny Podjachev for the fix!
2012-03-13 07:49:59 -04:00
Ryan C. Gordon c57bd94f84 Apparently, __PHYSFS_platformCurrentDir() is dead code. 2012-03-13 04:25:05 -04:00
Ryan C. Gordon 0ae446d970 Move Windows CD-ROM detection to another thread that uses device notifications.
Fixes blocking when a disc is spinning up, except on initial call.
2012-03-12 04:05:31 -04:00
Ryan C. Gordon 16ff5c8aca PhysicsFS works on Win64 now. 2012-03-12 03:48:34 -04:00
Ryan C. Gordon 5ad70036b2 Fixed stack smashing in newly-aligned __PHYSFS_smallAlloc(). 2012-03-12 01:33:16 -04:00
Ryan C. Gordon 1d41608a64 More doc tweaks. 2012-03-11 05:05:02 -04:00
Ryan C. Gordon 611aeec61b Removed __PHYSFS_platformRealPath().
It was an ugly piece of code, didn't work on The Hurd (apparently), likely
 dangerous in its incomplete understanding of Windows paths, and only
 used in places that should have given us normalized, absolute
 paths in the first place anyhow.
2012-03-11 04:19:36 -04:00
Ryan C. Gordon 2aa0c5a278 Replace C++/C99 single-line comments in miniz with C98 /* comments */ ... 2012-03-11 03:56:24 -04:00
Ryan C. Gordon c94d70ec0a Moved __PHYSFS_platformCurrentDir() from Unix to POSIX sources.
getcwd() is part of POSIX, after all.
2012-03-11 03:43:07 -04:00
Ryan C. Gordon b7e0ec7391 Change how Unix version of __PHYSFS_platformCurrentDir() allocates memory. 2012-03-11 03:39:57 -04:00
Ryan C. Gordon 7a8e3de103 Minor updates to the docs. 2012-03-11 03:09:07 -04:00
Ryan C. Gordon df3c281014 Fixed some compiler warnings. 2012-03-10 03:18:33 -05:00
Ryan C. Gordon 700d94e577 Replaced zlib with a hacked up copy of miniz: http://code.google.com/p/miniz/ 2012-03-10 02:31:58 -05:00
Ryan C. Gordon c8fc8cf957 Merge with pocketpc removal. 2012-03-10 01:13:03 -05:00
Ryan C. Gordon 6e4279e76a Bump the smallAlloc threshold up to 256 bytes. 2012-03-09 22:27:36 -05:00
Ryan C. Gordon 9dceda3d9f Align smallAllocs to the native pointer size. 2012-03-09 22:27:51 -05:00
Ryan C. Gordon a0b21c9ae9 Cleaned up all the readAll() cut and paste. 2012-03-09 04:50:27 -05:00
Ryan C. Gordon 25224b0e7a We never use calloc() internally. 2012-03-09 03:55:23 -05:00
Ryan C. Gordon eac0f11005 Cleaned up the updated TODO.txt, removed things that are already done, etc. 2012-03-09 03:55:04 -05:00
Ryan C. Gordon 86dbf54fc7 Updated TODO.txt from notes I had scratch down elsewhere over time. 2012-03-09 03:36:31 -05:00
Ryan C. Gordon 54cc53349d Cleaned up some __PHYSFS_platformStat() details. 2012-03-09 03:32:26 -05:00
Ryan C. Gordon de27c2a422 Removed the non-Unicode fallbacks from platform_windows.c, other cleanups.
This brings the minimum required OS up to Windows XP, which is around 11
 years old at this point.
2012-03-10 03:07:30 -05:00
Ryan C. Gordon 9e2acfd8a6 Removed OS/2 support. 2012-03-09 01:24:40 -05:00
Ryan C. Gordon 4d46d42f73 Removed PocketPC support. It was old and crusty and targeted a dead platform. 2012-03-09 00:44:59 -05:00
Ryan C. Gordon d1d0de3947 Fixed a compiler warning. 2011-11-18 01:08:19 -05:00
Ryan C. Gordon 608958b8ce Add support for SDL 1.3 to physfsrwops. 2011-10-18 23:48:28 -04:00
Sam Lantinga 9fb20ec349 Fixed deprecation warning in physfsrwops 2011-10-18 22:48:45 -04:00
Ryan C. Gordon 9d11b991bc Fixed up some bugs that clang's static analysis reported. 2011-10-18 15:55:29 -04:00
Ryan C. Gordon bbd356a27b Patched to compile. 2011-10-06 03:24:53 -04:00
Ryan C. Gordon b97ad1f366 Added Norfanin to the credits. 2011-10-05 04:04:06 -04:00
Ryan C. Gordon 6d4d91414a Check _M_X64 (Visual Studio, Windows/x86-64) in littleendian test.
Thanks to Norfanin for the tip!
2011-10-05 03:58:52 -04:00
Ryan C. Gordon 9d1ef087a9 Put some include-once and extern "C" blocks in the extras' headers. 2011-09-24 00:55:15 -07:00
Ryan C. Gordon 28007c9bae Fixed a typo in the docs. 2011-09-22 04:45:04 -04:00
Ryan C. Gordon 025a02f4c0 Corrected __PHYSFS_platformTell()'s return value to be correct. 2011-08-01 17:56:30 -04:00
Ryan C. Gordon 8258274a90 Removed __PHYSFS_platformEOF(). It's not used anymore. 2011-08-01 17:32:56 -04:00
Ryan C. Gordon e4cc3fcd9b Removed a space in CMakeLists.txt that can make the linker grumpy. 2011-07-25 11:32:32 -07:00
Ryan C. Gordon 65497160f7 Removed deprecated Mac OS X APIs. 2011-07-25 11:29:44 -07:00
Ryan C. Gordon 4075482826 Treat Haiku as BeOS in CMakeLists.txt ... this lets CD-ROM support build, etc. 2011-07-16 14:14:00 +00:00
Ryan C. Gordon f94d227945 Fixed basedir calculation on Mac OS X. 2011-07-09 23:11:17 -07:00
Ryan C. Gordon 49a8ff3f86 Added Frank Becker to the credits. 2011-06-22 15:57:16 -04:00
Ryan C. Gordon b8c4942413 POSIX version of __PHYSFS_platformStat() forgot to set *exists properly.
Thanks to Frank Becker for the fix.
2011-06-22 15:56:10 -04:00
Ryan C. Gordon 6a1aca5db5 Make sure utf8codepoint() advances the pointer even on bogus input.
This patch was from Francois Gouget, who found this bug in MojoSetup's copy
 of this function.
2011-06-01 03:10:08 -04:00
Ryan C. Gordon c6ca60eb20 Fixed infinite loop in zip_expand_symlink_path().
This patch was from Francois Gouget, who found this bug in MojoSetup's copy
 of the zip archiver code.
2011-06-01 03:08:53 -04:00
Ryan C. Gordon 4446cfa613 Fixed compiler warning on gcc-4.6. 2011-03-31 11:24:46 -04:00
Ryan C. Gordon 2939b26b7f Added an option to disable all SWIG bindings at once. 2011-02-22 00:16:56 -05:00
Ryan C. Gordon 4298d85313 Removed wxWidgets test program. 2011-02-21 23:55:58 -05:00
Ryan C. Gordon 014f0e2254 Put some quotes around autogenerated Doxygen options. 2011-02-21 23:45:22 -05:00
Ryan C. Gordon 794a3b3d90 Changed default doc version string. 2011-02-21 23:43:48 -05:00
Ryan C. Gordon 72f0e7f9b5 Corrected doc paths for development branch. 2011-02-21 23:43:36 -05:00
Ryan C. Gordon 67995ad0c5 Bumping version in CMakeLists.txt (but this is not ready for a release!). 2011-02-21 23:42:54 -05:00
Ryan C. Gordon 7dee41eb0c Fixed "make docs" for out-of-tree builds.
Also: this automatically updates the version number in the docs, so I don't
 have to with each release.
(transplanted from 72778f1e98f06c1e02f88dc8d263027d61469766)
2011-02-21 23:35:24 -05:00
Ryan C. Gordon 8e4fb13617 Corrected copyright dates in license. 2011-02-18 16:14:59 -05:00
Ryan C. Gordon 660c7f9823 Fixed bug in directory search for zip and qpak archivers (thanks, Michal!) 2011-02-18 12:38:05 -05:00
Ryan C. Gordon 54f72a0b42 Use LIB_SUFFIX to install to lib64 instead of lib (thanks, Cristian!). 2011-02-17 15:02:20 -05:00
Ryan C. Gordon 855025c3e5 Fixed include path when using internal zlib. 2011-02-11 00:19:22 -05:00
Ryan C. Gordon 706f50be0a Fixed logic error in QPAK archiver.
Should haved tested for a failed seek, but was testing for success instead.
2011-02-10 16:54:09 -05:00
Ryan C. Gordon 82b8546bc9 More Windows tests in the byteorder detection code. 2011-01-21 03:07:14 -05:00
Ryan C. Gordon f5e0dbe78b Patched to compile on Windows. 2011-01-21 02:50:20 -05:00
Ryan C. Gordon 899517dc85 Added Chris Roberts to the credits. 2010-12-30 19:53:41 -05:00
Ryan C. Gordon 5f5775c1ec Haiku fixes, merged from stable-2.0 branch. 2010-12-30 19:50:58 -05:00
Ryan C. Gordon 7d253b13ed Fixed leaking file handle on BeOS during CD-ROM detection. 2010-11-14 00:43:47 -05:00
Ryan C. Gordon 4d567a0d2f Fixed cut-and-paste error in malloc() failure test (thanks, Tolga!). 2010-10-04 01:48:34 -04:00
Ryan C. Gordon f871802f51 Cleaned up some #includes. 2010-09-06 19:35:01 -04:00
Ryan C. Gordon 3f02ce767f Moved most the cut-and-paste between simple archivers to one file. 2010-09-06 02:50:29 -04:00
Ryan C. Gordon 9d900f8814 Added a FIXME. 2010-09-05 02:43:43 -04:00
Ryan C. Gordon 125c170f7d Use lstat() instead of stat() for POSIX __PHYSFS_platformStat(). 2010-09-05 02:42:04 -04:00
Ryan C. Gordon 7f0e7105a7 Removed isDirectory, isSymLink and exists methods from internal code.
Use the PhysFS stat() interface instead.
2010-09-05 02:41:13 -04:00
Ryan C. Gordon 2219123cc5 SWIG bindings update. 2010-08-30 03:09:00 -04:00
Ryan C. Gordon 84c6e2242e Added PHYSFS_mountHandle(). Now you can do archives-in-archives! 2010-08-30 03:02:32 -04:00
Ryan C. Gordon d9e98704f7 PHYSFS_getRealDir() can't report a path for things that aren't real files. 2010-08-29 21:36:38 -04:00
Ryan C. Gordon 5ff1a2a12e Make PHYSFS_addToSearchPath() use doMount(), too. 2010-08-30 02:39:28 -04:00
Ryan C. Gordon bb9f5e5049 Added PHYSFS_mountMemory(). 2010-08-30 02:39:11 -04:00
Ryan C. Gordon 8cd320b858 Added PHYSFS_mountIo(). 2010-08-29 20:56:35 -04:00
Ryan C. Gordon 4bc5ed1725 Abstracted file i/o into PHYSFS_Io interface.
This touched a lot of code, and involved cleaning up a lot of stuff.
2010-08-30 03:01:57 -04:00
Ryan C. Gordon c2e77d7e35 Constification. 2010-08-29 01:55:30 -04:00
Ryan C. Gordon 74f8cb4f91 Fixed incorrect #ifdef. 2010-08-27 14:27:15 -04:00
Ryan C. Gordon b58e5f348c Removed __PHYSFS_platformGetLastModTime(). 2010-08-25 01:28:28 -04:00
Ryan C. Gordon 8def2f8aaf Fixed some single-line comments. 2010-08-24 14:17:07 -04:00
Ryan C. Gordon fc680aa468 Removed PHYSFS_Archiver's isArchive() method.
It was redundant with openArchive().
2010-08-24 10:05:58 -04:00
Ryan C. Gordon c92f3035f9 Made __PHYSFS_ui64FitsAddressSpace's behaviour match its name. 2010-08-24 10:03:25 -04:00
Ryan C. Gordon 2beafa790d Removed getLastModTime() interface from the archivers; it's not used anymore. 2010-08-22 20:20:04 -04:00
Ryan C. Gordon c1969d0595 Added PHYSFS_unmount(), deprecated addToSearchPath and removeFromSearchPath. 2010-08-22 03:43:22 -04:00
Ryan C. Gordon c306d73fdc Patched to compile. 2010-08-22 03:35:55 -04:00
Ryan C. Gordon f99f0ef9e7 Fixed details of PHYSFS_Archiver's stat method. 2010-08-22 00:37:25 -04:00
Ryan C. Gordon 024784efbd Actually, that's FOUR gigabytes. 2010-08-21 20:05:22 -04:00
Ryan C. Gordon f7a8d9292c Fixed PHYSFS_stat()'s return value to match rest of PhysicsFS API. 2010-08-21 19:10:42 -04:00
Ryan C. Gordon b69dfedaf0 Deprecated PHYSFS_getLastModTime()...use PHYSFS_stat() instead, now. 2010-08-21 17:34:00 -04:00
Ryan C. Gordon 8b0988a038 Some minor FIXME tweaks. 2010-08-21 15:07:13 -04:00
Ryan C. Gordon 51a22c576e Updated SWIG bindings. 2010-08-21 14:41:51 -04:00
Ryan C. Gordon 94c621c8fb Updated test_physfs.c to not use deprecated functions. 2010-08-21 14:42:14 -04:00
Ryan C. Gordon 8546c9a202 Replaced cut-and-paste byteswap i/o codepile with macros. 2010-08-21 14:30:52 -04:00
Ryan C. Gordon 3dc77f8a54 Get rid of __inline__, just make sure "inline" is defined sanely instead. 2010-08-21 14:29:40 -04:00
Ryan C. Gordon d797ea7cd8 Added PHYSFS_DEPRECATED. 2010-08-21 14:05:39 -04:00
Ryan C. Gordon 4000b234c0 Moved all the file i/o from stdio-style to POSIX-style.
Instead of trying to deal with a count of objects, just give 'em a stream of
bytes. This is WAY simpler to work with at the implementation level, and
removes confusion about what to do with a partial read.

This will be very useful when we expose the i/o interface to applications.
2010-08-21 02:47:58 -04:00
Ryan C. Gordon 68632d3c57 Wrap BAIL_* and GOTO_* macros in do { } while (0) ... 2010-08-21 02:42:23 -04:00
Ryan C. Gordon 11e2306c1c Added a FIXME. 2010-08-21 02:41:23 -04:00
Ryan C. Gordon c88d2c3746 Added UTF-16 support. 2010-08-20 02:38:32 -04:00
Ryan C. Gordon acdfcfca04 Fixed incorrect comments. 2010-08-20 02:49:11 -04:00
Ryan C. Gordon 77d16c2bed Zero-sized destination buffers when converting to UTF-8 shouldn't overflow. 2010-08-20 02:35:01 -04:00
Ryan C. Gordon 9d979b21d0 Added a see-also to the docs. 2010-08-20 01:25:32 -04:00
Ryan C. Gordon f329f4ed0b Added a FIXME. 2010-08-20 01:25:20 -04:00
Ryan C. Gordon 1fe05388ad Patched to compile on Solaris. 2010-04-08 09:56:51 -04:00
Ryan C. Gordon 80713fb40e Fixed documentation issue. 2010-04-05 15:50:02 -04:00
Ryan C. Gordon a9855949f0 Merged changeset 1084:ee3d2e6e1161 from stable-2.0: unitialized array fix. 2010-03-25 16:00:21 -04:00
Ryan C. Gordon a44e9669c1 Forgot to apply build-time thread fix to default branch (thanks, Patrice!). 2010-03-22 16:03:17 -04:00
Ryan C. Gordon e6f331f32d Add some more filesystem types that might be CDs or DVDs. 2010-03-22 11:12:45 -04:00
Ryan C. Gordon ddd82040f4 Back out Doxygen escaping stuff...doesn't actually work. 2010-03-22 11:11:09 -04:00
Ryan C. Gordon efa498fd5d See if $HOME is bogus, and if so, use getpwuid() instead.
Should fully fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553174
2010-03-21 12:20:44 -04:00
Ryan C. Gordon 72b232d4f5 If $HOME is invalid, scratch together a different userdir.
Partially fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553174
2010-03-21 12:11:39 -04:00
Ryan C. Gordon 4c7d25aebe Doxygen fixes (thanks, Patrick!) 2010-03-17 21:51:22 -04:00
Ryan C. Gordon ed989aa171 Added some missing file types to the documentation. 2010-03-17 21:37:06 -04:00
Ryan C. Gordon 47c3e8875c Windows: open files for read+write sharing, to match Unix. 2010-03-17 17:04:01 -04:00
Ryan C. Gordon cd3587bbf3 Make ISO9660 archiver optional. 2010-03-17 15:35:29 -04:00
Ryan C. Gordon 39e4da1929 Corrected file extension for ISO9660 archiver. 2010-03-17 15:34:30 -04:00
Ryan C. Gordon 0fa35af2b9 ISO9660 archiver, compliments of Christoph Nelles. 2010-03-17 14:50:54 -04:00
Ryan C. Gordon c369e78296 Added crc32 command to test_physfs.c (thanks, Christoph!). 2010-03-17 14:27:26 -04:00
Ryan C. Gordon 8d1cff2bdf Fix for the Hurd, from the debian project. 2010-03-15 09:46:33 -04:00
Ryan C. Gordon 9141cd77a0 Apparently that fix was from relnev, not theoddone33. Corrected credits. 2010-03-01 09:07:36 -08:00
Ryan C. Gordon 71dd0f7a6c Added a FIXME. 2010-03-01 08:49:04 -08:00
Ryan C. Gordon a4a72dfe8c Fixed logic bug (thanks, Dan!). 2010-02-23 21:58:49 -05:00
Ryan C. Gordon a4a7f88db0 Patched to compile (thanks, Christoph!). 2010-02-18 09:34:08 -05:00
Ryan C. Gordon f1cd4d8f0d THIS is Christoph's PHYSFS_stat() work.
I've merged some basic ideas from the other patch, which was Indy Sam's work,
 and cleaned up a few things.
2010-02-15 14:02:36 -05:00
Ryan C. Gordon 8e78e4719d Backed out changeset f87b0b7cca8e ... This wasn't Christoph's patch. Sorry! 2010-02-15 09:19:38 -05:00
Ryan C. Gordon 7cc80bebc5 Added first work on PHYSFS_stat() API (thanks, Christoph!). 2010-02-14 23:07:19 -05:00
Ryan C. Gordon eafefbdfdc Added SWIG-based Ruby bindings. 2010-02-04 04:46:14 -05:00
Ryan C. Gordon c08d722c2e Added Patrice to the credits. 2010-02-03 23:19:23 -05:00
Ryan C. Gordon 5a98fc83a8 Catch case where we use the Unix code on a non-Unix system that lacks pthreads.
Thanks, Patrice!
2010-02-03 23:14:11 -05:00
Ryan C. Gordon 6d6fec87ad Some targets need string.h here.
Thanks, Patrice!
2010-02-03 22:50:07 -05:00
Ryan C. Gordon 68db1196be Install test_physfs.pl with the rest of the project.
(Although I might yank this stuff...it probably doesn't need to go on the
end-user's system.)
2010-02-02 23:55:12 -05:00
Ryan C. Gordon 13a9f9b2dd Fixed "make dist" target. 2010-02-02 23:33:57 -05:00
Ryan C. Gordon 8ce71e5924 Added uninstall target for Unix platforms. 2010-02-02 23:22:49 -05:00
Ryan C. Gordon a40d3e1e3b Prevent bogus addition of -rpath to libraries. 2010-02-02 23:04:28 -05:00
Ryan C. Gordon 12ad3828e7 Not sure if this is still needed (it's definitely unneeded in CMake 2.8). 2010-02-02 23:04:13 -05:00
Ryan C. Gordon 35ed8dd586 Fixed filename collision when linking the library and script bindings. 2010-02-02 22:49:48 -05:00
Ryan C. Gordon 282bf1b3ec More perl bindings wanking. 2010-02-01 23:15:36 -05:00
Ryan C. Gordon bdd4d3ebe3 Added simple test for perl bindings. 2010-02-01 23:04:25 -05:00
Ryan C. Gordon 6116683f5e More work on Perl bindings linking.
Fixes linking on Mac OS X; the bindings now work there, too!.
2010-02-01 22:04:36 -05:00
Ryan C. Gordon c844a98be3 I think this gets the right Perl include path value.
Fixes Perl compiles on Mac OS X.
2010-02-01 21:33:20 -05:00
Ryan C. Gordon 8415f297f0 Use FIND_PROGRAM(perl) instead of FindPerl.
I don't see the value in using FindPerl at the moment.
2010-02-01 21:32:38 -05:00
Ryan C. Gordon 319ff77100 Initial work on Ruby bindings, barely started.
Mostly this is work on abstracting things in the build system.
2010-02-01 04:22:05 -05:00
Ryan C. Gordon 23d28cbe12 Tightened the SWIG warning filter. 2010-02-01 03:29:56 -05:00
Ryan C. Gordon 392193ea0c Hooked up Perl bindings, via SWIG. 2010-02-01 03:17:14 -05:00
Ryan C. Gordon 5720b168ca Fixed compiler warning on newer Linux systems. 2010-02-01 03:02:18 -05:00
Ryan C. Gordon a09a54d0f2 Initial SWIG work. 2010-01-29 04:17:44 -05:00
Ryan C. Gordon aa7126619e Added some (disabled!) calling conventions stuff. 2010-01-29 03:18:03 -05:00
Ryan C. Gordon 5629f8b8bc Renamed __EXPORT__ to PHYSFS_DECL. 2010-01-29 03:09:16 -05:00
Ryan C. Gordon c2c1ba9cc5 Fixed some C++-style one-line comments in C code. 2010-01-28 02:35:32 -05:00
Ryan C. Gordon 4cbe694020 Removed makedist.sh ... not needed with Mercurial's "hg archive" 2010-01-28 02:31:58 -05:00
Ryan C. Gordon 595ac1da39 Cleaned up returns that look like function calls for my updated coding style. 2010-01-28 02:27:45 -05:00
Ryan C. Gordon 17b2640d71 Corrected physfs.h installation for new directory layout (thanks, Patrice!). 2009-11-16 12:26:28 -05:00
Ryan C. Gordon cef8847a06 Attempt to clean up the thread ID mess in platform_unix ... 2009-09-06 01:05:27 -04:00
Ryan C. Gordon 5a26df8383 Fixed building with Mac OS X 10.6 SDK.
The SDK defines the TARGET_OS_IPHONE, etc symbols to 0, so you can't check
 "#if defined" for them.
2009-09-06 01:04:17 -04:00
Ryan C. Gordon 88729ebff2 Don't use -fvisibility=hidden on Windows, since MinGW doesn't support it. :( 2009-07-12 16:43:59 -04:00
Ryan C. Gordon a69f97bb26 Added some people to the credits. 2009-07-08 18:46:54 -04:00
Ryan C. Gordon 71e0e6883d Fixed CMakeLists.txt to properly handle cross-compiling (thanks, Marc!). 2009-07-08 18:45:21 -04:00
Ryan C. Gordon 44f6c8306d Try /proc/$PID/exe if /proc/self/exe doesn't work out. 2009-07-08 17:53:48 -04:00
Ryan C. Gordon 43207273dd Try to shrink returned buffer's allocation. 2009-07-08 17:47:05 -04:00
Ryan C. Gordon ff80fc8003 Fixed wrong readlink() usage (lstat() doesn't report dest link size!).
Thanks to Henk Boom for pointing this out.
2009-07-08 17:46:48 -04:00
Ryan C. Gordon 71fc15fd19 Temporary fix for (re)opening files in lzma archives (thanks, Sam!) 2009-06-21 17:37:47 -04:00
Ryan C. Gordon 5323b6a532 Fixed latin1 to UTF-8 conversion (sign conversion was broken). 2009-06-03 18:44:15 -04:00
Ryan C. Gordon 04b6388b68 Merged 0410dc655d45 from the 2.0-stable branch: strict-aliasing fix. 2009-05-03 01:36:18 -07:00
Ryan C. Gordon d7945d5955 Fixed strict-aliasing issue that gcc 4.4 complains about. 2009-05-03 01:24:41 -07:00
Ryan C. Gordon 94d1b71e49 I think sys/mount.h is only needed in the ucred.h path.
Fixes building on hurd, I think.
2009-05-02 23:25:41 -07:00
Ryan C. Gordon cedcd95541 Corrected __EXPORT__ test for Solaris. 2009-04-20 23:48:16 -04:00
Ryan C. Gordon 652f0ec03c Fixed a problem in some CMake versions. 2009-04-20 23:43:36 -04:00
Ryan C. Gordon d26781a809 Fixed SET_SOURCE_FILES_PROPERTIES in CMakefile for wxWidgets test app. 2009-04-20 23:41:27 -04:00
Ryan C. Gordon 57d908dca0 Added the Sun Studio equivalent of -fvisibility=hidden 2009-04-16 22:37:38 -04:00
Ryan C. Gordon 0bc32891ba Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris. 2009-04-13 17:59:15 -04:00
Ryan C. Gordon 3b91814f20 Ignore empty files (like #ifdef'd out platform code) on Sun Studio compiler. 2009-04-13 17:58:35 -04:00
Ryan C. Gordon 05e3864db8 Updated test_physfs.c's version to match everything else. 2009-04-13 17:57:56 -04:00
Ryan C. Gordon d8d296e8c6 Merge all the Unix __PHYSFS_platformDetectAvailableCDs() funcs into one. 2009-04-13 17:09:36 -04:00
Ryan C. Gordon 07e97a0166 Fixed some Sun Studio warnings about unreachable code. 2009-04-13 03:40:30 -04:00
Ryan C. Gordon e1dee8e56a More Solaris fixes. 2009-04-13 03:40:02 -04:00
Ryan C. Gordon 3f0cffcc50 Fixes for compiling on Solaris. 2009-04-13 03:27:53 -04:00
Ryan C. Gordon 8d796488a2 Removing makeos2.cmd 2009-03-29 04:38:53 -04:00
Ryan C. Gordon ca244993e6 Added new entry point to makeos2.cmd, in case we keep this. 2009-03-29 04:32:08 -04:00
Ryan C. Gordon 3bc1f7d670 OS/2 build fixes. 2009-03-29 04:29:24 -04:00
Ryan C. Gordon 47557ee2d4 Fixed include directory in CMakeLists.txt.
Test program now builds without physfs.h installed system-wide.
2009-03-29 04:18:50 -04:00
Ryan C. Gordon 544f0f6185 Patches to build on gcc 4.3.3 on OS/2.
This is with the build environment and latest GCC builds available from...

  http://www.smedley.info/os2ports/

...this is apparently what Mozilla uses for Firefox builds on OS/2.
2009-03-29 04:11:38 -04:00
Ryan C. Gordon 7eff1f1977 Added .hgignore ... 2009-03-28 18:15:35 -04:00
Ryan C. Gordon ec93cca7c7 Improved globbing extra.
Fixed FIXMEs, improved documentation, updated for 2.1 API.
2009-03-28 18:14:16 -04:00
Ryan C. Gordon 778f1987cf Updated some documentation, added a FIXME. 2009-03-28 17:51:10 -04:00
Ryan C. Gordon fb5e8d9cd2 PHYSFS_freeList(NULL) is now a safe no-op. 2009-03-28 17:50:54 -04:00
Ryan C. Gordon b78da18657 Bumped version number (although we're probably far from a real 2.1.0 release). 2009-03-28 16:16:08 -04:00
Ryan C. Gordon d6ce63e912 Added PHYSFS_getAllocator(). 2009-03-28 16:15:03 -04:00
Ryan C. Gordon 2a65060cde Moved directory structure around. 2009-03-27 15:10:42 -04:00
Ryan C. Gordon 60366b5b32 Updated stable TODO.txt ... 2009-03-23 16:57:59 -04:00
Ryan C. Gordon da35dbe448 Tagging release-1.1.0 2009-03-23 16:57:35 -04:00
Ryan C. Gordon 87558aad9d Updated TODO for development branch. 2009-03-23 16:50:44 -04:00
Ryan C. Gordon c32cd9d130 Updated TODO, branching stable-2.0 2009-03-23 16:49:30 -04:00
Ryan C. Gordon c021fa0613 Tagging 2.0.0 release. 2009-03-23 01:13:28 -04:00
Ryan C. Gordon a6354f6869 Updated copyright date. 2009-03-23 01:06:54 -04:00
Ryan C. Gordon 8b4f9e89b2 Updated install instructions. 2009-03-23 01:06:17 -04:00
Ryan C. Gordon fed94bf21a Upped version to 2.0.0! 2009-03-23 00:45:15 -04:00
Ryan C. Gordon 613aedceaa Removed physfs.spec.in.
Package maintainers can do this better outside our tree.
2009-03-23 00:15:22 -04:00
Ryan C. Gordon b71ef88ba7 Fixed comment typo. 2009-03-23 00:13:24 -04:00
Ryan C. Gordon 6df0e5ffba Removed the __arch__swabX macros; Linux kernel headers aren't reliable. 2009-03-23 00:13:08 -04:00
Ryan C. Gordon 10ce30f80d Screw it, change this back. 2009-03-23 00:12:03 -04:00
Ryan C. Gordon 3c38768192 Corrected soname.
Apparently we should be using 0 if we add functions. It's only changing or
 removing symbols that causes an SOVERSION bump.
2009-03-22 21:19:21 -04:00
Ryan C. Gordon 78037a7ccb Valgrind fix: avoid overlapping memcpy() in sorting routines (thanks, JLM!). 2009-02-28 01:34:02 -05:00
Ryan C. Gordon 43dbf3a22c Haiku support. 2008-11-05 14:42:48 -05:00
Ryan C. Gordon 2e134c7190 Removed the manually-maintained changelog.
This was a legacy workaround for CVS limitations. Use the web interface
 to our shiny, modern revision control tools instead.
2008-11-03 15:55:29 -05:00
Ryan C. Gordon bf895c15fc Updated. 2008-11-02 15:26:22 -05:00
Ryan C. Gordon 2f3ba7602b Corrected example code in the docs (thanks, Olivier!). 2008-11-02 15:26:14 -05:00
Ryan C. Gordon 2651eb2eb9 Added struct typedefs that you can predeclare without including physfs.h 2008-11-02 15:22:02 -05:00
Ryan C. Gordon 2f23846245 iPhone support patch (thanks, Christian!)
Original email...

Date: Tue, 28 Oct 2008 20:22:04 +0100
From: Christian Gmeiner
To: icculus@icculus.org
Subject: Physfs IPhone suport

Hi.. this simple patch adds IPhone support to physfs. I
have also tested a normal osx 10 cocoa app and it builds too
with this patch. Hope to see it soon in the main hg tree.
In the next week I will do some tests on a real IPhone/IPod Touch,
but I think it should be okay.

greets,
--
Christian Gmeiner, B.Sc.
2008-11-02 15:19:58 -05:00
convert-repo 4322ae7af2 update tags 2008-06-30 00:05:31 +00:00
Ryan C. Gordon 61749966b9 Fixed PHYSFS_openAppend() on Unix.
Apparently O_APPEND doesn't behave like I thought it did...all these years.  :/
2008-04-03 05:05:48 +00:00
Ryan C. Gordon 1b042d124d Yet another attempt to patch to compile. 2008-03-12 21:42:16 +00:00
Ryan C. Gordon 5c5e3d7e14 Patched to compile. 2008-03-12 21:35:54 +00:00
Ryan C. Gordon 53a9169400 Fixed aliasing bug in Windows platform layer (thanks, Dennis!). 2008-03-12 21:22:22 +00:00
Ryan C. Gordon bdb7e2a795 Updated. 2008-03-12 20:44:01 +00:00
Ryan C. Gordon af11d0a462 Converted translations to UTF-8 (and removed duplicate Russian translations,
since UTF-8 replaces the various other character encodings).
2008-03-11 05:28:13 +00:00
Ryan C. Gordon 73e7465f55 Changed some text files from ISO-8859-1 to UTF-8. 2008-03-11 05:19:56 +00:00
Ryan C. Gordon 1ae24fd938 Fixed compiler warnings in win32 API calls (thanks, Dennis!). 2008-03-09 02:44:50 +00:00
Ryan C. Gordon 3b0e1d7471 Various archiver swap and compare functions now check if they are
swapping/comparing an item against itself, for efficiency and to prevent
 overlapping memcpy() calls.
2008-02-20 12:24:10 +00:00
Ryan C. Gordon 7501090a5b Minor Windows fix (thanks, fydo!). 2008-02-13 05:48:57 +00:00
Ryan C. Gordon ac277daac4 Date: Sat, 2 Feb 2008 14:28:02 +1300
From: eH
To: physfs@icculus.org
Subject: [physfs] lzma.c msvc, etc. patch

I came across a few bugs compiling PhysFS with msvc9 - I've created a patch which seems to fix them:
SzFileReadImp / SzFileSeekImp:
Problem: Can't preform arithmatic on 'void *'
Fix:        Cast 'object' to unsigned long

LZMA_enumerateFiles:
Problem: There is no error handling if the directory 'dname' doesn't exist
Fix:         Check the return value of 'lzma_find_file()' before using it

LZMA_isDirectory:
Problem: return (file->item->IsDirectory) is illegal if 'file' doesn't exist
Fix:         Make sure 'file' isn't null before returning
2008-02-02 02:32:48 +00:00
Ryan C. Gordon f7f6c0efd0 Updated copyright date. 2008-01-23 05:14:15 +00:00
Ryan C. Gordon ee9e106555 Added zlib README and updated license notes. 2008-01-23 05:01:50 +00:00
Ryan C. Gordon 77a2c5009c Updated for lzma changes. 2008-01-23 05:00:07 +00:00
Ryan C. Gordon 66631578f8 Many improvements to lzma.c (thanks, Dennis!). 2008-01-23 04:57:47 +00:00
Ryan C. Gordon 4e457760a2 Upgraded lzma sdk to 4.57. 2008-01-23 03:52:35 +00:00
Ryan C. Gordon a91fc0d024 Upgrading lzma SDK... 2008-01-23 03:13:05 +00:00
Ryan C. Gordon a863c128be Fixed allocation size when converting from UTF-8 to UCS-2. 2008-01-22 04:11:27 +00:00
Ryan C. Gordon a928ba2763 Corrected credit in Changelog. 2008-01-22 03:46:44 +00:00
Ryan C. Gordon 0ea431927e Fixed HTTP header in physfshttpd.c. 2008-01-22 03:44:49 +00:00
Ryan C. Gordon 1aa0511f7b Fixed wrong dir test in Windows code in both 1.0 and 1.1 (thanks, Dennis!). 2007-12-11 18:54:10 +00:00
Ryan C. Gordon 565f973e2e Mingw32 fix for 64-bit literals. 2007-10-01 15:47:40 +00:00
Ryan C. Gordon 2296f69deb Minor windows cleanups. 2007-10-01 15:47:07 +00:00
Ryan C. Gordon a8842c9713 Whoops, it's malloc.h, not alloca.h ... 2007-07-12 10:37:56 +00:00
Ryan C. Gordon 827b643f49 Fixed missing alloc macro on mingw32, I think. 2007-07-12 08:58:09 +00:00
Ryan C. Gordon c5ee3d965c Fixed crash on zero-byte read/write (thanks, Ensiform!). 2007-07-11 22:11:29 +00:00
Ryan C. Gordon c27fd9639f Updated. 2007-05-27 14:34:29 +00:00
Ryan C. Gordon d1d0ea025f FIXME removal: Replaced a strncpy() with a memcpy(). 2007-05-27 14:34:28 +00:00
Ryan C. Gordon 711d9ec926 Minor documentation fix. 2007-05-11 20:12:10 +00:00
Ryan C. Gordon 05e44324c8 Fixed zip archiver: could do bogus seek if a small, non-zip file got put
through isArchive().
2007-05-05 05:52:43 +00:00
Ryan C. Gordon 35dcb89748 Minor const correctness tweak in zip archiver. 2007-04-29 08:16:30 +00:00
Ryan C. Gordon 32bc908a4b Forgot to update the project version in the Doxygen file before release.
Oh well.
2007-04-03 05:51:46 +00:00
164 changed files with 28020 additions and 37211 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
github: [icculus]
patreon: icculus

30
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Build
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform: # !!! FIXME: figure out an efficient way to get SDL2 on the Windows/Mac bots.
- { name: Linux, os: ubuntu-20.04, flags: -GNinja }
- { name: MinGW, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_SYSTEM_NAME=Windows }
- { name: Windows, os: windows-latest }
- { name: MacOS, os: macos-latest }
steps:
- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Setup MinGW dependencies
if: contains(matrix.platform.name, 'MinGW')
run: choco install ninja
- name: Get PhysicsFS sources
uses: actions/checkout@v2
- name: Configure CMake
run: cmake -B build ${{ matrix.platform.flags }}
- name: Build
run: cmake --build build/

20
.github/workflows/os2.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Build (OS/2)
on: [push, pull_request]
jobs:
os2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: open-watcom/setup-watcom@v0
- name: Build physfs.dll
run: |
cd src
wmake -f Makefile.os2
cd ..
- name: distclean
run: |
cd src
wmake -f Makefile.os2 distclean
cd ..

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
cmake-build

View File

@ -1,602 +0,0 @@
/*
* CHANGELOG.
*/
04032007 - Added a "make dist" target for packing up source code releases.
Reverted Unix recursive mutex code. There were some portability
issues I didn't anticipate. Upped version to 1.1.1!
04022007 - Added wxWidgets-based test program (incomplete). Filled in and
corrected some Doxygen comments.
04012007 - Added PHYSFS_isInit() and PHYSFS_symbolicLinksPermitted() functions.
03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved
DIR archiver to start of the list, so we don't have to have every
other archiver fail to open a directory as a file before mounting
it. Fixed typos in makeos2.cmd and the Doxygen comments. Added
symlink support to windows.c for use on Vista-based systems.
03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when
looking in a directory other than the root, instead of enumerating
only for the root (thanks, Chris!). Minor fix for compilers that
don't like the BAIL_* macros with an empty argument
(thanks, Chris!)
03262007 - Tons of Unicode work in windows.c ... should now use UCS-2 on
NT/XP/Vista/etc versions of the OS, and fallback to "ANSI" versions
for 95/98/ME, tapdancing around the system codepage if it has to.
Since the Unicode entry points are dynamically loaded, it won't
have issues with missing symbols on Win9x, nor does it need to be
built separately with #define UNICODE (although it will work the
same with or without this define, as it doesn't use TCHARs or
the non-[WA] versions of APIs. Other minor Windows cleanups and
corrections.
03252007 - Improved dynamic loader and initial Unicode work in windows.c ...
03242007 - Replaced BeOS semaphores with BLockers for the mutex implementation.
It's much simpler, it has "benaphores" built in behind the scenes
for faster performance, and it's recursive...also, we were
previously setting the PhysicsFS error state if BeOS mutex grabbing
failed (a big no no!), and that's now fixed. Good wins all around.
03222007 - Replaced some Malloc and all the alloca() calls with
__PHYSFS_smallAlloc(), which will stack allocate small (128 or
less bytes) blocks and Malloc the rest...naturally these now have
to be paired with __PHYSFS_smallFree() calls, so you can't be as
lazy as a basic alloca() would let you be. The benefit is both less
malloc pressure for those temporary allocations and better stack
overflow safety (so if some jerk tries to push a 78 megabyte string
through the library as a filename, we won't try to strcpy it to
the stack). Hopefully some internal interfaces can now get
refactored to stop generating heap pointers and let the caller use
smallAlloc to further reduce malloc pressure.
03212007 - Replaced LONGLONGLITERAL with __PHYSFS_UI64/__PHYSFS_SI64 ...
03202007 - Removed platform/skeleton.c (it was out of date), added
platform/macosx.c (To further Macify the code and get the #ifdefs
out of unix.c), and refactored the platform layer to try and
make the unix/posix/macosx/beos sources try to find a split that
works. Moved the platform allocators to physfs.c, since all but
Mac OS X were using malloc()...there's now an interface for the
platform to supply a custom allocator if they don't want the malloc
version. Removed __PHYSFS_platformTimeslice(), as it's no longer
being used. Replaced manual management of pthread mutexes with
PTHREAD_MUTEX_RECURSIVE attribute...let's see what platforms
throw up on that. Handled documentation comment FIXME in physfs.h.
03192007 - Fixed two switched strings in CMakeLists.txt ... patch to compile
with latest Windows Platform SDK. Explicitly check for NULL in
PHYSFS_init() when we can't go on without a real string here.
Removed ANSI-C workaround for missing lstat() nonsense in posix.c
(POSIX != ANSI, time to give up here). Try to use /proc/self/exe
to find the base dir on Unix, so we can do without argv[0] on
systems with a Linux-like /proc filesystem.
03162007 - Changed PHYSFS_file from a typedef to a #define (in case it would
cause an aggressive compiler to think you're passing the wrong type
to a function) and added Doxygen comments to explain it.
03152007 - Bunch of work on Unicode...added case-folding stricmp, removed
platform-specific stricmp implementations, changed appropriate
calls to an ASCII-only stricmp that ignores locale. Fixed case on
UTF-8 API entry points.
03142007 - Dropped classic Mac OS support. It's just too hard to find a working
Mac OS 9 install and reasonable development tools, so it's not
worth it. If you still target OS 8 or 9, please use PhysicsFS 1.0.
03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0
branch for history's sake. Added shared and static build options
to CMakeLists.txt, and the expected "make install" target.
Renamed some FILENAME files to FILENAME.txt, removed physfs.rc.
Now compiles everything whether we need it or not, removing whole
files with #ifdefs...this will make it easier to "embed" this
library in other projects or use a different build system: just
push everything through the compiler with preprocessor defines for
the parts you want/need...platform modules are determined
automatically without the build system needing to intervene, so you
just have to #define the archivers, etc that you want.
Updated makeos2.cmd for newer Innotek toolchain (thanks, Dave!)
03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c.
Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC
code to expect UTF-8 strings from the higher level. Changed
PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Killed some #ifdefs
in physfs.c. Moved to CMake...so long, autotools! Killed MIX
archiver, too.
11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work.
Minor BeOS realpath tweak.
09272006 - Reworked 7zip archiver (thanks, Dennis!).
09232006 - Fixed typo in doxygen comment.
04112006 - Added LZMA archiver...7zip support (thanks, Dennis!).
03232006 - Added -fvisibility for gcc4 (http://gcc.gnu.org/wiki/Visibility)
01012006 - Cleaned up overflow checks in platform memory allocators (thanks to
Nicolas Lebedenco for pointing out the original issue with
long long literals). Added physfs.rc (thanks, Dennis!). Changed my
email address. Removed acconfig.h.
11282005 - Corrected docs on PHYSFS_setWriteDir().
10122005 - Fixed locateInStringList() in physfs.c (thanks, Matze!). Patched
archivers/wad.c to compile.
09192005 - Make unix mutexes recursive above pthread layer...fixes deadlock on
MacOS X, for now.
09182005 - API BREAKAGE: PHYSFS_enumerateFilesCallback() now passes the
original directory name back to the app in the callback. This
API was only in 1.1.0, and wasn't promised to be stable at this
point. Please update your apps! Cleaned out a FIXME in file
enumeration that would confuse the library under certain
circumstances.
09092005 - Some tweaks to PHYSFS_Allocator. Apparently configure.in doesn't
work like I thought for version bumps, so it thinks 1.1.0 isn't
binary compatible with 1.0...fixed, I think.
09062005 - Happy September. Changed the allocation abstraction to use
PHYSFS_uint64 instead of size_t, so we don't have to include
system headers inside physfs.h. Minor MingW fixes (but it's still
broken, I think).
08202005 - Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig()
and other corner cases.
07242005 - Patched to compile on BeOS.
07232005 - Fixed bug in zip archiver (thanks, Jörg Walter!).
More minor OS/2 tweaks. Updated zlib to 1.2.3, which properly
includes the security fix. Fixed "make dist" to handle .svn dirs
and other file changes. Removed "debian" directory. Allow a mount
point of NULL to be "/", per the documentation. Fixed warning in
physfs.c. Assert definition fix. Updated CWProjects.sit.
Upped version to 1.1.0 ... first release of 1.1 dev branch!
07212005 - Patched to compile on OS/2 again.
07132005 - Updated zlib to 1.2.2, and patched it for this security hole:
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2096
06122005 - Added support for mingw to Unix build process (thanks, Matze!).
03162005 - Added missing translation and Portuguese support (thanks, Danny!).
MPW support and several MacOS Classic fixes (thanks, Chris!).
Changed CWProjects from SITX to SIT format, so OS9 users can
unpack it.
03132005 - More mount work, added PHYSFS_getMountPoint() and more cleanups.
Replaced all the C runtime allocations with PhysFS allocation hooks.
Added pocketpc.c to EXTRA_DIST. Added allocation hooks to some
platform drivers. Updated Mac Classic build.
03122005 - Added evil GOTO_*_MACRO_* macros. Fixed unix.c to compile again on
MacOS X. Added PHYSFS_mount() (thanks, Philip!). Cleaned up the
INSTALL and CREDITS files a little. Split off start of
verifySecurity() into a path sanitizer and changed entry points to
sanitize input paths into a stack-allocated buffer before further
processing. This removes the need for a malloc() for almost all
file system operations, and generally cleaned things up. Added a
"mount" command to test_physfs. Other general cleanups.
02152005 - Minor comment fix in platform/pocketpc.c
01052005 - Fixed HOG archiver file lookup (thanks, Chris!)
12162004 - Fixed some documentation/header comment typos (thanks, Gaetan!)
10302004 - Fixed a strcpy that should have been a strcat. (thanks, Tolga!)
Build system respects external CFLAGS now. (thanks, Adam!)
Fixed infinite loop in new enumeration code. (thanks, Adam!)
10062004 - Removed profiling code from physfs.c.
09292004 - Every API that can return a list of strings can now use a
callback mechanism if the application wants to do it's own
allocation or handling on a per-item basis. The guts of those
APIs that create string lists now use the callbacks themselves to
build the lists, too. The callback functionality goes all the way
down to the archivers and platform drivers where appropriate, which
cleans things up and simplifies some internal tasks very nicely.
Got rid of all the annoying forward declarations in all the
archivers and moved their PHYSFS_Archiver data to the end of the
file, since this was annoying me and I was getting sick of updating
function signatures in two places when the internal API changed.
Removed the code/data for LinkedStringLists...it isn't used anymore
now that the callback code is in place.
09262004 - Did the same thing to FileHandles than I did to DirHandles, but
this triggered massive tweaking in physfs.c. A lot of code got
little cleanups, which was nice. Less malloc pressure, too, since
opening a file used to allocate a ton of crap and mush it
together...now it's basically down to one structure and the
instance data in whatever archiver. Minor varname tweak in win32.c
and pocketpc.c. Changed PHYSFS_file to PHYSFS_File to match the
rest of the API's naming scheme (but put a typedef for source
compatibility).
09252004 - Cleaned up archiver interface to not deal with DirHandles anymore,
which simplifies things, removes some responsibility and code
duplication from the archivers, and trims some malloc pressure.
Ripped up the allocation hook code a little. We'll try to screw
with memory locking later, since it makes everything ugly and
complex. Oh well.
09232004 - Started adding allocation hooks.
09222004 - Happy September. Added Spanish translation back in.
04092004 - Added MIX support for legacy Westwood titles (Thanks, Sebastian!).
Made bootstrap script MacOSX-friendly. Moved byteorder defines into
physfs_internal.h ...
01152003 - Added Portuguese (Brazil) translation (Thanks, Danny!)
--- This is where the 1.1 development branch starts. ---
12292003 - Updated CodeWarrior projects from CW6 to CW7, and made a bunch of
patches to get the Mac Classic target building again. Removed
zlib114 from CVS repository. Updated OS/2 build batch file.
Added Z_PREFIX define to Unix builds that use internal zlib.
Patched up some (outdated?) Visual C project files for zlib121.
Patched Doxyfile and physfs.h for newer Doxygen. Fixed OS/2
build script. Tweaked Project Builder files to at least compile.
Added some last minute BeOS and Cygwin build fixes. Updated
Visual Studio projects and tweaked some Makefile.am crap. Made
changes so Visual Studio files would pack with DOS endlines and...
Upped version to 1.0.0 (woohoo!).
12222003 - Fixed a search-and-replace mistake in win32.c that preventing
compiling on Windows. (thanks, Brian!) Converted VC6 .dsp to use
zlib121; made Z_PREFIX=1 enabled by default to avoid link clashes;
put zlib files in separate logical folder in .dsp project; updated
zlib121/zconf.h to address remaining symbols that were still
causing link warnings.
12182003 - WAD archiver now puts maps into subdirectories, making them
accessible to the application. (Thanks, Travis!) RPM spec and
Makefile.am* now package zlib_license_change.txt (Thanks, Edward!)
12142003 - Added Doom WAD support (Thanks, Travis!)
12082003 - Fixed some win32.c deficiencies that Robby Dermody pointed
out (thanks!)
12072003 - Upgraded internal zlib to 1.2.1 (thanks, Adam!) Other
Unix build fixes.
11112003 - Patches to make OS/2 support compile again.
11092003 - Added __PHYSFS_platformStrnicmp(), and made qpak.c case-insensitive.
09122003 - Happy September. Actually released current tree as 0.1.9.
08262003 - Added MiNT support to build process and fixed cross-compiling
(thanks Patrice Mandin!)
08092003 - Some Windows build fixes (thanks, Brian Hook!)
07232003 - Upped version to 0.1.9.
07202003 - Switched to zlib license (see new LICENSE text in root of source
tree, and zlib_license_switch.txt for details). Had to remove
archivers/qpak.c, the Ruby bindings from the extras directory, and
the Russian and Spanish translations, since those contributors
couldn't be contacted. If they show up, we'll readd them to the
project, otherwise we'll eventually replace their work...everyone
else signed on for the change. Committed a patch to convert all
tabs to spaces (Thanks, James!). Added patch to zip.c to fix
crash (thanks, dillo!). Reimplmented qpak.c, by welding together
bits of grp.c and zip.c. Ed contacted me, so I could readd his
contributions post-license change...I'm going to keep the new
qpak.c, but I've readded his Ruby bindings and Russian translations.
06112003 - Patches to globbing.c to handle corner cases (thanks, Bradley!).
06102003 - Added globbing.c to "extras" directory.
05232003 - Rewrote MacOSX/Darwin CD-ROM detection code to use IOKit, which is
much much more accurate than the previous code. Updated
configure.in and Makefile.am.newautomake for some MacOSX stuff.
05222003 - Fixed win32 crash if PHYSFS_init() is called with a NULL.
05182003 - PocketPC fixes (thanks, David Hedbor!)
05162003 - Compiler warning cleanup in HOG and MVL archivers (Thanks, Bradley!)
04082003 - Minor changes to extras/abs-file.h (Thanks, Adam!)
03302003 - Fixed seeking in uncompressed ZIP entries, and handle a
misbehaviour in Java's JAR creation tools. Thanks to "Tree" for
pointing these bugs out. Added HOG and MVL archive support for
Descent I and II (Thanks, Bradley Bell!). Added example code to
do case-insensitive file searches ("extras/ignorecase.*").
03192003 - Fixed problem in PHYSFS_mkdir() when dirs to be created already
exist. Fixed problem where PHYSFS_mkdir() incorrectly tripped an
alarm in __PHYSFS_verifySecurity().
03122003 - Attempt at cleaning up some type correctness for VC++6. Made QPAK
archiver case-insensitive (since Quake2 has problems without it).
01302003 - Added buffering API to OS/2 build's exported symbol list. Updated
CWProjects.sit and made several fixes to get physfs building on
MacOS Classic again.
01282003 - Fixed seeking in buffered files opened for read.
01072003 - .NET assembly and C# wrapper by Gregory S. Read in the extras dir.
01042003 - Added a hack for dealing with OSX bundles and newer PBProjects
(thanks, Eric Wing!). Added some missing files to "make dist".
Fixed minor Doxygen typo in PHYSFS_flush() docs. Upped version to
0.1.8.
12172002 - Added Apple Project Builder support files (thanks, Eric Wing!).
12112002 - Added Ruby bindings to extras directory (thanks, Ed Sinjiashvili!).
Patched win32.c to compile with Mingw32 (thanks, Niels Wagenaar!).
12032002 - Adam updated his extras/abs-file.h for the new buffering API.
12022002 - German translation added, compliments of Michael Renner.
12012002 - Minor fix to configure.in: reported --enable-debug's default
setting incorrectly. Added buffering to the API: you can now
buffer a file with PHYSFS_setBuffer(), and flush the buffer to
disk with PHYSFS_flush(). PhysicsFS file handles are unbuffered
by default (as they were before this API addition), so this does
not break the API. Other fixes for bugs I stumbled upon during
this work are in CVS, too.
11292002 - Minor fix for strange PATH strings in unix.c (thanks, Alexander!)
11222002 - Initial PocketPC port by Corona688.
10222002 - Fixed segfault in test_physfs.c when user hits CTRL-D (and
readline() thus returns NULL)...now gracefully exits, as it should.
10142002 - Added check for AMD's x86-64 ("Hammer") architecture when
determining platform byte order.
10112002 - Fixed "setsaneconfig" command in test_physfs.c ...
09232002 - Happy September. Updated VC++6 project files, fixed some
VC++ compile nags (more work to be done in zip.c).
08302002 - Cleaned tab stops out of zip.c, and fixed a possible infinite loop
in zip_find_entry().
08292002 - Fixed a mistake in makeos2.cmd, and updated the INSTALL docs.
Added physfs.spec.in to EXTRA_DIST in Makefile.am*
08292002 - Added a physfs/stdio wrapper header to the "extras" dir,
compliments of Adam D. Moss (file is "abs-file.h").
08282002 - Cleanups in grp.c so that Visual C++ doesn't complain anymore.
zip.c now works correctly when PhysicsFS is disallowing symlinks.
A few minor optimizations in zip.c, with a few more to come later.
Added VS.NET project files to CVS.
08222002 - Fixed ZIP_exists() to work with directories. Now breaks out of
__PHYSFS_verifySecurity() early if a path element is missing
(since all the others will be, too)...this check is only done
if symlinks are disabled, but we might as well save easy cycles
where we can.
08212002 - Did a couple tedious-for-small-rewards cleanups, optimizations,
corrections and streamlinings I've been meaning to do. Touched a
lot of code. One of the side results is that ZIP_isDirectory()
got fixed.
08192002 - Generalized sorting routines, moved them into physfs.c and removed
the multiple copies from the various archivers. Adding profiling
code (currently only for sort routines)...enable it with
--enable-profiling in the configure script. Fixed incorrect
behaviours in configure.in.
08172002 - Patched configure.in to work around buggy autoconfs.
08162002 - Fixed QPAK archiver, since I broke it (sorry!). Also fixed a
qpak memory leak.
08092002 - Added Quake PAK archiver (qpak.c) by Ed Sinjiashvili. Thanks!
Made (successful?) attempt to fix pthread-to-ui64 cast problem.
Check for OS/2 in configure.in, in case anyone gets autoconf and
such to work right on their OS/2 box.
08012002 - Patched win32.c to compile.
07302002 - Minor error handling fix (thanks, Alexander!)
07292002 - Found some memory leaks, thanks to Valgrind (which rules, btw).
Added Russian translations (koi8-r, cp1251, cp866, and iso-8859-5)
by Ed Sinjiashvili. Added Spanish translation by Pedro J. Pérez.
Debian package support in CVS, thanks to Colin Bayer. French
translation by Stéphane Peter.
07282002 - macclassic.c now returns human readable error messages instead of
ERR_OS_ERROR. Closing files on MacOS no longer fails if the volume
info can't be flushed. Minor error message tweak in os2.c. All
possible human-readable literal strings (including all those OS/2
and MacOS error messages) have moved to constants in
physfs_internal.h...this allows the library to be translated to
other spoken languages fairly easily.
07272002 - Patched the OS/2 code to be useful...works pretty well, now. Added
makeos2.cmd for building (not an ideal solution, but oh well).
Initialized some variables in zip.c to prevent compiler whining.
07262002 - Fixed a typo in documentation. Archivers with matching file
extensions are now given first shot at opening an archive, but if
they fail, the other archivers are tried. More fixes to zip.c's
ZIP_enumerateFiles(). Wrote an OS/2 platform driver based on API
specs and a heavy pounding of Google Groups...as I don't have an
OS/2 compiler at the moment, it probably doesn't even compile. :)
07252002 - configure.in and unix.c now deal with platforms that lack a
functional pthread library. Edward Rudd sent in a patch to the RPM
specfile to have the build system set the correct version.
Clean ups in grp.c, beos.cpp and macclassic.c.
07242002 - Rewrote ZIP_enumerate(). Hopefully it sucks less this time.
unix.c and configure.in now have the infrastructure to disable
the CD-ROM detection code, and use a stub that successfully (and
unconditionally) reports no detected discs. Currently this is
used on AtheOS (which doesn't have CD-ROM support at the moment
anyhow), but it will be useful to get the library up on odd,
Unix-like systems that don't use either getmntinfo() or getmntent().
07232002 - Cleaned up the cut-and-pastes in the various file enumeration
routines and moved it into __PHYSFS_addToLinkedStringList().
Tons more ZIP file enhancing. I'm fairly certain it's robust and
fast in every reasonable respect, now. GRP archiver now caches
the file table...it was generally overhauled like the ZIP driver.
Added "ls" as an alias of "enumerate" in test_physfs.
I lied about zip.c's robustness; disabled the enumeration code.
07212002 - More FreeBSD build system patches. Added some new autoconf spew to
.cvsignore. bootstrap now copies the appropriate Makefile.am
instead of rename()ing it.
07192002 - Cleaned up configure.in and unix.c so that we check by available
header to determine the appropriate CD-ROM detection code...this
should make this more future-proof (and probably get it building
out of the box on other BSD platforms.)
07172002 - Fixed seeking backwards in ZIP_seek(). Changed the error message
ERR_TOO_MANY_SYMLINKS to ERR_SYMLINK_LOOP. Patches to build system
and unix.c for FreeBSD compatibility. Added physfs.spec to
"make dist" archives (thanks, Edward Rudd!).
07152002 - Symlinks in ZIP archives are detected correctly now, I think.
07142002 - Use GetVolumeInformation() instead of GetDiskFreeSpace() in
win32.c's mediaInDrive() function. This allows Windows NT 3.x to
correctly detect CD-ROM drives. Library now appears to be fully
functional on WinNT 3.51...need to try NT 3.1 still. :)
Patches to new ZIP code; cleaned up bugs in symlink reading code,
but we incorrectly identify some entries as symlinks, which doesn't
fly...for now, symlink code is commented out, so symlinks look
like regular files (and reading from a symlink entry gives you
the link as file data).
07122002 - Rewrote the ZIP archiver to no longer use Gilles Vollant's unzip.c
code. Losing that abstraction should make the ZIP archiver
significantly more efficient, and halved the amount of code used.
Plus, being a control freak, I like my coding style more than
Gilles's. :) There are still bugs to shake out, but this is good
progress.
07112002 - configure.in updated to make it happier on newer autoconfs
(thanks again, Alexander!). FIXME cleanups.
07102002 - Added a byteorder-friendly convenience API, so you can read/write
data and convert to the native byteorder without too much effort.
Upped version to 0.1.7.
Build system corrections for BeOS and Cygwin (thanks, Alexander!).
Added RPM specfile for PhysicsFS (thanks, Edward Rudd!).
06292002 - Fixed incorrect error message when opening a file for read without
defining a search path. LOTS of win32 updates and fixes; lots of
things that were broken work now, and we are slowly becoming
more compatible with legacy win32 systems. Builds on Cygwin again.
All platform drivers (except beos.cpp) had a buffer overflow when
detecting mounted CD-ROM drives...it only occurs when a drive is
detected, and it probably won't result in your box getting rooted,
but upgrade soon anyhow. Readded the .cvsignore files from the old
build system.
06282002 - Reworked build system _AGAIN_.
06222002 - Alexander Pipelka spotted a bug in the file open routines in
posix.c; patched.
06152002 - Autoconf build system will now generate shared libraries on BeOS,
and (supposedly) Cygwin.
06142002 - Rewrote autoconf build system. It now works around the MacOS X bug
that prevented shared libraries from building.
06112002 - Updated CodeWarrior projects and added them to CVS. _Finally_
officially released 0.1.6.
06102002 - Major overhauls to platform/win32.c ... should work on all Windows
platforms, including 95/98/ME and NT/2K/XP flavors. Someone should
see if this builds on WinCE! :) You no longer need the latest
platform SDK to build it, either; the questionable DLL is accessed
with LoadLibrary() at runtime now, and handled if not present. This
now builds correctly on a freshly installed Visual Studio 6.0, and
the DLL it builds works everywhere. Plus, a bunch of other bugs
and incorrect behaviours were squashed. Visual Studio 6.0 project
file added to CVS.
06082002 - Fixes to __PHYSFS_platformEnumerateFiles() in win32.c: cleaned up
memory leak, handles paths more robustly, and prevents possible
skipped file entries. Removed AC_C_CONST and AC_TYPE_SIZE_T checks
from configure.in (not needed, and they broke BeOS build). Clean
out the docs/ directory when doing a "make dist". Fixed crashbug
when calling PHYSFS_deinit() more than once in a row. Tried to get
MacOS X to build a shared library, gave up; I'm doing something
wrong in my Makefile.am, I think. On MacOS X, running ./configure
--enable-static --disable-shared works, though. Hopefully someone
will fix this soon. In unix.c, the Darwin version of
__PHYSFS_platformDetectAvailableCDs() was free()ing a static
buffer; fixed.
06072002 - Manpages! Finally installed Doxygen and scratched together a
Doxyfile. After some revision to physfs.h, we've got a rather
nice API reference.
06062002 - Fixed __PHYSFS_platformSeek() in archivers/posix.c. Implemented the
getLastModTime method in archivers/zip.c (returns legitimate info)
and archivers/grp.c (returns lastmodtime of GRPfile itself in the
physical filesystem). Put a 64-bit _llseek() version of the seek()
and tell() methods in platform/posix.c, but you need to hack (or
rather, fix) configure.in to enable it. From Greg on win32.c: Fixed
file enumerator function (needed a wildcard '*' specification), CD
enumeration only reports CDs that have media, getLastModTime() has
been implemented.
06012002 - Added -Wall to debug builds. Removed ANSI stdio calls from
platform/posix.c, and replaced them with actual POSIX calls (that
is, fopen() became open(), fseek() became lseek(), etc...)
05272002 - Added some explicit casts when calling malloc() in platform/posix.c
05252002 - Added John Hall's file modification time patch, and added a
getlastmodtime command to test_physfs. Corrected error reporting
for missing files a little bit. Changed build system to only try
building beos.cpp if on a BeOS system (since we need a C++ compiler
available to do so). Implemented getLastModTime in macclassic.c.
05242002 - Upped version to 0.1.6 (not officially released yet).
05232002 - Fixed the build system to always package the complete source, not
just what we built for a given system, when doing a "make dist".
Updated INSTALL. Wrote BeOS platform code (platform/beos.cpp).
Split unix.c into unix.c and posix.c. Linux and BeOS both share
posix.c, although I don't think it's completely POSIX compliant at
this point (not that it matters much).
05212002 - Cleaned up some FIXMEs.
05202002 - Added .cvsignore files.
05162002 - Edward Rudd also caught an embarrassing screwup by me in
unix.c: the open-for-append call was using "wb+" instead of
"ab" when calling fopen(). Doh!
05152002 - configure script now deals with systems that have a readline
lib, but require it to be linked with curses. Thanks to Edward
Rudd for the patch.
05102002 - A trimmed-down zlib 1.1.4 is now included in the source distro, for
use by win32, MacOS, and Unix systems that don't have it installed
on the system. Autoconf support! Initial attempt at this. Lots of
stuff may be very broken.
05082002 - From Greg: More win32 work. Library is now 95% functional on win32.
Only known win32 problem is that the CD drives are reported whether
they contain a disc or not).
05062002 - From Greg: Win32 boxes without the latest Platform SDK can now
#define DISABLE_NT_SUPPORT. Other fixes.
04242002 - Updated win32 info in INSTALL to discuss Platform SDK issues.
04202002 - Added a (very) quick and (very) dirty http server to the
extras directory (public domain), as another example of using
the library.
04192002 - Corrected some win32 info in INSTALL. Changed Makefile to
package releases as .tar.gz instead of .tar.bz2.
04122002 - Some win32 cleanups and fixes across several files. Upped
version to 0.1.5.
04082002 - Fixed problem when calling __PHYSFS_setError before PHYSFS_init.
04062002 - Added MacOS info, etc to INSTALL. Patched unix.c and
test_physfs.c to compile on Darwin again.
04052002 - Added byte ordering API. Byte ordering fixes in grp.c, and some
cleanups in unzip.c. Mac work is more or less complete.
04042002 - Mac work continues. Almost complete, now. test_physfs now has
tests for write, append, and filelength, and most of the
commands can tolerate a quoted argument (although this is
hacky, it's good enough for these purposes). Upped test_physfs
version to 0.1.1. Added a malloc-failure check in the Unix
CD-ROM detection code.
04032002 - PHYSFS_init always makes sure the calling thread initializes its
error state. Win32 codebase is updated with mutex implementation
(thanks, Greg!).
04022002 - Mac work continues. Found a bug where we put a double dir
separator in if we had to resort to the fallback userdir (if
__PHYSFS_platformGetUserDir() returned NULL to calculateUserDir().
Made note of potential infinite recursion in platform driver docs.
04012002 - (_NOT_ an April Fool's Joke:) Started working on MacOS Classic
port. Added skeleton.c to platform directory. Minor patches to
get things compiling on Mac (notably, DirInfo conflicts with
a type exposed by MacOS's namespace-polluting API, and some
typecasting issues). Found a call to ferror() I had missed in
unzip.c.
03302002 - Mutexes! PhysicsFS should be thread safe now, so long as you
don't try to do something like close a file at the same time as
you are reading from it in another thread. All reasonable race
conditions should now be gone, but the new code will need some
eyeballing before we install it on life support systems or anything.
The mutex abstraction is implemented in unix.c, win32.c will be
updated shortly.
03292002 - Fixed a potential problem in ZIP_realpath() and some byte order
issues in zip.c. Converted unzip.c to use physfs file i/o
abstractions. Converted CHANGELOG to list latest entries first.
03242002 - Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit(). Win32
improvements by Gregory S. Read. Added PHYSFS_[us]int(8|16|32)
types...this breaks binary compatibility with previous PhysicsFS
releases! Added platform specific i/o functions, so we don't have
to rely on stdio anymore. Updated TODO with my comments on the
physfs mailing list. 1.0, here we come! Removed race condition from
grp.c and converted to file i/o abstraction layer calls from stdio.
Tons of other fixes and enhancements.
03202002 - Patched platform/win32.c to compile.
03152002 - PHYSFS_setSaneConfig() now handles failure to set the write dir
better. Patched makefile to link the test program. Changed all the
"write" functions to get data from a "const" buffer. Added an
"extras" dir, which currently contains PhysFS->SDL_RWops glue code.
03052002 - Made unix.c's timeslice implementation more portable, and added a
Darwin-specific means to detect CDs (thanks to Patrick Stein).
Minor cleanup in win32.c (changed "for (; condition ;)" into
"while (condition)" ...)
11142001 - Removed a redundant error check in platform/win32.c
10092001 - Syntax fixes in dir.c, a FIXME in grp.c, and a "cat" command in
the test program. Apparently I had accidentally removed a rather
crucial line from dir.c a few revisions ago, and no one noticed. :(
Fixed. The win32 userdir will default to the base dir, now.
09252001 - Changed API: PHYSFS_setSaneConfig() takes an organization name, and
sets up less directories. Be warned. Fixes from David Hedbor:
make setSaneConfig() set write directory correctly if it had to
create the directory, and make sure that the writing functions
get used in dir.c when a file is opened for writing/appending.
Updated CREDITS.
09142001 - David Hedbor submitted a patch to handle a case where the
current working directory has been deleted out from under the
process (both in platform/unix.c and physfs.c itself). Thanks,
David! Added a CREDITS file. Changed the format of the author field
in PHYSFS_ArchiveInfo to put the email address between "<>" instead
of "()" chars. Updated TODO. make install now deletes previous
revisions of the library. Changed version to 0.1.4.
09012001 - Happy September. Moved the Visual C project files and the zlib
source to a separate download. Look for it at
http://icculus.org/physfs/downloads/physfs-win32-support.zip ...
Updated the INSTALL doc for Win32 building. Rewrote win32.c's
__PHYSFS_platformRealPath() to not rely on Visual C's runtime lib,
which was the last Cygwin incompatibility (although the Makefile
needs to be updated to build a DLL under Cygwin). Tinkered with the
Makefile a little, but it needs more work. Started working on a
MacOS version. All I have is CodeWarrior 4, which is way out of
date, and (for what is supposed to be an ultra-user-friendly
environment) is completely uninituitive to me. Still, managed to
get most everything compiling, which improved the quality of the
code somewhat). Haven't tried to compile the zipfile support, and
I still can't link the library. Dunno what the hell I'm supposed
to do there. Isn't Unix supposed to be hard compared to this?
08312001 - Built PhysicsFS on Mandrake 8.0 for the PowerPC. Compiles clean,
but there's at least one byte-ordering issue in zip.c that needs
to be fixed.
08292001 - win32.c calculates the base dir with GetModuleFileName() first, now,
and falls back to SearchPath() if there were problems. Changed an
occurence of _MAX_PATH to MAX_PATH, so both CygWin and Visual C can
handle it.
08282001 - win32.c now checks HOMEDRIVE, HOMEPATH, and HOME when calculating
the userdir. Added include files that make it a little closer to
compiling under Cygwin. Added a TODO file. Fixed unix.c's
__PHYSFS_platformCalcBaseDir() so that it actually works. Fixed
Makefile so that it links the test program properly.
Changed version to 0.1.3.
08232001 - Fixed a potential free()ing of a NULL pointer in
__PHYSFS_platformEnumerateFiles() in platform/unix.c. Added
platform/win32.c. Other cleanups to get this compiling with
Visual C and CygWin. Added BAIL_MACRO for times when we were doing
BAIL_IF_MACRO(1, ...). Abstracted mkdir() in the platform drivers.
Added GRP setting output to showcfg in the Makefile. Updated INSTALL
with license info and Win32 build instructions. Dependency on the
readline library in test_physfs.c is now optional.
Changed version to 0.1.2.
08072001 - Changed version to 0.1.1.
08062001 - Added CD-ROM detection code to the unix platform driver.
08012001 - Added a safety memset in error setting, fixed URLs and email addr.
07282001 - Initial release.
--ryan. (icculus@icculus.org)
/* end of CHANGELOG ... */

View File

@ -1,383 +1,345 @@
# PhysicsFS; a portable, flexible file i/o abstraction.
# Copyright (C) 2007 Ryan C. Gordon.
#
# Please see the file LICENSE.txt in the source's root directory.
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
# The CMake project file is meant to get this compiling on all sorts of
# platforms quickly, and serve as the way Unix platforms and Linux distros
# package up official builds, but you don't _need_ to use this; we have
# built PhysicsFS to (hopefully) be able to drop into your project and
# compile, using preprocessor checks for platform-specific bits instead of
# testing in here.
PROJECT(PhysicsFS)
SET(PHYSFS_VERSION 1.1.1)
SET(PHYSFS_SOVERSION 1)
set(PHYSFS_VERSION 3.3.0)
cmake_minimum_required(VERSION 3.0)
project(PhysicsFS VERSION ${PHYSFS_VERSION} LANGUAGES C )
include(GNUInstallDirs)
# Increment this if/when we break backwards compatibility.
set(PHYSFS_SOVERSION 1)
set(PHYSFS_M_SRCS)
set(PHYSFS_CPP_SRCS)
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
IF(WIN32 AND NOT WINDOWS)
SET(WINDOWS TRUE)
ENDIF(WIN32 AND NOT WINDOWS)
# Bleh, let's do it for "APPLE" too.
IF(APPLE AND NOT MACOSX)
SET(MACOSX TRUE)
ENDIF(APPLE AND NOT MACOSX)
if(APPLE)
set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework IOKit -framework Foundation")
list(APPEND PHYSFS_M_SRCS src/physfs_platform_apple.m)
endif()
INCLUDE(CheckIncludeFile)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckCSourceCompiles)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall)
# Don't use -rpath.
set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
endif()
INCLUDE_DIRECTORIES(.)
#INCLUDE_DIRECTORIES(platform)
#INCLUDE_DIRECTORIES(archivers)
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
add_definitions(-xldscope=hidden)
endif()
IF(MACOSX)
# Fallback to older OS X on PowerPC to support wider range of systems...
IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
# Need these everywhere...
ADD_DEFINITIONS(-fno-common)
SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -framework Carbon -framework IOKit")
ENDIF(MACOSX)
# Add some gcc-specific command lines.
IF(CMAKE_COMPILER_IS_GNUCC)
# Always build with debug symbols...you can strip it later.
ADD_DEFINITIONS(-g -pipe -Werror -fsigned-char)
# Stupid BeOS generates warnings in the system headers.
IF(NOT BEOS)
ADD_DEFINITIONS(-Wall)
ENDIF(NOT BEOS)
CHECK_C_SOURCE_COMPILES("
#if ((defined(__GNUC__)) && (__GNUC__ >= 4))
int main(int argc, char **argv) { int is_gcc4 = 1; return 0; }
#else
#error This is not gcc4.
#endif
" PHYSFS_IS_GCC4)
IF(PHYSFS_IS_GCC4)
ADD_DEFINITIONS(-fvisibility=hidden)
ENDIF(PHYSFS_IS_GCC4)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
IF(MSVC)
# VS.NET 8.0 got really really anal about strcpy, etc, which even if we
# cleaned up our code, zlib, etc still use...so disable the warning.
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
ENDIF(MSVC)
# Basic chunks of source code ...
SET(ZLIB_SRCS
zlib123/adler32.c
zlib123/compress.c
zlib123/crc32.c
zlib123/deflate.c
zlib123/gzio.c
zlib123/infback.c
zlib123/inffast.c
zlib123/inflate.c
zlib123/inftrees.c
zlib123/trees.c
zlib123/uncompr.c
zlib123/zutil.c
)
SET(LZMA_SRCS
lzma/7zBuffer.c
lzma/7zCrc.c
lzma/7zDecode.c
lzma/7zExtract.c
lzma/7zHeader.c
lzma/7zIn.c
lzma/7zItem.c
lzma/7zMethodID.c
lzma/LzmaDecode.c
lzma/LzmaStateDecode.c
)
IF(BEOS)
if(HAIKU)
# We add this explicitly, since we don't want CMake to think this
# is a C++ project unless we're on BeOS.
SET(PHYSFS_BEOS_SRCS platform/beos.cpp)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} be root)
ENDIF(BEOS)
# is a C++ project unless we're on Haiku.
list(APPEND PHYSFS_CPP_SRCS src/physfs_platform_haiku.cpp)
find_library(BE_LIBRARY be)
find_library(ROOT_LIBRARY root)
list(APPEND OPTIONAL_LIBRARY_LIBS ${BE_LIBRARY} ${ROOT_LIBRARY})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(WINRT TRUE)
endif()
if(WINRT)
list(APPEND PHYSFS_CPP_SRCS src/physfs_platform_winrt.cpp)
endif()
if(UNIX AND NOT WIN32 AND NOT APPLE) # (MingW and such might be UNIX _and_ WINDOWS!)
find_library(PTHREAD_LIBRARY pthread)
if(PTHREAD_LIBRARY)
set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${PTHREAD_LIBRARY})
endif()
endif()
if(PHYSFS_CPP_SRCS)
enable_language(CXX)
endif()
# Almost everything is "compiled" here, but things that don't apply to the
# build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
# another project or bring up a new build system: just compile all the source
# code and #define the things you want.
SET(PHYSFS_SRCS
physfs.c
physfs_byteorder.c
physfs_unicode.c
platform/os2.c
platform/pocketpc.c
platform/posix.c
platform/unix.c
platform/macosx.c
platform/windows.c
archivers/dir.c
archivers/grp.c
archivers/hog.c
archivers/lzma.c
archivers/mvl.c
archivers/qpak.c
archivers/wad.c
archivers/zip.c
${PHYSFS_BEOS_SRCS}
set(PHYSFS_SRCS
src/physfs.c
src/physfs_byteorder.c
src/physfs_unicode.c
src/physfs_platform_posix.c
src/physfs_platform_unix.c
src/physfs_platform_windows.c
src/physfs_platform_os2.c
src/physfs_platform_qnx.c
src/physfs_platform_android.c
src/physfs_archiver_dir.c
src/physfs_archiver_unpacked.c
src/physfs_archiver_grp.c
src/physfs_archiver_hog.c
src/physfs_archiver_7z.c
src/physfs_archiver_mvl.c
src/physfs_archiver_qpak.c
src/physfs_archiver_wad.c
src/physfs_archiver_zip.c
src/physfs_archiver_slb.c
src/physfs_archiver_iso9660.c
src/physfs_archiver_vdf.c
${PHYSFS_CPP_SRCS}
${PHYSFS_M_SRCS}
)
# platform layers ...
IF(UNIX)
IF(BEOS)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
SET(HAVE_PTHREAD_H TRUE)
ELSE(BEOS)
# !!! FIXME
# AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek])
CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
IF(HAVE_UCRED_H)
ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
ENDIF(HAVE_UCRED_H)
CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
IF(HAVE_MNTENT_H)
ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
ENDIF(HAVE_MNTENT_H)
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
IF(HAVE_PTHREAD_H)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
ELSE(HAVE_PTHREAD_H)
ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1)
ENDIF(HAVE_PTHREAD_H)
ENDIF(BEOS)
ENDIF(UNIX)
IF(WINDOWS)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
ENDIF(WINDOWS)
IF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1)
MESSAGE(WARNING " ***")
MESSAGE(WARNING " *** There is no CD-ROM support in this build!")
MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.")
MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
MESSAGE(WARNING " *** but is this what you REALLY wanted?")
MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
MESSAGE(WARNING " ***")
ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
IF(PHYSFS_HAVE_THREAD_SUPPORT)
ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
MESSAGE(WARNING " ***")
MESSAGE(WARNING " *** There is no thread support in this build!")
MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")
MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
MESSAGE(WARNING " *** but is this what you REALLY wanted?")
MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
MESSAGE(WARNING " ***")
ENDIF(PHYSFS_HAVE_THREAD_SUPPORT)
CHECK_INCLUDE_FILE(assert.h HAVE_ASSERT_H)
IF(HAVE_ASSERT_H)
ADD_DEFINITIONS(-DHAVE_ASSERT_H=1)
ENDIF(HAVE_ASSERT_H)
# Archivers ...
# These are (mostly) on by default now, so these options are only useful for
# disabling them.
OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
IF(PHYSFS_ARCHIVE_ZIP)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
SET(PHYSFS_NEED_ZLIB TRUE)
ENDIF(PHYSFS_ARCHIVE_ZIP)
option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
if(NOT PHYSFS_ARCHIVE_ZIP)
add_definitions(-DPHYSFS_SUPPORTS_ZIP=0)
endif()
OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
IF(PHYSFS_ARCHIVE_7Z)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1)
# !!! FIXME: rename to 7z.c?
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
INCLUDE_DIRECTORIES(lzma)
ADD_DEFINITIONS(-D_LZMA_IN_CB=1)
ADD_DEFINITIONS(-D_LZMA_PROB32=1)
ADD_DEFINITIONS(-D_LZMA_SYSTEM_SIZE_T=1)
ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY=1)
ENDIF(PHYSFS_ARCHIVE_7Z)
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
if(NOT PHYSFS_ARCHIVE_7Z)
add_definitions(-DPHYSFS_SUPPORTS_7Z=0)
endif()
OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
IF(PHYSFS_ARCHIVE_GRP)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1)
ENDIF(PHYSFS_ARCHIVE_GRP)
option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
if(NOT PHYSFS_ARCHIVE_GRP)
add_definitions(-DPHYSFS_SUPPORTS_GRP=0)
endif()
OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
IF(PHYSFS_ARCHIVE_WAD)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1)
ENDIF(PHYSFS_ARCHIVE_WAD)
option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
if(NOT PHYSFS_ARCHIVE_WAD)
add_definitions(-DPHYSFS_SUPPORTS_WAD=0)
endif()
OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
IF(PHYSFS_ARCHIVE_HOG)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1)
ENDIF(PHYSFS_ARCHIVE_HOG)
option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
if(NOT PHYSFS_ARCHIVE_HOG)
add_definitions(-DPHYSFS_SUPPORTS_HOG=0)
endif()
OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
IF(PHYSFS_ARCHIVE_MVL)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1)
ENDIF(PHYSFS_ARCHIVE_MVL)
option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
if(NOT PHYSFS_ARCHIVE_MVL)
add_definitions(-DPHYSFS_SUPPORTS_MVL=0)
endif()
OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
IF(PHYSFS_ARCHIVE_QPAK)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1)
ENDIF(PHYSFS_ARCHIVE_QPAK)
option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
if(NOT PHYSFS_ARCHIVE_QPAK)
add_definitions(-DPHYSFS_SUPPORTS_QPAK=0)
endif()
option(PHYSFS_ARCHIVE_SLB "Enable I-War / Independence War SLB support" TRUE)
if(NOT PHYSFS_ARCHIVE_SLB)
add_definitions(-DPHYSFS_SUPPORTS_SLB=0)
endif()
option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
if(NOT PHYSFS_ARCHIVE_ISO9660)
add_definitions(-DPHYSFS_SUPPORTS_ISO9660=0)
endif()
option(PHYSFS_ARCHIVE_VDF "Enable Gothic I/II VDF archive support" TRUE)
if(NOT PHYSFS_ARCHIVE_VDF)
add_definitions(-DPHYSFS_SUPPORTS_VDF=0)
endif()
# See if some archiver required zlib, and see about using system version.
option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
if(PHYSFS_BUILD_STATIC)
add_library(physfs-static STATIC ${PHYSFS_SRCS})
add_library(PhysFS::PhysFS-static ALIAS physfs-static)
set_target_properties(physfs-static PROPERTIES EXPORT_NAME PhysFS-static)
# Don't rename this on Windows, since DLLs will also produce an import
# library named "physfs.lib" which would conflict; Unix tend to like the
# same library name with a different extension for static libs, but
# Windows can just have a separate name.
if(NOT MSVC)
set_target_properties(physfs-static PROPERTIES OUTPUT_NAME "physfs")
endif()
if(WINRT)
# Ignore LNK4264 warnings; we don't author any WinRT components, just consume them, so we're okay in a static library.
set_target_properties(physfs-static PROPERTIES VS_WINRT_COMPONENT True)
set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
endif()
if(WIN32 OR WINRT OR OS2)
# no dll exports from the static library
target_compile_definitions(physfs-static PRIVATE "PHYSFS_STATIC")
endif()
target_include_directories(physfs-static PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
target_link_libraries(physfs-static PRIVATE ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
set(PHYSFS_LIB_TARGET physfs-static)
list(APPEND PHYSFS_INSTALL_TARGETS "physfs-static")
endif()
IF(PHYSFS_NEED_ZLIB)
CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H)
IF(HAVE_ZLIB_H)
CHECK_LIBRARY_EXISTS("z" "inflate" "" HAVE_LIBZ)
IF(HAVE_LIBZ)
SET(HAVE_SYSTEM_ZLIB TRUE)
ENDIF(HAVE_LIBZ)
ENDIF(HAVE_ZLIB_H)
option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
if(PHYSFS_BUILD_SHARED)
add_library(physfs SHARED ${PHYSFS_SRCS})
add_library(PhysFS::PhysFS ALIAS physfs)
set_target_properties(physfs PROPERTIES MACOSX_RPATH 1)
set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
set_target_properties(physfs PROPERTIES EXPORT_NAME PhysFS)
if(WINRT)
set_target_properties(physfs PROPERTIES VS_WINRT_COMPONENT True)
endif()
if(OS2) # OS/2 does not support a DLL name longer than 8 characters.
set_target_properties(physfs PROPERTIES OUTPUT_NAME "physfs")
endif()
target_include_directories(physfs PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
target_link_libraries(physfs PRIVATE ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
set(PHYSFS_LIB_TARGET physfs)
list(APPEND PHYSFS_INSTALL_TARGETS "physfs")
endif()
IF(HAVE_SYSTEM_ZLIB)
OPTION(PHYSFS_INTERNAL_ZLIB "Link own zlib instead of system library" FALSE)
ELSE(HAVE_SYSTEM_ZLIB)
SET(PHYSFS_INTERNAL_ZLIB TRUE)
ENDIF(HAVE_SYSTEM_ZLIB)
IF(PHYSFS_INTERNAL_ZLIB)
INCLUDE_DIRECTORIES(zlib123)
ADD_DEFINITIONS(-DZ_PREFIX=1)
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${ZLIB_SRCS})
ELSE(PHYSFS_INTERNAL_ZLIB)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z)
ENDIF(PHYSFS_INTERNAL_ZLIB)
ENDIF(PHYSFS_NEED_ZLIB)
OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
IF(PHYSFS_BUILD_STATIC)
ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS})
SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs")
SET(PHYSFS_LIB_TARGET physfs-static)
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
ENDIF(PHYSFS_BUILD_STATIC)
OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
IF(PHYSFS_BUILD_SHARED)
ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
SET(PHYSFS_LIB_TARGET physfs)
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
ENDIF(PHYSFS_BUILD_SHARED)
IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
MESSAGE(FATAL "Both shared and static libraries are disabled!")
ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
message(FATAL "Both shared and static libraries are disabled!")
endif()
# CMake FAQ says I need this...
IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC AND NOT WIN32)
set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
endif()
OPTION(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
IF(PHYSFS_BUILD_TEST)
CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H)
CHECK_INCLUDE_FILE(readline/history.h HAVE_HISTORY_H)
IF(HAVE_READLINE_H AND HAVE_HISTORY_H)
SET(CMAKE_REQUIRED_LIBRARIES curses)
CHECK_LIBRARY_EXISTS("readline" "readline" "" HAVE_LIBREADLINE)
CHECK_LIBRARY_EXISTS("readline" "history" "" HAVE_LIBHISTORY)
IF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
SET(HAVE_SYSTEM_READLINE TRUE)
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses)
ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H)
ADD_EXECUTABLE(test_physfs test/test_physfs.c)
TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
ENDIF(PHYSFS_BUILD_TEST)
option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
mark_as_advanced(PHYSFS_BUILD_TEST)
if(PHYSFS_BUILD_TEST)
find_path(READLINE_H readline/readline.h)
find_path(HISTORY_H readline/history.h)
if(READLINE_H AND HISTORY_H)
find_library(CURSES_LIBRARY NAMES curses ncurses)
if(CURSES_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
find_library(READLINE_LIBRARY readline)
if(READLINE_LIBRARY)
set(HAVE_SYSTEM_READLINE TRUE)
list(APPEND TEST_PHYSFS_LIBS ${READLINE_LIBRARY} ${CURSES_LIBRARY})
include_directories(SYSTEM ${READLINE_H} ${HISTORY_H})
add_definitions(-DPHYSFS_HAVE_READLINE=1)
endif()
endif()
endif()
add_executable(test_physfs test/test_physfs.c)
target_link_libraries(test_physfs PRIVATE ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
list(APPEND PHYSFS_INSTALL_TARGETS test_physfs)
endif()
OPTION(PHYSFS_BUILD_WX_TEST "Build wxWidgets test program." TRUE)
MARK_AS_ADVANCED(PHYSFS_BUILD_WX_TEST)
IF(PHYSFS_BUILD_WX_TEST)
SET(wxWidgets_USE_LIBS base core adv)
SET(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1)
FIND_PACKAGE(wxWidgets)
IF(wxWidgets_FOUND)
INCLUDE(${wxWidgets_USE_FILE})
ADD_EXECUTABLE(wxtest_physfs test/wxtest_physfs.cpp)
SET_SOURCE_FILES_PROPERTIES(test/wxtest_physfs.cpp COMPILE_FLAGS ${wxWidgets_CXX_FLAGS})
TARGET_LINK_LIBRARIES(wxtest_physfs ${PHYSFS_LIB_TARGET} ${wxWidgets_LIBRARIES} ${OTHER_LDFLAGS})
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";wxtest_physfs")
ELSE(wxWidgets_FOUND)
MESSAGE(STATUS "wxWidgets not found. Disabling wx test app.")
SET(PHYSFS_BUILD_WX_TEST FALSE)
ENDIF(wxWidgets_FOUND)
ENDIF(PHYSFS_BUILD_WX_TEST)
option(PHYSFS_DISABLE_INSTALL "Disable installing PhysFS" OFF)
if(NOT PHYSFS_DISABLE_INSTALL)
INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(FILES physfs.h DESTINATION include)
install(TARGETS ${PHYSFS_INSTALL_TARGETS} EXPORT PhysFSExport
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES src/physfs.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation")
ELSE(DOXYGEN_FOUND)
MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.")
ENDIF(DOXYGEN_FOUND)
install(EXPORT PhysFSExport
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/PhysFS"
FILE PhysFSConfig.cmake
NAMESPACE PhysFS::
)
IF(UNIX)
ADD_CUSTOM_TARGET(dist ./extras/makedist.sh ${PHYSFS_VERSION} COMMENT "Building source tarball")
ENDIF(UNIX)
if(NOT MSVC)
configure_file(
"extras/physfs.pc.in"
"extras/physfs.pc"
@ONLY
)
MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE)
IF(${_VALUE})
MESSAGE(STATUS " ${_NAME}: enabled")
ELSE(${_VALUE})
MESSAGE(STATUS " ${_NAME}: disabled")
ENDIF(${_VALUE})
ENDMACRO(MESSAGE_BOOL_OPTION)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/extras/physfs.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
endif()
endif()
MESSAGE(STATUS "PhysicsFS will build with the following options:")
MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP)
MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z)
MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP)
MESSAGE_BOOL_OPTION("WAD support" PHYSFS_ARCHIVE_WAD)
MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG)
MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL)
MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK)
MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB)
MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC)
MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED)
MESSAGE_BOOL_OPTION("Build wxWidgets test program" PHYSFS_BUILD_WX_TEST)
MESSAGE_BOOL_OPTION("Build stdio test program" PHYSFS_BUILD_TEST)
IF(PHYSFS_BUILD_TEST)
MESSAGE_BOOL_OPTION(" Use readline in test program" HAVE_SYSTEM_READLINE)
ENDIF(PHYSFS_BUILD_TEST)
option(PHYSFS_BUILD_DOCS "Build doxygen based documentation" TRUE)
if(PHYSFS_BUILD_DOCS)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/docs/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")
set(PHYSFS_TARGETNAME_DOCS "docs" CACHE STRING "Name of 'docs' build target")
add_custom_target(
${PHYSFS_TARGETNAME_DOCS}
${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building documentation in 'docs' directory..."
)
else()
message(STATUS "Doxygen not found. You won't be able to build documentation.")
endif()
endif()
if(UNIX)
set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
set(PHYSFS_TARGETNAME_DIST "dist" CACHE STRING "Name of 'dist' build target")
add_custom_target(
${PHYSFS_TARGETNAME_DIST}
git archive --prefix="physfs-${PHYSFS_VERSION}/" --output="${PHYSFS_TARBALL}" HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
)
set(PHYSFS_TARGETNAME_UNINSTALL "uninstall" CACHE STRING "Name of 'uninstall' build target")
add_custom_target(
${PHYSFS_TARGETNAME_UNINSTALL}
"${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Uninstall the project..."
)
endif()
macro(message_bool_option _NAME _VALUE)
if(${_VALUE})
message(STATUS " ${_NAME}: enabled")
else()
message(STATUS " ${_NAME}: disabled")
endif()
endmacro()
message(STATUS "PhysicsFS will build with the following options:")
message_bool_option("ZIP support" PHYSFS_ARCHIVE_ZIP)
message_bool_option("7zip support" PHYSFS_ARCHIVE_7Z)
message_bool_option("GRP support" PHYSFS_ARCHIVE_GRP)
message_bool_option("WAD support" PHYSFS_ARCHIVE_WAD)
message_bool_option("HOG support" PHYSFS_ARCHIVE_HOG)
message_bool_option("MVL support" PHYSFS_ARCHIVE_MVL)
message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)
message_bool_option("SLB support" PHYSFS_ARCHIVE_SLB)
message_bool_option("VDF support" PHYSFS_ARCHIVE_VDF)
message_bool_option("ISO9660 support" PHYSFS_ARCHIVE_ISO9660)
message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
message_bool_option("Build Doxygen documentation" PHYSFS_BUILD_DOCS)
if(PHYSFS_BUILD_TEST)
message_bool_option(" Use readline in test program" HAVE_SYSTEM_READLINE)
endif()
# end of CMakeLists.txt ...

View File

@ -1,149 +0,0 @@
The latest PhysicsFS information and releases can be found at:
http://icculus.org/physfs/
Building is (ahem) very easy.
ALL PLATFORMS:
Please understand your rights and mine: read the text file LICENSE.txt in the
root of the source tree. If you can't abide by it, delete this source tree
now. The license is extremely liberal, even to closed-source, commercial
applications.
If you've got Doxygen (http://www.doxygen.org/) installed, you can run it
without any command line arguments in the root of the source tree to generate
the API reference (or build the "docs" target from your build system). This
is optional. You can browse the API docs online here:
http://icculus.org/physfs/docs/
UNIX:
You will need CMake (http://www.cmake.org/) 2.4 or later installed.
Run "cmake ." in the root of the source directory to generate Makefiles.
You can then run "ccmake ." and customize the build, but the defaults are
probably okay. You can have CMake generate KDevelop project files if you
prefer these.
Run "make". PhysicsFS will now build.
As root, run "make install".
If you get sick of the library, run "xargs rm < install_manifest.txt" as root
and it will remove all traces of the library from the system paths.
Primary Unix development is done with GNU/Linux, but PhysicsFS is known to
work out of the box with several flavors of Unix. It it doesn't work, patches
to get it running can be sent to icculus@icculus.org.
BeOS:
Use the "Unix" instructions, above. The CMake port to BeOS is fairly new at
the time of this writing, but it works. You can get a build of CMake from
bebits.com or build it yourself from source from cmake.org.
Windows:
If building with CygWin, mingw32 or something else that uses the GNU
toolchain, follow the Unix instructions, above.
If you want to use Visual Studio, nmake, or the Platform SDK, you will need
CMake (http://www.cmake.org/) 2.4 or later installed. Point CMake at the
CMakeLists.txt file in the root of the source directory and hit the
"Configure" button. After telling it what type of compiler you are targeting
(Borland, Visual Studio, etc), CMake will process for while and then give you
a list of options you can change (what archivers you want to support, etc).
If you aren't sure, the defaults are probably fine. Hit the "Configure"
button again, then "OK" once configuration has completed with options that
match your liking. Now project files for your favorite programming
environment will be generated for you in the directory you specified.
Go there and use them to build PhysicsFS.
PhysicsFS will only link directly against system libraries that have existed
since Windows 95 and Windows NT 3.51. If there's a newer API we want to use,
we try to dynamically load it at runtime and fallback to a reasonable
behaviour when we can't find it...this is used for Unicode support and
locating user-specific directories, etc.
PhysicsFS has not been tested on 64-bit Windows, but probably works. There is
no 16-bit Windows support at all. Reports of success and problems can go to
Ryan at icculus@icculus.org ...
If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear
from you; send an email to icculus@icculus.org ...
PocketPC/WindowsCE:
Code exists for PocketPC support, and there are shipping titles that used
PhysicsFS 1.0 on PocketPC...but it isn't tested in 2.0, and is probably
broken with the new build system. Please send patches.
MAC OS 8/9:
Classic Mac OS support has been dropped in PhysicsFS 2.0. Apple hasn't updated
pre-OSX versions in almost a decade at this point, none of the hardware
they've shipped will boot it for almost as many years, and finding
developer tools for it is becoming almost impossible. As the switch to Intel
hardware has removed the "Classic" emulation environment, it was time to
remove support from PhysicsFS. That being said, the PhysicsFS 1.0 branch can
still target back to Mac OS 8.5, so you can use that if you need support for
this legacy OS. We still very much support Mac OS X, though: see below.
MAC OS X:
You will need CMake (http://www.cmake.org/) 2.4 or later installed.
You can either generate a Unix makefile with CMake, or generate an Xcode
project, whichever makes you more comfortable.
PowerPC and Intel Macs should both be supported.
If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for
Mac OS X, I'd like to hear from you; send an email to icculus@icculus.org.
OS/2:
You need Innotek GCC and libc installed (or kLIBC). I tried this on a stock
Warp 4 install, no fixpaks. You need to install link386.exe (Selective
Install, "link object modules" option). Once klibc and GCC are installed
correctly, unpack the source to PhysicsFS and run the script
file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build
without users having to hunt down a "make" program.
Someone please port CMake to OS/2. Ideally I'd like to be able to target
Innotek GCC and OpenWatcom with CMake.
If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for
OS/2, I'd like to hear from you; send an email to icculus@icculus.org.
OTHER PLATFORMS:
Many Unix-like platforms might "just work" with CMake. Some of these platforms
are known to have worked at one time, but have not been heavily tested, if
tested at all. PhysicsFS is, as far as we know, 64-bit and byteorder clean,
and is known to compile on several compilers across many platforms. To
implement a new platform or archiver, please read the heavily-commented
physfs_internal.h and look in the platform/ and archiver/ directories for
examples.
--ryan. (icculus@icculus.org)

View File

@ -1,29 +1,17 @@
Copyright (c) 2001-2022 Ryan C. Gordon <icculus@icculus.org> and others.
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 the use of this software.
Copyright (c) 2003 Ryan C. Gordon and others.
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
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@icculus.org>
(Please note that versions of PhysicsFS prior to 0.1.9 are licensed under
the GNU Lesser General Public License, which restricts you significantly more.
For your own safety, please make sure you've got 0.1.9 or later if you plan
to use physfs in a commercial or closed-source project.)
3. This notice may not be removed or altered from any source distribution.

9
README.txt Normal file
View File

@ -0,0 +1,9 @@
PhysicsFS; a portable, flexible file i/o abstraction.
https://icculus.org/physfs/
Please see the docs directory for documentation.
Please see LICENSE.txt for licensing information.

View File

@ -1,45 +0,0 @@
Stuff that needs to be done and wishlist:
These are in no particular order.
Some might be dupes, some might be done already.
UNICODE:
- OS/2: Codepages. No full Unicode in the filesystem, but we can probably make
a conversion effort.
Stuff:
- Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less
important, since streaming archives aren't of much value to games (which
is why zipfiles are king: random access), but it could have uses for, say,
an installer/updater.
- Reduce malloc() pressure all over the place. We fragment memory like mad.
- profile string list interpolation.
- We have two different ways to find dir entries in zip.c.
- Do symlinks in zip archiver work when they point to dirs?
- Enable more warnings?
- Use __cdecl in physfs.h?
- Look for FIXMEs (many marked with "!!!" in comments).
- Find some way to relax or remove the security model for external tools.
- OSX shouldn't use ~/.app for userdir.
- fscanf and fprintf support in extras dir.
- Why do we call it openArchive and dirClose?
- Sanity check byte order at runtime.
- Memory locking?
- Find a better name than dvoid and fvoid.
- Can windows.c and pocketpc.c get merged?
- There's so much cut-and-paste between archivers...can this be reduced?
- General code audit.
- Multiple write dirs with mount points?
- Deprecate PHYSFS_setSaneConfig and move it to extras?
- Why is physfsrwops.c cut-and-pasted into the ruby bindings?
- Replace code from SDL...
- Should file enumeration return an error or set error state?
- Need "getmountpoint" command in test_physfs.c ...
- Look for calloc() calls that aren't going through the allocation hooks.
- Write up a simple HOWTO on embedding physicsfs in another project.
- Archivers need abstracted i/o to read from memory or files (archives in archives?)
- Probably other stuff. Requests and recommendations are welcome.
// end of TODO.txt ...

View File

@ -1,283 +0,0 @@
/*
* Standard directory I/O support routines for PhysicsFS.
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
static PHYSFS_sint64 DIR_read(fvoid *opaque, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
PHYSFS_sint64 retval;
retval = __PHYSFS_platformRead(opaque, buffer, objSize, objCount);
return(retval);
} /* DIR_read */
static PHYSFS_sint64 DIR_write(fvoid *opaque, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
PHYSFS_sint64 retval;
retval = __PHYSFS_platformWrite(opaque, buffer, objSize, objCount);
return(retval);
} /* DIR_write */
static int DIR_eof(fvoid *opaque)
{
return(__PHYSFS_platformEOF(opaque));
} /* DIR_eof */
static PHYSFS_sint64 DIR_tell(fvoid *opaque)
{
return(__PHYSFS_platformTell(opaque));
} /* DIR_tell */
static int DIR_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
return(__PHYSFS_platformSeek(opaque, offset));
} /* DIR_seek */
static PHYSFS_sint64 DIR_fileLength(fvoid *opaque)
{
return(__PHYSFS_platformFileLength(opaque));
} /* DIR_fileLength */
static int DIR_fileClose(fvoid *opaque)
{
/*
* we manually flush the buffer, since that's the place a close will
* most likely fail, but that will leave the file handle in an undefined
* state if it fails. Flush failures we can recover from.
*/
BAIL_IF_MACRO(!__PHYSFS_platformFlush(opaque), NULL, 0);
BAIL_IF_MACRO(!__PHYSFS_platformClose(opaque), NULL, 0);
return(1);
} /* DIR_fileClose */
static int DIR_isArchive(const char *filename, int forWriting)
{
/* directories ARE archives in this driver... */
return(__PHYSFS_platformIsDirectory(filename));
} /* DIR_isArchive */
static void *DIR_openArchive(const char *name, int forWriting)
{
const char *dirsep = PHYSFS_getDirSeparator();
char *retval = NULL;
size_t namelen = strlen(name);
size_t seplen = strlen(dirsep);
/* !!! FIXME: when is this not called right before openArchive? */
BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
ERR_UNSUPPORTED_ARCHIVE, 0);
retval = allocator.Malloc(namelen + seplen + 1);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
/* make sure there's a dir separator at the end of the string */
strcpy(retval, name);
if (strcmp((name + namelen) - seplen, dirsep) != 0)
strcat(retval, dirsep);
return(retval);
} /* DIR_openArchive */
static void DIR_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
char *d = __PHYSFS_platformCvtToDependent((char *)opaque, dname, NULL);
if (d != NULL)
{
__PHYSFS_platformEnumerateFiles(d, omitSymLinks, cb,
origdir, callbackdata);
allocator.Free(d);
} /* if */
} /* DIR_enumerateFiles */
static int DIR_exists(dvoid *opaque, const char *name)
{
char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
int retval;
BAIL_IF_MACRO(f == NULL, NULL, 0);
retval = __PHYSFS_platformExists(f);
allocator.Free(f);
return(retval);
} /* DIR_exists */
static int DIR_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
char *d = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
int retval = 0;
BAIL_IF_MACRO(d == NULL, NULL, 0);
*fileExists = __PHYSFS_platformExists(d);
if (*fileExists)
retval = __PHYSFS_platformIsDirectory(d);
allocator.Free(d);
return(retval);
} /* DIR_isDirectory */
static int DIR_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
int retval = 0;
BAIL_IF_MACRO(f == NULL, NULL, 0);
*fileExists = __PHYSFS_platformExists(f);
if (*fileExists)
retval = __PHYSFS_platformIsSymLink(f);
allocator.Free(f);
return(retval);
} /* DIR_isSymLink */
static PHYSFS_sint64 DIR_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
char *d = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
PHYSFS_sint64 retval = -1;
BAIL_IF_MACRO(d == NULL, NULL, 0);
*fileExists = __PHYSFS_platformExists(d);
if (*fileExists)
retval = __PHYSFS_platformGetLastModTime(d);
allocator.Free(d);
return(retval);
} /* DIR_getLastModTime */
static fvoid *doOpen(dvoid *opaque, const char *name,
void *(*openFunc)(const char *filename),
int *fileExists)
{
char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
void *rc = NULL;
BAIL_IF_MACRO(f == NULL, NULL, NULL);
if (fileExists != NULL)
{
*fileExists = __PHYSFS_platformExists(f);
if (!(*fileExists))
{
allocator.Free(f);
return(NULL);
} /* if */
} /* if */
rc = openFunc(f);
allocator.Free(f);
return((fvoid *) rc);
} /* doOpen */
static fvoid *DIR_openRead(dvoid *opaque, const char *fnm, int *exist)
{
return(doOpen(opaque, fnm, __PHYSFS_platformOpenRead, exist));
} /* DIR_openRead */
static fvoid *DIR_openWrite(dvoid *opaque, const char *filename)
{
return(doOpen(opaque, filename, __PHYSFS_platformOpenWrite, NULL));
} /* DIR_openWrite */
static fvoid *DIR_openAppend(dvoid *opaque, const char *filename)
{
return(doOpen(opaque, filename, __PHYSFS_platformOpenAppend, NULL));
} /* DIR_openAppend */
static int DIR_remove(dvoid *opaque, const char *name)
{
char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
int retval;
BAIL_IF_MACRO(f == NULL, NULL, 0);
retval = __PHYSFS_platformDelete(f);
allocator.Free(f);
return(retval);
} /* DIR_remove */
static int DIR_mkdir(dvoid *opaque, const char *name)
{
char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
int retval;
BAIL_IF_MACRO(f == NULL, NULL, 0);
retval = __PHYSFS_platformMkDir(f);
allocator.Free(f);
return(retval);
} /* DIR_mkdir */
static void DIR_dirClose(dvoid *opaque)
{
allocator.Free(opaque);
} /* DIR_dirClose */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
{
"",
DIR_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_DIR =
{
&__PHYSFS_ArchiveInfo_DIR,
DIR_isArchive, /* isArchive() method */
DIR_openArchive, /* openArchive() method */
DIR_enumerateFiles, /* enumerateFiles() method */
DIR_exists, /* exists() method */
DIR_isDirectory, /* isDirectory() method */
DIR_isSymLink, /* isSymLink() method */
DIR_getLastModTime, /* getLastModTime() method */
DIR_openRead, /* openRead() method */
DIR_openWrite, /* openWrite() method */
DIR_openAppend, /* openAppend() method */
DIR_remove, /* remove() method */
DIR_mkdir, /* mkdir() method */
DIR_dirClose, /* dirClose() method */
DIR_read, /* read() method */
DIR_write, /* write() method */
DIR_eof, /* eof() method */
DIR_tell, /* tell() method */
DIR_seek, /* seek() method */
DIR_fileLength, /* fileLength() method */
DIR_fileClose /* fileClose() method */
};
/* end of dir.c ... */

View File

@ -1,467 +0,0 @@
/*
* GRP support routines for PhysicsFS.
*
* This driver handles BUILD engine archives ("groupfiles"). This format
* (but not this driver) was put together by Ken Silverman.
*
* The format is simple enough. In Ken's words:
*
* What's the .GRP file format?
*
* The ".grp" file format is just a collection of a lot of files stored
* into 1 big one. I tried to make the format as simple as possible: The
* first 12 bytes contains my name, "KenSilverman". The next 4 bytes is
* the number of files that were compacted into the group file. Then for
* each file, there is a 16 byte structure, where the first 12 bytes are
* the filename, and the last 4 bytes are the file's size. The rest of
* the group file is just the raw data packed one after the other in the
* same order as the list of files.
*
* (That info is from http://www.advsys.net/ken/build.htm ...)
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#if (defined PHYSFS_SUPPORTS_GRP)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
typedef struct
{
char name[13];
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} GRPentry;
typedef struct
{
char *filename;
PHYSFS_sint64 last_mod_time;
PHYSFS_uint32 entryCount;
GRPentry *entries;
} GRPinfo;
typedef struct
{
void *handle;
GRPentry *entry;
PHYSFS_uint32 curPos;
} GRPfileinfo;
static void GRP_dirClose(dvoid *opaque)
{
GRPinfo *info = ((GRPinfo *) opaque);
allocator.Free(info->filename);
allocator.Free(info->entries);
allocator.Free(info);
} /* GRP_dirClose */
static PHYSFS_sint64 GRP_read(fvoid *opaque, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
GRPfileinfo *finfo = (GRPfileinfo *) opaque;
GRPentry *entry = finfo->entry;
PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (PHYSFS_uint32) (rc * objSize);
return(rc);
} /* GRP_read */
static PHYSFS_sint64 GRP_write(fvoid *opaque, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* GRP_write */
static int GRP_eof(fvoid *opaque)
{
GRPfileinfo *finfo = (GRPfileinfo *) opaque;
GRPentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* GRP_eof */
static PHYSFS_sint64 GRP_tell(fvoid *opaque)
{
return(((GRPfileinfo *) opaque)->curPos);
} /* GRP_tell */
static int GRP_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
GRPfileinfo *finfo = (GRPfileinfo *) opaque;
GRPentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
return(rc);
} /* GRP_seek */
static PHYSFS_sint64 GRP_fileLength(fvoid *opaque)
{
GRPfileinfo *finfo = (GRPfileinfo *) opaque;
return((PHYSFS_sint64) finfo->entry->size);
} /* GRP_fileLength */
static int GRP_fileClose(fvoid *opaque)
{
GRPfileinfo *finfo = (GRPfileinfo *) opaque;
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
allocator.Free(finfo);
return(1);
} /* GRP_fileClose */
static int grp_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count)
{
PHYSFS_uint8 buf[12];
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
if (__PHYSFS_platformRead(*fh, buf, 12, 1) != 1)
goto openGrp_failed;
if (memcmp(buf, "KenSilverman", 12) != 0)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openGrp_failed;
} /* if */
if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
goto openGrp_failed;
*count = PHYSFS_swapULE32(*count);
return(1);
openGrp_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
return(0);
} /* grp_open */
static int GRP_isArchive(const char *filename, int forWriting)
{
void *fh;
PHYSFS_uint32 fileCount;
int retval = grp_open(filename, forWriting, &fh, &fileCount);
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(retval);
} /* GRP_isArchive */
static int grp_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
GRPentry *a = (GRPentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* grp_entry_cmp */
static void grp_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
GRPentry tmp;
GRPentry *first = &(((GRPentry *) _a)[one]);
GRPentry *second = &(((GRPentry *) _a)[two]);
memcpy(&tmp, first, sizeof (GRPentry));
memcpy(first, second, sizeof (GRPentry));
memcpy(second, &tmp, sizeof (GRPentry));
} /* grp_entry_swap */
static int grp_load_entries(const char *name, int forWriting, GRPinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
PHYSFS_uint32 location = 16; /* sizeof sig. */
GRPentry *entry;
char *ptr;
BAIL_IF_MACRO(!grp_open(name, forWriting, &fh, &fileCount), NULL, 0);
info->entryCount = fileCount;
info->entries = (GRPentry *) allocator.Malloc(sizeof(GRPentry)*fileCount);
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
location += (16 * fileCount);
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
if (__PHYSFS_platformRead(fh, &entry->name, 12, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->name[12] = '\0'; /* name isn't null-terminated in file. */
if ((ptr = strchr(entry->name, ' ')) != NULL)
*ptr = '\0'; /* trim extra spaces. */
if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = location;
location += entry->size;
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
grp_entry_cmp, grp_entry_swap);
return(1);
} /* grp_load_entries */
static void *GRP_openArchive(const char *name, int forWriting)
{
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
GRPinfo *info = (GRPinfo *) allocator.Malloc(sizeof (GRPinfo));
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
memset(info, '\0', sizeof (GRPinfo));
info->filename = (char *) allocator.Malloc(strlen(name) + 1);
GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, GRP_openArchive_failed);
if (!grp_load_entries(name, forWriting, info))
goto GRP_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
return(info);
GRP_openArchive_failed:
if (info != NULL)
{
if (info->filename != NULL)
allocator.Free(info->filename);
if (info->entries != NULL)
allocator.Free(info->entries);
allocator.Free(info);
} /* if */
return(NULL);
} /* GRP_openArchive */
static void GRP_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
/* no directories in GRP files. */
if (*dname == '\0')
{
GRPinfo *info = (GRPinfo *) opaque;
GRPentry *entry = info->entries;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
for (i = 0; i < max; i++, entry++)
cb(callbackdata, origdir, entry->name);
} /* if */
} /* GRP_enumerateFiles */
static GRPentry *grp_find_entry(GRPinfo *info, const char *name)
{
char *ptr = strchr(name, '.');
GRPentry *a = info->entries;
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
int rc;
/*
* Rule out filenames to avoid unneeded processing...no dirs,
* big filenames, or extensions > 3 chars.
*/
BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
rc = strcmp(name, a[middle].name);
if (rc == 0) /* found it! */
return(&a[middle]);
else if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* grp_find_entry */
static int GRP_exists(dvoid *opaque, const char *name)
{
return(grp_find_entry((GRPinfo *) opaque, name) != NULL);
} /* GRP_exists */
static int GRP_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = GRP_exists(opaque, name);
return(0); /* never directories in a groupfile. */
} /* GRP_isDirectory */
static int GRP_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = GRP_exists(opaque, name);
return(0); /* never symlinks in a groupfile. */
} /* GRP_isSymLink */
static PHYSFS_sint64 GRP_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
GRPinfo *info = (GRPinfo *) opaque;
PHYSFS_sint64 retval = -1;
*fileExists = (grp_find_entry(info, name) != NULL);
if (*fileExists) /* use time of GRP itself in the physical filesystem. */
retval = info->last_mod_time;
return(retval);
} /* GRP_getLastModTime */
static fvoid *GRP_openRead(dvoid *opaque, const char *fnm, int *fileExists)
{
GRPinfo *info = (GRPinfo *) opaque;
GRPfileinfo *finfo;
GRPentry *entry;
entry = grp_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
finfo = (GRPfileinfo *) allocator.Malloc(sizeof (GRPfileinfo));
BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
allocator.Free(finfo);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
return(finfo);
} /* GRP_openRead */
static fvoid *GRP_openWrite(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* GRP_openWrite */
static fvoid *GRP_openAppend(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* GRP_openAppend */
static int GRP_remove(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* GRP_remove */
static int GRP_mkdir(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* GRP_mkdir */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP =
{
"GRP",
GRP_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_GRP =
{
&__PHYSFS_ArchiveInfo_GRP,
GRP_isArchive, /* isArchive() method */
GRP_openArchive, /* openArchive() method */
GRP_enumerateFiles, /* enumerateFiles() method */
GRP_exists, /* exists() method */
GRP_isDirectory, /* isDirectory() method */
GRP_isSymLink, /* isSymLink() method */
GRP_getLastModTime, /* getLastModTime() method */
GRP_openRead, /* openRead() method */
GRP_openWrite, /* openWrite() method */
GRP_openAppend, /* openAppend() method */
GRP_remove, /* remove() method */
GRP_mkdir, /* mkdir() method */
GRP_dirClose, /* dirClose() method */
GRP_read, /* read() method */
GRP_write, /* write() method */
GRP_eof, /* eof() method */
GRP_tell, /* tell() method */
GRP_seek, /* seek() method */
GRP_fileLength, /* fileLength() method */
GRP_fileClose /* fileClose() method */
};
#endif /* defined PHYSFS_SUPPORTS_GRP */
/* end of grp.c ... */

View File

@ -1,506 +0,0 @@
/*
* HOG support routines for PhysicsFS.
*
* This driver handles Descent I/II HOG archives.
*
* The format is very simple:
*
* The file always starts with the 3-byte signature "DHF" (Descent
* HOG file). After that the files of a HOG are just attached after
* another, divided by a 17 bytes header, which specifies the name
* and length (in bytes) of the forthcoming file! So you just read
* the header with its information of how big the following file is,
* and then skip exact that number of bytes to get to the next file
* in that HOG.
*
* char sig[3] = {'D', 'H', 'F'}; // "DHF"=Descent HOG File
*
* struct {
* char file_name[13]; // Filename, padded to 13 bytes with 0s
* int file_size; // filesize in bytes
* char data[file_size]; // The file data
* } FILE_STRUCT; // Repeated until the end of the file.
*
* (That info is from http://www.descent2.com/ddn/specs/hog/)
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Bradley Bell.
* Based on grp.c by Ryan C. Gordon.
*/
#if (defined PHYSFS_SUPPORTS_HOG)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
/*
* One HOGentry is kept for each file in an open HOG archive.
*/
typedef struct
{
char name[13];
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} HOGentry;
/*
* One HOGinfo is kept for each open HOG archive.
*/
typedef struct
{
char *filename;
PHYSFS_sint64 last_mod_time;
PHYSFS_uint32 entryCount;
HOGentry *entries;
} HOGinfo;
/*
* One HOGfileinfo is kept for each open file in a HOG archive.
*/
typedef struct
{
void *handle;
HOGentry *entry;
PHYSFS_uint32 curPos;
} HOGfileinfo;
static void HOG_dirClose(dvoid *opaque)
{
HOGinfo *info = ((HOGinfo *) opaque);
allocator.Free(info->filename);
allocator.Free(info->entries);
allocator.Free(info);
} /* HOG_dirClose */
static PHYSFS_sint64 HOG_read(fvoid *opaque, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
HOGfileinfo *finfo = (HOGfileinfo *) opaque;
HOGentry *entry = finfo->entry;
PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (PHYSFS_uint32) (rc * objSize);
return(rc);
} /* HOG_read */
static PHYSFS_sint64 HOG_write(fvoid *opaque, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* HOG_write */
static int HOG_eof(fvoid *opaque)
{
HOGfileinfo *finfo = (HOGfileinfo *) opaque;
HOGentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* HOG_eof */
static PHYSFS_sint64 HOG_tell(fvoid *opaque)
{
return(((HOGfileinfo *) opaque)->curPos);
} /* HOG_tell */
static int HOG_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
HOGfileinfo *finfo = (HOGfileinfo *) opaque;
HOGentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
return(rc);
} /* HOG_seek */
static PHYSFS_sint64 HOG_fileLength(fvoid *opaque)
{
HOGfileinfo *finfo = (HOGfileinfo *) opaque;
return((PHYSFS_sint64) finfo->entry->size);
} /* HOG_fileLength */
static int HOG_fileClose(fvoid *opaque)
{
HOGfileinfo *finfo = (HOGfileinfo *) opaque;
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
allocator.Free(finfo);
return(1);
} /* HOG_fileClose */
static int hog_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count)
{
PHYSFS_uint8 buf[13];
PHYSFS_uint32 size;
PHYSFS_sint64 pos;
*count = 0;
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
if (__PHYSFS_platformRead(*fh, buf, 3, 1) != 1)
goto openHog_failed;
if (memcmp(buf, "DHF", 3) != 0)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openHog_failed;
} /* if */
while (1)
{
if (__PHYSFS_platformRead(*fh, buf, 13, 1) != 1)
break; /* eof here is ok */
if (__PHYSFS_platformRead(*fh, &size, 4, 1) != 1)
goto openHog_failed;
size = PHYSFS_swapULE32(size);
(*count)++;
/* Skip over entry... */
pos = __PHYSFS_platformTell(*fh);
if (pos == -1)
goto openHog_failed;
if (!__PHYSFS_platformSeek(*fh, pos + size))
goto openHog_failed;
} /* while */
/* Rewind to start of entries... */
if (!__PHYSFS_platformSeek(*fh, 3))
goto openHog_failed;
return(1);
openHog_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
return(0);
} /* hog_open */
static int HOG_isArchive(const char *filename, int forWriting)
{
void *fh;
PHYSFS_uint32 fileCount;
int retval = hog_open(filename, forWriting, &fh, &fileCount);
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(retval);
} /* HOG_isArchive */
static int hog_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
HOGentry *a = (HOGentry *) _a;
return(__PHYSFS_stricmpASCII(a[one].name, a[two].name));
} /* hog_entry_cmp */
static void hog_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
HOGentry tmp;
HOGentry *first = &(((HOGentry *) _a)[one]);
HOGentry *second = &(((HOGentry *) _a)[two]);
memcpy(&tmp, first, sizeof (HOGentry));
memcpy(first, second, sizeof (HOGentry));
memcpy(second, &tmp, sizeof (HOGentry));
} /* hog_entry_swap */
static int hog_load_entries(const char *name, int forWriting, HOGinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
HOGentry *entry;
BAIL_IF_MACRO(!hog_open(name, forWriting, &fh, &fileCount), NULL, 0);
info->entryCount = fileCount;
info->entries = (HOGentry *) allocator.Malloc(sizeof(HOGentry)*fileCount);
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
if (__PHYSFS_platformRead(fh, &entry->name, 13, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = (unsigned int) __PHYSFS_platformTell(fh);
if (entry->startPos == -1)
{
__PHYSFS_platformClose(fh);
return(0);
}
/* Skip over entry */
if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size))
{
__PHYSFS_platformClose(fh);
return(0);
}
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
hog_entry_cmp, hog_entry_swap);
return(1);
} /* hog_load_entries */
static void *HOG_openArchive(const char *name, int forWriting)
{
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
memset(info, '\0', sizeof (HOGinfo));
info->filename = (char *) allocator.Malloc(strlen(name) + 1);
GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, HOG_openArchive_failed);
if (!hog_load_entries(name, forWriting, info))
goto HOG_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
return(info);
HOG_openArchive_failed:
if (info != NULL)
{
if (info->filename != NULL)
allocator.Free(info->filename);
if (info->entries != NULL)
allocator.Free(info->entries);
allocator.Free(info);
} /* if */
return(NULL);
} /* HOG_openArchive */
static void HOG_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
/* no directories in HOG files. */
if (*dname == '\0')
{
HOGinfo *info = (HOGinfo *) opaque;
HOGentry *entry = info->entries;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
for (i = 0; i < max; i++, entry++)
cb(callbackdata, origdir, entry->name);
} /* if */
} /* HOG_enumerateFiles */
static HOGentry *hog_find_entry(HOGinfo *info, const char *name)
{
char *ptr = strchr(name, '.');
HOGentry *a = info->entries;
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
int rc;
/*
* Rule out filenames to avoid unneeded processing...no dirs,
* big filenames, or extensions > 3 chars.
*/
BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
rc = __PHYSFS_stricmpASCII(name, a[middle].name);
if (rc == 0) /* found it! */
return(&a[middle]);
else if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* hog_find_entry */
static int HOG_exists(dvoid *opaque, const char *name)
{
return(hog_find_entry(((HOGinfo *) opaque), name) != NULL);
} /* HOG_exists */
static int HOG_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = HOG_exists(opaque, name);
return(0); /* never directories in a groupfile. */
} /* HOG_isDirectory */
static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = HOG_exists(opaque, name);
return(0); /* never symlinks in a groupfile. */
} /* HOG_isSymLink */
static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
HOGinfo *info = ((HOGinfo *) opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (hog_find_entry(info, name) != NULL);
if (*fileExists) /* use time of HOG itself in the physical filesystem. */
retval = info->last_mod_time;
return(retval);
} /* HOG_getLastModTime */
static fvoid *HOG_openRead(dvoid *opaque, const char *fnm, int *fileExists)
{
HOGinfo *info = ((HOGinfo *) opaque);
HOGfileinfo *finfo;
HOGentry *entry;
entry = hog_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
finfo = (HOGfileinfo *) allocator.Malloc(sizeof (HOGfileinfo));
BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
allocator.Free(finfo);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
return(finfo);
} /* HOG_openRead */
static fvoid *HOG_openWrite(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* HOG_openWrite */
static fvoid *HOG_openAppend(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* HOG_openAppend */
static int HOG_remove(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* HOG_remove */
static int HOG_mkdir(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* HOG_mkdir */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG =
{
"HOG",
HOG_ARCHIVE_DESCRIPTION,
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_HOG =
{
&__PHYSFS_ArchiveInfo_HOG,
HOG_isArchive, /* isArchive() method */
HOG_openArchive, /* openArchive() method */
HOG_enumerateFiles, /* enumerateFiles() method */
HOG_exists, /* exists() method */
HOG_isDirectory, /* isDirectory() method */
HOG_isSymLink, /* isSymLink() method */
HOG_getLastModTime, /* getLastModTime() method */
HOG_openRead, /* openRead() method */
HOG_openWrite, /* openWrite() method */
HOG_openAppend, /* openAppend() method */
HOG_remove, /* remove() method */
HOG_mkdir, /* mkdir() method */
HOG_dirClose, /* dirClose() method */
HOG_read, /* read() method */
HOG_write, /* write() method */
HOG_eof, /* eof() method */
HOG_tell, /* tell() method */
HOG_seek, /* seek() method */
HOG_fileLength, /* fileLength() method */
HOG_fileClose /* fileClose() method */
};
#endif /* defined PHYSFS_SUPPORTS_HOG */
/* end of hog.c ... */

View File

@ -1,693 +0,0 @@
/*
* LZMA support routines for PhysicsFS.
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file is written by Dennis Schridde, with some peeking at "7zMain.c"
* by Igor Pavlov.
*/
#if (defined PHYSFS_SUPPORTS_7Z)
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
#ifndef _LZMA_IN_CB
#define _LZMA_IN_CB
/* Use callback for input data */
#endif
/* #define _LZMA_OUT_READ */
/* Use read function for output data */
#ifndef _LZMA_PROB32
#define _LZMA_PROB32
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
#endif
#ifndef _LZMA_SYSTEM_SIZE_T
#define _LZMA_SYSTEM_SIZE_T
/* Use system's size_t. You can use it to enable 64-bit sizes supporting */
#endif
#include "7zIn.h"
#include "7zCrc.h"
#include "7zExtract.h"
/* 7z internal from 7zIn.c */
int TestSignatureCandidate(Byte *testBytes);
typedef struct _CFileInStream
{
ISzInStream InStream;
void *File;
} CFileInStream;
/*
* In LZMA the archive is splited in blocks, those are called folders
* Set by LZMA_read()
*/
typedef struct _LZMAfolder
{
PHYSFS_uint8 *cache; /* Cached folder */
PHYSFS_uint32 size; /* Size of folder */
PHYSFS_uint32 index; /* Index of folder in archive */
PHYSFS_uint32 references; /* Number of files using this block */
} LZMAfolder;
/*
* Set by LZMA_openArchive(), except folder which gets it's values
* in LZMA_read()
*/
typedef struct _LZMAarchive
{
struct _LZMAentry *firstEntry; /* Used for cleanup on shutdown */
struct _LZMAentry *lastEntry;
LZMAfolder *folder; /* Array of folders */
CArchiveDatabaseEx db; /* For 7z: Database */
CFileInStream stream; /* For 7z: Input file incl. read and seek callbacks */
} LZMAarchive;
/* Set by LZMA_openRead(), except offset which is set by LZMA_read() */
typedef struct _LZMAentry
{
struct _LZMAentry *next; /* Used for cleanup on shutdown */
struct _LZMAentry *previous;
LZMAarchive *archive; /* Link to corresponding archive */
CFileItem *file; /* For 7z: File info, eg. name, size */
PHYSFS_uint32 fileIndex; /* Index of file in archive */
PHYSFS_uint32 folderIndex; /* Index of folder in archive */
size_t offset; /* Offset in folder */
PHYSFS_uint64 position; /* Current "virtual" position in file */
} LZMAentry;
/* Memory management implementations to be passed to 7z */
static void *SzAllocPhysicsFS(size_t size)
{
return ((size == 0) ? NULL : allocator.Malloc(size));
} /* SzAllocPhysicsFS */
static void SzFreePhysicsFS(void *address)
{
if (address != NULL)
allocator.Free(address);
} /* SzFreePhysicsFS */
/* Filesystem implementations to be passed to 7z */
#ifdef _LZMA_IN_CB
#define kBufferSize (1 << 12)
static Byte g_Buffer[kBufferSize]; /* !!! FIXME: not thread safe! */
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
size_t *processedSize)
{
CFileInStream *s = (CFileInStream *)object;
PHYSFS_sint64 processedSizeLoc;
if (maxReqSize > kBufferSize)
maxReqSize = kBufferSize;
processedSizeLoc = __PHYSFS_platformRead(s->File, g_Buffer, 1, maxReqSize);
*buffer = g_Buffer;
if (processedSize != NULL)
*processedSize = (size_t) processedSizeLoc;
return SZ_OK;
} /* SzFileReadImp */
#else
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
size_t *processedSize)
{
CFileInStream *s = (CFileInStream *)object;
size_t processedSizeLoc = __PHYSFS_platformRead(s->File, buffer, 1, size);
if (processedSize != 0)
*processedSize = processedSizeLoc;
return SZ_OK;
} /* SzFileReadImp */
#endif
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
{
CFileInStream *s = (CFileInStream *) object;
if (__PHYSFS_platformSeek(s->File, (PHYSFS_uint64) pos))
return SZ_OK;
return SZE_FAIL;
} /* SzFileSeekImp */
/*
* Find entry 'name' in 'archive' and report the 'index' back
*/
static int lzma_find_entry(LZMAarchive *archive, const char *name,
PHYSFS_uint32 *index)
{
for (*index = 0; *index < archive->db.Database.NumFiles; (*index)++)
{
if (strcmp(archive->db.Database.Files[*index].Name, name) == 0)
return 1;
} /* for */
BAIL_MACRO(ERR_NO_SUCH_FILE, 0);
} /* lzma_find_entry */
/*
* Report the first file index of a directory
*/
static PHYSFS_sint32 lzma_find_start_of_dir(LZMAarchive *archive,
const char *path,
int stop_on_first_find)
{
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (archive->db.Database.NumFiles - 1);
PHYSFS_sint32 middle;
PHYSFS_uint32 dlen = strlen(path);
PHYSFS_sint32 retval = -1;
const char *name;
int rc;
if (*path == '\0') /* root dir? */
return(0);
if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
dlen--;
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
name = archive->db.Database.Files[middle].Name;
rc = strncmp(path, name, dlen);
if (rc == 0)
{
char ch = name[dlen];
if ('/' < ch) /* make sure this isn't just a substr match. */
rc = -1;
else if ('/' > ch)
rc = 1;
else
{
if (stop_on_first_find) /* Just checking dir's existance? */
return(middle);
if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
return(middle + 1);
/* there might be more entries earlier in the list. */
retval = middle;
hi = middle - 1;
} /* else */
} /* if */
if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
return(retval);
} /* lzma_find_start_of_dir */
/*
* Wrap all 7z calls in this, so the physfs error state is set appropriately.
*/
static int lzma_err(SZ_RESULT rc)
{
switch (rc)
{
case SZ_OK: /* Same as LZMA_RESULT_OK */
break;
case SZE_DATA_ERROR: /* Same as LZMA_RESULT_DATA_ERROR */
__PHYSFS_setError(ERR_DATA_ERROR);
break;
case SZE_OUTOFMEMORY:
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
break;
case SZE_CRC_ERROR:
__PHYSFS_setError(ERR_CORRUPTED);
break;
case SZE_NOTIMPL:
__PHYSFS_setError(ERR_NOT_IMPLEMENTED);
break;
case SZE_FAIL:
__PHYSFS_setError(ERR_UNKNOWN_ERROR); /* !!! FIXME: right? */
break;
case SZE_ARCHIVE_ERROR:
__PHYSFS_setError(ERR_CORRUPTED); /* !!! FIXME: right? */
break;
default:
__PHYSFS_setError(ERR_UNKNOWN_ERROR);
} /* switch */
return(rc);
} /* lzma_err */
static PHYSFS_sint64 LZMA_read(fvoid *opaque, void *outBuffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
LZMAentry *entry = (LZMAentry *) opaque;
PHYSFS_sint64 wantedSize = objSize*objCount;
PHYSFS_sint64 remainingSize = entry->file->Size - entry->position;
size_t fileSize;
ISzAlloc allocImp;
ISzAlloc allocTempImp;
BAIL_IF_MACRO(wantedSize == 0, NULL, 0); /* quick rejection. */
BAIL_IF_MACRO(remainingSize == 0, ERR_PAST_EOF, 0);
if (remainingSize < wantedSize)
{
wantedSize = remainingSize - (remainingSize % objSize);
objCount = (PHYSFS_uint32) (remainingSize / objSize);
BAIL_IF_MACRO(objCount == 0, ERR_PAST_EOF, 0); /* quick rejection. */
__PHYSFS_setError(ERR_PAST_EOF); /* this is always true here. */
} /* if */
/* Prepare callbacks for 7z */
allocImp.Alloc = SzAllocPhysicsFS;
allocImp.Free = SzFreePhysicsFS;
allocTempImp.Alloc = SzAllocPhysicsFS;
allocTempImp.Free = SzFreePhysicsFS;
/* Only decompress the folder if it is not allready cached */
if (entry->archive->folder[entry->folderIndex].cache == NULL)
{
size_t tmpsize = entry->archive->folder[entry->folderIndex].size;
int rc = lzma_err(SzExtract(
&entry->archive->stream.InStream, /* compressed data */
&entry->archive->db,
entry->fileIndex,
/* Index of cached folder, will be changed by SzExtract */
&entry->archive->folder[entry->folderIndex].index,
/* Cache for decompressed folder, allocated/freed by SzExtract */
&entry->archive->folder[entry->folderIndex].cache,
/* Size of cache, will be changed by SzExtract */
&tmpsize,
/* Offset of this file inside the cache, set by SzExtract */
&entry->offset,
&fileSize, /* Size of this file */
&allocImp,
&allocTempImp));
entry->archive->folder[entry->folderIndex].size = tmpsize;
if (rc != SZ_OK)
return -1;
} /* if */
/* Copy wanted bytes over from cache to outBuffer */
/* !!! FIXME: strncpy for non-string data? */
strncpy(outBuffer,
(void*) (entry->archive->folder[entry->folderIndex].cache +
entry->offset + entry->position),
(size_t) wantedSize);
entry->position += wantedSize;
return objCount;
} /* LZMA_read */
static PHYSFS_sint64 LZMA_write(fvoid *opaque, const void *buf,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* LZMA_write */
static int LZMA_eof(fvoid *opaque)
{
LZMAentry *entry = (LZMAentry *) opaque;
return (entry->position >= entry->file->Size);
} /* LZMA_eof */
static PHYSFS_sint64 LZMA_tell(fvoid *opaque)
{
LZMAentry *entry = (LZMAentry *) opaque;
return (entry->position);
} /* LZMA_tell */
static int LZMA_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
LZMAentry *entry = (LZMAentry *) opaque;
BAIL_IF_MACRO(offset < 0, ERR_SEEK_OUT_OF_RANGE, 0);
BAIL_IF_MACRO(offset > entry->file->Size, ERR_PAST_EOF, 0);
entry->position = offset;
return 1;
} /* LZMA_seek */
static PHYSFS_sint64 LZMA_fileLength(fvoid *opaque)
{
LZMAentry *entry = (LZMAentry *) opaque;
return (entry->file->Size);
} /* LZMA_fileLength */
static int LZMA_fileClose(fvoid *opaque)
{
LZMAentry *entry = (LZMAentry *) opaque;
/* Fix archive */
if (entry == entry->archive->firstEntry)
entry->archive->firstEntry = entry->next;
if (entry == entry->archive->lastEntry)
entry->archive->lastEntry = entry->previous;
/* Fix neighbours */
if (entry->previous != NULL)
entry->previous->next = entry->next;
if (entry->next != NULL)
entry->next->previous = entry->previous;
entry->archive->folder[entry->folderIndex].references--;
if (entry->archive->folder[entry->folderIndex].references == 0)
{
allocator.Free(entry->archive->folder[entry->folderIndex].cache);
entry->archive->folder[entry->folderIndex].cache = NULL;
}
allocator.Free(entry);
entry = NULL;
return(1);
} /* LZMA_fileClose */
static int LZMA_isArchive(const char *filename, int forWriting)
{
PHYSFS_uint8 sig[k7zSignatureSize];
PHYSFS_uint8 res;
void *in;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
in = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(in == NULL, NULL, 0);
if (__PHYSFS_platformRead(in, sig, k7zSignatureSize, 1) != 1)
BAIL_MACRO(NULL, 0);
/* Test whether sig is the 7z signature */
res = TestSignatureCandidate(sig);
__PHYSFS_platformClose(in);
return res;
} /* LZMA_isArchive */
static void *LZMA_openArchive(const char *name, int forWriting)
{
PHYSFS_uint64 len;
LZMAarchive *archive = NULL;
ISzAlloc allocImp;
ISzAlloc allocTempImp;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, NULL);
BAIL_IF_MACRO(!LZMA_isArchive(name,forWriting), ERR_UNSUPPORTED_ARCHIVE, 0);
archive = (LZMAarchive *) allocator.Malloc(sizeof (LZMAarchive));
BAIL_IF_MACRO(archive == NULL, ERR_OUT_OF_MEMORY, NULL);
archive->firstEntry = NULL;
archive->lastEntry = NULL;
if ((archive->stream.File = __PHYSFS_platformOpenRead(name)) == NULL)
{
allocator.Free(archive);
return NULL;
} /* if */
/* Prepare structs for 7z */
archive->stream.InStream.Read = SzFileReadImp;
archive->stream.InStream.Seek = SzFileSeekImp;
allocImp.Alloc = SzAllocPhysicsFS;
allocImp.Free = SzFreePhysicsFS;
allocTempImp.Alloc = SzAllocPhysicsFS;
allocTempImp.Free = SzFreePhysicsFS;
InitCrcTable();
SzArDbExInit(&archive->db);
if (lzma_err(SzArchiveOpen(&archive->stream.InStream, &archive->db,
&allocImp, &allocTempImp)) != SZ_OK)
{
__PHYSFS_platformClose(archive->stream.File);
allocator.Free(archive);
return NULL;
} /* if */
len = archive->db.Database.NumFolders * sizeof (LZMAfolder);
archive->folder = (LZMAfolder *) allocator.Malloc(len);
BAIL_IF_MACRO(archive->folder == NULL, ERR_OUT_OF_MEMORY, NULL);
/*
* Init with 0 so we know when a folder is already cached
* Values will be set by LZMA_read()
*/
memset(archive->folder, 0, (size_t) len);
return(archive);
} /* LZMA_openArchive */
/*
* Moved to seperate function so we can use alloca then immediately throw
* away the allocated stack space...
*/
static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
const char *odir, const char *str, PHYSFS_sint32 ln)
{
char *newstr = __PHYSFS_smallAlloc(ln + 1);
if (newstr == NULL)
return;
memcpy(newstr, str, ln);
newstr[ln] = '\0';
cb(callbackdata, odir, newstr);
__PHYSFS_smallFree(newstr);
} /* doEnumCallback */
static void LZMA_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
LZMAarchive *archive = (LZMAarchive *) opaque;
PHYSFS_sint32 dlen;
PHYSFS_sint32 dlen_inc;
PHYSFS_sint32 max;
PHYSFS_sint32 i;
i = lzma_find_start_of_dir(archive, dname, 0);
if (i == -1) /* no such directory. */
return;
dlen = strlen(dname);
if ((dlen > 0) && (dname[dlen - 1] == '/')) /* ignore trailing slash. */
dlen--;
dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
max = (PHYSFS_sint32) archive->db.Database.NumFiles;
while (i < max)
{
char *add;
char *ptr;
PHYSFS_sint32 ln;
char *e = archive->db.Database.Files[i].Name;
if ((dlen) && ((strncmp(e, dname, dlen)) || (e[dlen] != '/')))
break; /* past end of this dir; we're done. */
add = e + dlen_inc;
ptr = strchr(add, '/');
ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
doEnumCallback(cb, callbackdata, origdir, add, ln);
ln += dlen_inc; /* point past entry to children... */
/* increment counter and skip children of subdirs... */
while ((++i < max) && (ptr != NULL))
{
char *e_new = archive->db.Database.Files[i].Name;
if ((strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
break;
} /* while */
} /* while */
} /* LZMA_enumerateFiles */
static int LZMA_exists(dvoid *opaque, const char *name)
{
LZMAarchive *archive = (LZMAarchive *) opaque;
PHYSFS_uint32 index = 0;
return(lzma_find_entry(archive, name, &index));
} /* LZMA_exists */
static PHYSFS_sint64 LZMA_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
/* !!! FIXME: Lacking support in the LZMA C SDK. */
BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
} /* LZMA_getLastModTime */
static int LZMA_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
LZMAarchive *archive = (LZMAarchive *) opaque;
PHYSFS_uint32 index = 0;
*fileExists = lzma_find_entry(archive, name, &index);
return(archive->db.Database.Files[index].IsDirectory);
} /* LZMA_isDirectory */
static int LZMA_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* LZMA_isSymLink */
static fvoid *LZMA_openRead(dvoid *opaque, const char *name, int *fileExists)
{
LZMAarchive *archive = (LZMAarchive *) opaque;
LZMAentry *entry = NULL;
PHYSFS_uint32 fileIndex = 0;
PHYSFS_uint32 folderIndex = 0;
*fileExists = lzma_find_entry(archive, name, &fileIndex);
BAIL_IF_MACRO(!*fileExists, ERR_NO_SUCH_FILE, NULL);
folderIndex = archive->db.FileIndexToFolderIndexMap[fileIndex];
BAIL_IF_MACRO(folderIndex == (PHYSFS_uint32)-1, ERR_UNKNOWN_ERROR, NULL);
entry = (LZMAentry *) allocator.Malloc(sizeof (LZMAentry));
BAIL_IF_MACRO(entry == NULL, ERR_OUT_OF_MEMORY, NULL);
entry->fileIndex = fileIndex;
entry->folderIndex = folderIndex;
entry->archive = archive;
entry->file = archive->db.Database.Files + entry->fileIndex;
entry->offset = 0; /* Offset will be set by LZMA_read() */
entry->position = 0;
archive->folder[folderIndex].references++;
entry->next = NULL;
entry->previous = entry->archive->lastEntry;
if (entry->previous != NULL)
entry->previous->next = entry;
entry->archive->lastEntry = entry;
if (entry->archive->firstEntry == NULL)
entry->archive->firstEntry = entry;
return(entry);
} /* LZMA_openRead */
static fvoid *LZMA_openWrite(dvoid *opaque, const char *filename)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* LZMA_openWrite */
static fvoid *LZMA_openAppend(dvoid *opaque, const char *filename)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* LZMA_openAppend */
static void LZMA_dirClose(dvoid *opaque)
{
LZMAarchive *archive = (LZMAarchive *) opaque;
LZMAentry *entry = archive->firstEntry;
LZMAentry *tmpEntry = entry;
while (entry != NULL)
{
tmpEntry = entry->next;
LZMA_fileClose(entry);
entry = tmpEntry;
} /* while */
SzArDbExFree(&archive->db, SzFreePhysicsFS);
__PHYSFS_platformClose(archive->stream.File);
/* Free the cache which might have been allocated by LZMA_read() */
allocator.Free(archive->folder);
allocator.Free(archive);
} /* LZMA_dirClose */
static int LZMA_remove(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* LZMA_remove */
static int LZMA_mkdir(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* LZMA_mkdir */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_LZMA =
{
"7Z",
LZMA_ARCHIVE_DESCRIPTION,
"Dennis Schridde <devurandom@gmx.net>",
"http://icculus.org/physfs/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
{
&__PHYSFS_ArchiveInfo_LZMA,
LZMA_isArchive, /* isArchive() method */
LZMA_openArchive, /* openArchive() method */
LZMA_enumerateFiles, /* enumerateFiles() method */
LZMA_exists, /* exists() method */
LZMA_isDirectory, /* isDirectory() method */
LZMA_isSymLink, /* isSymLink() method */
LZMA_getLastModTime, /* getLastModTime() method */
LZMA_openRead, /* openRead() method */
LZMA_openWrite, /* openWrite() method */
LZMA_openAppend, /* openAppend() method */
LZMA_remove, /* remove() method */
LZMA_mkdir, /* mkdir() method */
LZMA_dirClose, /* dirClose() method */
LZMA_read, /* read() method */
LZMA_write, /* write() method */
LZMA_eof, /* eof() method */
LZMA_tell, /* tell() method */
LZMA_seek, /* seek() method */
LZMA_fileLength, /* fileLength() method */
LZMA_fileClose /* fileClose() method */
};
#endif /* defined PHYSFS_SUPPORTS_7Z */
/* end of lzma.c ... */

View File

@ -1,463 +0,0 @@
/*
* MVL support routines for PhysicsFS.
*
* This driver handles Descent II Movielib archives.
*
* The file format of MVL is quite easy...
*
* //MVL File format - Written by Heiko Herrmann
* char sig[4] = {'D','M', 'V', 'L'}; // "DMVL"=Descent MoVie Library
*
* int num_files; // the number of files in this MVL
*
* struct {
* char file_name[13]; // Filename, padded to 13 bytes with 0s
* int file_size; // filesize in bytes
* }DIR_STRUCT[num_files];
*
* struct {
* char data[file_size]; // The file data
* }FILE_STRUCT[num_files];
*
* (That info is from http://www.descent2.com/ddn/specs/mvl/)
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Bradley Bell.
* Based on grp.c by Ryan C. Gordon.
*/
#if (defined PHYSFS_SUPPORTS_MVL)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
typedef struct
{
char name[13];
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} MVLentry;
typedef struct
{
char *filename;
PHYSFS_sint64 last_mod_time;
PHYSFS_uint32 entryCount;
MVLentry *entries;
} MVLinfo;
typedef struct
{
void *handle;
MVLentry *entry;
PHYSFS_uint32 curPos;
} MVLfileinfo;
static void MVL_dirClose(dvoid *opaque)
{
MVLinfo *info = ((MVLinfo *) opaque);
allocator.Free(info->filename);
allocator.Free(info->entries);
allocator.Free(info);
} /* MVL_dirClose */
static PHYSFS_sint64 MVL_read(fvoid *opaque, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
MVLfileinfo *finfo = (MVLfileinfo *) opaque;
MVLentry *entry = finfo->entry;
PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (PHYSFS_uint32) (rc * objSize);
return(rc);
} /* MVL_read */
static PHYSFS_sint64 MVL_write(fvoid *opaque, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* MVL_write */
static int MVL_eof(fvoid *opaque)
{
MVLfileinfo *finfo = (MVLfileinfo *) opaque;
MVLentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* MVL_eof */
static PHYSFS_sint64 MVL_tell(fvoid *opaque)
{
return(((MVLfileinfo *) opaque)->curPos);
} /* MVL_tell */
static int MVL_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
MVLfileinfo *finfo = (MVLfileinfo *) opaque;
MVLentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
return(rc);
} /* MVL_seek */
static PHYSFS_sint64 MVL_fileLength(fvoid *opaque)
{
MVLfileinfo *finfo = (MVLfileinfo *) opaque;
return((PHYSFS_sint64) finfo->entry->size);
} /* MVL_fileLength */
static int MVL_fileClose(fvoid *opaque)
{
MVLfileinfo *finfo = (MVLfileinfo *) opaque;
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
allocator.Free(finfo);
return(1);
} /* MVL_fileClose */
static int mvl_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count)
{
PHYSFS_uint8 buf[4];
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
if (__PHYSFS_platformRead(*fh, buf, 4, 1) != 1)
goto openMvl_failed;
if (memcmp(buf, "DMVL", 4) != 0)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openMvl_failed;
} /* if */
if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
goto openMvl_failed;
*count = PHYSFS_swapULE32(*count);
return(1);
openMvl_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
return(0);
} /* mvl_open */
static int MVL_isArchive(const char *filename, int forWriting)
{
void *fh;
PHYSFS_uint32 fileCount;
int retval = mvl_open(filename, forWriting, &fh, &fileCount);
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(retval);
} /* MVL_isArchive */
static int mvl_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
MVLentry *a = (MVLentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* mvl_entry_cmp */
static void mvl_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
MVLentry tmp;
MVLentry *first = &(((MVLentry *) _a)[one]);
MVLentry *second = &(((MVLentry *) _a)[two]);
memcpy(&tmp, first, sizeof (MVLentry));
memcpy(first, second, sizeof (MVLentry));
memcpy(second, &tmp, sizeof (MVLentry));
} /* mvl_entry_swap */
static int mvl_load_entries(const char *name, int forWriting, MVLinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
PHYSFS_uint32 location = 8; /* sizeof sig. */
MVLentry *entry;
BAIL_IF_MACRO(!mvl_open(name, forWriting, &fh, &fileCount), NULL, 0);
info->entryCount = fileCount;
info->entries = (MVLentry *) allocator.Malloc(sizeof(MVLentry)*fileCount);
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
location += (17 * fileCount);
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
if (__PHYSFS_platformRead(fh, &entry->name, 13, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = location;
location += entry->size;
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
mvl_entry_cmp, mvl_entry_swap);
return(1);
} /* mvl_load_entries */
static void *MVL_openArchive(const char *name, int forWriting)
{
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
MVLinfo *info = (MVLinfo *) allocator.Malloc(sizeof (MVLinfo));
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
memset(info, '\0', sizeof (MVLinfo));
info->filename = (char *) allocator.Malloc(strlen(name) + 1);
GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, MVL_openArchive_failed);
if (!mvl_load_entries(name, forWriting, info))
goto MVL_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
return(info);
MVL_openArchive_failed:
if (info != NULL)
{
if (info->filename != NULL)
allocator.Free(info->filename);
if (info->entries != NULL)
allocator.Free(info->entries);
allocator.Free(info);
} /* if */
return(NULL);
} /* MVL_openArchive */
static void MVL_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
/* no directories in MVL files. */
if (*dname == '\0')
{
MVLinfo *info = ((MVLinfo *) opaque);
MVLentry *entry = info->entries;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
for (i = 0; i < max; i++, entry++)
cb(callbackdata, origdir, entry->name);
} /* if */
} /* MVL_enumerateFiles */
static MVLentry *mvl_find_entry(MVLinfo *info, const char *name)
{
char *ptr = strchr(name, '.');
MVLentry *a = info->entries;
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
int rc;
/*
* Rule out filenames to avoid unneeded processing...no dirs,
* big filenames, or extensions > 3 chars.
*/
BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
rc = __PHYSFS_stricmpASCII(name, a[middle].name);
if (rc == 0) /* found it! */
return(&a[middle]);
else if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* mvl_find_entry */
static int MVL_exists(dvoid *opaque, const char *name)
{
return(mvl_find_entry(((MVLinfo *) opaque), name) != NULL);
} /* MVL_exists */
static int MVL_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = MVL_exists(opaque, name);
return(0); /* never directories in a groupfile. */
} /* MVL_isDirectory */
static int MVL_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = MVL_exists(opaque, name);
return(0); /* never symlinks in a groupfile. */
} /* MVL_isSymLink */
static PHYSFS_sint64 MVL_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
MVLinfo *info = ((MVLinfo *) opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (mvl_find_entry(info, name) != NULL);
if (*fileExists) /* use time of MVL itself in the physical filesystem. */
retval = info->last_mod_time;
return(retval);
} /* MVL_getLastModTime */
static fvoid *MVL_openRead(dvoid *opaque, const char *fnm, int *fileExists)
{
MVLinfo *info = ((MVLinfo *) opaque);
MVLfileinfo *finfo;
MVLentry *entry;
entry = mvl_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
finfo = (MVLfileinfo *) allocator.Malloc(sizeof (MVLfileinfo));
BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
allocator.Free(finfo);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
return(finfo);
} /* MVL_openRead */
static fvoid *MVL_openWrite(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* MVL_openWrite */
static fvoid *MVL_openAppend(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* MVL_openAppend */
static int MVL_remove(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* MVL_remove */
static int MVL_mkdir(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* MVL_mkdir */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL =
{
"MVL",
MVL_ARCHIVE_DESCRIPTION,
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_MVL =
{
&__PHYSFS_ArchiveInfo_MVL,
MVL_isArchive, /* isArchive() method */
MVL_openArchive, /* openArchive() method */
MVL_enumerateFiles, /* enumerateFiles() method */
MVL_exists, /* exists() method */
MVL_isDirectory, /* isDirectory() method */
MVL_isSymLink, /* isSymLink() method */
MVL_getLastModTime, /* getLastModTime() method */
MVL_openRead, /* openRead() method */
MVL_openWrite, /* openWrite() method */
MVL_openAppend, /* openAppend() method */
MVL_remove, /* remove() method */
MVL_mkdir, /* mkdir() method */
MVL_dirClose, /* dirClose() method */
MVL_read, /* read() method */
MVL_write, /* write() method */
MVL_eof, /* eof() method */
MVL_tell, /* tell() method */
MVL_seek, /* seek() method */
MVL_fileLength, /* fileLength() method */
MVL_fileClose /* fileClose() method */
};
#endif /* defined PHYSFS_SUPPORTS_MVL */
/* end of mvl.c ... */

View File

@ -1,622 +0,0 @@
/*
* QPAK support routines for PhysicsFS.
*
* This archiver handles the archive format utilized by Quake 1 and 2.
* Quake3-based games use the PkZip/Info-Zip format (which our zip.c
* archiver handles).
*
* ========================================================================
*
* This format info (in more detail) comes from:
* http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt
*
* Quake PAK Format
*
* Header
* (4 bytes) signature = 'PACK'
* (4 bytes) directory offset
* (4 bytes) directory length
*
* Directory
* (56 bytes) file name
* (4 bytes) file position
* (4 bytes) file length
*
* ========================================================================
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#if (defined PHYSFS_SUPPORTS_QPAK)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
#if 1 /* Make this case insensitive? */
#define QPAK_strcmp(x, y) __PHYSFS_stricmpASCII(x, y)
#define QPAK_strncmp(x, y, z) __PHYSFS_strnicmpASCII(x, y, z)
#else
#define QPAK_strcmp(x, y) strcmp(x, y)
#define QPAK_strncmp(x, y, z) strncmp(x, y, z)
#endif
typedef struct
{
char name[56];
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} QPAKentry;
typedef struct
{
char *filename;
PHYSFS_sint64 last_mod_time;
PHYSFS_uint32 entryCount;
QPAKentry *entries;
} QPAKinfo;
typedef struct
{
void *handle;
QPAKentry *entry;
PHYSFS_uint32 curPos;
} QPAKfileinfo;
/* Magic numbers... */
#define QPAK_SIG 0x4b434150 /* "PACK" in ASCII. */
static void QPAK_dirClose(dvoid *opaque)
{
QPAKinfo *info = ((QPAKinfo *) opaque);
allocator.Free(info->filename);
allocator.Free(info->entries);
allocator.Free(info);
} /* QPAK_dirClose */
static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
QPAKentry *entry = finfo->entry;
PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (PHYSFS_uint32) (rc * objSize);
return(rc);
} /* QPAK_read */
static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* QPAK_write */
static int QPAK_eof(fvoid *opaque)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
QPAKentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* QPAK_eof */
static PHYSFS_sint64 QPAK_tell(fvoid *opaque)
{
return(((QPAKfileinfo *) opaque)->curPos);
} /* QPAK_tell */
static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
QPAKentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
return(rc);
} /* QPAK_seek */
static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
return((PHYSFS_sint64) finfo->entry->size);
} /* QPAK_fileLength */
static int QPAK_fileClose(fvoid *opaque)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
allocator.Free(finfo);
return(1);
} /* QPAK_fileClose */
static int qpak_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count)
{
PHYSFS_uint32 buf;
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
if (__PHYSFS_platformRead(*fh, &buf, sizeof (PHYSFS_uint32), 1) != 1)
goto openQpak_failed;
buf = PHYSFS_swapULE32(buf);
GOTO_IF_MACRO(buf != QPAK_SIG, ERR_UNSUPPORTED_ARCHIVE, openQpak_failed);
if (__PHYSFS_platformRead(*fh, &buf, sizeof (PHYSFS_uint32), 1) != 1)
goto openQpak_failed;
buf = PHYSFS_swapULE32(buf); /* directory table offset. */
if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
goto openQpak_failed;
*count = PHYSFS_swapULE32(*count);
/* corrupted archive? */
GOTO_IF_MACRO((*count % 64) != 0, ERR_CORRUPTED, openQpak_failed);
if (!__PHYSFS_platformSeek(*fh, buf))
goto openQpak_failed;
*count /= 64;
return(1);
openQpak_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
return(0);
} /* qpak_open */
static int QPAK_isArchive(const char *filename, int forWriting)
{
void *fh;
PHYSFS_uint32 fileCount;
int retval = qpak_open(filename, forWriting, &fh, &fileCount);
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(retval);
} /* QPAK_isArchive */
static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
QPAKentry *a = (QPAKentry *) _a;
return(QPAK_strcmp(a[one].name, a[two].name));
} /* qpak_entry_cmp */
static void qpak_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
QPAKentry tmp;
QPAKentry *first = &(((QPAKentry *) _a)[one]);
QPAKentry *second = &(((QPAKentry *) _a)[two]);
memcpy(&tmp, first, sizeof (QPAKentry));
memcpy(first, second, sizeof (QPAKentry));
memcpy(second, &tmp, sizeof (QPAKentry));
} /* qpak_entry_swap */
static int qpak_load_entries(const char *name, int forWriting, QPAKinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
QPAKentry *entry;
BAIL_IF_MACRO(!qpak_open(name, forWriting, &fh, &fileCount), NULL, 0);
info->entryCount = fileCount;
info->entries = (QPAKentry*) allocator.Malloc(sizeof(QPAKentry)*fileCount);
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
PHYSFS_uint32 loc;
if (__PHYSFS_platformRead(fh,&entry->name,sizeof(entry->name),1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh,&loc,sizeof(loc),1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh,&entry->size,sizeof(entry->size),1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = PHYSFS_swapULE32(loc);
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
qpak_entry_cmp, qpak_entry_swap);
return(1);
} /* qpak_load_entries */
static void *QPAK_openArchive(const char *name, int forWriting)
{
QPAKinfo *info = (QPAKinfo *) allocator.Malloc(sizeof (QPAKinfo));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
memset(info, '\0', sizeof (QPAKinfo));
info->filename = (char *) allocator.Malloc(strlen(name) + 1);
if (info->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto QPAK_openArchive_failed;
} /* if */
if (!qpak_load_entries(name, forWriting, info))
goto QPAK_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
return(info);
QPAK_openArchive_failed:
if (info != NULL)
{
if (info->filename != NULL)
allocator.Free(info->filename);
if (info->entries != NULL)
allocator.Free(info->entries);
allocator.Free(info);
} /* if */
return(NULL);
} /* QPAK_openArchive */
static PHYSFS_sint32 qpak_find_start_of_dir(QPAKinfo *info, const char *path,
int stop_on_first_find)
{
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
PHYSFS_uint32 dlen = strlen(path);
PHYSFS_sint32 retval = -1;
const char *name;
int rc;
if (*path == '\0') /* root dir? */
return(0);
if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
dlen--;
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
name = info->entries[middle].name;
rc = QPAK_strncmp(path, name, dlen);
if (rc == 0)
{
char ch = name[dlen];
if (ch < '/') /* make sure this isn't just a substr match. */
rc = -1;
else if (ch > '/')
rc = 1;
else
{
if (stop_on_first_find) /* Just checking dir's existance? */
return(middle);
if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
return(middle + 1);
/* there might be more entries earlier in the list. */
retval = middle;
hi = middle - 1;
} /* else */
} /* if */
if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
return(retval);
} /* qpak_find_start_of_dir */
/*
* Moved to seperate function so we can use alloca then immediately throw
* away the allocated stack space...
*/
static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
const char *odir, const char *str, PHYSFS_sint32 ln)
{
char *newstr = __PHYSFS_smallAlloc(ln + 1);
if (newstr == NULL)
return;
memcpy(newstr, str, ln);
newstr[ln] = '\0';
cb(callbackdata, odir, newstr);
__PHYSFS_smallFree(newstr);
} /* doEnumCallback */
static void QPAK_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
QPAKinfo *info = ((QPAKinfo *) opaque);
PHYSFS_sint32 dlen, dlen_inc, max, i;
i = qpak_find_start_of_dir(info, dname, 0);
if (i == -1) /* no such directory. */
return;
dlen = strlen(dname);
if ((dlen > 0) && (dname[dlen - 1] == '/')) /* ignore trailing slash. */
dlen--;
dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
max = (PHYSFS_sint32) info->entryCount;
while (i < max)
{
char *add;
char *ptr;
PHYSFS_sint32 ln;
char *e = info->entries[i].name;
if ((dlen) && ((QPAK_strncmp(e, dname, dlen)) || (e[dlen] != '/')))
break; /* past end of this dir; we're done. */
add = e + dlen_inc;
ptr = strchr(add, '/');
ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
doEnumCallback(cb, callbackdata, origdir, add, ln);
ln += dlen_inc; /* point past entry to children... */
/* increment counter and skip children of subdirs... */
while ((++i < max) && (ptr != NULL))
{
char *e_new = info->entries[i].name;
if ((QPAK_strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
break;
} /* while */
} /* while */
} /* QPAK_enumerateFiles */
/*
* This will find the QPAKentry associated with a path in platform-independent
* notation. Directories don't have QPAKentries associated with them, but
* (*isDir) will be set to non-zero if a dir was hit.
*/
static QPAKentry *qpak_find_entry(QPAKinfo *info, const char *path, int *isDir)
{
QPAKentry *a = info->entries;
PHYSFS_sint32 pathlen = strlen(path);
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
const char *thispath = NULL;
int rc;
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
thispath = a[middle].name;
rc = QPAK_strncmp(path, thispath, pathlen);
if (rc > 0)
lo = middle + 1;
else if (rc < 0)
hi = middle - 1;
else /* substring match...might be dir or entry or nothing. */
{
if (isDir != NULL)
{
*isDir = (thispath[pathlen] == '/');
if (*isDir)
return(NULL);
} /* if */
if (thispath[pathlen] == '\0') /* found entry? */
return(&a[middle]);
else
hi = middle - 1; /* adjust search params, try again. */
} /* if */
} /* while */
if (isDir != NULL)
*isDir = 0;
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* qpak_find_entry */
static int QPAK_exists(dvoid *opaque, const char *name)
{
int isDir;
QPAKinfo *info = (QPAKinfo *) opaque;
QPAKentry *entry = qpak_find_entry(info, name, &isDir);
return((entry != NULL) || (isDir));
} /* QPAK_exists */
static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
QPAKinfo *info = (QPAKinfo *) opaque;
int isDir;
QPAKentry *entry = qpak_find_entry(info, name, &isDir);
*fileExists = ((isDir) || (entry != NULL));
if (isDir)
return(1); /* definitely a dir. */
BAIL_MACRO(ERR_NO_SUCH_FILE, 0);
} /* QPAK_isDirectory */
static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = QPAK_exists(opaque, name);
return(0); /* never symlinks in a quake pak. */
} /* QPAK_isSymLink */
static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
int isDir;
QPAKinfo *info = ((QPAKinfo *) opaque);
PHYSFS_sint64 retval = -1;
QPAKentry *entry = qpak_find_entry(info, name, &isDir);
*fileExists = ((isDir) || (entry != NULL));
if (*fileExists) /* use time of QPAK itself in the physical filesystem. */
retval = info->last_mod_time;
return(retval);
} /* QPAK_getLastModTime */
static fvoid *QPAK_openRead(dvoid *opaque, const char *fnm, int *fileExists)
{
QPAKinfo *info = ((QPAKinfo *) opaque);
QPAKfileinfo *finfo;
QPAKentry *entry;
int isDir;
entry = qpak_find_entry(info, fnm, &isDir);
*fileExists = ((entry != NULL) || (isDir));
BAIL_IF_MACRO(isDir, ERR_NOT_A_FILE, NULL);
BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL);
finfo = (QPAKfileinfo *) allocator.Malloc(sizeof (QPAKfileinfo));
BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
allocator.Free(finfo);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
return(finfo);
} /* QPAK_openRead */
static fvoid *QPAK_openWrite(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* QPAK_openWrite */
static fvoid *QPAK_openAppend(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* QPAK_openAppend */
static int QPAK_remove(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* QPAK_remove */
static int QPAK_mkdir(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* QPAK_mkdir */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
{
"PAK",
QPAK_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
{
&__PHYSFS_ArchiveInfo_QPAK,
QPAK_isArchive, /* isArchive() method */
QPAK_openArchive, /* openArchive() method */
QPAK_enumerateFiles, /* enumerateFiles() method */
QPAK_exists, /* exists() method */
QPAK_isDirectory, /* isDirectory() method */
QPAK_isSymLink, /* isSymLink() method */
QPAK_getLastModTime, /* getLastModTime() method */
QPAK_openRead, /* openRead() method */
QPAK_openWrite, /* openWrite() method */
QPAK_openAppend, /* openAppend() method */
QPAK_remove, /* remove() method */
QPAK_mkdir, /* mkdir() method */
QPAK_dirClose, /* dirClose() method */
QPAK_read, /* read() method */
QPAK_write, /* write() method */
QPAK_eof, /* eof() method */
QPAK_tell, /* tell() method */
QPAK_seek, /* seek() method */
QPAK_fileLength, /* fileLength() method */
QPAK_fileClose /* fileClose() method */
};
#endif /* defined PHYSFS_SUPPORTS_QPAK */
/* end of qpak.c ... */

View File

@ -1,526 +0,0 @@
/*
* WAD support routines for PhysicsFS.
*
* This driver handles DOOM engine archives ("wads").
* This format (but not this driver) was designed by id Software for use
* with the DOOM engine.
* The specs of the format are from the unofficial doom specs v1.666
* found here: http://www.gamers.org/dhs/helpdocs/dmsp1666.html
* The format of the archive: (from the specs)
*
* A WAD file has three parts:
* (1) a twelve-byte header
* (2) one or more "lumps"
* (3) a directory or "info table" that contains the names, offsets, and
* sizes of all the lumps in the WAD
*
* The header consists of three four-byte parts:
* (a) an ASCII string which must be either "IWAD" or "PWAD"
* (b) a 4-byte (long) integer which is the number of lumps in the wad
* (c) a long integer which is the file offset to the start of
* the directory
*
* The directory has one 16-byte entry for every lump. Each entry consists
* of three parts:
*
* (a) a long integer, the file offset to the start of the lump
* (b) a long integer, the size of the lump in bytes
* (c) an 8-byte ASCII string, the name of the lump, padded with zeros.
* For example, the "DEMO1" entry in hexadecimal would be
* (44 45 4D 4F 31 00 00 00)
*
* Note that there is no way to tell if an opened WAD archive is a
* IWAD or PWAD with this archiver.
* I couldn't think of a way to provide that information, without being too
* hacky.
* I don't think it's really that important though.
*
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Travis Wells, based on the GRP archiver by
* Ryan C. Gordon.
*/
#if (defined PHYSFS_SUPPORTS_WAD)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
typedef struct
{
char name[18];
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} WADentry;
typedef struct
{
char *filename;
PHYSFS_sint64 last_mod_time;
PHYSFS_uint32 entryCount;
PHYSFS_uint32 entryOffset;
WADentry *entries;
} WADinfo;
typedef struct
{
void *handle;
WADentry *entry;
PHYSFS_uint32 curPos;
} WADfileinfo;
static void WAD_dirClose(dvoid *opaque)
{
WADinfo *info = ((WADinfo *) opaque);
allocator.Free(info->filename);
allocator.Free(info->entries);
allocator.Free(info);
} /* WAD_dirClose */
static PHYSFS_sint64 WAD_read(fvoid *opaque, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
WADfileinfo *finfo = (WADfileinfo *) opaque;
WADentry *entry = finfo->entry;
PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (PHYSFS_uint32) (rc * objSize);
return(rc);
} /* WAD_read */
static PHYSFS_sint64 WAD_write(fvoid *opaque, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* WAD_write */
static int WAD_eof(fvoid *opaque)
{
WADfileinfo *finfo = (WADfileinfo *) opaque;
WADentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* WAD_eof */
static PHYSFS_sint64 WAD_tell(fvoid *opaque)
{
return(((WADfileinfo *) opaque)->curPos);
} /* WAD_tell */
static int WAD_seek(fvoid *opaque, PHYSFS_uint64 offset)
{
WADfileinfo *finfo = (WADfileinfo *) opaque;
WADentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
return(rc);
} /* WAD_seek */
static PHYSFS_sint64 WAD_fileLength(fvoid *opaque)
{
WADfileinfo *finfo = (WADfileinfo *) opaque;
return((PHYSFS_sint64) finfo->entry->size);
} /* WAD_fileLength */
static int WAD_fileClose(fvoid *opaque)
{
WADfileinfo *finfo = (WADfileinfo *) opaque;
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
allocator.Free(finfo);
return(1);
} /* WAD_fileClose */
static int wad_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count,PHYSFS_uint32 *offset)
{
PHYSFS_uint8 buf[4];
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
if (__PHYSFS_platformRead(*fh, buf, 4, 1) != 1)
goto openWad_failed;
if (memcmp(buf, "IWAD", 4) != 0 && memcmp(buf, "PWAD", 4) != 0)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openWad_failed;
} /* if */
if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
goto openWad_failed;
*count = PHYSFS_swapULE32(*count);
if (__PHYSFS_platformRead(*fh, offset, sizeof (PHYSFS_uint32), 1) != 1)
goto openWad_failed;
*offset = PHYSFS_swapULE32(*offset);
return(1);
openWad_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
return(0);
} /* wad_open */
static int WAD_isArchive(const char *filename, int forWriting)
{
void *fh;
PHYSFS_uint32 fileCount,offset;
int retval = wad_open(filename, forWriting, &fh, &fileCount,&offset);
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(retval);
} /* WAD_isArchive */
static int wad_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
WADentry *a = (WADentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* wad_entry_cmp */
static void wad_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
WADentry tmp;
WADentry *first = &(((WADentry *) _a)[one]);
WADentry *second = &(((WADentry *) _a)[two]);
memcpy(&tmp, first, sizeof (WADentry));
memcpy(first, second, sizeof (WADentry));
memcpy(second, &tmp, sizeof (WADentry));
} /* wad_entry_swap */
static int wad_load_entries(const char *name, int forWriting, WADinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
PHYSFS_uint32 directoryOffset;
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);
info->entryCount = fileCount;
info->entries = (WADentry *) allocator.Malloc(sizeof(WADentry)*fileCount);
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
__PHYSFS_platformSeek(fh,directoryOffset);
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
if (__PHYSFS_platformRead(fh, &entry->startPos, 4, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh, &entry->name, 8, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->name[8] = '\0'; /* name might not be null-terminated in file. */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = PHYSFS_swapULE32(entry->startPos);
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
wad_entry_cmp, wad_entry_swap);
return(1);
} /* wad_load_entries */
static void *WAD_openArchive(const char *name, int forWriting)
{
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
WADinfo *info = (WADinfo *) allocator.Malloc(sizeof (WADinfo));
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
memset(info, '\0', sizeof (WADinfo));
info->filename = (char *) allocator.Malloc(strlen(name) + 1);
GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, WAD_openArchive_failed);
if (!wad_load_entries(name, forWriting, info))
goto WAD_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
return(info);
WAD_openArchive_failed:
if (info != NULL)
{
if (info->filename != NULL)
allocator.Free(info->filename);
if (info->entries != NULL)
allocator.Free(info->entries);
allocator.Free(info);
} /* if */
return(NULL);
} /* WAD_openArchive */
static void WAD_enumerateFiles(dvoid *opaque, const char *dname,
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
{
WADinfo *info = ((WADinfo *) opaque);
WADentry *entry = info->entries;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
const char *name;
char *sep;
if (*dname == '\0') /* root directory enumeration? */
{
for (i = 0; i < max; i++, entry++)
{
name = entry->name;
if (strchr(name, '/') == NULL)
cb(callbackdata, origdir, name);
} /* for */
} /* if */
else
{
for (i = 0; i < max; i++, entry++)
{
name = entry->name;
sep = strchr(name, '/');
if (sep != NULL)
{
if (strncmp(dname, name, (sep - name)) == 0)
cb(callbackdata, origdir, sep + 1);
} /* if */
} /* for */
} /* else */
} /* WAD_enumerateFiles */
static WADentry *wad_find_entry(WADinfo *info, const char *name)
{
WADentry *a = info->entries;
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
int rc;
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
rc = strcmp(name, a[middle].name);
if (rc == 0) /* found it! */
return(&a[middle]);
else if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* wad_find_entry */
static int WAD_exists(dvoid *opaque, const char *name)
{
return(wad_find_entry(((WADinfo *) opaque), name) != NULL);
} /* WAD_exists */
static int WAD_isDirectory(dvoid *opaque, const char *name, int *fileExists)
{
WADentry *entry = wad_find_entry(((WADinfo *) opaque), name);
if (entry != NULL)
{
char *n;
*fileExists = 1;
/* Can't be a directory if it's a subdirectory. */
if (strchr(entry->name, '/') != NULL)
return(0);
/* Check if it matches "MAP??" or "E?M?" ... */
n = entry->name;
if ((n[0] == 'E' && n[2] == 'M') ||
(n[0] == 'M' && n[1] == 'A' && n[2] == 'P' && n[6] == 0))
{
return(1);
} /* if */
return(0);
} /* if */
else
{
*fileExists = 0;
return(0);
} /* else */
} /* WAD_isDirectory */
static int WAD_isSymLink(dvoid *opaque, const char *name, int *fileExists)
{
*fileExists = WAD_exists(opaque, name);
return(0); /* never symlinks in a wad. */
} /* WAD_isSymLink */
static PHYSFS_sint64 WAD_getLastModTime(dvoid *opaque,
const char *name,
int *fileExists)
{
WADinfo *info = ((WADinfo *) opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (wad_find_entry(info, name) != NULL);
if (*fileExists) /* use time of WAD itself in the physical filesystem. */
retval = info->last_mod_time;
return(retval);
} /* WAD_getLastModTime */
static fvoid *WAD_openRead(dvoid *opaque, const char *fnm, int *fileExists)
{
WADinfo *info = ((WADinfo *) opaque);
WADfileinfo *finfo;
WADentry *entry;
entry = wad_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
finfo = (WADfileinfo *) allocator.Malloc(sizeof (WADfileinfo));
BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
allocator.Free(finfo);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
return(finfo);
} /* WAD_openRead */
static fvoid *WAD_openWrite(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* WAD_openWrite */
static fvoid *WAD_openAppend(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* WAD_openAppend */
static int WAD_remove(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* WAD_remove */
static int WAD_mkdir(dvoid *opaque, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* WAD_mkdir */
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD =
{
"WAD",
WAD_ARCHIVE_DESCRIPTION,
"Travis Wells <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_WAD =
{
&__PHYSFS_ArchiveInfo_WAD,
WAD_isArchive, /* isArchive() method */
WAD_openArchive, /* openArchive() method */
WAD_enumerateFiles, /* enumerateFiles() method */
WAD_exists, /* exists() method */
WAD_isDirectory, /* isDirectory() method */
WAD_isSymLink, /* isSymLink() method */
WAD_getLastModTime, /* getLastModTime() method */
WAD_openRead, /* openRead() method */
WAD_openWrite, /* openWrite() method */
WAD_openAppend, /* openAppend() method */
WAD_remove, /* remove() method */
WAD_mkdir, /* mkdir() method */
WAD_dirClose, /* dirClose() method */
WAD_read, /* read() method */
WAD_write, /* write() method */
WAD_eof, /* eof() method */
WAD_tell, /* tell() method */
WAD_seek, /* seek() method */
WAD_fileLength, /* fileLength() method */
WAD_fileClose /* fileClose() method */
};
#endif /* defined PHYSFS_SUPPORTS_WAD */
/* end of wad.c ... */

File diff suppressed because it is too large Load Diff

11
docs/CHANGELOG.txt Normal file
View File

@ -0,0 +1,11 @@
The changelog is no longer maintained by hand. It made sense to have a single
timeline when we were using CVS, but modern revision control tools make this
redundant, at best.
If you want a list of changes, updated in real time, just point your web
browser here:
https://github.com/icculus/physfs/commits/

View File

@ -27,12 +27,11 @@ Various support, fixes and suggestions:
Alexander Pipelka
Russian translation,
Ruby bindings,
QPAK archiver:
Ed Sinjiashvili
French translation:
Stéphane Peter
Stéphane Peter
Debian package support:
Colin Bayer
@ -50,6 +49,12 @@ Apple Project Builder support,
Mac OS X improvements:
Eric Wing
iPhone support:
Christian Gmeiner
WinRT support:
Martin Ahrnbom
HOG archiver,
MVL archiver:
Bradley Bell
@ -67,7 +72,7 @@ Brazillian Portuguese translation:
Danny Angelo Carminati Grein
Spanish translation:
Pedro J. Pérez
Pedro J. Pérez
MacOS Classic fixes,
MPW support,
@ -78,8 +83,20 @@ Mingw support,
General bug fixes:
Matze Braun
Haiku support:
scott mc
Bug fixes:
Jörg Walter
Jörg Walter
Bug fixes:
Olivier Boudeville
Bug fixes:
Henk Boom
Build system fixes:
Marc Kleine-Budde
Windows .rc file,
7zip/lzma archiver:
@ -88,6 +105,68 @@ Windows .rc file,
OS/2 updates:
Dave Yeo
Bug fixes:
Patrice Mandin
PHYSFS_stat() API:
Christoph Nelles
Indy Sams
ISO9660 archiver:
Christoph Nelles
Bug fixes:
Steven Fuller
Bug fixes:
Tolga Dalman
Bug fixes:
Frank Becker
Bug fixes:
Norfanin
Bug fixes:
Evgeny Podjachev
Haiku fixes:
Chris Roberts
SLB archiver:
Aleksi Nurmi
Bug fixes:
Dmitry Marakasov
Bug fixes:
Andreas Karlsson
Bug fixes:
Michael Bacon
Bug fixes:
Xian Nox
Bug fixes:
Reto Schneider
pkg-config support:
Jonas Kulla
Bug fixes,
VDF archiver:
Francesco Bertolaccini
CMake fixes:
Tobias Markus
Bug fixes,
Rémi Verschelde
Bug fixes:
Rob Loach
Other stuff:
Your name here! Patches go to icculus@icculus.org ...

View File

@ -23,7 +23,8 @@ PROJECT_NAME = physfs
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.1.0
# (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)
# base path where the generated documentation will be put.
@ -361,7 +362,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = physfs.h
INPUT = src/physfs.h
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
@ -876,7 +877,8 @@ INCLUDE_FILE_PATTERNS =
# omitted =1 is assumed.
PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \
__EXPORT__=
PHYSFS_DECL= \
PHYSFS_DEPRECATED=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.

173
docs/INSTALL.txt Normal file
View File

@ -0,0 +1,173 @@
The latest PhysicsFS information and releases can be found at:
https://icculus.org/physfs/
Building is (ahem) very easy.
ALL PLATFORMS:
Please read the text file LICENSE.txt in the root of the source tree.
The license is extremely liberal, even to closed-source, commercial
applications.
If you've got Doxygen (http://www.doxygen.org/) installed, you can run it
without any command line arguments in the root of the source tree to generate
the API reference (or build the "docs" target from your build system). This
is optional. You can browse the API docs online here:
https://icculus.org/physfs/docs/
BUILD IT WITH YOUR OWN PROGRAM:
If you don't care about formal packaging: just add everything in the "src"
directory to whatever you use to build your program and compile it along with
everything else, and you're done. It should compile with any reasonable
ANSI C compiler, should build cleanly even with excessive compiler warnings
enabled, needs no extra configuration, and allows static linking.
WinRT and Haiku need C++ compilers for their system APIs, but if you aren't on
these platforms and don't have a C++ compiler, don't build the .cpp files.
Likewise: Apple platforms (macOS, iOS, etc) need an Objective-C compiler, but
if you aren't on these platforms and don't have a Objective-C compiler, don't
build the .m file. Everything you need is in the .c sources.
If this all worked for your specific project, you can stop reading now.
Unix:
You will need CMake (https://www.cmake.org/) 2.4 or later installed.
Make a directory, wherever you like. This will be your build directory.
Chdir to your build directory. Run "cmake /where/i/unpacked/physfs" to
generate Makefiles. You can then run "ccmake ." and customize the build,
but the defaults are probably okay. You can have CMake generate KDevelop
or Ninja project files or whatever, if you prefer these.
Run "make". PhysicsFS will now build.
As root, run "make install".
If you get sick of the library, run "make uninstall" as root
and it will remove all traces of the library from the system paths.
Once you are satisfied, you can delete the build directory.
Primary Unix development is done with GNU/Linux, but PhysicsFS is known to
work out of the box with several flavors of Unix. It it doesn't work, patches
to get it running can be sent to icculus@icculus.org.
Windows:
If building with Cygwin, mingw32, MSYS, or something else that uses the GNU
toolchain, follow the Unix instructions, above.
If you want to use Visual Studio, nmake, or the Platform SDK, you will need
CMake (https://www.cmake.org/) 2.4 or later installed. Point CMake at the
CMakeLists.txt file in the root of the source directory and hit the
"Configure" button. After telling it what type of compiler you are targeting
(Borland, Visual Studio, etc), CMake will process for while and then give you
a list of options you can change (what archivers you want to support, etc).
If you aren't sure, the defaults are probably fine. Hit the "Configure"
button again, then "OK" once configuration has completed with options that
match your liking. Now project files for your favorite programming
environment will be generated for you in the directory you specified.
Go there and use them to build PhysicsFS.
PhysicsFS will only link directly against system libraries that have existed
since Windows NT 3.51. If there's a newer API we want to use, we try to
dynamically load it at runtime and fallback to a reasonable behaviour when
we can't find it. Note that Windows 98 and later _should_
work if you use the Microsoft Layer for Unicode (UNICOWS.DLL) to provide
some missing system APIs, but this is no longer tested as of PhysicsFS 2.1.0.
PhysicsFS 2.0.x is known to work with Windows 95 without UNICOWS.DLL.
PhysicsFS works on 32-bit and 64-bit Windows. There is no 16-bit Windows
support at all. Windows RT is covered below.
Windows RT:
Windows RT (Windows Phone, Windows Store, UWP) 8.0 and later are supported.
Make sure you include both physfs_platform_windows.c _and_
physfs_platform_winrt.cpp in your build, and that the C++ file has
"Consume Windows Runtime Extension" set to "Yes" in its Visual Studio
properties (from the command line, you want to compile this file with the
"/ZW" compiler switch). CMake can, in theory, generate a project file for
WinRT if you pick a recent Visual Studio target, choose manual cross-compile
options, and set the system name to "WindowsPhone" or "WindowsStore" and the
correct OS version (8.0 or later).
PocketPC/WindowsCE:
Support for PocketPC was removed in PhysicsFS 2.1.0. This was known to work
in the 1.0 releases, but wasn't tested in 2.0 and later. PhysicsFS should
work on modern Windows Phones (see "Windows RT" section).
macOS:
You will need CMake (https://www.cmake.org/) 2.4 or later installed.
You can either generate a Unix makefile with CMake, or generate an Xcode
project, whichever makes you more comfortable.
PowerPC and Intel Macs should both be supported.
MAC OS 8/9 ("Mac OS Classic"):
Classic Mac OS support has been dropped in PhysicsFS 2.0. Apple hasn't updated
pre-OSX versions in more than a decade at this point, none of the hardware
they've shipped will boot it for almost as many years, and finding
developer tools for it is becoming almost impossible. As the switch to Intel
hardware has removed the "Classic" emulation environment, it was time to
remove support from PhysicsFS. That being said, the PhysicsFS 1.0 branch can
still target back to Mac OS 8.5, so you can use that if you need support for
this legacy OS. We still very much support modern macOS, though: see above.
Emscripten:
Use the "Unix" instructions, above. You can install the Emscripten SDK and use
the extras/buildbot-emscripten.sh script to automate this for you.
BeOS, Zeta, YellowTab:
BeOS support was dropped in PhysicsFS 2.1.0. Consider installing Haiku, which
we still support.
Haiku:
Use the "Unix" instructions, above.
OS/2:
OS/2 is known to work with OpenWatcom and GCC-based compilers. I couldn't get
an OS/2 port of CMake to generate OpenWatcom project files (although it should
be able to do that in theory), it should be able to do Unix Makefiles with
GCC. It might be easier to just compile PhysicsFS along with the rest of
your project on this platform.
OTHER PLATFORMS:
Many Unix-like platforms might "just work" with CMake. Some of these platforms
are known to have worked at one time, but have not been heavily tested, if
tested at all. PhysicsFS is, as far as we know, 64-bit and byteorder clean,
and is known to compile on several compilers across many platforms. To
implement a new platform or archiver, please read the heavily-commented
physfs_internal.h and look at the physfs_platform_* and physfs_archiver_*
source files for examples.
--ryan. (icculus@icculus.org)

View File

@ -0,0 +1,18 @@
The API documentation is readable in a few ways:
- Read physfs.h; it's _heavily_ documented and the primary source of reference
documentation for the library.
- Run Doxygen over the header, which produces nicer-to-browse documentation in
HTML, LaTeX, manpage, etc formats. This is done for you if Doxygen is
installed and you build the "docs" target in whatever project files CMake
generated for you.
- Too much trouble? We generated the HTML reference for you, online here:
https://icculus.org/physfs/docs/
- We would love well-written tutorials for the latest version of PhysicsFS!
If you write one, we would love to list it here. Drop me a line about it:
icculus@icculus.org ... Thanks!
--ryan.

62
docs/TODO.txt Normal file
View File

@ -0,0 +1,62 @@
Stuff that needs to be done and wishlist:
These are in no particular order.
Some might be dupes, some might be done already, some might be bad ideas.
From https://icculus.org/pipermail/physfs/2009-March/000698.html ...
- Write support for various archives. I haven't decided how to do this yet,
but I'd like to.
- Add an API to expose a file's extended attributes to the application?
- Deprecate PHYSFS_setSaneConfig(). It really should have been in the extras
directory.
- Clean up the sources to match my ever-changing coding style. :)
From https://icculus.org/pipermail/physfs/2010-January/000826.html ...
- Lua bindings
From https://icculus.org/pipermail/physfs/2010-January/000833.html ...
- SWIG bindings
From old TODO.txt...
- Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less
important, since streaming archives aren't of much value to games (which
is why zipfiles are king: random access), but it could have uses for, say,
an installer/updater.
- Do symlinks in zip archiver work when they point to dirs?
- Enable more warnings?
- Use __cdecl in physfs.h?
- Look for FIXMEs (many marked with "!!!" in comments).
- fscanf and fprintf support in extras dir.
- Sanity check byte order at runtime.
- Memory locking?
- General code audit.
- Multiple write dirs with mount points?
Other stuff I thought of...
- moar asserts!
- constify!
- Does iPhone work?
- Fix CMake vs Doxygen.
- Doxygen replacement? (manpages suck.)
- Fix coding standards to match.
- See if we can ditch some #include lines...
- LZMA support in zip archiver?
- bzip2 support in zip archiver?
- Reduce the BAIL and GOTO macro use. A lot of these don't add anything.
- Change the term "search path" to something less confusing.
Probably other stuff. Requests and recommendations are welcome.
// end of TODO.txt ...

View File

@ -1,58 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("PhysFS.NET")]
[assembly: AssemblyDescription("PhysFS Bindings for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PhysFS.NET")]
[assembly: AssemblyCopyright("(c)2003 Gregory S. Read")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

View File

@ -1,113 +0,0 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{C6205A43-3D4D-41E6-872C-96CD7BE55230}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "PhysFS.NET"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
RootNamespace = "PhysFS.NET"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "true"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "true"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
<Reference
Name = "System.Drawing"
AssemblyName = "System.Drawing"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "PhysFS.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "PhysFS_DLL.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "PhysFSFileStream.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@ -1,21 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysFS.NET", "PhysFS.NET.csproj", "{C6205A43-3D4D-41E6-872C-96CD7BE55230}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Debug.ActiveCfg = Debug|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Debug.Build.0 = Debug|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Release.ActiveCfg = Release|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -1,189 +0,0 @@
/* PhysFS.cs - (c)2003 Gregory S. Read
* Provides access to PhysFS API calls not specific to file handle access.
*/
using System;
namespace PhysFS_NET
{
public class PhysFS
{
/* Initialize
* Inits the PhysFS API. This normally does not need to be called unless
* the API has been manually deinitialized since the PhysFS_DLL class
* initializes just before the first call is made into the DLL.
* Parameters
* none
* Returns
* none
* Exceptions
* PhysFSException - An error occured in the PhysFS API
*/
public static void Initialize()
{
// Initialize the physfs library, raise an exception if error
if(PhysFS_DLL.PHYSFS_init("") == 0)
throw new PhysFSException();
}
/* Deinitialize
* Deinits the PhysFS API. It is recommended that this method be called
* by the application before exiting in order to gracefully deallocate
* resources and close all filehandles, etc.
* Parameters
* none
* Returns
* none
* Exceptions
* PhysFSException - An error occured in the PhysFS API
*/
public static void Deinitialize()
{
// Deinit, raise an exception if an error occured
if(PhysFS_DLL.PHYSFS_deinit() == 0)
throw new PhysFSException();
}
/* BaseDir
* Gets the base directory configured for PhysFS. See the PhysFS API
* documentation for more information.
* Parameters
* none
* Returns
* A string value representing the Base Directory
* Exceptions
* none
*/
public static string BaseDir
{
get
{
// Return the current base directory
return PhysFS_DLL.PHYSFS_getBaseDir();
}
}
/* WriteDir
* Gets or sets the write directory configured for PhysFS. See the PhysFS API
* documentation for more information.
* Parameters
* set - Path to set the WriteDir property to
* Returns
* A string value representing the Write Directory
* Exceptions
* PhysFSException - An error occured in the PhysFS API when
* settings the write directory.
*/
public static string WriteDir
{
get
{
// Return the current write directory
return PhysFS_DLL.PHYSFS_getWriteDir();
}
set
{
// Set the write directory and raise an exception if an error occured
if(PhysFS_DLL.PHYSFS_setWriteDir(value) == 0)
throw new PhysFSException();
}
}
/* UserDir
* Gets or sets the write directory configured for PhysFS. See the PhysFS API
* documentation for more information.
* Parameters
* set - Path to set the WriteDir property to
* Returns
* A string value representing the Write Directory
* Exceptions
* PhysFSException - An error occured in the PhysFS API when
* settings the write directory.
*/
public static string UserDir
{
get
{
// Return the current user directory
return PhysFS_DLL.PHYSFS_getUserDir();
}
}
public static void AddToSearchPath(string NewDir, bool Append)
{
if(PhysFS_DLL.PHYSFS_addToSearchPath(NewDir, Append?1:0) == 0)
throw new PhysFSException();
}
public static void RemoveFromSearchPath(string OldDir)
{
if(PhysFS_DLL.PHYSFS_removeFromSearchPath(OldDir) == 0)
throw new PhysFSException();
}
public unsafe static string[] GetSearchPath()
{
byte** p; // Searchpath list from PhysFS dll
string[] pathlist; // List converted to an array
// Get the CDROM drive listing
p = PhysFS_DLL.PHYSFS_getSearchPath();
// Convert the C-style array to a .NET style array
pathlist = PhysFS_DLL.BytePPToArray(p);
// Free the original list since we're done with it
PhysFS_DLL.PHYSFS_freeList(p);
return pathlist;
}
public unsafe static string[] GetCDROMDrives()
{
byte** p; // CDROM list from PhysFS dll
string[] cdromlist; // List converted to an array
// Get the CDROM drive listing
p = PhysFS_DLL.PHYSFS_getCdRomDirs();
// Convert the C-style array to a .NET style array
cdromlist = PhysFS_DLL.BytePPToArray(p);
// Free the original list since we're done with it
PhysFS_DLL.PHYSFS_freeList(p);
return cdromlist;
}
public static void MkDir(string Dirname)
{
if(PhysFS_DLL.PHYSFS_mkdir(Dirname) == 0)
throw new PhysFSException();
}
public static void Delete(string Filename)
{
if(PhysFS_DLL.PHYSFS_delete(Filename) == 0)
throw new PhysFSException();
}
public static string GetRealDir(string Filename)
{
string RetValue;
RetValue = PhysFS_DLL.PHYSFS_getRealDir(Filename);
if(RetValue == null)
throw new PhysFSException("File not found in search path.");
// Return the real file path of the specified filename
return RetValue;
}
public unsafe static string[] EnumerateFiles(string Dirname)
{
byte** p; // File list from PhysFS dll
string[] filelist; // List converted to an array
// Get the CDROM drive listing
p = PhysFS_DLL.PHYSFS_enumerateFiles(Dirname);
// Convert the C-style array to a .NET style array
filelist = PhysFS_DLL.BytePPToArray(p);
// Free the original list since we're done with it
PhysFS_DLL.PHYSFS_freeList(p);
return filelist;
}
public static bool IsDirectory(string Filename)
{
// Return true if non-zero, otherwise return false
return (PhysFS_DLL.PHYSFS_isDirectory(Filename) == 0)?false:true;
}
}
}

View File

@ -1,194 +0,0 @@
/* PhysFSFileStream.cs - (c)2003 Gregory S. Read */
using System;
using System.Collections;
using System.IO;
namespace PhysFS_NET
{
public enum PhysFSFileMode {Read, Write, Append};
// Our exception class we'll use for throwing all PhysFS API related exception
public class PhysFSException : IOException
{
public PhysFSException(string Message) : base(Message) {}
public PhysFSException() : base(PhysFS_DLL.PHYSFS_getLastError()) {}
}
public unsafe class PhysFSFileStream : Stream
{
// ***Public properties***
public override bool CanRead
{
get
{
// Reading is supported
return true;
}
}
public override bool CanSeek
{
get
{
// Seek is supported
return true;
}
}
public override bool CanWrite
{
get
{
// Writing is supported
return true;
}
}
public override long Length
{
get
{
long TempLength;
TempLength = PhysFS_DLL.PHYSFS_fileLength(pHandle);
// If call returned an error, throw an exception
if(TempLength == -1)
throw new PhysFSException();
return TempLength;
}
}
public override long Position
{
get
{
long TempPosition;
TempPosition = PhysFS_DLL.PHYSFS_tell(pHandle);
// If call returned an error, throw an exception
if(TempPosition == -1)
throw new PhysFSException();
return TempPosition;
}
set
{
// Seek from beginning of file using the position value
Seek(value, SeekOrigin.Begin);
}
}
// ***Public methods***
public PhysFSFileStream(string FileName, PhysFSFileMode FileMode, ulong BufferSize)
{
// Open the specified file with the appropriate file access
switch(FileMode)
{
case PhysFSFileMode.Read:
pHandle = PhysFS_DLL.PHYSFS_openRead(FileName);
break;
case PhysFSFileMode.Write:
pHandle = PhysFS_DLL.PHYSFS_openWrite(FileName);
break;
case PhysFSFileMode.Append:
pHandle = PhysFS_DLL.PHYSFS_openAppend(FileName);
break;
default:
throw new PhysFSException("Invalid FileMode specified");
}
// If handle is null, an error occured, so raise an exception
//!!! Does object get created if exception is thrown?
if(pHandle == null)
throw new PhysFSException();
// Set buffer size, raise an exception if an error occured
if(PhysFS_DLL.PHYSFS_setBuffer(pHandle, BufferSize) == 0)
throw new PhysFSException();
}
// This constructor sets the buffer size to 0 if not specified
public PhysFSFileStream(string FileName, PhysFSFileMode FileMode) : this(FileName, FileMode, 0) {}
~PhysFSFileStream()
{
// Don't close the handle if they've specifically closed it already
if(!Closed)
Close();
}
public override void Flush()
{
if(PhysFS_DLL.PHYSFS_flush(pHandle) == 0)
throw new PhysFSException();
}
public override int Read(byte[] buffer, int offset, int count)
{
long RetValue;
fixed(byte *pbytes = &buffer[offset])
{
// Read into our allocated pointer
RetValue = PhysFS_DLL.PHYSFS_read(pHandle, pbytes, sizeof(byte), (uint)count);
}
if(RetValue == -1)
throw new PhysFSException();
// Return number of bytes read
// Note: This cast should be safe since we are only reading 'count' items, which
// is of type 'int'.
return (int)RetValue;
}
public override void Write(byte[] buffer, int offset, int count)
{
long RetValue;
fixed(byte* pbytes = &buffer[offset])
{
// Write buffer
RetValue = PhysFS_DLL.PHYSFS_write(pHandle, pbytes, sizeof(byte), (uint)count);
}
if(RetValue == -1)
throw new PhysFSException();
}
public override long Seek(long offset, SeekOrigin origin)
{
// Only seeking from beginning is supported by PhysFS API
if(origin != SeekOrigin.Begin)
throw new PhysFSException("Only seek origin of \"Begin\" is supported");
// Seek to specified offset, raise an exception if error occured
if(PhysFS_DLL.PHYSFS_seek(pHandle, (ulong)offset) == 0)
throw new PhysFSException();
// Since we always seek from beginning, the offset is always
// the absolute position.
return offset;
}
public override void SetLength(long value)
{
throw new NotSupportedException("SetLength method not supported in PhysFSFileStream objects.");
}
public override void Close()
{
// Close the handle
if(PhysFS_DLL.PHYSFS_close(pHandle) == 0)
throw new PhysFSException();
// File has been closed. Rock.
Closed = true;
}
// ***Private variables***
private void *pHandle;
private bool Closed = false;
}
}

View File

@ -1,113 +0,0 @@
/* PhysFS_DLL - (c)2003 Gregory S. Read
* Internal class that provides direct access to the PhysFS DLL. It is
* not accessible outside of the PhysFS.NET assembly.
*/
using System.Collections;
using System.Runtime.InteropServices;
namespace PhysFS_NET
{
internal class PhysFS_DLL
{
/* Static constructor
* Initializes the PhysFS API before any method is called in this class. This
* relieves the user from having to explicitly initialize the API.
* Parameters
* none
* Returns
* none
* Exceptions
* PhysFSException - An error occured in the PhysFS API
*/
static PhysFS_DLL()
{
if(PHYSFS_init("") == 0)
throw new PhysFSException();
}
/* BytePPToArray
* Converts a C-style string array into a .NET managed string array
* Parameters
* C-style string array pointer returned from PhysFS
* Returns
* .NET managed string array
* Exceptions
* none
*/
public unsafe static string[] BytePPToArray(byte **bytearray)
{
byte** ptr;
byte* c;
string tempstr;
ArrayList MyArrayList = new ArrayList();
string[] RetArray;
for(ptr = bytearray; *ptr != null; ptr++)
{
tempstr = "";
for(c = *ptr; *c != 0; c++)
{
tempstr += (char)*c;
}
// Add string to our list
MyArrayList.Add(tempstr);
}
// Return a normal array of the list
RetArray = new string[MyArrayList.Count];
MyArrayList.CopyTo(RetArray, 0);
return RetArray;
}
// Name of DLL to import
private const string PHYSFS_DLLNAME = "physfs.dll";
// DLL import declarations
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_init(string argv0);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_deinit();
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void PHYSFS_freeList(void *listVar);
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getLastError();
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getDirSeparator();
[DllImport(PHYSFS_DLLNAME)] public static extern void PHYSFS_permitSymbolicLinks(int allow);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe byte** PHYSFS_getCdRomDirs();
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getBaseDir();
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getUserDir();
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getWriteDir();
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_setWriteDir(string newDir);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_addToSearchPath(string newDir, int appendToPath);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_removeFromSearchPath(string oldDir);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe byte** PHYSFS_getSearchPath();
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_setSaneConfig(string organization,
string appName,
string archiveExt,
int includeCdRoms,
int archivesFirst);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_mkdir(string dirName);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_delete(string filename);
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getRealDir(string filename);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe byte** PHYSFS_enumerateFiles(string dir);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_exists(string fname);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_isDirectory(string fname);
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_isSymbolicLink(string fname);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void* PHYSFS_openWrite(string filename);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void* PHYSFS_openAppend(string filename);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void* PHYSFS_openRead(string filename);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_close(void* handle);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_getLastModTime(string filename);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_read(void* handle,
void *buffer,
uint objSize,
uint objCount);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_write(void* handle,
void *buffer,
uint objSize,
uint objCount);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_eof(void* handle);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_tell(void* handle);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_seek(void* handle, ulong pos);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_fileLength(void* handle);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_setBuffer(void* handle, ulong bufsize);
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_flush(void* handle);
}
}

View File

@ -1,10 +0,0 @@
PhysFS.NET is a library that encapsulates the PhysFS API into a .NET assembly.
There are two class objects that are exposed in the assembly:
PhysFS.cs
This class exposes any non-filehandle specific functionality contained in
the PhysFS library.
PhysFSFileStream.cs
A System.IO.Stream derived class which provides file access via the
PhysFS API. Usage of this object is identical to a standard stream
object.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,58 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

View File

@ -1,116 +0,0 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}"
>
<Build>
<Settings
ApplicationIcon = "App.ico"
AssemblyKeyContainerName = ""
AssemblyName = "TestApp"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "WinExe"
RootNamespace = "TestApp"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.Drawing"
AssemblyName = "System.Drawing"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
<Reference
Name = "PhysFS.NET"
Project = "{C6205A43-3D4D-41E6-872C-96CD7BE55230}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "AssemblyInfo.cs"
BuildAction = "Compile"
/>
<File
RelPath = "TestAppForm.cs"
SubType = "Form"
BuildAction = "Compile"
/>
<File
RelPath = "TestAppForm.resx"
DependentUpon = "TestAppForm.cs"
BuildAction = "EmbeddedResource"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@ -1,27 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp.csproj", "{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysFS.NET", "..\PhysFS.NET.csproj", "{C6205A43-3D4D-41E6-872C-96CD7BE55230}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Debug.ActiveCfg = Debug|.NET
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Debug.Build.0 = Debug|.NET
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Release.ActiveCfg = Release|.NET
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Release.Build.0 = Release|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Debug.ActiveCfg = Debug|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Debug.Build.0 = Debug|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Release.ActiveCfg = Release|.NET
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -1,274 +0,0 @@
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using PhysFS_NET;
namespace TestApp
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class TestAppForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button RefreshCDsButton;
private System.Windows.Forms.ListBox CDDrivesList;
private System.Windows.Forms.ListBox SearchPathList;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox EnumFilesPath;
private System.Windows.Forms.ListBox EnumList;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox NewSearchPathText;
private System.Windows.Forms.Button AddSearchPathButton;
private System.Windows.Forms.Button RemovePathButton;
private System.Windows.Forms.Button RefreshEnumList;
private System.Windows.Forms.Button RefreshSearchPathButton;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public TestAppForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.RefreshCDsButton = new System.Windows.Forms.Button();
this.CDDrivesList = new System.Windows.Forms.ListBox();
this.SearchPathList = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.EnumFilesPath = new System.Windows.Forms.TextBox();
this.EnumList = new System.Windows.Forms.ListBox();
this.label3 = new System.Windows.Forms.Label();
this.RefreshEnumList = new System.Windows.Forms.Button();
this.NewSearchPathText = new System.Windows.Forms.TextBox();
this.AddSearchPathButton = new System.Windows.Forms.Button();
this.RemovePathButton = new System.Windows.Forms.Button();
this.RefreshSearchPathButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 8);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(136, 16);
this.label2.TabIndex = 2;
this.label2.Text = "Available CD-ROM Drives";
//
// RefreshCDsButton
//
this.RefreshCDsButton.Location = new System.Drawing.Point(8, 152);
this.RefreshCDsButton.Name = "RefreshCDsButton";
this.RefreshCDsButton.Size = new System.Drawing.Size(72, 24);
this.RefreshCDsButton.TabIndex = 4;
this.RefreshCDsButton.Text = "Refresh";
this.RefreshCDsButton.Click += new System.EventHandler(this.RefreshCDsButton_Click);
//
// CDDrivesList
//
this.CDDrivesList.Location = new System.Drawing.Point(8, 24);
this.CDDrivesList.Name = "CDDrivesList";
this.CDDrivesList.Size = new System.Drawing.Size(136, 121);
this.CDDrivesList.TabIndex = 7;
//
// SearchPathList
//
this.SearchPathList.Location = new System.Drawing.Point(152, 24);
this.SearchPathList.Name = "SearchPathList";
this.SearchPathList.Size = new System.Drawing.Size(248, 95);
this.SearchPathList.TabIndex = 8;
//
// label1
//
this.label1.Location = new System.Drawing.Point(152, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(136, 16);
this.label1.TabIndex = 10;
this.label1.Text = "Search Path";
//
// EnumFilesPath
//
this.EnumFilesPath.Location = new System.Drawing.Point(408, 128);
this.EnumFilesPath.Name = "EnumFilesPath";
this.EnumFilesPath.Size = new System.Drawing.Size(208, 20);
this.EnumFilesPath.TabIndex = 11;
this.EnumFilesPath.Text = "";
//
// EnumList
//
this.EnumList.Location = new System.Drawing.Point(408, 24);
this.EnumList.Name = "EnumList";
this.EnumList.Size = new System.Drawing.Size(208, 95);
this.EnumList.TabIndex = 12;
//
// label3
//
this.label3.Location = new System.Drawing.Point(408, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(136, 16);
this.label3.TabIndex = 13;
this.label3.Text = "Enumerate Files";
//
// RefreshEnumList
//
this.RefreshEnumList.Location = new System.Drawing.Point(544, 152);
this.RefreshEnumList.Name = "RefreshEnumList";
this.RefreshEnumList.Size = new System.Drawing.Size(72, 24);
this.RefreshEnumList.TabIndex = 14;
this.RefreshEnumList.Text = "Refresh";
this.RefreshEnumList.Click += new System.EventHandler(this.RefreshEnumList_Click);
//
// NewSearchPathText
//
this.NewSearchPathText.Location = new System.Drawing.Point(152, 128);
this.NewSearchPathText.Name = "NewSearchPathText";
this.NewSearchPathText.Size = new System.Drawing.Size(248, 20);
this.NewSearchPathText.TabIndex = 15;
this.NewSearchPathText.Text = "";
//
// AddSearchPathButton
//
this.AddSearchPathButton.Location = new System.Drawing.Point(152, 152);
this.AddSearchPathButton.Name = "AddSearchPathButton";
this.AddSearchPathButton.Size = new System.Drawing.Size(72, 24);
this.AddSearchPathButton.TabIndex = 9;
this.AddSearchPathButton.Text = "Add Path";
this.AddSearchPathButton.Click += new System.EventHandler(this.AddSearchPathButton_Click);
//
// RemovePathButton
//
this.RemovePathButton.Location = new System.Drawing.Point(232, 152);
this.RemovePathButton.Name = "RemovePathButton";
this.RemovePathButton.Size = new System.Drawing.Size(88, 24);
this.RemovePathButton.TabIndex = 16;
this.RemovePathButton.Text = "Remove Path";
this.RemovePathButton.Click += new System.EventHandler(this.RemovePathButton_Click);
//
// RefreshSearchPathButton
//
this.RefreshSearchPathButton.Location = new System.Drawing.Point(328, 152);
this.RefreshSearchPathButton.Name = "RefreshSearchPathButton";
this.RefreshSearchPathButton.Size = new System.Drawing.Size(72, 24);
this.RefreshSearchPathButton.TabIndex = 17;
this.RefreshSearchPathButton.Text = "Refresh";
this.RefreshSearchPathButton.Click += new System.EventHandler(this.RefreshSearchPathButton_Click);
//
// TestAppForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(624, 309);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.RefreshSearchPathButton,
this.RemovePathButton,
this.NewSearchPathText,
this.RefreshEnumList,
this.label3,
this.EnumList,
this.EnumFilesPath,
this.label1,
this.SearchPathList,
this.CDDrivesList,
this.RefreshCDsButton,
this.label2,
this.AddSearchPathButton});
this.Name = "TestAppForm";
this.Text = "PhysFS Test Application";
this.Load += new System.EventHandler(this.TestAppForm_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new TestAppForm());
}
private void TestAppForm_Load(object sender, System.EventArgs e)
{
}
private void RefreshCDsButton_Click(object sender, System.EventArgs e)
{
// Clear ths listbox if it contains any items
CDDrivesList.Items.Clear();
// Add the items to the list
CDDrivesList.Items.AddRange(PhysFS.GetCDROMDrives());
}
private void RefreshSearchPathButton_Click(object sender, System.EventArgs e)
{
// Clear ths listbox if it contains any items
SearchPathList.Items.Clear();
// Add the items to the list
SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
}
private void AddSearchPathButton_Click(object sender, System.EventArgs e)
{
// Add search path
PhysFS.AddToSearchPath(NewSearchPathText.Text, false);
// Clear ths listbox if it contains any items
SearchPathList.Items.Clear();
// Add the items to the list
SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
}
private void RemovePathButton_Click(object sender, System.EventArgs e)
{
if(SearchPathList.SelectedItem != null)
{
PhysFS.RemoveFromSearchPath(SearchPathList.SelectedItem.ToString());
// Clear ths listbox if it contains any items
SearchPathList.Items.Clear();
// Add the items to the list
SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
}
}
private void RefreshEnumList_Click(object sender, System.EventArgs e)
{
EnumList.Items.Clear();
EnumList.Items.AddRange(PhysFS.EnumerateFiles(EnumFilesPath.Text));
}
}
}

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.Name">
<value>TestAppForm</value>
</data>
</root>

11
extras/README-CSharp.txt Normal file
View File

@ -0,0 +1,11 @@
There used to be C# bindings in this directory, but they have been
unmaintained for many years.
Instead, there is a more modern PhysicsFS wrapper for .NET available.
You can find it at https://github.com/frabert/SharpPhysFS
Thanks to Francesco Bertolaccini for his efforts on that project!
--ryan.

59
extras/buildbot-checker.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
# This is a script used by some Buildbot workers to push the project
# through Clang's static analyzer and prepare the output to be uploaded
# back to the buildmaster. You might find it useful too.
# Install Clang (you already have it on Mac OS X, apt-get install clang
# on Ubuntu, etc), Make sure "scan-build" is in your $PATH.
FINALDIR="$1"
set -x
set -e
cd `dirname "$0"`
cd ..
rm -rf checker-buildbot analysis
if [ ! -z "$FINALDIR" ]; then
rm -rf "$FINALDIR"
fi
mkdir checker-buildbot
cd checker-buildbot
# We turn off deprecated declarations, because we don't care about these warnings during static analysis.
# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
# You might want to do this for CMake-backed builds instead...
scan-build -o analysis cmake -G Ninja -Wno-dev -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXE_LINKER_FLAGS="-Wno-liblto" ..
rm -rf analysis
scan-build -o analysis cmake --build . --config Debug
if [ `ls -A analysis |wc -l` == 0 ] ; then
mkdir analysis/zarro
echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
fi
mv analysis/* ../analysis
rmdir analysis # Make sure this is empty.
cd ..
chmod -R a+r analysis
chmod -R go-w analysis
find analysis -type d -exec chmod a+x {} \;
if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
if [ ! -z "$FINALDIR" ]; then
mv analysis "$FINALDIR"
else
FINALDIR=analysis
fi
rm -rf checker-buildbot
echo "Done. Final output is in '$FINALDIR' ..."
# end of checker-buildbot.sh ...

52
extras/buildbot-emscripten.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
if [ -z "$SDKDIR" ]; then
SDKDIR="/emsdk"
fi
ENVSCRIPT="$SDKDIR/emsdk_env.sh"
if [ ! -f "$ENVSCRIPT" ]; then
echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2
exit 1
fi
TARBALL="$1"
if [ -z $1 ]; then
TARBALL=physfs-emscripten.tar.xz
fi
cd `dirname "$0"`
cd ..
PHYSFSBASE=`pwd`
echo "Setting up Emscripten SDK environment..."
source "$ENVSCRIPT"
echo "Setting up..."
cd "$PHYSFSBASE"
rm -rf buildbot
mkdir buildbot
cd buildbot
echo "Configuring..."
emcmake cmake -G "Ninja" -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=MinSizeRel .. || exit $?
echo "Building..."
emmake cmake --build . --config MinSizeRel || exit $?
set -e
rm -rf "$TARBALL" physfs-emscripten
mkdir -p physfs-emscripten
echo "Archiving to '$TARBALL' ..."
cp ../src/physfs.h libphysfs.a physfs-emscripten
chmod -R a+r physfs-emscripten
chmod a+x physfs-emscripten
chmod -R go-w physfs-emscripten
tar -cJvvf "$TARBALL" physfs-emscripten
echo "Done."
exit 0
# end of emscripten-buildbot.sh ...

87
extras/buildbot-os2.sh Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# This is used by the buildbot to cross-compile for OS/2 from Linux, using
# OpenWatcom. In an ideal world, we wouldn't need this, but we need a few
# things to do this "properly" ...
#
# - OS/2 running as a VMware guest on the build machine
# - Buildbot-worker running on that OS/2 guest
# - CMake for OS/2 that...
# - ... has Open Watcom compiler support and...
# - ... a Watcom WMake project generator.
#
# Some of these things are doable (there is a CMake port for OS/2, you can
# use GCC with it), but since OpenWatcom will just target OS/2 on Linux just
# like it could on OS/2, it's easier and more efficient to just have a
# buildbot script compile it here.
#
# Note that we just blast all the C files through the wcc386 compiler and
# skip CMake entirely. We should fix this at some point.
set -e
ZIPFILE="$1"
if [ -z $ZIPFILE ]; then
ZIPFILE=physfs-os2.zip
fi
export WATCOM="/usr/local/share/watcom"
export PATH="$PATH:$WATCOM/binl"
CFLAGS="-i=\"$WATCOM/h;$WATCOM/h/os2;../src\" -wx -d0 -otexan -6r -zq -bt=os2 -fo=.obj -mf"
WLIBFLAGS="-b -c -n -q -p=512"
cd `dirname "$0"`
cd ..
mkdir -p buildbot
cd buildbot
rm -f test_physfs.obj
OKAY="1"
for src in ../src/*.c ; do
echo wcc386 $src $CFLAGS
wcc386 $src $CFLAGS || OKAY="0"
done
if [ "$OKAY" == "1" ]; then
echo wlib $WLIBFLAGS physfs.lib *.obj
wlib $WLIBFLAGS physfs.lib *.obj || OKAY="0"
fi
echo wcc386 ../test/test_physfs.c $CFLAGS
wcc386 ../test/test_physfs.c $CFLAGS || OKAY="0"
if [ "$OKAY" == "1" ]; then
LDFLAGS="name test_physfs d all sys os2v2 op m libr physfs op q op symf FIL test_physfs.obj"
echo wlink $LDFLAGS
wlink $LDFLAGS || OKAY="0"
fi
if [ "$OKAY" == "1" ]; then
F=`file test_physfs.exe`
echo "$F"
if [ "$F" != 'test_physfs.exe: MS-DOS executable, LX for OS/2 (console) i80386' ]; then
echo 1>&2 "ERROR: final binary doesn't appear to be OS/2 executable."
OKAY=0
fi
fi
if [ "$OKAY" == "1" ]; then
echo 1>&2 "Build succeeded."
set -e
rm -rf "$ZIPFILE" physfs-os2
mkdir -p physfs-os2
echo "Zipping to '$ZIPFILE' ..."
cp ../src/physfs.h physfs.lib physfs-os2
chmod -R a+r physfs-os2
chmod a+x physfs-os2
chmod -R go-w physfs-os2
zip -9r "$ZIPFILE" physfs-os2
echo "Done."
exit 0
else
echo 1>&2 "Build failed."
exit 1
fi

56
extras/buildbot-raspberrypi.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# This is the script physfs-buildbot.icculus.org uses to cross-compile
# PhysicsFS from x86 Linux to Raspberry Pi. This script was originally from
# Simple Directmedia Layer ( https://www.libsdl.org/ ).
# The final tarball can be unpacked in the root directory of a RPi,
# so the PhysicsFS install lands in /usr/local. Run ldconfig, and then
# you should be able to build and run PhysicsFS-based software on your
# Pi. Standard configure scripts should be able to find PhysicsFS and
# build against it.
TARBALL="$1"
if [ -z $1 ]; then
TARBALL=physfs-raspberrypi.tar.xz
fi
BUILDBOTDIR="buildbot"
PARENTDIR="$PWD"
set -e
set -x
rm -f $TARBALL
rm -rf $BUILDBOTDIR
mkdir -p $BUILDBOTDIR
pushd $BUILDBOTDIR
# the '-G "Ninja"' can be '-G "Unix Makefiles"' if you prefer to use GNU Make.
SYSROOT="/opt/rpi-sysroot"
cmake -G "Ninja" \
-DCMAKE_C_COMPILER="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc" \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_SYSROOT="$SYSROOT" \
-DCMAKE_FIND_ROOT_PATH="$SYSROOT" \
-DCMAKE_SYSTEM_NAME="Linux" \
-DCMAKE_SYSTEM_VERSION=1 \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
..
cmake --build . --config MinSizeRel
rm -rf "$TARBALL" physfs-raspberrypi
mkdir -p physfs-raspberrypi
echo "Archiving to '$TARBALL' ..."
cp -a ../src/physfs.h libphysfs.a libphysfs.so* physfs-raspberrypi
chmod -R a+r physfs-raspberrypi
chmod a+x physfs-raspberrypi physfs-raspberrypi/*.so*
chmod -R go-w physfs-raspberrypi
tar -cJvvf "$TARBALL" physfs-raspberrypi
set +x
echo "Done."

View File

@ -1,10 +1,10 @@
# CaseFolding-4.1.0.txt
# Date: 2005-03-26, 00:24:43 GMT [MD]
# CaseFolding-8.0.0.txt
# Date: 2015-01-13, 18:16:36 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2005 Unicode, Inc.
# Copyright (c) 1991-2015 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see UCD.html
# For documentation, see http://www.unicode.org/reports/tr44/
#
# Case Folding Properties
#
@ -23,8 +23,9 @@
#
# NOTE: case folding does not preserve normalization formats!
#
# For information on case folding, see
# UTR #21 Case Mappings, at http://www.unicode.org/unicode/reports/tr21/
# For information on case folding, including how to have case folding
# preserve normalization formats, see Section 3.13 Default Case Algorithms in
# The Unicode Standard.
#
# ================================================================================
# Format
@ -52,6 +53,12 @@
#
# =================================================================
# Property: Case_Folding
# All code points not explicitly listed for Case_Folding
# have the value C for the status field, and the code point itself for the mapping field.
# =================================================================
0041; C; 0061; # LATIN CAPITAL LETTER A
0042; C; 0062; # LATIN CAPITAL LETTER B
0043; C; 0063; # LATIN CAPITAL LETTER C
@ -272,10 +279,24 @@
022E; C; 022F; # LATIN CAPITAL LETTER O WITH DOT ABOVE
0230; C; 0231; # LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON
0232; C; 0233; # LATIN CAPITAL LETTER Y WITH MACRON
023A; C; 2C65; # LATIN CAPITAL LETTER A WITH STROKE
023B; C; 023C; # LATIN CAPITAL LETTER C WITH STROKE
023D; C; 019A; # LATIN CAPITAL LETTER L WITH BAR
0241; C; 0294; # LATIN CAPITAL LETTER GLOTTAL STOP
023E; C; 2C66; # LATIN CAPITAL LETTER T WITH DIAGONAL STROKE
0241; C; 0242; # LATIN CAPITAL LETTER GLOTTAL STOP
0243; C; 0180; # LATIN CAPITAL LETTER B WITH STROKE
0244; C; 0289; # LATIN CAPITAL LETTER U BAR
0245; C; 028C; # LATIN CAPITAL LETTER TURNED V
0246; C; 0247; # LATIN CAPITAL LETTER E WITH STROKE
0248; C; 0249; # LATIN CAPITAL LETTER J WITH STROKE
024A; C; 024B; # LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL
024C; C; 024D; # LATIN CAPITAL LETTER R WITH STROKE
024E; C; 024F; # LATIN CAPITAL LETTER Y WITH STROKE
0345; C; 03B9; # COMBINING GREEK YPOGEGRAMMENI
0370; C; 0371; # GREEK CAPITAL LETTER HETA
0372; C; 0373; # GREEK CAPITAL LETTER ARCHAIC SAMPI
0376; C; 0377; # GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA
037F; C; 03F3; # GREEK CAPITAL LETTER YOT
0386; C; 03AC; # GREEK CAPITAL LETTER ALPHA WITH TONOS
0388; C; 03AD; # GREEK CAPITAL LETTER EPSILON WITH TONOS
0389; C; 03AE; # GREEK CAPITAL LETTER ETA WITH TONOS
@ -312,6 +333,7 @@
03AB; C; 03CB; # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
03B0; F; 03C5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
03C2; C; 03C3; # GREEK SMALL LETTER FINAL SIGMA
03CF; C; 03D7; # GREEK CAPITAL KAI SYMBOL
03D0; C; 03B2; # GREEK BETA SYMBOL
03D1; C; 03B8; # GREEK THETA SYMBOL
03D5; C; 03C6; # GREEK PHI SYMBOL
@ -335,6 +357,9 @@
03F7; C; 03F8; # GREEK CAPITAL LETTER SHO
03F9; C; 03F2; # GREEK CAPITAL LUNATE SIGMA SYMBOL
03FA; C; 03FB; # GREEK CAPITAL LETTER SAN
03FD; C; 037B; # GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL
03FE; C; 037C; # GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL
03FF; C; 037D; # GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL
0400; C; 0450; # CYRILLIC CAPITAL LETTER IE WITH GRAVE
0401; C; 0451; # CYRILLIC CAPITAL LETTER IO
0402; C; 0452; # CYRILLIC CAPITAL LETTER DJE
@ -427,6 +452,7 @@
04BA; C; 04BB; # CYRILLIC CAPITAL LETTER SHHA
04BC; C; 04BD; # CYRILLIC CAPITAL LETTER ABKHASIAN CHE
04BE; C; 04BF; # CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER
04C0; C; 04CF; # CYRILLIC LETTER PALOCHKA
04C1; C; 04C2; # CYRILLIC CAPITAL LETTER ZHE WITH BREVE
04C3; C; 04C4; # CYRILLIC CAPITAL LETTER KA WITH HOOK
04C5; C; 04C6; # CYRILLIC CAPITAL LETTER EL WITH TAIL
@ -455,6 +481,9 @@
04F4; C; 04F5; # CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS
04F6; C; 04F7; # CYRILLIC CAPITAL LETTER GHE WITH DESCENDER
04F8; C; 04F9; # CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS
04FA; C; 04FB; # CYRILLIC CAPITAL LETTER GHE WITH STROKE AND HOOK
04FC; C; 04FD; # CYRILLIC CAPITAL LETTER HA WITH HOOK
04FE; C; 04FF; # CYRILLIC CAPITAL LETTER HA WITH STROKE
0500; C; 0501; # CYRILLIC CAPITAL LETTER KOMI DE
0502; C; 0503; # CYRILLIC CAPITAL LETTER KOMI DJE
0504; C; 0505; # CYRILLIC CAPITAL LETTER KOMI ZJE
@ -463,6 +492,22 @@
050A; C; 050B; # CYRILLIC CAPITAL LETTER KOMI NJE
050C; C; 050D; # CYRILLIC CAPITAL LETTER KOMI SJE
050E; C; 050F; # CYRILLIC CAPITAL LETTER KOMI TJE
0510; C; 0511; # CYRILLIC CAPITAL LETTER REVERSED ZE
0512; C; 0513; # CYRILLIC CAPITAL LETTER EL WITH HOOK
0514; C; 0515; # CYRILLIC CAPITAL LETTER LHA
0516; C; 0517; # CYRILLIC CAPITAL LETTER RHA
0518; C; 0519; # CYRILLIC CAPITAL LETTER YAE
051A; C; 051B; # CYRILLIC CAPITAL LETTER QA
051C; C; 051D; # CYRILLIC CAPITAL LETTER WE
051E; C; 051F; # CYRILLIC CAPITAL LETTER ALEUT KA
0520; C; 0521; # CYRILLIC CAPITAL LETTER EL WITH MIDDLE HOOK
0522; C; 0523; # CYRILLIC CAPITAL LETTER EN WITH MIDDLE HOOK
0524; C; 0525; # CYRILLIC CAPITAL LETTER PE WITH DESCENDER
0526; C; 0527; # CYRILLIC CAPITAL LETTER SHHA WITH DESCENDER
0528; C; 0529; # CYRILLIC CAPITAL LETTER EN WITH LEFT HOOK
052A; C; 052B; # CYRILLIC CAPITAL LETTER DZZHE
052C; C; 052D; # CYRILLIC CAPITAL LETTER DCHE
052E; C; 052F; # CYRILLIC CAPITAL LETTER EL WITH DESCENDER
0531; C; 0561; # ARMENIAN CAPITAL LETTER AYB
0532; C; 0562; # ARMENIAN CAPITAL LETTER BEN
0533; C; 0563; # ARMENIAN CAPITAL LETTER GIM
@ -540,6 +585,14 @@
10C3; C; 2D23; # GEORGIAN CAPITAL LETTER WE
10C4; C; 2D24; # GEORGIAN CAPITAL LETTER HAR
10C5; C; 2D25; # GEORGIAN CAPITAL LETTER HOE
10C7; C; 2D27; # GEORGIAN CAPITAL LETTER YN
10CD; C; 2D2D; # GEORGIAN CAPITAL LETTER AEN
13F8; C; 13F0; # CHEROKEE SMALL LETTER YE
13F9; C; 13F1; # CHEROKEE SMALL LETTER YI
13FA; C; 13F2; # CHEROKEE SMALL LETTER YO
13FB; C; 13F3; # CHEROKEE SMALL LETTER YU
13FC; C; 13F4; # CHEROKEE SMALL LETTER YV
13FD; C; 13F5; # CHEROKEE SMALL LETTER MV
1E00; C; 1E01; # LATIN CAPITAL LETTER A WITH RING BELOW
1E02; C; 1E03; # LATIN CAPITAL LETTER B WITH DOT ABOVE
1E04; C; 1E05; # LATIN CAPITAL LETTER B WITH DOT BELOW
@ -621,6 +674,8 @@
1E99; F; 0079 030A; # LATIN SMALL LETTER Y WITH RING ABOVE
1E9A; F; 0061 02BE; # LATIN SMALL LETTER A WITH RIGHT HALF RING
1E9B; C; 1E61; # LATIN SMALL LETTER LONG S WITH DOT ABOVE
1E9E; F; 0073 0073; # LATIN CAPITAL LETTER SHARP S
1E9E; S; 00DF; # LATIN CAPITAL LETTER SHARP S
1EA0; C; 1EA1; # LATIN CAPITAL LETTER A WITH DOT BELOW
1EA2; C; 1EA3; # LATIN CAPITAL LETTER A WITH HOOK ABOVE
1EA4; C; 1EA5; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
@ -666,6 +721,9 @@
1EF4; C; 1EF5; # LATIN CAPITAL LETTER Y WITH DOT BELOW
1EF6; C; 1EF7; # LATIN CAPITAL LETTER Y WITH HOOK ABOVE
1EF8; C; 1EF9; # LATIN CAPITAL LETTER Y WITH TILDE
1EFA; C; 1EFB; # LATIN CAPITAL LETTER MIDDLE-WELSH LL
1EFC; C; 1EFD; # LATIN CAPITAL LETTER MIDDLE-WELSH V
1EFE; C; 1EFF; # LATIN CAPITAL LETTER Y WITH LOOP
1F08; C; 1F00; # GREEK CAPITAL LETTER ALPHA WITH PSILI
1F09; C; 1F01; # GREEK CAPITAL LETTER ALPHA WITH DASIA
1F0A; C; 1F02; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA
@ -845,6 +903,7 @@
2126; C; 03C9; # OHM SIGN
212A; C; 006B; # KELVIN SIGN
212B; C; 00E5; # ANGSTROM SIGN
2132; C; 214E; # TURNED CAPITAL F
2160; C; 2170; # ROMAN NUMERAL ONE
2161; C; 2171; # ROMAN NUMERAL TWO
2162; C; 2172; # ROMAN NUMERAL THREE
@ -861,6 +920,7 @@
216D; C; 217D; # ROMAN NUMERAL ONE HUNDRED
216E; C; 217E; # ROMAN NUMERAL FIVE HUNDRED
216F; C; 217F; # ROMAN NUMERAL ONE THOUSAND
2183; C; 2184; # ROMAN NUMERAL REVERSED ONE HUNDRED
24B6; C; 24D0; # CIRCLED LATIN CAPITAL LETTER A
24B7; C; 24D1; # CIRCLED LATIN CAPITAL LETTER B
24B8; C; 24D2; # CIRCLED LATIN CAPITAL LETTER C
@ -934,6 +994,21 @@
2C2C; C; 2C5C; # GLAGOLITIC CAPITAL LETTER SHTAPIC
2C2D; C; 2C5D; # GLAGOLITIC CAPITAL LETTER TROKUTASTI A
2C2E; C; 2C5E; # GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE
2C60; C; 2C61; # LATIN CAPITAL LETTER L WITH DOUBLE BAR
2C62; C; 026B; # LATIN CAPITAL LETTER L WITH MIDDLE TILDE
2C63; C; 1D7D; # LATIN CAPITAL LETTER P WITH STROKE
2C64; C; 027D; # LATIN CAPITAL LETTER R WITH TAIL
2C67; C; 2C68; # LATIN CAPITAL LETTER H WITH DESCENDER
2C69; C; 2C6A; # LATIN CAPITAL LETTER K WITH DESCENDER
2C6B; C; 2C6C; # LATIN CAPITAL LETTER Z WITH DESCENDER
2C6D; C; 0251; # LATIN CAPITAL LETTER ALPHA
2C6E; C; 0271; # LATIN CAPITAL LETTER M WITH HOOK
2C6F; C; 0250; # LATIN CAPITAL LETTER TURNED A
2C70; C; 0252; # LATIN CAPITAL LETTER TURNED ALPHA
2C72; C; 2C73; # LATIN CAPITAL LETTER W WITH HOOK
2C75; C; 2C76; # LATIN CAPITAL LETTER HALF H
2C7E; C; 023F; # LATIN CAPITAL LETTER S WITH SWASH TAIL
2C7F; C; 0240; # LATIN CAPITAL LETTER Z WITH SWASH TAIL
2C80; C; 2C81; # COPTIC CAPITAL LETTER ALFA
2C82; C; 2C83; # COPTIC CAPITAL LETTER VIDA
2C84; C; 2C85; # COPTIC CAPITAL LETTER GAMMA
@ -984,6 +1059,196 @@
2CDE; C; 2CDF; # COPTIC CAPITAL LETTER OLD NUBIAN NGI
2CE0; C; 2CE1; # COPTIC CAPITAL LETTER OLD NUBIAN NYI
2CE2; C; 2CE3; # COPTIC CAPITAL LETTER OLD NUBIAN WAU
2CEB; C; 2CEC; # COPTIC CAPITAL LETTER CRYPTOGRAMMIC SHEI
2CED; C; 2CEE; # COPTIC CAPITAL LETTER CRYPTOGRAMMIC GANGIA
2CF2; C; 2CF3; # COPTIC CAPITAL LETTER BOHAIRIC KHEI
A640; C; A641; # CYRILLIC CAPITAL LETTER ZEMLYA
A642; C; A643; # CYRILLIC CAPITAL LETTER DZELO
A644; C; A645; # CYRILLIC CAPITAL LETTER REVERSED DZE
A646; C; A647; # CYRILLIC CAPITAL LETTER IOTA
A648; C; A649; # CYRILLIC CAPITAL LETTER DJERV
A64A; C; A64B; # CYRILLIC CAPITAL LETTER MONOGRAPH UK
A64C; C; A64D; # CYRILLIC CAPITAL LETTER BROAD OMEGA
A64E; C; A64F; # CYRILLIC CAPITAL LETTER NEUTRAL YER
A650; C; A651; # CYRILLIC CAPITAL LETTER YERU WITH BACK YER
A652; C; A653; # CYRILLIC CAPITAL LETTER IOTIFIED YAT
A654; C; A655; # CYRILLIC CAPITAL LETTER REVERSED YU
A656; C; A657; # CYRILLIC CAPITAL LETTER IOTIFIED A
A658; C; A659; # CYRILLIC CAPITAL LETTER CLOSED LITTLE YUS
A65A; C; A65B; # CYRILLIC CAPITAL LETTER BLENDED YUS
A65C; C; A65D; # CYRILLIC CAPITAL LETTER IOTIFIED CLOSED LITTLE YUS
A65E; C; A65F; # CYRILLIC CAPITAL LETTER YN
A660; C; A661; # CYRILLIC CAPITAL LETTER REVERSED TSE
A662; C; A663; # CYRILLIC CAPITAL LETTER SOFT DE
A664; C; A665; # CYRILLIC CAPITAL LETTER SOFT EL
A666; C; A667; # CYRILLIC CAPITAL LETTER SOFT EM
A668; C; A669; # CYRILLIC CAPITAL LETTER MONOCULAR O
A66A; C; A66B; # CYRILLIC CAPITAL LETTER BINOCULAR O
A66C; C; A66D; # CYRILLIC CAPITAL LETTER DOUBLE MONOCULAR O
A680; C; A681; # CYRILLIC CAPITAL LETTER DWE
A682; C; A683; # CYRILLIC CAPITAL LETTER DZWE
A684; C; A685; # CYRILLIC CAPITAL LETTER ZHWE
A686; C; A687; # CYRILLIC CAPITAL LETTER CCHE
A688; C; A689; # CYRILLIC CAPITAL LETTER DZZE
A68A; C; A68B; # CYRILLIC CAPITAL LETTER TE WITH MIDDLE HOOK
A68C; C; A68D; # CYRILLIC CAPITAL LETTER TWE
A68E; C; A68F; # CYRILLIC CAPITAL LETTER TSWE
A690; C; A691; # CYRILLIC CAPITAL LETTER TSSE
A692; C; A693; # CYRILLIC CAPITAL LETTER TCHE
A694; C; A695; # CYRILLIC CAPITAL LETTER HWE
A696; C; A697; # CYRILLIC CAPITAL LETTER SHWE
A698; C; A699; # CYRILLIC CAPITAL LETTER DOUBLE O
A69A; C; A69B; # CYRILLIC CAPITAL LETTER CROSSED O
A722; C; A723; # LATIN CAPITAL LETTER EGYPTOLOGICAL ALEF
A724; C; A725; # LATIN CAPITAL LETTER EGYPTOLOGICAL AIN
A726; C; A727; # LATIN CAPITAL LETTER HENG
A728; C; A729; # LATIN CAPITAL LETTER TZ
A72A; C; A72B; # LATIN CAPITAL LETTER TRESILLO
A72C; C; A72D; # LATIN CAPITAL LETTER CUATRILLO
A72E; C; A72F; # LATIN CAPITAL LETTER CUATRILLO WITH COMMA
A732; C; A733; # LATIN CAPITAL LETTER AA
A734; C; A735; # LATIN CAPITAL LETTER AO
A736; C; A737; # LATIN CAPITAL LETTER AU
A738; C; A739; # LATIN CAPITAL LETTER AV
A73A; C; A73B; # LATIN CAPITAL LETTER AV WITH HORIZONTAL BAR
A73C; C; A73D; # LATIN CAPITAL LETTER AY
A73E; C; A73F; # LATIN CAPITAL LETTER REVERSED C WITH DOT
A740; C; A741; # LATIN CAPITAL LETTER K WITH STROKE
A742; C; A743; # LATIN CAPITAL LETTER K WITH DIAGONAL STROKE
A744; C; A745; # LATIN CAPITAL LETTER K WITH STROKE AND DIAGONAL STROKE
A746; C; A747; # LATIN CAPITAL LETTER BROKEN L
A748; C; A749; # LATIN CAPITAL LETTER L WITH HIGH STROKE
A74A; C; A74B; # LATIN CAPITAL LETTER O WITH LONG STROKE OVERLAY
A74C; C; A74D; # LATIN CAPITAL LETTER O WITH LOOP
A74E; C; A74F; # LATIN CAPITAL LETTER OO
A750; C; A751; # LATIN CAPITAL LETTER P WITH STROKE THROUGH DESCENDER
A752; C; A753; # LATIN CAPITAL LETTER P WITH FLOURISH
A754; C; A755; # LATIN CAPITAL LETTER P WITH SQUIRREL TAIL
A756; C; A757; # LATIN CAPITAL LETTER Q WITH STROKE THROUGH DESCENDER
A758; C; A759; # LATIN CAPITAL LETTER Q WITH DIAGONAL STROKE
A75A; C; A75B; # LATIN CAPITAL LETTER R ROTUNDA
A75C; C; A75D; # LATIN CAPITAL LETTER RUM ROTUNDA
A75E; C; A75F; # LATIN CAPITAL LETTER V WITH DIAGONAL STROKE
A760; C; A761; # LATIN CAPITAL LETTER VY
A762; C; A763; # LATIN CAPITAL LETTER VISIGOTHIC Z
A764; C; A765; # LATIN CAPITAL LETTER THORN WITH STROKE
A766; C; A767; # LATIN CAPITAL LETTER THORN WITH STROKE THROUGH DESCENDER
A768; C; A769; # LATIN CAPITAL LETTER VEND
A76A; C; A76B; # LATIN CAPITAL LETTER ET
A76C; C; A76D; # LATIN CAPITAL LETTER IS
A76E; C; A76F; # LATIN CAPITAL LETTER CON
A779; C; A77A; # LATIN CAPITAL LETTER INSULAR D
A77B; C; A77C; # LATIN CAPITAL LETTER INSULAR F
A77D; C; 1D79; # LATIN CAPITAL LETTER INSULAR G
A77E; C; A77F; # LATIN CAPITAL LETTER TURNED INSULAR G
A780; C; A781; # LATIN CAPITAL LETTER TURNED L
A782; C; A783; # LATIN CAPITAL LETTER INSULAR R
A784; C; A785; # LATIN CAPITAL LETTER INSULAR S
A786; C; A787; # LATIN CAPITAL LETTER INSULAR T
A78B; C; A78C; # LATIN CAPITAL LETTER SALTILLO
A78D; C; 0265; # LATIN CAPITAL LETTER TURNED H
A790; C; A791; # LATIN CAPITAL LETTER N WITH DESCENDER
A792; C; A793; # LATIN CAPITAL LETTER C WITH BAR
A796; C; A797; # LATIN CAPITAL LETTER B WITH FLOURISH
A798; C; A799; # LATIN CAPITAL LETTER F WITH STROKE
A79A; C; A79B; # LATIN CAPITAL LETTER VOLAPUK AE
A79C; C; A79D; # LATIN CAPITAL LETTER VOLAPUK OE
A79E; C; A79F; # LATIN CAPITAL LETTER VOLAPUK UE
A7A0; C; A7A1; # LATIN CAPITAL LETTER G WITH OBLIQUE STROKE
A7A2; C; A7A3; # LATIN CAPITAL LETTER K WITH OBLIQUE STROKE
A7A4; C; A7A5; # LATIN CAPITAL LETTER N WITH OBLIQUE STROKE
A7A6; C; A7A7; # LATIN CAPITAL LETTER R WITH OBLIQUE STROKE
A7A8; C; A7A9; # LATIN CAPITAL LETTER S WITH OBLIQUE STROKE
A7AA; C; 0266; # LATIN CAPITAL LETTER H WITH HOOK
A7AB; C; 025C; # LATIN CAPITAL LETTER REVERSED OPEN E
A7AC; C; 0261; # LATIN CAPITAL LETTER SCRIPT G
A7AD; C; 026C; # LATIN CAPITAL LETTER L WITH BELT
A7B0; C; 029E; # LATIN CAPITAL LETTER TURNED K
A7B1; C; 0287; # LATIN CAPITAL LETTER TURNED T
A7B2; C; 029D; # LATIN CAPITAL LETTER J WITH CROSSED-TAIL
A7B3; C; AB53; # LATIN CAPITAL LETTER CHI
A7B4; C; A7B5; # LATIN CAPITAL LETTER BETA
A7B6; C; A7B7; # LATIN CAPITAL LETTER OMEGA
AB70; C; 13A0; # CHEROKEE SMALL LETTER A
AB71; C; 13A1; # CHEROKEE SMALL LETTER E
AB72; C; 13A2; # CHEROKEE SMALL LETTER I
AB73; C; 13A3; # CHEROKEE SMALL LETTER O
AB74; C; 13A4; # CHEROKEE SMALL LETTER U
AB75; C; 13A5; # CHEROKEE SMALL LETTER V
AB76; C; 13A6; # CHEROKEE SMALL LETTER GA
AB77; C; 13A7; # CHEROKEE SMALL LETTER KA
AB78; C; 13A8; # CHEROKEE SMALL LETTER GE
AB79; C; 13A9; # CHEROKEE SMALL LETTER GI
AB7A; C; 13AA; # CHEROKEE SMALL LETTER GO
AB7B; C; 13AB; # CHEROKEE SMALL LETTER GU
AB7C; C; 13AC; # CHEROKEE SMALL LETTER GV
AB7D; C; 13AD; # CHEROKEE SMALL LETTER HA
AB7E; C; 13AE; # CHEROKEE SMALL LETTER HE
AB7F; C; 13AF; # CHEROKEE SMALL LETTER HI
AB80; C; 13B0; # CHEROKEE SMALL LETTER HO
AB81; C; 13B1; # CHEROKEE SMALL LETTER HU
AB82; C; 13B2; # CHEROKEE SMALL LETTER HV
AB83; C; 13B3; # CHEROKEE SMALL LETTER LA
AB84; C; 13B4; # CHEROKEE SMALL LETTER LE
AB85; C; 13B5; # CHEROKEE SMALL LETTER LI
AB86; C; 13B6; # CHEROKEE SMALL LETTER LO
AB87; C; 13B7; # CHEROKEE SMALL LETTER LU
AB88; C; 13B8; # CHEROKEE SMALL LETTER LV
AB89; C; 13B9; # CHEROKEE SMALL LETTER MA
AB8A; C; 13BA; # CHEROKEE SMALL LETTER ME
AB8B; C; 13BB; # CHEROKEE SMALL LETTER MI
AB8C; C; 13BC; # CHEROKEE SMALL LETTER MO
AB8D; C; 13BD; # CHEROKEE SMALL LETTER MU
AB8E; C; 13BE; # CHEROKEE SMALL LETTER NA
AB8F; C; 13BF; # CHEROKEE SMALL LETTER HNA
AB90; C; 13C0; # CHEROKEE SMALL LETTER NAH
AB91; C; 13C1; # CHEROKEE SMALL LETTER NE
AB92; C; 13C2; # CHEROKEE SMALL LETTER NI
AB93; C; 13C3; # CHEROKEE SMALL LETTER NO
AB94; C; 13C4; # CHEROKEE SMALL LETTER NU
AB95; C; 13C5; # CHEROKEE SMALL LETTER NV
AB96; C; 13C6; # CHEROKEE SMALL LETTER QUA
AB97; C; 13C7; # CHEROKEE SMALL LETTER QUE
AB98; C; 13C8; # CHEROKEE SMALL LETTER QUI
AB99; C; 13C9; # CHEROKEE SMALL LETTER QUO
AB9A; C; 13CA; # CHEROKEE SMALL LETTER QUU
AB9B; C; 13CB; # CHEROKEE SMALL LETTER QUV
AB9C; C; 13CC; # CHEROKEE SMALL LETTER SA
AB9D; C; 13CD; # CHEROKEE SMALL LETTER S
AB9E; C; 13CE; # CHEROKEE SMALL LETTER SE
AB9F; C; 13CF; # CHEROKEE SMALL LETTER SI
ABA0; C; 13D0; # CHEROKEE SMALL LETTER SO
ABA1; C; 13D1; # CHEROKEE SMALL LETTER SU
ABA2; C; 13D2; # CHEROKEE SMALL LETTER SV
ABA3; C; 13D3; # CHEROKEE SMALL LETTER DA
ABA4; C; 13D4; # CHEROKEE SMALL LETTER TA
ABA5; C; 13D5; # CHEROKEE SMALL LETTER DE
ABA6; C; 13D6; # CHEROKEE SMALL LETTER TE
ABA7; C; 13D7; # CHEROKEE SMALL LETTER DI
ABA8; C; 13D8; # CHEROKEE SMALL LETTER TI
ABA9; C; 13D9; # CHEROKEE SMALL LETTER DO
ABAA; C; 13DA; # CHEROKEE SMALL LETTER DU
ABAB; C; 13DB; # CHEROKEE SMALL LETTER DV
ABAC; C; 13DC; # CHEROKEE SMALL LETTER DLA
ABAD; C; 13DD; # CHEROKEE SMALL LETTER TLA
ABAE; C; 13DE; # CHEROKEE SMALL LETTER TLE
ABAF; C; 13DF; # CHEROKEE SMALL LETTER TLI
ABB0; C; 13E0; # CHEROKEE SMALL LETTER TLO
ABB1; C; 13E1; # CHEROKEE SMALL LETTER TLU
ABB2; C; 13E2; # CHEROKEE SMALL LETTER TLV
ABB3; C; 13E3; # CHEROKEE SMALL LETTER TSA
ABB4; C; 13E4; # CHEROKEE SMALL LETTER TSE
ABB5; C; 13E5; # CHEROKEE SMALL LETTER TSI
ABB6; C; 13E6; # CHEROKEE SMALL LETTER TSO
ABB7; C; 13E7; # CHEROKEE SMALL LETTER TSU
ABB8; C; 13E8; # CHEROKEE SMALL LETTER TSV
ABB9; C; 13E9; # CHEROKEE SMALL LETTER WA
ABBA; C; 13EA; # CHEROKEE SMALL LETTER WE
ABBB; C; 13EB; # CHEROKEE SMALL LETTER WI
ABBC; C; 13EC; # CHEROKEE SMALL LETTER WO
ABBD; C; 13ED; # CHEROKEE SMALL LETTER WU
ABBE; C; 13EE; # CHEROKEE SMALL LETTER WV
ABBF; C; 13EF; # CHEROKEE SMALL LETTER YA
FB00; F; 0066 0066; # LATIN SMALL LIGATURE FF
FB01; F; 0066 0069; # LATIN SMALL LIGATURE FI
FB02; F; 0066 006C; # LATIN SMALL LIGATURE FL
@ -1062,3 +1327,88 @@ FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z
10425; C; 1044D; # DESERET CAPITAL LETTER ENG
10426; C; 1044E; # DESERET CAPITAL LETTER OI
10427; C; 1044F; # DESERET CAPITAL LETTER EW
10C80; C; 10CC0; # OLD HUNGARIAN CAPITAL LETTER A
10C81; C; 10CC1; # OLD HUNGARIAN CAPITAL LETTER AA
10C82; C; 10CC2; # OLD HUNGARIAN CAPITAL LETTER EB
10C83; C; 10CC3; # OLD HUNGARIAN CAPITAL LETTER AMB
10C84; C; 10CC4; # OLD HUNGARIAN CAPITAL LETTER EC
10C85; C; 10CC5; # OLD HUNGARIAN CAPITAL LETTER ENC
10C86; C; 10CC6; # OLD HUNGARIAN CAPITAL LETTER ECS
10C87; C; 10CC7; # OLD HUNGARIAN CAPITAL LETTER ED
10C88; C; 10CC8; # OLD HUNGARIAN CAPITAL LETTER AND
10C89; C; 10CC9; # OLD HUNGARIAN CAPITAL LETTER E
10C8A; C; 10CCA; # OLD HUNGARIAN CAPITAL LETTER CLOSE E
10C8B; C; 10CCB; # OLD HUNGARIAN CAPITAL LETTER EE
10C8C; C; 10CCC; # OLD HUNGARIAN CAPITAL LETTER EF
10C8D; C; 10CCD; # OLD HUNGARIAN CAPITAL LETTER EG
10C8E; C; 10CCE; # OLD HUNGARIAN CAPITAL LETTER EGY
10C8F; C; 10CCF; # OLD HUNGARIAN CAPITAL LETTER EH
10C90; C; 10CD0; # OLD HUNGARIAN CAPITAL LETTER I
10C91; C; 10CD1; # OLD HUNGARIAN CAPITAL LETTER II
10C92; C; 10CD2; # OLD HUNGARIAN CAPITAL LETTER EJ
10C93; C; 10CD3; # OLD HUNGARIAN CAPITAL LETTER EK
10C94; C; 10CD4; # OLD HUNGARIAN CAPITAL LETTER AK
10C95; C; 10CD5; # OLD HUNGARIAN CAPITAL LETTER UNK
10C96; C; 10CD6; # OLD HUNGARIAN CAPITAL LETTER EL
10C97; C; 10CD7; # OLD HUNGARIAN CAPITAL LETTER ELY
10C98; C; 10CD8; # OLD HUNGARIAN CAPITAL LETTER EM
10C99; C; 10CD9; # OLD HUNGARIAN CAPITAL LETTER EN
10C9A; C; 10CDA; # OLD HUNGARIAN CAPITAL LETTER ENY
10C9B; C; 10CDB; # OLD HUNGARIAN CAPITAL LETTER O
10C9C; C; 10CDC; # OLD HUNGARIAN CAPITAL LETTER OO
10C9D; C; 10CDD; # OLD HUNGARIAN CAPITAL LETTER NIKOLSBURG OE
10C9E; C; 10CDE; # OLD HUNGARIAN CAPITAL LETTER RUDIMENTA OE
10C9F; C; 10CDF; # OLD HUNGARIAN CAPITAL LETTER OEE
10CA0; C; 10CE0; # OLD HUNGARIAN CAPITAL LETTER EP
10CA1; C; 10CE1; # OLD HUNGARIAN CAPITAL LETTER EMP
10CA2; C; 10CE2; # OLD HUNGARIAN CAPITAL LETTER ER
10CA3; C; 10CE3; # OLD HUNGARIAN CAPITAL LETTER SHORT ER
10CA4; C; 10CE4; # OLD HUNGARIAN CAPITAL LETTER ES
10CA5; C; 10CE5; # OLD HUNGARIAN CAPITAL LETTER ESZ
10CA6; C; 10CE6; # OLD HUNGARIAN CAPITAL LETTER ET
10CA7; C; 10CE7; # OLD HUNGARIAN CAPITAL LETTER ENT
10CA8; C; 10CE8; # OLD HUNGARIAN CAPITAL LETTER ETY
10CA9; C; 10CE9; # OLD HUNGARIAN CAPITAL LETTER ECH
10CAA; C; 10CEA; # OLD HUNGARIAN CAPITAL LETTER U
10CAB; C; 10CEB; # OLD HUNGARIAN CAPITAL LETTER UU
10CAC; C; 10CEC; # OLD HUNGARIAN CAPITAL LETTER NIKOLSBURG UE
10CAD; C; 10CED; # OLD HUNGARIAN CAPITAL LETTER RUDIMENTA UE
10CAE; C; 10CEE; # OLD HUNGARIAN CAPITAL LETTER EV
10CAF; C; 10CEF; # OLD HUNGARIAN CAPITAL LETTER EZ
10CB0; C; 10CF0; # OLD HUNGARIAN CAPITAL LETTER EZS
10CB1; C; 10CF1; # OLD HUNGARIAN CAPITAL LETTER ENT-SHAPED SIGN
10CB2; C; 10CF2; # OLD HUNGARIAN CAPITAL LETTER US
118A0; C; 118C0; # WARANG CITI CAPITAL LETTER NGAA
118A1; C; 118C1; # WARANG CITI CAPITAL LETTER A
118A2; C; 118C2; # WARANG CITI CAPITAL LETTER WI
118A3; C; 118C3; # WARANG CITI CAPITAL LETTER YU
118A4; C; 118C4; # WARANG CITI CAPITAL LETTER YA
118A5; C; 118C5; # WARANG CITI CAPITAL LETTER YO
118A6; C; 118C6; # WARANG CITI CAPITAL LETTER II
118A7; C; 118C7; # WARANG CITI CAPITAL LETTER UU
118A8; C; 118C8; # WARANG CITI CAPITAL LETTER E
118A9; C; 118C9; # WARANG CITI CAPITAL LETTER O
118AA; C; 118CA; # WARANG CITI CAPITAL LETTER ANG
118AB; C; 118CB; # WARANG CITI CAPITAL LETTER GA
118AC; C; 118CC; # WARANG CITI CAPITAL LETTER KO
118AD; C; 118CD; # WARANG CITI CAPITAL LETTER ENY
118AE; C; 118CE; # WARANG CITI CAPITAL LETTER YUJ
118AF; C; 118CF; # WARANG CITI CAPITAL LETTER UC
118B0; C; 118D0; # WARANG CITI CAPITAL LETTER ENN
118B1; C; 118D1; # WARANG CITI CAPITAL LETTER ODD
118B2; C; 118D2; # WARANG CITI CAPITAL LETTER TTE
118B3; C; 118D3; # WARANG CITI CAPITAL LETTER NUNG
118B4; C; 118D4; # WARANG CITI CAPITAL LETTER DA
118B5; C; 118D5; # WARANG CITI CAPITAL LETTER AT
118B6; C; 118D6; # WARANG CITI CAPITAL LETTER AM
118B7; C; 118D7; # WARANG CITI CAPITAL LETTER BU
118B8; C; 118D8; # WARANG CITI CAPITAL LETTER PU
118B9; C; 118D9; # WARANG CITI CAPITAL LETTER HIYO
118BA; C; 118DA; # WARANG CITI CAPITAL LETTER HOLO
118BB; C; 118DB; # WARANG CITI CAPITAL LETTER HORR
118BC; C; 118DC; # WARANG CITI CAPITAL LETTER HAR
118BD; C; 118DD; # WARANG CITI CAPITAL LETTER SSUU
118BE; C; 118DE; # WARANG CITI CAPITAL LETTER SII
118BF; C; 118DF; # WARANG CITI CAPITAL LETTER VIYO
#
# EOF

View File

@ -4,8 +4,8 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "physfs.h"
#include "globbing.h"
/**
@ -22,7 +22,7 @@
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
* Please see the file LICENSE.txt in the source's root directory.
*
* \author Ryan C. Gordon.
*/
@ -77,38 +77,118 @@ static int matchesPattern(const char *fname, const char *wildcard,
fnameptr++;
if (x != y)
return(0);
return 0;
} /* else */
} /* while */
while (*wildptr == '*')
wildptr++;
return(*fnameptr == *wildptr);
return (*fnameptr == *wildptr);
} /* matchesPattern */
typedef struct
{
const PHYSFS_Allocator *allocator;
const char *wildcard;
int caseSensitive;
PHYSFS_EnumFilesCallback callback;
void *origData;
} WildcardCallbackData;
/*
* This callback sits between the enumerator and the enduser callback,
* filtering out files that don't match the wildcard pattern.
*/
static void wildcardCallback(void *_d, const char *origdir, const char *fname)
{
const WildcardCallbackData *data = (const WildcardCallbackData *) _d;
if (matchesPattern(fname, data->wildcard, data->caseSensitive))
data->callback(data->origData, origdir, fname);
} /* wildcardCallback */
void PHYSFSEXT_enumerateFilesCallbackWildcard(const char *dir,
const char *wildcard,
int caseSensitive,
PHYSFS_EnumFilesCallback c,
void *d)
{
WildcardCallbackData data;
data.allocator = PHYSFS_getAllocator();
data.wildcard = wildcard;
data.caseSensitive = caseSensitive;
data.callback = c;
data.origData = d;
PHYSFS_enumerateFilesCallback(dir, wildcardCallback, &data);
} /* PHYSFSEXT_enumerateFilesCallbackWildcard */
void PHYSFSEXT_freeEnumeration(char **list)
{
const PHYSFS_Allocator *allocator = PHYSFS_getAllocator();
int i;
if (list != NULL)
{
for (i = 0; list[i] != NULL; i++)
allocator->Free(list[i]);
allocator->Free(list);
} /* if */
} /* PHYSFSEXT_freeEnumeration */
char **PHYSFSEXT_enumerateFilesWildcard(const char *dir, const char *wildcard,
int caseSensitive)
{
char **rc = PHYSFS_enumerateFiles(dir);
char **i = rc;
char **j;
const PHYSFS_Allocator *allocator = PHYSFS_getAllocator();
char **list = PHYSFS_enumerateFiles(dir);
char **retval = NULL;
int totalmatches = 0;
int matches = 0;
char **i;
while (*i != NULL)
for (i = list; *i != NULL; i++)
{
#if 0
printf("matchesPattern: '%s' vs '%s' (%s) ... %s\n", *i, wildcard,
caseSensitive ? "case" : "nocase",
matchesPattern(*i, wildcard, caseSensitive) ? "true" : "false");
#endif
if (matchesPattern(*i, wildcard, caseSensitive))
i++;
else
{
/* FIXME: This counts on physfs's allocation method not changing! */
free(*i);
for (j = i; *j != NULL; j++)
j[0] = j[1];
} /* else */
totalmatches++;
} /* for */
return(rc);
retval = (char **) allocator->Malloc(sizeof (char *) * (totalmatches+1));
if (retval != NULL)
{
for (i = list; ((matches < totalmatches) && (*i != NULL)); i++)
{
if (matchesPattern(*i, wildcard, caseSensitive))
{
retval[matches] = (char *) allocator->Malloc(strlen(*i) + 1);
if (retval[matches] == NULL)
{
while (matches--)
allocator->Free(retval[matches]);
allocator->Free(retval);
retval = NULL;
break;
} /* if */
strcpy(retval[matches], *i);
matches++;
} /* if */
} /* for */
if (retval != NULL)
{
assert(totalmatches == matches);
retval[matches] = NULL;
} /* if */
} /* if */
PHYSFS_freeList(list);
return retval;
} /* PHYSFSEXT_enumerateFilesWildcard */
@ -123,20 +203,20 @@ int main(int argc, char **argv)
{
printf("USAGE: %s <pattern> <caseSen>\n"
" where <caseSen> is 1 or 0.\n", argv[0]);
return(1);
return 1;
} /* if */
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getLastError());
return(1);
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 1;
} /* if */
if (!PHYSFS_addToSearchPath(".", 1))
{
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
flist = PHYSFSEXT_enumerateFilesWildcard("/", argv[1], atoi(argv[2]));
@ -148,10 +228,10 @@ int main(int argc, char **argv)
} /* for */
printf("\n total %d files.\n\n", rc);
PHYSFS_freeList(flist);
PHYSFSEXT_freeEnumeration(flist);
PHYSFS_deinit();
return(0);
return 0;
} /* main */
#endif

View File

@ -1,5 +1,10 @@
#ifndef INCL_PHYSFSEXT_GLOBBING_H
#define INCL_PHYSFSEXT_GLOBBING_H
/** \file globbing.h */
#include "physfs.h"
/**
* \mainpage PhysicsFS globbing
*
@ -9,10 +14,10 @@
* locating matching entries.
*
* Usage: Set up PhysicsFS as you normally would, then use
* PHYSFSEXT_enumerateFilesPattern() when enumerating files. This is just
* PHYSFSEXT_enumerateFilesWildcard() when enumerating files. This is just
* like PHYSFS_enumerateFiles(), but it returns a subset that matches your
* wildcard pattern. You must call PHYSFS_freeList() on the results, just
* like you would with PHYSFS_enumerateFiles().
* wildcard pattern. You must call PHYSFSEXT_freeEnumeration() on the results,
* just PHYSFS_enumerateFiles() would do with PHYSFS_freeList().
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
@ -25,15 +30,18 @@
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
* Please see LICENSE.txt in the source's "docs" directory.
*
* \author Ryan C. Gordon.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \fn char **PHYSFS_enumerateFilesWildcard(const char *dir, const char *wildcard, int caseSensitive)
* \brief Get a file listing of a search path's directory.
* \brief Get a file listing of a search path's directory, filtered with a wildcard pattern.
*
* Matching directories are interpolated. That is, if "C:\mydir" is in the
* search path and contains a directory "savegames" that contains "x.sav",
@ -63,15 +71,95 @@
* Wildcard strings can use the '*' and '?' characters, currently.
* Matches can be case-insensitive if you pass a zero for argument 3.
*
* Don't forget to call PHYSFS_freeList() with the return value from this
* function when you are done with it.
* Don't forget to call PHYSFSEXT_freeEnumerator() with the return value from
* this function when you are done with it. As we use PhysicsFS's allocator
* for this list, you must free it before calling PHYSFS_deinit().
* Do not use PHYSFS_freeList() on the returned value!
*
* \param dir directory in platform-independent notation to enumerate.
* \param wildcard Wildcard pattern to use for filtering.
* \param caseSensitive Zero for case-insensitive matching,
* non-zero for case-sensitive.
* \return Null-terminated array of null-terminated strings.
*
* \sa PHYSFSEXT_freeEnumeration
*/
__EXPORT__ char **PHYSFSEXT_enumerateFilesWildcard(const char *dir,
PHYSFS_DECL char **PHYSFSEXT_enumerateFilesWildcard(const char *dir,
const char *wildcard,
int caseSensitive);
/**
* \fn void PHYSFSEXT_freeEnumeration(char **list)
* \brief Free data returned by PHYSFSEXT_enumerateFilesWildcard
*
* Conceptually, this works like PHYSFS_freeList(), but is used with data
* returned by PHYSFSEXT_enumerateFilesWildcard() only. Be sure to call this
* on any returned data from that function before
*
* \param list Pointer previously returned by
* PHYSFSEXT_enumerateFilesWildcard(). It is safe to pass a
* NULL here.
*
* \sa PHYSFSEXT_enumerateFilesWildcard
*/
PHYSFS_DECL void PHYSFSEXT_freeEnumeration(char **list);
/**
* \fn void PHYSFSEXT_enumerateFilesCallbackWildcard(const char *dir, const char *wildcard, int caseSensitive, PHYSFS_EnumFilesCallback c, void *d);
* \brief Get a file listing of a search path's directory, filtered with a wildcard pattern, using an application-defined callback.
*
* This function is equivalent to PHYSFSEXT_enumerateFilesWildcard(). It
* reports file listings, filtered by a wildcard pattern.
*
* Unlike PHYSFS_enumerateFiles(), this function does not return an array.
* Rather, it calls a function specified by the application once per
* element of the search path:
*
* \code
*
* static void printDir(void *data, const char *origdir, const char *fname)
* {
* printf(" * We've got [%s] in [%s].\n", fname, origdir);
* }
*
* // ...
* PHYSFS_enumerateFilesCallbackWildcard("savegames","*.sav",0,printDir,NULL);
* \endcode
*
* Items sent to the callback are not guaranteed to be in any order whatsoever.
* There is no sorting done at this level, and if you need that, you should
* probably use PHYSFS_enumerateFilesWildcard() instead, which guarantees
* alphabetical sorting. This form reports whatever is discovered in each
* archive before moving on to the next. Even within one archive, we can't
* guarantee what order it will discover data. <em>Any sorting you find in
* these callbacks is just pure luck. Do not rely on it.</em> As this walks
* the entire list of archives, you may receive duplicate filenames.
*
* Wildcard strings can use the '*' and '?' characters, currently.
* Matches can be case-insensitive if you pass a zero for argument 3.
*
* \param dir Directory, in platform-independent notation, to enumerate.
* \param wildcard Wildcard pattern to use for filtering.
* \param caseSensitive Zero for case-insensitive matching,
* non-zero for case-sensitive.
* \param c Callback function to notify about search path elements.
* \param d Application-defined data passed to callback. Can be NULL.
*
* \sa PHYSFS_EnumFilesCallback
* \sa PHYSFS_enumerateFiles
*/
PHYSFS_DECL void PHYSFSEXT_enumerateFilesCallbackWildcard(const char *dir,
const char *wildcard,
int caseSensitive,
PHYSFS_EnumFilesCallback c,
void *d);
#ifdef __cplusplus
}
#endif
#endif /* include-once blocker. */
/* end of globbing.h ... */

View File

@ -27,25 +27,6 @@
* \author Ryan C. Gordon.
*/
/* I'm not screwing around with stricmp vs. strcasecmp... */
/* !!! FIXME: this will NOT work with UTF-8 strings in physfs2.0 */
static int caseInsensitiveStringCompare(const char *x, const char *y)
{
int ux, uy;
do
{
ux = toupper((int) *x);
uy = toupper((int) *y);
if (ux != uy)
return((ux > uy) ? 1 : -1);
x++;
y++;
} while ((ux) && (uy));
return(0);
} /* caseInsensitiveStringCompare */
static int locateOneElement(char *buf)
{
char *ptr;
@ -53,7 +34,7 @@ static int locateOneElement(char *buf)
char **i;
if (PHYSFS_exists(buf))
return(1); /* quick rejection: exists in current case. */
return 1; /* quick rejection: exists in current case. */
ptr = strrchr(buf, '/'); /* find entry at end of path. */
if (ptr == NULL)
@ -69,19 +50,23 @@ static int locateOneElement(char *buf)
ptr++; /* point past dirsep to entry itself. */
} /* else */
for (i = rc; *i != NULL; i++)
if (rc != NULL)
{
if (caseInsensitiveStringCompare(*i, ptr) == 0)
for (i = rc; *i != NULL; i++)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return(1);
} /* if */
} /* for */
if (PHYSFS_utf8stricmp(*i, ptr) == 0)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return 1;
} /* if */
} /* for */
PHYSFS_freeList(rc);
} /* if */
/* no match at all... */
PHYSFS_freeList(rc);
return(0);
return 0;
} /* locateOneElement */
@ -89,26 +74,25 @@ int PHYSFSEXT_locateCorrectCase(char *buf)
{
int rc;
char *ptr;
char *prevptr;
while (*buf == '/') /* skip any '/' at start of string... */
buf++;
ptr = prevptr = buf;
ptr = buf;
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 */
rc = locateOneElement(buf);
*ptr = '/'; /* restore path separator */
if (!rc)
return(-2); /* missing element in path. */
return -2; /* missing element in path. */
} /* while */
/* check final element... */
return(locateOneElement(buf) ? 0 : -1);
return locateOneElement(buf) ? 0 : -1;
} /* PHYSFSEXT_locateCorrectCase */
@ -121,54 +105,54 @@ int main(int argc, char **argv)
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getLastError());
return(1);
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 1;
} /* if */
if (!PHYSFS_addToSearchPath(".", 1))
{
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
if (!PHYSFS_setWriteDir("."))
{
fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
if (!PHYSFS_mkdir("/a/b/c"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
if (!PHYSFS_mkdir("/a/b/C"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
f = PHYSFS_openWrite("/a/b/c/x.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
f = PHYSFS_openWrite("/a/b/C/X.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return(1);
return 1;
} /* if */
strcpy(buf, "/a/b/c/x.txt");
@ -211,7 +195,7 @@ int main(int argc, char **argv)
PHYSFS_delete("/a/b");
PHYSFS_delete("/a");
PHYSFS_deinit();
return(0);
return 0;
} /* main */
#endif

View File

@ -1,3 +1,6 @@
#ifndef INCL_PHYSFSEXT_IGNORECASE_H
#define INCL_PHYSFSEXT_IGNORECASE_H
/** \file ignorecase.h */
/**
@ -15,14 +18,14 @@
* or file (which brings security considerations and potential bugs). This
* code favours exact case matches, but you will lose access to otherwise
* duplicate filenames, or you might go down a wrong directory tree, etc.
* In practive, this is rarely a problem, but you need to be aware of it.
* In practice, this is rarely a problem, but you need to be aware of it.
* - This doesn't do _anything_ with the write directory; you're on your
* own for opening the right files for writing. You can sort of get around
* this by adding your write directory to the search path, but then the
* interpolated directory tree can screw you up even more.
*
* This code should be considered an aid for legacy code. New development
* shouldn't do dumbass things that require this aid in the first place. :)
* shouldn't do things that require this aid in the first place. :)
*
* Usage: Set up PhysicsFS as you normally would, then use
* PHYSFSEXT_locateCorrectCase() to get a "correct" pathname to pass to
@ -44,6 +47,9 @@
* \author Ryan C. Gordon.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \fn int PHYSFSEXT_locateCorrectCase(char *buf)
@ -61,8 +67,7 @@
* existing match. If there is no match, the search aborts and reports an
* error. Exact matches are favored over case-insensitive matches.
*
* THIS IS RISKY. Please do not use this function for anything but crappy
* legacy code.
* THIS IS RISKY. Please do not use this function for anything but legacy code.
*
* \param buf Buffer with null-terminated string of path/file to locate.
* This buffer will be modified by this function.
@ -71,5 +76,11 @@
*/
int PHYSFSEXT_locateCorrectCase(char *buf);
#ifdef __cplusplus
}
#endif
#endif /* include-once blocker. */
/* end of ignorecase.h ... */

View File

@ -3,9 +3,14 @@
use warnings;
use strict;
my $HASHBUCKETS1_16 = 256;
my $HASHBUCKETS1_32 = 16;
my $HASHBUCKETS2_16 = 16;
my $HASHBUCKETS3_16 = 4;
print <<__EOF__;
/*
* This file is part of PhysicsFS (http://icculus.org/physfs/)
* This file is part of PhysicsFS (https://icculus.org/physfs/)
*
* This data generated by physfs/extras/makecasefoldhashtable.pl ...
* Do not manually edit this file!
@ -13,17 +18,97 @@ print <<__EOF__;
* Please see the file LICENSE.txt in the source's root directory.
*/
#ifndef _INCLUDE_PHYSFS_CASEFOLDING_H_
#define _INCLUDE_PHYSFS_CASEFOLDING_H_
#ifndef __PHYSICSFS_INTERNAL__
#error Do not include this header from your applications.
#endif
/* We build three simple hashmaps here: one that maps Unicode codepoints to
a one, two, or three lowercase codepoints. To retrieve this info: look at
case_fold_hashX, where X is 1, 2, or 3. Most foldable codepoints fold to one,
a few dozen fold to two, and a handful fold to three. If the codepoint isn't
in any of these hashes, it doesn't fold (no separate upper and lowercase).
Almost all these codepoints fit into 16 bits, so we hash them as such to save
memory. If a codepoint is > 0xFFFF, we have separate hashes for them,
since there are (currently) only about 120 of them and (currently) all of them
map to a single lowercase codepoint. */
typedef struct CaseFoldMapping1_32
{
PHYSFS_uint32 from;
PHYSFS_uint32 to0;
} CaseFoldMapping1_32;
typedef struct CaseFoldMapping1_16
{
PHYSFS_uint16 from;
PHYSFS_uint16 to0;
} CaseFoldMapping1_16;
typedef struct CaseFoldMapping2_16
{
PHYSFS_uint16 from;
PHYSFS_uint16 to0;
PHYSFS_uint16 to1;
} CaseFoldMapping2_16;
typedef struct CaseFoldMapping3_16
{
PHYSFS_uint16 from;
PHYSFS_uint16 to0;
PHYSFS_uint16 to1;
PHYSFS_uint16 to2;
} CaseFoldMapping3_16;
typedef struct CaseFoldHashBucket1_16
{
const CaseFoldMapping1_16 *list;
const PHYSFS_uint8 count;
} CaseFoldHashBucket1_16;
typedef struct CaseFoldHashBucket1_32
{
const CaseFoldMapping1_32 *list;
const PHYSFS_uint8 count;
} CaseFoldHashBucket1_32;
typedef struct CaseFoldHashBucket2_16
{
const CaseFoldMapping2_16 *list;
const PHYSFS_uint8 count;
} CaseFoldHashBucket2_16;
typedef struct CaseFoldHashBucket3_16
{
const CaseFoldMapping3_16 *list;
const PHYSFS_uint8 count;
} CaseFoldHashBucket3_16;
__EOF__
my @foldPairs;
my @foldPairs1_16;
my @foldPairs2_16;
my @foldPairs3_16;
my @foldPairs1_32;
for (my $i = 0; $i < 256; $i++) {
$foldPairs[$i] = '';
for (my $i = 0; $i < $HASHBUCKETS1_16; $i++) {
$foldPairs1_16[$i] = '';
}
for (my $i = 0; $i < $HASHBUCKETS1_32; $i++) {
$foldPairs1_32[$i] = '';
}
for (my $i = 0; $i < $HASHBUCKETS2_16; $i++) {
$foldPairs2_16[$i] = '';
}
for (my $i = 0; $i < $HASHBUCKETS3_16; $i++) {
$foldPairs3_16[$i] = '';
}
open(FH,'<','casefolding.txt') or die("failed to open casefolding.txt: $!\n");
@ -38,47 +123,153 @@ while (<FH>) {
next if not /\A([a-fA-F0-9]+)\;\s*(.)\;\s*(.+)\;/;
my ($code, $status, $mapping) = ($1, $2, $3);
my $hexxed = hex($code);
my $hashed = (($hexxed ^ ($hexxed >> 8)) & 0xFF);
#print("// code '$code' status '$status' mapping '$mapping'\n");
#print("// hexxed '$hexxed' hashed '$hashed'\n");
if (($status eq 'C') or ($status eq 'F')) {
my ($map1, $map2, $map3) = ('0000', '0000', '0000');
my ($map1, $map2, $map3) = (undef, undef, undef);
$map1 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//;
$map2 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//;
$map3 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//;
die("mapping space too small for '$code'\n") if ($mapping ne '');
$foldPairs[$hashed] .= " { 0x$code, 0x$map1, 0x$map2, 0x$map3 },\n";
die("problem parsing mapping for '$code'\n") if (not defined($map1));
if ($hexxed < 128) {
# Just ignore these, we'll handle the low-ASCII ones ourselves.
} elsif ($hexxed > 0xFFFF) {
# We just need to add the 32-bit 2 and/or 3 codepoint maps if this die()'s here.
die("Uhoh, a codepoint > 0xFFFF that folds to multiple codepoints! Fixme.") if defined($map2);
my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS1_32-1));
#print("// hexxed '$hexxed' hashed1 '$hashed'\n");
$foldPairs1_32[$hashed] .= " { 0x$code, 0x$map1 },\n";
} elsif (not defined($map2)) {
my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS1_16-1));
#print("// hexxed '$hexxed' hashed1 '$hashed'\n");
$foldPairs1_16[$hashed] .= " { 0x$code, 0x$map1 },\n";
} elsif (not defined($map3)) {
my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS2_16-1));
#print("// hexxed '$hexxed' hashed2 '$hashed'\n");
$foldPairs2_16[$hashed] .= " { 0x$code, 0x$map1, 0x$map2 },\n";
} else {
my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS3_16-1));
#print("// hexxed '$hexxed' hashed3 '$hashed'\n");
$foldPairs3_16[$hashed] .= " { 0x$code, 0x$map1, 0x$map2, 0x$map3 },\n";
}
}
}
close(FH);
for (my $i = 0; $i < 256; $i++) {
$foldPairs[$i] =~ s/,\n\Z//;
my $str = $foldPairs[$i];
for (my $i = 0; $i < $HASHBUCKETS1_16; $i++) {
$foldPairs1_16[$i] =~ s/,\n\Z//;
my $str = $foldPairs1_16[$i];
next if $str eq '';
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold_${num}";
print("static const CaseFoldMapping ${sym}[] = {\n$str\n};\n\n");
my $sym = "case_fold1_16_${num}";
print("static const CaseFoldMapping1_16 ${sym}[] = {\n$str\n};\n\n");
}
print("\nstatic const CaseFoldHashBucket case_fold_hash[256] = {\n");
for (my $i = 0; $i < $HASHBUCKETS1_32; $i++) {
$foldPairs1_32[$i] =~ s/,\n\Z//;
my $str = $foldPairs1_32[$i];
next if $str eq '';
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold1_32_${num}";
print("static const CaseFoldMapping1_32 ${sym}[] = {\n$str\n};\n\n");
}
for (my $i = 0; $i < 256; $i++) {
my $str = $foldPairs[$i];
for (my $i = 0; $i < $HASHBUCKETS2_16; $i++) {
$foldPairs2_16[$i] =~ s/,\n\Z//;
my $str = $foldPairs2_16[$i];
next if $str eq '';
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold2_16_${num}";
print("static const CaseFoldMapping2_16 ${sym}[] = {\n$str\n};\n\n");
}
for (my $i = 0; $i < $HASHBUCKETS3_16; $i++) {
$foldPairs3_16[$i] =~ s/,\n\Z//;
my $str = $foldPairs3_16[$i];
next if $str eq '';
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold3_16_${num}";
print("static const CaseFoldMapping3_16 ${sym}[] = {\n$str\n};\n\n");
}
print("static const CaseFoldHashBucket1_16 case_fold_hash1_16[] = {\n");
for (my $i = 0; $i < $HASHBUCKETS1_16; $i++) {
my $str = $foldPairs1_16[$i];
if ($str eq '') {
print(" { 0, NULL },\n");
print(" { NULL, 0 },\n");
} else {
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold_${num}";
print(" { __PHYSFS_ARRAYLEN($sym), $sym },\n");
my $sym = "case_fold1_16_${num}";
print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
}
}
print("};\n\n");
print("static const CaseFoldHashBucket1_32 case_fold_hash1_32[] = {\n");
for (my $i = 0; $i < $HASHBUCKETS1_32; $i++) {
my $str = $foldPairs1_32[$i];
if ($str eq '') {
print(" { NULL, 0 },\n");
} else {
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold1_32_${num}";
print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
}
}
print("};\n\n");
print("static const CaseFoldHashBucket2_16 case_fold_hash2_16[] = {\n");
for (my $i = 0; $i < $HASHBUCKETS2_16; $i++) {
my $str = $foldPairs2_16[$i];
if ($str eq '') {
print(" { NULL, 0 },\n");
} else {
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold2_16_${num}";
print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
}
}
print("};\n\n");
print("static const CaseFoldHashBucket3_16 case_fold_hash3_16[] = {\n");
for (my $i = 0; $i < $HASHBUCKETS3_16; $i++) {
my $str = $foldPairs3_16[$i];
if ($str eq '') {
print(" { NULL, 0 },\n");
} else {
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
my $sym = "case_fold3_16_${num}";
print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
}
}
print("};\n\n");
print <<__EOF__;
#endif /* _INCLUDE_PHYSFS_CASEFOLDING_H_ */
/* end of physfs_casefolding.h ... */
__EOF__
exit 0;
# end of makecashfoldhashtable.pl ...

View File

@ -1,54 +0,0 @@
#!/bin/sh
# This shell script is roughly equivalent to what "make dist" did in the
# autotools build system and is called from a custom CMake target.
# !!! FIXME: This code sort of sucks. Consider using CPack instead...
if [ ! -f ./CMakeLists.txt ]; then
echo "you are in the wrong place."
exit 1
fi
if [ -z "$1" ]; then
echo "Wrong arguments."
exit 2
fi
set -e
VERSION="$1"
BASENAME="physfs-$VERSION"
TARBALL="$BASENAME.tar.gz"
TMPCPDIR="../9sdkujy75jv932-physfstmp-$VERSION"
CPDIR="$TMPCPDIR/$BASENAME"
echo "Packing PhysicsFS $VERSION source tarball..."
echo " + Setting up scratch dir..."
rm -rf $TMPCPDIR
mkdir $TMPCPDIR
mkdir $CPDIR
echo " + Making copy of source tree in scratch dir..."
cp -R . $CPDIR/
echo " + Deleting cruft..."
pushd $CPDIR >/dev/null
rm -rf `svn propget svn:ignore .`
rm -rf `svn status |grep '?' |sed -s 's/\?//'`
popd >/dev/null
rm -rf `find $CPDIR -type d -name '.svn'`
echo " + Deleting Subversion metadata..."
rm -rf `find $CPDIR -type d -name '.svn'`
echo " + Fixing up permissions..."
chmod -R a+rw $CPDIR
chmod a+x `find $CPDIR -type d`
echo " + Building final tarball..."
rm -f $TARBALL
tar -czf $TARBALL -C $TMPCPDIR $BASENAME
echo " + Cleaning up..."
rm -rf $TMPCPDIR
echo " + All done! Packed to '$TARBALL' ..."
set +e
exit 0

11
extras/physfs.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: PhysicsFS
Description: PhysicsFS is a library to provide abstract access to various archives.
URL: https://icculus.org/physfs/
Version: @PHYSFS_VERSION@
Libs: -L${libdir} -lphysfs
Cflags: -I${includedir}

View File

@ -1,103 +0,0 @@
# $Id: installer.rb,v 1.3 2003/07/21 03:46:50 icculus Exp $
require 'rbconfig'
require 'find'
require 'ftools'
include Config
module Slimb
class Installer
def initialize target_dir = "", &user_skip
@user_skip = user_skip or proc {|f| false}
@version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
@libdir = File.join(CONFIG["libdir"], "ruby", @version)
@sitedir = CONFIG["sitedir"] || File.join(@libdir, "site_ruby")
@dest = File.join @sitedir, target_dir
File::makedirs @dest
File::chmod 0755, @dest, true
end
def skip? file
@user_skip[file] or
file[0] == ?. or file[-1] == ?~ or file[-1] == ?#
end
def install_dir dir
File::makedirs(File.join(@dest, dir))
File::chmod(0755, File.join(@dest, dir), true)
Dir.foreach(dir) {|file|
next if skip? file
if File.ftype(File.join(dir, file)) == "directory"
install_dir File.join(dir, file)
else
install_file File.join(dir, file)
end
}
end
def install_file file
if file =~ /\.so$/
install_so file
else
File::install file, File.join(@dest, file), 0644, true
end
end
def install_so file
File::install file, File.join(CONFIG["sitearchdir"], file), 0644, true
end
def uninstall_so file
file = File.join(CONFIG["sitearchdir"], file)
File::safe_unlink file
end
def install something
case something
when Array
something.each {|x|
install x if x.is_a? String
}
when String
if File.ftype(something) == "directory"
install_dir something
else
install_file something
end
end
end
def uninstall what = "*"
case what
when Array
files = what.map {|x| File.join(@dest, x)}
when String
files = Dir[File.join(@dest, what)]
end
files.each {|x|
# FIXME: recursive uninstall is a must
next if FileTest.directory? x
File::safe_unlink x
}
end
def run files, argv
if !argv.grep(/--uninstall/).empty?
uninstall files
else
install files
end
end
end
end
# self-installation
if $0 == __FILE__
$stderr.puts "Installing slimb installer..."
Slimb::Installer.new("slimb").install File.basename(__FILE__)
end

View File

@ -1,9 +0,0 @@
require 'mkmf'
$CFLAGS += `sdl-config --cflags`.chomp
$LDFLAGS += `sdl-config --libs`.chomp
have_library "physfs", "PHYSFS_init"
have_library "SDL", "SDL_AllocRW"
create_makefile "physfs_so"

View File

@ -1,7 +0,0 @@
#!/usr/local/bin/ruby
if __FILE__ == $0
require 'slimb/installer'
files = ["physfs.rb", "physfs_so.so"]
installer = Slimb::Installer.new.run files, ARGV
end

View File

@ -1,9 +0,0 @@
#!/bin/sh
ruby extconf.rb
make
cd ..
ruby installer.rb
cd physfs
ruby install.rb
cd test
ruby test_physfs.rb

View File

@ -1,121 +0,0 @@
#
# PhysicsFS - ruby interface
#
# Author: Ed Sinjiashvili (slimb@vlinkmail.com)
# License: LGPL
#
require 'physfs_so'
module PhysicsFS
class Version
def initialize major, minor, patch
@major = major
@minor = minor
@patch = patch
end
attr_reader :major, :minor, :patch
def to_s
"#@major.#@minor.#@patch"
end
end
class ArchiveInfo
def initialize ext, desc, author, url
@extension = ext
@description = desc
@author = author
@url = url
end
attr_reader :extension, :description
attr_reader :author, :url
def to_s
" * #@extension: #@description\n Written by #@author.\n #@url\n"
end
end
#
# convenience methods
#
class << self
def init argv0 = $0
init_internal argv0
end
def append_search_path str
add_to_search_path str, 1
self
end
def prepend_search_path str
add_to_search_path str, 0
self
end
alias_method :<<, :append_search_path
alias_method :push, :append_search_path
alias_method :unshift, :prepend_search_path
def ls path = ""
enumerate path
end
end
#
# File - PhysicsFS abstract file - can be drawn from various sources
#
class File
def write_str str
write str, 1, str.length
end
def cat
prev_pos = tell
seek 0
r = read length, 1
seek prev_pos
r
end
alias_method :size, :length
end
#
# RWops - general stdio like operations on file-like creatures
#
class RWops
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
# tell current position of RWopted entity
def tell
seek 0, SEEK_CUR
end
# length of RWops abstracted entity
def length
cur = tell
r = seek 0, SEEK_END
seek cur, SEEK_SET
r
end
alias_method :size, :length
#
# create rwops from PhysicsFS file object
#
def self.from_physfs file
file.to_rwops
end
end
end
# physfs.rb ends here #

View File

@ -1,192 +0,0 @@
/*
* This code provides a glue layer between PhysicsFS and Simple Directmedia
* Layer's (SDL) RWops i/o abstraction.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
* General Public License: http://www.gnu.org/licenses/lgpl.txt
*
* SDL falls under the LGPL, too. You can get SDL at http://www.libsdl.org/
*
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#include <stdio.h> /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */
#include "physfsrwops.h"
static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
int pos = 0;
if (whence == SEEK_SET)
{
pos = offset;
} /* if */
else if (whence == SEEK_CUR)
{
PHYSFS_sint64 current = PHYSFS_tell(handle);
if (current == -1)
{
SDL_SetError("Can't find position in file: %s",
PHYSFS_getLastError());
return(-1);
} /* if */
pos = (int) current;
if ( ((PHYSFS_sint64) pos) != current )
{
SDL_SetError("Can't fit current file position in an int!");
return(-1);
} /* if */
if (offset == 0) /* this is a "tell" call. We're done. */
return(pos);
pos += offset;
} /* else if */
else if (whence == SEEK_END)
{
PHYSFS_sint64 len = PHYSFS_fileLength(handle);
if (len == -1)
{
SDL_SetError("Can't find end of file: %s", PHYSFS_getLastError());
return(-1);
} /* if */
pos = (int) len;
if ( ((PHYSFS_sint64) pos) != len )
{
SDL_SetError("Can't fit end-of-file position in an int!");
return(-1);
} /* if */
pos += offset;
} /* else if */
else
{
SDL_SetError("Invalid 'whence' parameter.");
return(-1);
} /* else */
if ( pos < 0 )
{
SDL_SetError("Attempt to seek past start of file.");
return(-1);
} /* if */
if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);
} /* if */
return(pos);
} /* physfsrwops_seek */
static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
if (rc != maxnum)
{
if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
} /* if */
return((int) rc);
} /* physfsrwops_read */
static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
if (rc != num)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return((int) rc);
} /* physfsrwops_write */
static int physfsrwops_close(SDL_RWops *rw)
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
if (!PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);
} /* if */
SDL_FreeRW(rw);
return(0);
} /* physfsrwops_close */
static SDL_RWops *create_rwops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;
if (handle == NULL)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
else
{
retval = SDL_AllocRW();
if (retval != NULL)
{
retval->seek = physfsrwops_seek;
retval->read = physfsrwops_read;
retval->write = physfsrwops_write;
retval->close = physfsrwops_close;
retval->hidden.unknown.data1 = handle;
} /* if */
} /* else */
return(retval);
} /* create_rwops */
SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;
if (handle == NULL)
SDL_SetError("NULL pointer passed to PHYSFSRWOPS_makeRWops().");
else
retval = create_rwops(handle);
return(retval);
} /* PHYSFSRWOPS_makeRWops */
SDL_RWops *PHYSFSRWOPS_openRead(const char *fname)
{
return(create_rwops(PHYSFS_openRead(fname)));
} /* PHYSFSRWOPS_openRead */
SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname)
{
return(create_rwops(PHYSFS_openWrite(fname)));
} /* PHYSFSRWOPS_openWrite */
SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname)
{
return(create_rwops(PHYSFS_openAppend(fname)));
} /* PHYSFSRWOPS_openAppend */
/* end of physfsrwops.c ... */

View File

@ -1,87 +0,0 @@
/*
* This code provides a glue layer between PhysicsFS and Simple Directmedia
* Layer's (SDL) RWops i/o abstraction.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
* General Public License: http://www.gnu.org/licenses/lgpl.txt
*
* SDL falls under the LGPL, too. You can get SDL at http://www.libsdl.org/
*
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#ifndef _INCLUDE_PHYSFSRWOPS_H_
#define _INCLUDE_PHYSFSRWOPS_H_
#include "physfs.h"
#include "SDL.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Open a platform-independent filename for reading, and make it accessible
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
* RWops is closed. PhysicsFS should be configured to your liking before
* opening files through this method.
*
* @param filename File to open in platform-independent notation.
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
/**
* Open a platform-independent filename for writing, and make it accessible
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
* RWops is closed. PhysicsFS should be configured to your liking before
* opening files through this method.
*
* @param filename File to open in platform-independent notation.
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
/**
* Open a platform-independent filename for appending, and make it accessible
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
* RWops is closed. PhysicsFS should be configured to your liking before
* opening files through this method.
*
* @param filename File to open in platform-independent notation.
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
/**
* Make a SDL_RWops from an existing PhysicsFS file handle. You should
* dispose of any references to the handle after successful creation of
* the RWops. The actual PhysicsFS handle will be destroyed when the
* RWops is closed.
*
* @param handle a valid PhysicsFS file handle.
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
#ifdef __cplusplus
}
#endif
#endif /* include-once blocker */
/* end of physfsrwops.h ... */

View File

@ -1,462 +0,0 @@
/*
* PhysicsFS - ruby interface
*
* Author:: Ed Sinjiashvili (slimb@vlinkmail.com)
* License:: LGPL
*/
#include "physfs.h"
#include "ruby.h"
#include "rb_physfs.h"
#include "rb_physfs_file.h"
VALUE modulePhysfs;
/*
* PhysicsFS::init str
*
* initialize PhysicsFS
*/
VALUE physfs_init (VALUE self, VALUE str)
{
int result = PHYSFS_init (STR2CSTR(str));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::deinit
*/
VALUE physfs_deinit (VALUE self)
{
if (PHYSFS_deinit ())
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::version
*
* return PhysicsFS::Version object
*/
VALUE physfs_version (VALUE self)
{
char evalStr[200];
PHYSFS_Version ver;
PHYSFS_getLinkedVersion (&ver);
sprintf (evalStr, "PhysicsFS::Version.new %d, %d, %d",
ver.major, ver.minor, ver.patch);
return rb_eval_string (evalStr);
}
/*
* PhysicsFS::supported_archives
*
* return Array of PhysicsFS::ArchiveInfo objects
*/
VALUE physfs_supported_archives (VALUE self)
{
const PHYSFS_ArchiveInfo **info = PHYSFS_supportedArchiveTypes();
VALUE klass = rb_const_get (modulePhysfs, rb_intern ("ArchiveInfo"));
VALUE ary = rb_ary_new ();
VALUE params[4];
while ( *info != 0 )
{
params[0] = rb_str_new2 ((*info)->extension);
params[1] = rb_str_new2 ((*info)->description);
params[2] = rb_str_new2 ((*info)->author);
params[3] = rb_str_new2 ((*info)->url);
rb_ary_push (ary, rb_class_new_instance (4, params, klass));
info++;
}
return ary;
}
/*
* PhysicsFS::last_error
*
* return string representation of last PhysicsFS error
*/
VALUE physfs_last_error (VALUE self)
{
const char *last_error = PHYSFS_getLastError ();
if (last_error == 0)
last_error = "";
return rb_str_new2 (last_error);
}
/*
* PhysicsFS::dir_separator
*
* return platform directory separator
*/
VALUE physfs_dir_separator (VALUE self)
{
return rb_str_new2 (PHYSFS_getDirSeparator ());
}
/*
* PhysicsFS::permit_symlinks boolValue
*
* turn symlinks support on/off
*/
VALUE physfs_permit_symlinks (VALUE self, VALUE allow)
{
int p = 1;
if (allow == Qfalse || allow == Qnil)
p = 0;
PHYSFS_permitSymbolicLinks (p);
return Qtrue;
}
/*
* PhysicsFS::cdrom_dirs
*
* return Array of strings containing available CDs
*/
VALUE physfs_cdrom_dirs (VALUE self)
{
char **cds = PHYSFS_getCdRomDirs();
char **i;
VALUE ary = rb_ary_new ();
for (i = cds; *i != 0; i++)
rb_ary_push (ary, rb_str_new2 (*i));
PHYSFS_freeList (cds);
return ary;
}
/*
* PhysicsFS::base_dir
*
* return base directory
*/
VALUE physfs_base_dir (VALUE self)
{
const char *base_dir = PHYSFS_getBaseDir ();
if (base_dir == 0)
base_dir = "";
return rb_str_new2 (base_dir);
}
/*
* PhysicsFS::user_dir
*
* return user directory
*/
VALUE physfs_user_dir (VALUE self)
{
const char *user_dir = PHYSFS_getBaseDir ();
if (user_dir == 0)
user_dir = "";
return rb_str_new2 (user_dir);
}
/*
* PhysicsFS::write_dir
*
* return write directory
*/
VALUE physfs_write_dir (VALUE self)
{
const char *write_dir = PHYSFS_getWriteDir ();
if (write_dir == 0)
return Qnil;
return rb_str_new2 (write_dir);
}
/*
* PhysicsFS::write_dir= str
*
* set write directory to *str*
*/
VALUE physfs_set_write_dir (VALUE self, VALUE str)
{
int result = PHYSFS_setWriteDir (STR2CSTR(str));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::add_to_search_path str, append
*
* if append > 0 - append str to search path, otherwise prepend it
*/
VALUE physfs_add_search_path (VALUE self, VALUE str, VALUE append)
{
int result = PHYSFS_addToSearchPath (STR2CSTR(str), FIX2INT(append));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::remove_from_search_path str
*
* removes str from search path
*/
VALUE physfs_remove_search_path (VALUE self, VALUE str)
{
int result = PHYSFS_removeFromSearchPath (STR2CSTR(str));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::search_path
*
* return current search_path - as array of strings
*/
VALUE physfs_search_path (VALUE self)
{
char **path = PHYSFS_getSearchPath ();
char **i;
VALUE ary = rb_ary_new ();
for (i = path ; *i != 0; i++)
rb_ary_push (ary, rb_str_new2 (*i));
PHYSFS_freeList (path);
return ary;
}
//
VALUE physfs_setSaneConfig(VALUE self, VALUE org, VALUE app, VALUE ext,
VALUE includeCdroms, VALUE archivesFirst)
{
int res = PHYSFS_setSaneConfig (STR2CSTR(org), STR2CSTR(app), STR2CSTR(ext),
RTEST(includeCdroms), RTEST(archivesFirst));
if (res)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::mkdir newdir
*
* create new directory
*/
VALUE physfs_mkdir (VALUE self, VALUE newdir)
{
int result = PHYSFS_mkdir (STR2CSTR(newdir));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::delete name
*
* delete file with name
*/
VALUE physfs_delete (VALUE self, VALUE name)
{
int result = PHYSFS_delete (STR2CSTR(name));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::real_dir name
*
* return real directory (in search path) of a name
*/
VALUE physfs_real_dir (VALUE self, VALUE name)
{
const char *path = PHYSFS_getRealDir (STR2CSTR(name));
if (path == 0)
return Qnil;
return rb_str_new2 (path);
}
/*
* PhysicsFS::enumerate dir
*
* list a dir from a search path
*/
VALUE physfs_enumerate (VALUE self, VALUE dir)
{
char **files = PHYSFS_enumerateFiles (STR2CSTR(dir));
char **i;
VALUE ary = rb_ary_new ();
for (i = files; *i != 0; i++)
rb_ary_push (ary, rb_str_new2 (*i));
PHYSFS_freeList (files);
return ary;
}
/*
* PhysicsFS::exists? name
*
* does a file with name exist?
*/
VALUE physfs_exists (VALUE self, VALUE name)
{
int result = PHYSFS_exists (STR2CSTR(name));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::is_directory? name
*
* return true if name is directory
*/
VALUE physfs_is_directory (VALUE self, VALUE name)
{
int result = PHYSFS_isDirectory (STR2CSTR(name));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::is_symlink? name
*
* return true if name is symlink
*/
VALUE physfs_is_symlink (VALUE self, VALUE name)
{
int result = PHYSFS_isSymbolicLink (STR2CSTR(name));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::last_mod_time name
*
* return last modification time of a file
*/
VALUE physfs_last_mod_time (VALUE self, VALUE name)
{
int result = PHYSFS_getLastModTime (STR2CSTR(name));
return INT2FIX(result);
}
/*
* PhysicsFS::open_read name
*
* return +PhysicsFS::File+ ready for reading
*/
VALUE physfs_open_read (VALUE self, VALUE name)
{
PHYSFS_File *file = PHYSFS_openRead (STR2CSTR(name));
return physfs_file_new (file);
}
/*
* PhysicsFS::open_write name
*
* return PhysicsFS::File ready for writing
*/
VALUE physfs_open_write (VALUE self, VALUE name)
{
PHYSFS_File *file = PHYSFS_openWrite (STR2CSTR(name));
return physfs_file_new (file);
}
/*
* PhysicsFS::open_append name
*
* return PhysicsFS::File ready for appending
*/
VALUE physfs_open_append (VALUE self, VALUE name)
{
PHYSFS_File *file = PHYSFS_openAppend (STR2CSTR(name));
return physfs_file_new (file);
}
void Init_physfs_so (void)
{
modulePhysfs = rb_define_module ("PhysicsFS");
rb_define_singleton_method (modulePhysfs, "init_internal", physfs_init, 1);
rb_define_singleton_method (modulePhysfs, "deinit", physfs_deinit, 0);
rb_define_singleton_method (modulePhysfs, "version", physfs_version, 0);
rb_define_singleton_method (modulePhysfs, "supported_archives",
physfs_supported_archives, 0);
rb_define_singleton_method (modulePhysfs, "last_error",
physfs_last_error, 0);
rb_define_singleton_method (modulePhysfs, "dir_separator",
physfs_dir_separator, 0);
rb_define_singleton_method (modulePhysfs, "permit_symlinks",
physfs_permit_symlinks, 1);
rb_define_singleton_method (modulePhysfs, "cdrom_dirs",
physfs_cdrom_dirs, 0);
rb_define_singleton_method (modulePhysfs, "base_dir", physfs_base_dir, 0);
rb_define_singleton_method (modulePhysfs, "user_dir", physfs_user_dir, 0);
rb_define_singleton_method (modulePhysfs, "write_dir", physfs_write_dir, 0);
rb_define_singleton_method (modulePhysfs, "write_dir=",
physfs_set_write_dir, 1);
rb_define_singleton_method (modulePhysfs, "add_to_search_path",
physfs_add_search_path, 2);
rb_define_singleton_method (modulePhysfs, "remove_from_search_path",
physfs_remove_search_path, 1);
rb_define_singleton_method (modulePhysfs, "search_path",
physfs_search_path, 0);
rb_define_singleton_method (modulePhysfs, "set_sane_config",
physfs_setSaneConfig, 5);
rb_define_singleton_method (modulePhysfs, "mkdir", physfs_mkdir, 1);
rb_define_singleton_method (modulePhysfs, "delete", physfs_delete, 1);
rb_define_singleton_method (modulePhysfs, "real_dir",
physfs_real_dir, 1);
rb_define_singleton_method (modulePhysfs, "enumerate", physfs_enumerate, 1);
rb_define_singleton_method (modulePhysfs, "exists?", physfs_exists, 1);
rb_define_singleton_method (modulePhysfs, "is_directory?",
physfs_is_directory, 1);
rb_define_singleton_method (modulePhysfs, "is_symlink?",
physfs_is_symlink, 1);
rb_define_singleton_method (modulePhysfs, "last_mod_time",
physfs_last_mod_time, 1);
rb_define_singleton_method (modulePhysfs, "open_read",
physfs_open_read, 1);
rb_define_singleton_method (modulePhysfs, "open_write",
physfs_open_write, 1);
rb_define_singleton_method (modulePhysfs, "open_append",
physfs_open_append, 1);
init_physfs_file ();
init_sdl_rwops ();
}
/*
// Local Variables:
// mode: C
// c-indentation-style: "stroustrup"
// indent-tabs-mode: nil
// End:
*/

View File

@ -1,13 +0,0 @@
/*
* PhysicsFS - ruby interface
*
* Author:: Ed Sinjiashvili (slimb@vlinkmail.com)
* License:: LGPL
*/
#ifndef __RB__PHYSFS__H__
#define __RB__PHYSFS__H__
extern VALUE modulePhysfs;
#endif

View File

@ -1,226 +0,0 @@
/*
* PhysicsFS File abstraction - ruby interface
*
* Author:: Ed Sinjiashvili (slimb@vlinkmail.com)
* License:: LGPL
*/
#include "physfs.h"
#include "ruby.h"
#include "rb_physfs.h"
#include "rb_physfs_file.h"
#include "physfsrwops.h"
VALUE classPhysfsFile;
/*
* construct new PhysicsFS::File object
*/
VALUE physfs_file_new (PHYSFS_File *file)
{
if (file == 0)
return Qnil;
return Data_Wrap_Struct (classPhysfsFile, 0, 0, file);
}
/*
* PhysicsFS::File#close
*
* Close the file. It's illegal to use the object after its closure.
*/
VALUE physfs_file_close (VALUE self)
{
int result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qfalse;
result = PHYSFS_close (file);
DATA_PTR(self) = 0;
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::File#read obj_size, num_objects
*
* Read *objCount* objects which are *objSize* each.
* return String instance containing raw data or nil if failure.
* #length of string will reflect real number of objects read.
*/
VALUE physfs_file_read (VALUE self, VALUE objSize, VALUE objCount)
{
int objRead;
void *buffer;
VALUE result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil; //wasted file - no read possible
buffer = malloc (FIX2UINT(objSize) * FIX2UINT(objCount));
if (buffer == 0)
return Qnil;
objRead = PHYSFS_read (file, buffer, FIX2UINT(objSize), FIX2UINT(objCount));
if (objRead == -1)
{
free (buffer);
return Qnil;
}
result = rb_str_new (buffer, objRead * FIX2UINT(objSize));
free (buffer);
return result;
}
/*
* PhysicsFS::File#write buffer, obj_size, num_objects
*
* return nil on failure or number of objects written.
*/
VALUE physfs_file_write (VALUE self, VALUE buf, VALUE objSize, VALUE objCount)
{
int result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;
result = PHYSFS_write (file, STR2CSTR(buf),
FIX2UINT(objSize), FIX2UINT(objCount));
if (result == -1)
return Qnil;
return INT2FIX(result);
}
/*
* PhysicsFS::File#eof?
*/
VALUE physfs_file_eof (VALUE self)
{
int result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;
result = PHYSFS_eof (file);
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::File#tell
*
* tells current position in file
*/
VALUE physfs_file_tell (VALUE self)
{
int result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;
result = PHYSFS_tell (file);
if (result == -1)
return Qnil;
return INT2FIX(result);
}
/*
* PhysicsFS::File#seek pos
*
* seek to pos in file
*/
VALUE physfs_file_seek (VALUE self, VALUE pos)
{
int result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;
result = PHYSFS_seek (file, FIX2LONG(pos));
if (result)
return Qtrue;
return Qfalse;
}
/*
* PhysicsFS::File#length
*/
VALUE physfs_file_length (VALUE self)
{
int result;
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;
result = PHYSFS_fileLength (file);
if (result == -1)
return Qnil;
return INT2FIX(result);
}
/*
* PhysicsFS::File#to_rwops
*
* File object is converted to RWops object.
* File object becomes unusable after that - every operation
* should be done through new-born RWops object.
*/
VALUE physfs_file_to_rwops (VALUE self)
{
PHYSFS_File *file;
SDL_RWops *rwops;
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;
rwops = PHYSFSRWOPS_makeRWops (file);
if (rwops == 0)
return Qnil;
DATA_PTR(self) = 0; // oh, gosh, we've sacrificed ourselves!
return sdl_rwops_new (rwops);
}
void init_physfs_file (void)
{
classPhysfsFile = rb_define_class_under (modulePhysfs, "File", rb_cObject);
rb_define_method (classPhysfsFile, "close", physfs_file_close, 0);
rb_define_method (classPhysfsFile, "eof?", physfs_file_eof, 0);
rb_define_method (classPhysfsFile, "tell", physfs_file_tell, 0);
rb_define_method (classPhysfsFile, "seek", physfs_file_seek, 1);
rb_define_method (classPhysfsFile, "length", physfs_file_length, 0);
rb_define_method (classPhysfsFile, "read", physfs_file_read, 2);
rb_define_method (classPhysfsFile, "write", physfs_file_write, 3);
rb_define_method (classPhysfsFile, "to_rwops", physfs_file_to_rwops, 0);
}

View File

@ -1,24 +0,0 @@
/*
* PhysicsFS File abstraction - ruby interface
*
* Author:: Ed Sinjiashvili (slimb@vlinkmail.com)
* License:: LGPL
*/
#ifndef __RB__PHYSFS__FILE__H__
#define __RB__PHYSFS__FILE__H__
extern VALUE classPhysfsFile;
VALUE physfs_file_new (PHYSFS_file *file);
VALUE physfs_file_close (VALUE self);
VALUE physfs_file_read (VALUE self, VALUE objSize, VALUE objCount);
VALUE physfs_file_write (VALUE self, VALUE buf, VALUE objSize, VALUE objCount);
VALUE physfs_file_eof (VALUE self);
VALUE physfs_file_tell (VALUE self);
VALUE physfs_file_seek (VALUE self, VALUE pos);
VALUE physfs_file_length (VALUE self);
void init_physfs_file (void);
#endif

View File

@ -1,162 +0,0 @@
/*
* SDL_RWops - ruby interface
*
* Author:: Ed Sinjiashvili (slimb@vlinkmail.com)
* License:: LGPL
*/
#include "SDL_rwops.h"
#include "ruby.h"
#include "rb_physfs.h"
#include "rb_sdl_rwops.h"
VALUE classRWops;
/*
* RWops constructor
*/
VALUE sdl_rwops_new (SDL_RWops *ops)
{
VALUE result;
if (ops == 0)
return Qnil;
result = Data_Wrap_Struct (classRWops, 0, SDL_FreeRW, ops);
return result;
}
/*
* PhysicsFS::RWops::from_file name, mode
*
* create RWops object from file
*/
VALUE sdl_rwops_from_file (VALUE self, VALUE name, VALUE mode)
{
SDL_RWops *ops = SDL_RWFromFile(STR2CSTR(name), STR2CSTR(mode));
return sdl_rwops_new (ops);
}
/*
* PhysicsFS::RWops::from_memory string
*
* create RWops object from memory
*/
VALUE sdl_rwops_from_mem (VALUE self, VALUE str)
{
int len = RSTRING(str)->len;
void *mem = STR2CSTR(str);
SDL_RWops *ops = SDL_RWFromMem(mem, len);
return sdl_rwops_new (ops);
}
/*
* PhysicsFS::RWops#seek offset, whence
*
* position RWops object
*/
VALUE sdl_rwops_seek (VALUE self, VALUE offset, VALUE whence)
{
int result;
SDL_RWops *ops;
Data_Get_Struct (self, SDL_RWops, ops);
if (ops == 0)
return Qnil;
result = SDL_RWseek(ops, FIX2INT(offset), FIX2INT(whence));
return INT2FIX(result);
}
/*
* PhysicsFS::RWops#close
*
* close RWops. No use of the object is possible after that.
*/
VALUE sdl_rwops_close (VALUE self)
{
int result;
SDL_RWops *ops;
Data_Get_Struct (self, SDL_RWops, ops);
if (ops == 0)
return Qnil;
result = SDL_RWclose (ops);
DATA_PTR(self) = 0;
return INT2FIX(result);
}
/*
* PhysicsFS::RWops#read
*
* read from RWops object objCount objSize'd entities.
* return string containing raw data or nil
*/
VALUE sdl_rwops_read (VALUE self, VALUE objSize, VALUE objCount)
{
int objRead;
void *buffer;
VALUE result;
SDL_RWops *ops;
Data_Get_Struct (self, SDL_RWops, ops);
if (ops == 0)
return Qnil;
buffer = malloc (FIX2UINT(objSize) * FIX2UINT(objCount));
if (buffer == 0)
return Qnil;
objRead = SDL_RWread (ops, buffer, FIX2UINT(objSize), FIX2UINT(objCount));
if (objRead == -1)
{
free (buffer);
return Qnil;
}
result = rb_str_new (buffer, objRead * FIX2UINT(objSize));
free (buffer);
return result;
}
/*
* PhysicsFS::RWops#write buffer, size, n
*
* write raw string containing n objects size length each.
* return number of objects written or nil
*/
VALUE sdl_rwops_write (VALUE self, VALUE buffer, VALUE size, VALUE n)
{
int result;
SDL_RWops *ops;
Data_Get_Struct (self, SDL_RWops, ops);
if (ops == 0)
return Qnil;
result = SDL_RWwrite (ops, STR2CSTR(buffer), FIX2INT(size), FIX2INT(n));
if (result == -1)
return Qnil;
return INT2FIX(result);
}
void init_sdl_rwops (void)
{
classRWops = rb_define_class_under (modulePhysfs, "RWops", rb_cObject);
rb_define_method (classRWops, "seek", sdl_rwops_seek, 2);
rb_define_method (classRWops, "read", sdl_rwops_read, 2);
rb_define_method (classRWops, "write", sdl_rwops_write, 3);
rb_define_method (classRWops, "close", sdl_rwops_close, 0);
rb_define_singleton_method (classRWops, "from_file",
sdl_rwops_from_file, 2);
rb_define_singleton_method (classRWops, "from_memory",
sdl_rwops_from_mem, 1);
}

View File

@ -1,16 +0,0 @@
/*
* SDL_RWops - ruby interface
*
* Author:: Ed Sinjiashvili (slimb@vlinkmail.com)
* License:: LGPL
*/
#ifndef __RB__SDL__RWOPS__H__
#define __RB__SDL__RWOPS__H__
extern VALUE classRWops;
VALUE sdl_rwops_new (SDL_RWops *ops);
void init_sdl_rwops (void);
#endif

View File

@ -1,358 +0,0 @@
#
# PhysicsFS test program - mimics real physfs_test
#
require 'readline'
require 'physfs'
def die msg
puts "#{msg} - reason: #{PhysicsFS.last_error}"
end
#
# parse line to command and args
#
def parse line
return false if line.nil?
if line.strip =~ /^(.*?) (?: (?:\s+(.*)) | $)/x
run $1, $2
else
false
end
end
#
# parse command args
#
def parse_args args
args.strip!
dquoted = /^ " (.*?) "/x
squoted = /^ ' (.*?) '/x
unquoted = /^([^\s\'\"]+)/
regexps = [dquoted, squoted, unquoted]
result = []
while args != ""
regexps.each do |r|
if args =~ r
result << $1
args.sub! r, ""
args.sub!(/\s+/, "")
break
end
end
end
result
end
def usage cmd, prefix = "usage: "
print prefix
args = Commands::HELP[cmd]
if args
print cmd
args.scan(/\w+/).each {|x|
print " <#{x}>"
}
puts
else
puts %|#{cmd} (no arguments)|
end
end
# commands go below
module Commands
HELP = {
"init" => "argv0",
"addarchive" => "archiveLocation append",
"removearchive" => "archiveLocation",
"enumerate" => "dirToEnumerate",
"ls" => "dirToEnumerate",
"setwritedir" => "newWriteDir",
"permitsymlinks" => "1or0",
"setsaneconfig" => "org appName arcExt includeCdRoms archivesFirst",
"mkdir" => "dirToMk",
"delete" => "dirToDelete",
"getrealdir" => "fileToFind",
"exists" => "fileToCheck",
"isdir" => "fileToCheck",
"issymlink" => "fileToCheck",
"cat" => "fileToCat",
"filelength" => "fileToCheck",
"append" => "fileToAppend",
"write" => "fileToCreateOrTrash",
"getlastmodtime" => "fileToExamine"
}
def quit_cmd
exit
end
alias q_cmd quit_cmd
def help_cmd
commands = ::Commands.instance_methods.grep(/_cmd$/).sort
puts "Commands:"
commands.each do |c|
usage c.sub("_cmd", ""), " - "
end
true
end
def e val
if val
puts "Successful."
else
puts "Failure. reason: #{PhysicsFS.last_error}"
end
true
end
def init_cmd arg
e PhysicsFS.init(arg)
end
def deinit_cmd
e PhysicsFS.deinit
end
def addarchive_cmd archive, append
e PhysicsFS.add_to_search_path(archive, append)
end
def removearchive_cmd archive
e PhysicsFS.remove_from_search_path archive
end
def enumerate_cmd path
entries = PhysicsFS.enumerate(path)
entries.each {|x|
puts x
}
true
end
alias ls_cmd enumerate_cmd
def getlasterror_cmd
puts "Last error is [#{PhysicsFS.last_error}]"
true
end
def getdirsep_cmd
puts "Directory separator is [#{PhysicsFS.dir_separator}]"
true
end
def getcdromdirs_cmd
dirs = PhysicsFS.cdrom_dirs
dirs.each {|x|
puts x
}
puts " total [#{dirs.length}] drives."
true
end
def getsearchpath_cmd
spath = PhysicsFS.search_path
spath.each {|x|
puts x
}
puts "total [#{spath.length}] directories."
true
end
def getbasedir_cmd
dir = PhysicsFS.base_dir
puts dir if dir
true
end
def getuserdir_cmd
puts PhysicsFS.user_dir
true
end
def getwritedir_cmd
dir = PhysicsFS.write_dir
if dir
puts "Write directory is [#{dir}]."
else
puts "No write directory defined."
end
true
end
def setwritedir_cmd dir
e(PhysicsFS.write_dir = dir)
end
def permitsymlinks_cmd val
if val.to_i == 1
PhysicsFS.permit_symlinks true
puts "Symlinks are now permitted"
else
PhysicsFS.permit_symlinks false
puts "Symlinks are now forbidden"
end
true
end
def setsaneconfig_cmd org, appname, ext, includeCdroms, archivesFirst
includeCdroms = includeCdroms.to_i == 1
archiveFirst = archivesFirst == 1
e PhysicsFS.set_sane_config(org, appname, ext, includeCdroms, archivesFirst)
end
def mkdir_cmd dir
e PhysicsFS.mkdir(dir)
end
def delete_cmd dir
e PhysicsFS.delete(dir)
end
def getrealdir_cmd file
dir = PhysicsFS.real_dir file
if dir
puts "Found at [#{dir}]"
else
puts "Not found."
end
true
end
def exists_cmd file
if PhysicsFS.exists? file
puts "File exists"
else
puts "File does not exist"
end
true
end
def isdir_cmd file
if PhysicsFS.is_directory? file
puts "File is a directory"
else
puts "File is NOT a directory"
end
true
end
def issymlink_cmd file
if PhysicsFS.is_symlink? file
puts "File is a symlink"
else
puts "File is NOT a symlink"
end
true
end
def cat_cmd filename
file = PhysicsFS.open_read filename
if file.nil?
puts "failed to open. reason: #{PhysicsFS.last_error}"
return true
end
puts file.cat
true
end
def filelength_cmd filename
file = PhysicsFS.open_read filename
if file.nil?
puts "failed to open. reason: #{PhysicsFS.last_error}"
return true
end
puts file.length
file.close
true
end
WRITE_STR = "Rubyfied PhysicsFS works just fine.\n\n"
def append_cmd filename
file = PhysicsFS.open_append filename
if file.nil?
puts "failed to open. reason: #{PhysicsFS.last_error}"
return true
end
file.write WRITE_STR, 1, WRITE_STR.length
file.close
true
end
def write_cmd filename
file = PhysicsFS.open_write filename
if file.nil?
puts "failed to open. reason: #{PhysicsFS.last_error}"
return true
end
file.write_str WRITE_STR
file.close
true
end
def getlastmodtime_cmd filename
t = PhysicsFS.last_mod_time filename
if t == -1
puts "failed to determin. reason: #{PhysicsFS.last_error}"
else
puts "Last modified: #{Time.at(t)}"
end
true
end
end
include Commands
def run command, args
if args
args = parse_args args
else
args = []
end
begin
cmd = method "#{command}_cmd"
if args.length == cmd.arity
return cmd.call *args
else
usage command
true
end
rescue NameError
puts 'Unknown command. Enter "help" for instructions.'
true
end
end
if __FILE__ == $0
PhysicsFS.init($0) or die "PhysicsFS init failed"
puts "PhysicsFS version: #{PhysicsFS.version}"
puts
puts "Supported archives: "
puts PhysicsFS.supported_archives
puts
puts 'Enter commands. Enter "help" for instructions.'
loop {
line = Readline::readline "physfs_rb> ", true
break unless parse line
}
end

View File

@ -7,7 +7,7 @@
* ./physfshttpd archive1.zip archive2.zip /path/to/a/real/dir etc...
*
* The files are appended in order to the PhysicsFS search path, and when
* a client request comes it, it looks for the file in said search path.
* a client request comes in, it looks for the file in said search path.
*
* My goal was to make this work in less than 300 lines of C, so again, it's
* not to be used for any serious purpose. Patches to make this application
@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@ -54,7 +55,7 @@
#include "physfs.h"
#define DEFAULT_PORTNUM 6667
#define DEFAULT_PORTNUM 8080
typedef struct
{
@ -64,45 +65,153 @@ typedef struct
} http_args;
static char *txt404 =
"HTTP/1.0 404 Not Found\n"
"Connection: close\n"
"Content-type: text/html\n"
"\n"
"<html><head><title>404 Not Found</title></head>\n"
"<body>Can't find that.</body></html>\n\n";
#define txt404 \
"HTTP/1.0 404 Not Found\n" \
"Connection: close\n" \
"Content-Type: text/html; charset=utf-8\n" \
"\n" \
"<html><head><title>404 Not Found</title></head>\n" \
"<body>Can't find '%s'.</body></html>\n\n" \
#define txt200 \
"HTTP/1.0 200 OK\n" \
"Connection: close\n" \
"Content-Type: %s\n" \
"\n"
static const char *lastError(void)
{
return PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
} /* lastError */
static int writeAll(const char *ipstr, const int sock, void *buf, const size_t len)
{
if (write(sock, buf, len) != len)
{
printf("%s: Write error to socket.\n", ipstr);
return 0;
} /* if */
return 1;
} /* writeAll */
static int writeString(const char *ipstr, const int sock, const char *fmt, ...)
{
/* none of this is robust against large strings or HTML escaping. */
char buffer[1024];
int len;
va_list ap;
va_start(ap, fmt);
len = vsnprintf(buffer, sizeof (buffer), fmt, ap);
va_end(ap);
if (len < 0)
{
printf("uhoh, vsnprintf() failed!\n");
return 0;
} /* if */
return writeAll(ipstr, sock, buffer, len);
} /* writeString */
static void feed_file_http(const char *ipstr, int sock, const char *fname)
{
PHYSFS_File *in = PHYSFS_openRead(fname);
char buffer[1024];
printf("%s: requested [%s].\n", ipstr, fname);
if (in == NULL)
{
printf("%s: Can't open [%s]: %s.\n",
ipstr, fname, PHYSFS_getLastError());
write(sock, txt404, strlen(txt404)); /* !!! FIXME: Check retval */
printf("%s: Can't open [%s]: %s.\n", ipstr, fname, lastError());
writeString(ipstr, sock, txt404, fname);
return;
} /* if */
else
/* !!! FIXME: mimetype */
if (writeString(ipstr, sock, txt200, "text/plain; charset=utf-8"))
{
do
{
PHYSFS_sint64 br = PHYSFS_read(in, buffer, 1, sizeof (buffer));
char buffer[1024];
PHYSFS_sint64 br = PHYSFS_readBytes(in, buffer, sizeof (buffer));
if (br == -1)
{
printf("%s: Read error: %s.\n", ipstr, PHYSFS_getLastError());
printf("%s: Read error: %s.\n", ipstr, lastError());
break;
} /* if */
write(sock, buffer, (int) br); /* !!! FIXME: CHECK THIS RETVAL! */
else if (!writeAll(ipstr, sock, buffer, (size_t) br))
{
break;
} /* else if */
} while (!PHYSFS_eof(in));
} /* if */
PHYSFS_close(in);
} /* else */
PHYSFS_close(in);
} /* feed_file_http */
static void feed_dirlist_http(const char *ipstr, int sock,
const char *dname, char **list)
{
int i;
if (!writeString(ipstr, sock, txt200, "text/html; charset=utf-8"))
return;
else if (!writeString(ipstr, sock,
"<html><head><title>Directory %s</title></head>"
"<body><p><h1>Directory %s</h1></p><p><ul>\n",
dname, dname))
return;
if (strcmp(dname, "/") == 0)
dname = "";
for (i = 0; list[i]; i++)
{
const char *fname = list[i];
if (!writeString(ipstr, sock,
"<li><a href='%s/%s'>%s</a></li>\n", dname, fname, fname))
break;
} /* for */
writeString(ipstr, sock, "</ul></body></html>\n");
} /* feed_dirlist_http */
static void feed_dir_http(const char *ipstr, int sock, const char *dname)
{
char **list = PHYSFS_enumerateFiles(dname);
if (list == NULL)
{
printf("%s: Can't enumerate directory [%s]: %s.\n",
ipstr, dname, lastError());
writeString(ipstr, sock, txt404, dname);
return;
} /* if */
feed_dirlist_http(ipstr, sock, dname, list);
PHYSFS_freeList(list);
} /* feed_dir_http */
static void feed_http_request(const char *ipstr, int sock, const char *fname)
{
PHYSFS_Stat statbuf;
printf("%s: requested [%s].\n", ipstr, fname);
if (!PHYSFS_stat(fname, &statbuf))
{
printf("%s: Can't stat [%s]: %s.\n", ipstr, fname, lastError());
writeString(ipstr, sock, txt404, fname);
return;
} /* if */
if (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY)
feed_dir_http(ipstr, sock, fname);
else
feed_file_http(ipstr, sock, fname);
} /* feed_http_request */
static void *do_http(void *_args)
{
http_args *args = (http_args *) _args;
@ -135,7 +244,7 @@ static void *do_http(void *_args)
ptr = strchr(buffer + 5, ' ');
if (ptr != NULL)
*ptr = '\0';
feed_file_http(ipstr, args->sock, buffer + 4);
feed_http_request(ipstr, args->sock, buffer + 4);
} /* if */
} /* else */
@ -144,7 +253,7 @@ static void *do_http(void *_args)
close(args->sock);
free(args->addr);
free(args);
return(NULL);
return NULL;
} /* do_http */
@ -156,14 +265,14 @@ static void serve_http_request(int sock, struct sockaddr *addr,
{
printf("out of memory.\n");
return;
} // if
} /* if */
args->addr = (struct sockaddr *) malloc(addrlen);
if (args->addr == NULL)
{
free(args);
printf("out of memory.\n");
return;
} // if
} /* if */
args->sock = sock;
args->addrlen = addrlen;
@ -194,7 +303,7 @@ static int create_listen_socket(short portnum)
addr.sin_family = AF_INET;
addr.sin_port = htons(portnum);
addr.sin_addr.s_addr = INADDR_ANY;
if ((bind(retval, &addr, (socklen_t) sizeof (addr)) == -1) ||
if ((bind(retval, (struct sockaddr *) &addr, (socklen_t) sizeof (addr)) == -1) ||
(listen(retval, 5) == -1))
{
close(retval);
@ -202,7 +311,7 @@ static int create_listen_socket(short portnum)
} /* if */
} /* if */
return(retval);
return retval;
} /* create_listen_socket */
@ -219,7 +328,7 @@ void at_exit_cleanup(void)
close(listensocket);
if (!PHYSFS_deinit())
printf("PHYSFS_deinit() failed: %s\n", PHYSFS_getLastError());
printf("PHYSFS_deinit() failed: %s\n", lastError());
} /* at_exit_cleanup */
@ -244,13 +353,13 @@ int main(int argc, char **argv)
if (argc == 1)
{
printf("USAGE: %s <archive1> [archive2 [... archiveN]]\n", argv[0]);
return(42);
return 42;
} /* if */
if (!PHYSFS_init(argv[0]))
{
printf("PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
return(42);
printf("PHYSFS_init() failed: %s\n", lastError());
return 42;
} /* if */
/* normally, this is bad practice, but oh well. */
@ -258,7 +367,7 @@ int main(int argc, char **argv)
for (i = 1; i < argc; i++)
{
if (!PHYSFS_addToSearchPath(argv[i], 1))
if (!PHYSFS_mount(argv[i], NULL, 1))
printf(" WARNING: failed to add [%s] to search path.\n", argv[i]);
} /* else */
@ -266,7 +375,7 @@ int main(int argc, char **argv)
if (listensocket < 0)
{
printf("listen socket failed to create.\n");
return(42);
return 42;
} /* if */
while (1) /* infinite loop for now. */
@ -278,13 +387,13 @@ int main(int argc, char **argv)
{
printf("accept() failed: %s\n", strerror(errno));
close(listensocket);
return(42);
return 42;
} /* if */
serve_http_request(s, &addr, len);
} /* while */
return(0);
return 0;
} /* main */
/* end of physfshttpd.c ... */

View File

@ -15,7 +15,8 @@
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
* SDL 1.2 falls under the LGPL license. SDL 1.3+ is zlib, like PhysicsFS.
* You can get SDL at https://www.libsdl.org/
*
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
@ -23,102 +24,156 @@
#include <stdio.h> /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */
#include "physfsrwops.h"
static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
/* SDL's RWOPS interface changed a little in SDL 2.0... */
#if defined(SDL_VERSION_ATLEAST)
#if SDL_VERSION_ATLEAST(2, 0, 0)
#define TARGET_SDL2 1
#endif
#endif
#if !TARGET_SDL2
#ifndef RW_SEEK_SET
#define RW_SEEK_SET SEEK_SET
#endif
#ifndef RW_SEEK_CUR
#define RW_SEEK_CUR SEEK_CUR
#endif
#ifndef RW_SEEK_END
#define RW_SEEK_END SEEK_END
#endif
#endif
#if TARGET_SDL2
static Sint64 SDLCALL physfsrwops_size(struct SDL_RWops *rw)
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
int pos = 0;
return (Sint64) PHYSFS_fileLength(handle);
} /* physfsrwops_size */
#endif
if (whence == SEEK_SET)
{
pos = offset;
} /* if */
else if (whence == SEEK_CUR)
#if TARGET_SDL2
static Sint64 SDLCALL physfsrwops_seek(struct SDL_RWops *rw, Sint64 offset, int whence)
#else
static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
#endif
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 pos = 0;
if (whence == RW_SEEK_SET)
pos = (PHYSFS_sint64) offset;
else if (whence == RW_SEEK_CUR)
{
PHYSFS_sint64 current = PHYSFS_tell(handle);
const PHYSFS_sint64 current = PHYSFS_tell(handle);
if (current == -1)
{
SDL_SetError("Can't find position in file: %s",
PHYSFS_getLastError());
return(-1);
} /* if */
pos = (int) current;
if ( ((PHYSFS_sint64) pos) != current )
{
SDL_SetError("Can't fit current file position in an int!");
return(-1);
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
if (offset == 0) /* this is a "tell" call. We're done. */
return(pos);
{
#if TARGET_SDL2
return (Sint64) current;
#else
return (int) current;
#endif
} /* if */
pos += offset;
pos = current + ((PHYSFS_sint64) offset);
} /* else if */
else if (whence == SEEK_END)
else if (whence == RW_SEEK_END)
{
PHYSFS_sint64 len = PHYSFS_fileLength(handle);
const PHYSFS_sint64 len = PHYSFS_fileLength(handle);
if (len == -1)
{
SDL_SetError("Can't find end of file: %s", PHYSFS_getLastError());
return(-1);
SDL_SetError("Can't find end of file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
pos = (int) len;
if ( ((PHYSFS_sint64) pos) != len )
{
SDL_SetError("Can't fit end-of-file position in an int!");
return(-1);
} /* if */
pos += offset;
pos = len + ((PHYSFS_sint64) offset);
} /* else if */
else
{
SDL_SetError("Invalid 'whence' parameter.");
return(-1);
return -1;
} /* else */
if ( pos < 0 )
{
SDL_SetError("Attempt to seek past start of file.");
return(-1);
return -1;
} /* if */
if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
return(pos);
#if TARGET_SDL2
return (Sint64) pos;
#else
return (int) pos;
#endif
} /* physfsrwops_seek */
#if TARGET_SDL2
static size_t SDLCALL physfsrwops_read(struct SDL_RWops *rw, void *ptr,
size_t size, size_t maxnum)
#else
static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
#endif
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
if (rc != maxnum)
const PHYSFS_uint64 readlen = (PHYSFS_uint64) (maxnum * size);
const PHYSFS_sint64 rc = PHYSFS_readBytes(handle, ptr, readlen);
if (rc != ((PHYSFS_sint64) readlen))
{
if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
#if TARGET_SDL2
return 0;
#else
return -1;
#endif
} /* if */
} /* if */
return((int) rc);
#if TARGET_SDL2
return (size_t) rc / size;
#else
return (int) rc / size;
#endif
} /* physfsrwops_read */
#if TARGET_SDL2
static size_t SDLCALL physfsrwops_write(struct SDL_RWops *rw, const void *ptr,
size_t size, size_t num)
#else
static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
#endif
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
if (rc != num)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
const PHYSFS_uint64 writelen = (PHYSFS_uint64) (num * size);
const PHYSFS_sint64 rc = PHYSFS_writeBytes(handle, ptr, writelen);
if (rc != ((PHYSFS_sint64) writelen))
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return((int) rc);
#if TARGET_SDL2
return (size_t) rc;
#else
return (int) rc;
#endif
} /* physfsrwops_write */
@ -127,12 +182,12 @@ static int physfsrwops_close(SDL_RWops *rw)
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
if (!PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
SDL_FreeRW(rw);
return(0);
return 0;
} /* physfsrwops_close */
@ -141,12 +196,15 @@ static SDL_RWops *create_rwops(PHYSFS_File *handle)
SDL_RWops *retval = NULL;
if (handle == NULL)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
else
{
retval = SDL_AllocRW();
if (retval != NULL)
{
#if TARGET_SDL2
retval->size = physfsrwops_size;
#endif
retval->seek = physfsrwops_seek;
retval->read = physfsrwops_read;
retval->write = physfsrwops_write;
@ -155,7 +213,7 @@ static SDL_RWops *create_rwops(PHYSFS_File *handle)
} /* if */
} /* else */
return(retval);
return retval;
} /* create_rwops */
@ -167,25 +225,25 @@ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle)
else
retval = create_rwops(handle);
return(retval);
return retval;
} /* PHYSFSRWOPS_makeRWops */
SDL_RWops *PHYSFSRWOPS_openRead(const char *fname)
{
return(create_rwops(PHYSFS_openRead(fname)));
return create_rwops(PHYSFS_openRead(fname));
} /* PHYSFSRWOPS_openRead */
SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname)
{
return(create_rwops(PHYSFS_openWrite(fname)));
return create_rwops(PHYSFS_openWrite(fname));
} /* PHYSFSRWOPS_openWrite */
SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname)
{
return(create_rwops(PHYSFS_openAppend(fname)));
return create_rwops(PHYSFS_openAppend(fname));
} /* PHYSFSRWOPS_openAppend */

View File

@ -15,7 +15,8 @@
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
* SDL 1.2 falls under the LGPL license. SDL 1.3+ is zlib, like PhysicsFS.
* You can get SDL at https://www.libsdl.org/
*
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
@ -40,7 +41,7 @@ extern "C" {
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
/**
* Open a platform-independent filename for writing, and make it accessible
@ -52,7 +53,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
/**
* Open a platform-independent filename for appending, and make it accessible
@ -64,7 +65,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
/**
* Make a SDL_RWops from an existing PhysicsFS file handle. You should
@ -76,7 +77,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
#ifdef __cplusplus
}

View File

@ -28,7 +28,7 @@ static void modTimeToStr(PHYSFS_sint64 modtime, char *modstr, size_t strsize)
static void fail(const char *what, const char *why)
{
if (why == NULL)
why = PHYSFS_getLastError();
why = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
fprintf(stderr, "%s failed: %s\n", what, why);
failure = 1;
} /* fail */
@ -150,21 +150,21 @@ int main(int argc, char **argv)
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 2;
} /* if */
if (!PHYSFS_setWriteDir(argv[2]))
{
fprintf(stderr, "PHYSFS_setWriteDir('%s') failed: %s\n",
argv[2], PHYSFS_getLastError());
argv[2], PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 3;
} /* if */
if (!PHYSFS_mount(argv[1], NULL, 1))
{
fprintf(stderr, "PHYSFS_mount('%s') failed: %s\n",
argv[1], PHYSFS_getLastError());
argv[1], PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 4;
} /* if */

View File

@ -40,16 +40,16 @@ int main(int argc, char **argv)
if (!PHYSFS_init(argv[0]))
{
printf("PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
return(42);
printf("PHYSFS_init() failed: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 42;
} /* if */
rc = PHYSFS_addToSearchPath(argv[0], 0);
if (!rc)
{
printf("Couldn't find self-extract data: %s\n", PHYSFS_getLastError());
printf("Couldn't find self-extract data: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
printf("This might mean you didn't append a zipfile to the binary.\n");
return(42);
return 42;
} /* if */
char **files = PHYSFS_enumerateFiles("/");
@ -61,6 +61,6 @@ int main(int argc, char **argv)
} /* for */
PHYSFS_freeList(files);
return(0);
return 0;
} /* main */

10
extras/uninstall.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
if [ ! -f "./install_manifest.txt" ]; then
echo "ERROR: This needs to be run from your CMake build directory after installing." 1>&2
exit 1
fi
xargs rm -vf < install_manifest.txt
exit 0

View File

@ -1,20 +0,0 @@
/* 7zAlloc.h */
#ifndef __7Z_ALLOC_H
#define __7Z_ALLOC_H
#include <stddef.h>
typedef struct _ISzAlloc
{
void *(*Alloc)(size_t size);
void (*Free)(void *address); /* address can be 0 */
} ISzAlloc;
void *SzAlloc(size_t size);
void SzFree(void *address);
void *SzAllocTemp(size_t size);
void SzFreeTemp(void *address);
#endif

View File

@ -1,29 +0,0 @@
/* 7zBuffer.c */
#include "7zBuffer.h"
#include "7zAlloc.h"
void SzByteBufferInit(CSzByteBuffer *buffer)
{
buffer->Capacity = 0;
buffer->Items = 0;
}
int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size))
{
buffer->Capacity = newCapacity;
if (newCapacity == 0)
{
buffer->Items = 0;
return 1;
}
buffer->Items = (Byte *)allocFunc(newCapacity);
return (buffer->Items != 0);
}
void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *))
{
freeFunc(buffer->Items);
buffer->Items = 0;
buffer->Capacity = 0;
}

View File

@ -1,19 +0,0 @@
/* 7zBuffer.h */
#ifndef __7Z_BUFFER_H
#define __7Z_BUFFER_H
#include <stddef.h>
#include "7zTypes.h"
typedef struct _CSzByteBuffer
{
size_t Capacity;
Byte *Items;
}CSzByteBuffer;
void SzByteBufferInit(CSzByteBuffer *buffer);
int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size));
void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *));
#endif

View File

@ -1,76 +0,0 @@
/* 7zCrc.c */
#include "7zCrc.h"
#define kCrcPoly 0xEDB88320
UInt32 g_CrcTable[256];
void InitCrcTable()
{
UInt32 i;
for (i = 0; i < 256; i++)
{
UInt32 r = i;
int j;
for (j = 0; j < 8; j++)
if (r & 1)
r = (r >> 1) ^ kCrcPoly;
else
r >>= 1;
g_CrcTable[i] = r;
}
}
void CrcInit(UInt32 *crc) { *crc = 0xFFFFFFFF; }
UInt32 CrcGetDigest(UInt32 *crc) { return *crc ^ 0xFFFFFFFF; }
void CrcUpdateByte(UInt32 *crc, Byte b)
{
*crc = g_CrcTable[((Byte)(*crc)) ^ b] ^ (*crc >> 8);
}
void CrcUpdateUInt16(UInt32 *crc, UInt16 v)
{
CrcUpdateByte(crc, (Byte)v);
CrcUpdateByte(crc, (Byte)(v >> 8));
}
void CrcUpdateUInt32(UInt32 *crc, UInt32 v)
{
int i;
for (i = 0; i < 4; i++)
CrcUpdateByte(crc, (Byte)(v >> (8 * i)));
}
void CrcUpdateUInt64(UInt32 *crc, UInt64 v)
{
int i;
for (i = 0; i < 8; i++)
{
CrcUpdateByte(crc, (Byte)(v));
v >>= 8;
}
}
void CrcUpdate(UInt32 *crc, const void *data, size_t size)
{
UInt32 v = *crc;
const Byte *p = (const Byte *)data;
for (; size > 0 ; size--, p++)
v = g_CrcTable[((Byte)(v)) ^ *p] ^ (v >> 8);
*crc = v;
}
UInt32 CrcCalculateDigest(const void *data, size_t size)
{
UInt32 crc;
CrcInit(&crc);
CrcUpdate(&crc, data, size);
return CrcGetDigest(&crc);
}
int CrcVerifyDigest(UInt32 digest, const void *data, size_t size)
{
return (CrcCalculateDigest(data, size) == digest);
}

View File

@ -1,24 +0,0 @@
/* 7zCrc.h */
#ifndef __7Z_CRC_H
#define __7Z_CRC_H
#include <stddef.h>
#include "7zTypes.h"
extern UInt32 g_CrcTable[256];
void InitCrcTable();
void CrcInit(UInt32 *crc);
UInt32 CrcGetDigest(UInt32 *crc);
void CrcUpdateByte(UInt32 *crc, Byte v);
void CrcUpdateUInt16(UInt32 *crc, UInt16 v);
void CrcUpdateUInt32(UInt32 *crc, UInt32 v);
void CrcUpdateUInt64(UInt32 *crc, UInt64 v);
void CrcUpdate(UInt32 *crc, const void *data, size_t size);
UInt32 CrcCalculateDigest(const void *data, size_t size);
int CrcVerifyDigest(UInt32 digest, const void *data, size_t size);
#endif

View File

@ -1,150 +0,0 @@
/* 7zDecode.c */
#include "7zDecode.h"
#ifdef _SZ_ONE_DIRECTORY
#include "LzmaDecode.h"
#else
#include "../../Compress/LZMA_C/LzmaDecode.h"
#endif
CMethodID k_Copy = { { 0x0 }, 1 };
CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 };
#ifdef _LZMA_IN_CB
typedef struct _CLzmaInCallbackImp
{
ILzmaInCallback InCallback;
ISzInStream *InStream;
size_t Size;
} CLzmaInCallbackImp;
int LzmaReadImp(void *object, const unsigned char **buffer, SizeT *size)
{
CLzmaInCallbackImp *cb = (CLzmaInCallbackImp *)object;
size_t processedSize;
SZ_RESULT res;
*size = 0;
res = cb->InStream->Read((void *)cb->InStream, (void **)buffer, cb->Size, &processedSize);
*size = (SizeT)processedSize;
if (processedSize > cb->Size)
return (int)SZE_FAIL;
cb->Size -= processedSize;
if (res == SZ_OK)
return 0;
return (int)res;
}
#endif
SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
#ifdef _LZMA_IN_CB
ISzInStream *inStream,
#else
const Byte *inBuffer,
#endif
Byte *outBuffer, size_t outSize,
size_t *outSizeProcessed, ISzAlloc *allocMain)
{
UInt32 si;
size_t inSize = 0;
CCoderInfo *coder;
if (folder->NumPackStreams != 1)
return SZE_NOTIMPL;
if (folder->NumCoders != 1)
return SZE_NOTIMPL;
coder = folder->Coders;
*outSizeProcessed = 0;
for (si = 0; si < folder->NumPackStreams; si++)
inSize += (size_t)packSizes[si];
if (AreMethodsEqual(&coder->MethodID, &k_Copy))
{
size_t i;
if (inSize != outSize)
return SZE_DATA_ERROR;
#ifdef _LZMA_IN_CB
for (i = 0; i < inSize;)
{
size_t j;
void *inBuffer;
size_t bufferSize;
RINOK(inStream->Read((void *)inStream, (void **)&inBuffer, inSize - i, &bufferSize));
if (bufferSize == 0)
return SZE_DATA_ERROR;
if (bufferSize > inSize - i)
return SZE_FAIL;
*outSizeProcessed += bufferSize;
for (j = 0; j < bufferSize && i < inSize; j++, i++)
outBuffer[i] = ((Byte*)inBuffer)[j];
}
#else
for (i = 0; i < inSize; i++)
outBuffer[i] = inBuffer[i];
*outSizeProcessed = inSize;
#endif
return SZ_OK;
}
if (AreMethodsEqual(&coder->MethodID, &k_LZMA))
{
#ifdef _LZMA_IN_CB
CLzmaInCallbackImp lzmaCallback;
#else
SizeT inProcessed;
#endif
CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */
int result;
SizeT outSizeProcessedLoc;
#ifdef _LZMA_IN_CB
lzmaCallback.Size = inSize;
lzmaCallback.InStream = inStream;
lzmaCallback.InCallback.Read = LzmaReadImp;
#endif
if (LzmaDecodeProperties(&state.Properties, coder->Properties.Items,
coder->Properties.Capacity) != LZMA_RESULT_OK)
return SZE_FAIL;
state.Probs = (CProb *)allocMain->Alloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
if (state.Probs == 0)
return SZE_OUTOFMEMORY;
#ifdef _LZMA_OUT_READ
if (state.Properties.DictionarySize == 0)
state.Dictionary = 0;
else
{
state.Dictionary = (unsigned char *)allocMain->Alloc(state.Properties.DictionarySize);
if (state.Dictionary == 0)
{
allocMain->Free(state.Probs);
return SZE_OUTOFMEMORY;
}
}
LzmaDecoderInit(&state);
#endif
result = LzmaDecode(&state,
#ifdef _LZMA_IN_CB
&lzmaCallback.InCallback,
#else
inBuffer, (SizeT)inSize, &inProcessed,
#endif
outBuffer, (SizeT)outSize, &outSizeProcessedLoc);
*outSizeProcessed = (size_t)outSizeProcessedLoc;
allocMain->Free(state.Probs);
#ifdef _LZMA_OUT_READ
allocMain->Free(state.Dictionary);
#endif
if (result == LZMA_RESULT_DATA_ERROR)
return SZE_DATA_ERROR;
if (result != LZMA_RESULT_OK)
return SZE_FAIL;
return SZ_OK;
}
return SZE_NOTIMPL;
}

View File

@ -1,21 +0,0 @@
/* 7zDecode.h */
#ifndef __7Z_DECODE_H
#define __7Z_DECODE_H
#include "7zItem.h"
#include "7zAlloc.h"
#ifdef _LZMA_IN_CB
#include "7zIn.h"
#endif
SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
#ifdef _LZMA_IN_CB
ISzInStream *stream,
#else
const Byte *inBuffer,
#endif
Byte *outBuffer, size_t outSize,
size_t *outSizeProcessed, ISzAlloc *allocMain);
#endif

View File

@ -1,116 +0,0 @@
/* 7zExtract.c */
#include "7zExtract.h"
#include "7zDecode.h"
#include "7zCrc.h"
SZ_RESULT SzExtract(
ISzInStream *inStream,
CArchiveDatabaseEx *db,
UInt32 fileIndex,
UInt32 *blockIndex,
Byte **outBuffer,
size_t *outBufferSize,
size_t *offset,
size_t *outSizeProcessed,
ISzAlloc *allocMain,
ISzAlloc *allocTemp)
{
UInt32 folderIndex = db->FileIndexToFolderIndexMap[fileIndex];
SZ_RESULT res = SZ_OK;
*offset = 0;
*outSizeProcessed = 0;
if (folderIndex == (UInt32)-1)
{
allocMain->Free(*outBuffer);
*blockIndex = folderIndex;
*outBuffer = 0;
*outBufferSize = 0;
return SZ_OK;
}
if (*outBuffer == 0 || *blockIndex != folderIndex)
{
CFolder *folder = db->Database.Folders + folderIndex;
CFileSize unPackSize = SzFolderGetUnPackSize(folder);
#ifndef _LZMA_IN_CB
CFileSize packSize = SzArDbGetFolderFullPackSize(db, folderIndex);
Byte *inBuffer = 0;
size_t processedSize;
#endif
*blockIndex = folderIndex;
allocMain->Free(*outBuffer);
*outBuffer = 0;
RINOK(inStream->Seek(inStream, SzArDbGetFolderStreamPos(db, folderIndex, 0)));
#ifndef _LZMA_IN_CB
if (packSize != 0)
{
inBuffer = (Byte *)allocTemp->Alloc((size_t)packSize);
if (inBuffer == 0)
return SZE_OUTOFMEMORY;
}
res = inStream->Read(inStream, inBuffer, (size_t)packSize, &processedSize);
if (res == SZ_OK && processedSize != (size_t)packSize)
res = SZE_FAIL;
#endif
if (res == SZ_OK)
{
*outBufferSize = (size_t)unPackSize;
if (unPackSize != 0)
{
*outBuffer = (Byte *)allocMain->Alloc((size_t)unPackSize);
if (*outBuffer == 0)
res = SZE_OUTOFMEMORY;
}
if (res == SZ_OK)
{
size_t outRealSize;
res = SzDecode(db->Database.PackSizes +
db->FolderStartPackStreamIndex[folderIndex], folder,
#ifdef _LZMA_IN_CB
inStream,
#else
inBuffer,
#endif
*outBuffer, (size_t)unPackSize, &outRealSize, allocTemp);
if (res == SZ_OK)
{
if (outRealSize == (size_t)unPackSize)
{
if (folder->UnPackCRCDefined)
{
if (!CrcVerifyDigest(folder->UnPackCRC, *outBuffer, (size_t)unPackSize))
res = SZE_FAIL;
}
}
else
res = SZE_FAIL;
}
}
}
#ifndef _LZMA_IN_CB
allocTemp->Free(inBuffer);
#endif
}
if (res == SZ_OK)
{
UInt32 i;
CFileItem *fileItem = db->Database.Files + fileIndex;
*offset = 0;
for(i = db->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
*offset += (UInt32)db->Database.Files[i].Size;
*outSizeProcessed = (size_t)fileItem->Size;
if (*offset + *outSizeProcessed > *outBufferSize)
return SZE_FAIL;
{
if (fileItem->IsFileCRCDefined)
{
if (!CrcVerifyDigest(fileItem->FileCRC, *outBuffer + *offset, *outSizeProcessed))
res = SZE_FAIL;
}
}
}
return res;
}

View File

@ -1,40 +0,0 @@
/* 7zExtract.h */
#ifndef __7Z_EXTRACT_H
#define __7Z_EXTRACT_H
#include "7zIn.h"
/*
SzExtract extracts file from archive
*outBuffer must be 0 before first call for each new archive.
Extracting cache:
If you need to decompress more than one file, you can send
these values from previous call:
*blockIndex,
*outBuffer,
*outBufferSize
You can consider "*outBuffer" as cache of solid block. If your archive is solid,
it will increase decompression speed.
If you use external function, you can declare these 3 cache variables
(blockIndex, outBuffer, outBufferSize) as static in that external function.
Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
*/
SZ_RESULT SzExtract(
ISzInStream *inStream,
CArchiveDatabaseEx *db,
UInt32 fileIndex, /* index of file */
UInt32 *blockIndex, /* index of solid block */
Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
size_t *outBufferSize, /* buffer size for output buffer */
size_t *offset, /* offset of stream for required file in *outBuffer */
size_t *outSizeProcessed, /* size of file in *outBuffer */
ISzAlloc *allocMain,
ISzAlloc *allocTemp);
#endif

View File

@ -1,5 +0,0 @@
/* 7zHeader.c */
#include "7zHeader.h"
Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};

View File

@ -1,55 +0,0 @@
/* 7zHeader.h */
#ifndef __7Z_HEADER_H
#define __7Z_HEADER_H
#include "7zTypes.h"
#define k7zSignatureSize 6
extern Byte k7zSignature[k7zSignatureSize];
#define k7zMajorVersion 0
#define k7zStartHeaderSize 0x20
enum EIdEnum
{
k7zIdEnd,
k7zIdHeader,
k7zIdArchiveProperties,
k7zIdAdditionalStreamsInfo,
k7zIdMainStreamsInfo,
k7zIdFilesInfo,
k7zIdPackInfo,
k7zIdUnPackInfo,
k7zIdSubStreamsInfo,
k7zIdSize,
k7zIdCRC,
k7zIdFolder,
k7zIdCodersUnPackSize,
k7zIdNumUnPackStream,
k7zIdEmptyStream,
k7zIdEmptyFile,
k7zIdAnti,
k7zIdName,
k7zIdCreationTime,
k7zIdLastAccessTime,
k7zIdLastWriteTime,
k7zIdWinAttributes,
k7zIdComment,
k7zIdEncodedHeader,
k7zIdStartPos
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
/* 7zIn.h */
#ifndef __7Z_IN_H
#define __7Z_IN_H
#include "7zHeader.h"
#include "7zItem.h"
#include "7zAlloc.h"
typedef struct _CInArchiveInfo
{
CFileSize StartPositionAfterHeader;
CFileSize DataStartPosition;
}CInArchiveInfo;
typedef struct _CArchiveDatabaseEx
{
CArchiveDatabase Database;
CInArchiveInfo ArchiveInfo;
UInt32 *FolderStartPackStreamIndex;
CFileSize *PackStreamStartPositions;
UInt32 *FolderStartFileIndex;
UInt32 *FileIndexToFolderIndexMap;
}CArchiveDatabaseEx;
void SzArDbExInit(CArchiveDatabaseEx *db);
void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *));
CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder);
CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex);
typedef struct _ISzInStream
{
#ifdef _LZMA_IN_CB
SZ_RESULT (*Read)(
void *object, /* pointer to ISzInStream itself */
void **buffer, /* out: pointer to buffer with data */
size_t maxRequiredSize, /* max required size to read */
size_t *processedSize); /* real processed size.
processedSize can be less than maxRequiredSize.
If processedSize == 0, then there are no more
bytes in stream. */
#else
SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize);
#endif
SZ_RESULT (*Seek)(void *object, CFileSize pos);
} ISzInStream;
int SzArchiveOpen(
ISzInStream *inStream,
CArchiveDatabaseEx *db,
ISzAlloc *allocMain,
ISzAlloc *allocTemp);
#endif

View File

@ -1,133 +0,0 @@
/* 7zItem.c */
#include "7zItem.h"
#include "7zAlloc.h"
void SzCoderInfoInit(CCoderInfo *coder)
{
SzByteBufferInit(&coder->Properties);
}
void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p))
{
SzByteBufferFree(&coder->Properties, freeFunc);
SzCoderInfoInit(coder);
}
void SzFolderInit(CFolder *folder)
{
folder->NumCoders = 0;
folder->Coders = 0;
folder->NumBindPairs = 0;
folder->BindPairs = 0;
folder->NumPackStreams = 0;
folder->PackStreams = 0;
folder->UnPackSizes = 0;
folder->UnPackCRCDefined = 0;
folder->UnPackCRC = 0;
folder->NumUnPackStreams = 0;
}
void SzFolderFree(CFolder *folder, void (*freeFunc)(void *p))
{
UInt32 i;
for (i = 0; i < folder->NumCoders; i++)
SzCoderInfoFree(&folder->Coders[i], freeFunc);
freeFunc(folder->Coders);
freeFunc(folder->BindPairs);
freeFunc(folder->PackStreams);
freeFunc(folder->UnPackSizes);
SzFolderInit(folder);
}
UInt32 SzFolderGetNumOutStreams(CFolder *folder)
{
UInt32 result = 0;
UInt32 i;
for (i = 0; i < folder->NumCoders; i++)
result += folder->Coders[i].NumOutStreams;
return result;
}
int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex)
{
UInt32 i;
for(i = 0; i < folder->NumBindPairs; i++)
if (folder->BindPairs[i].InIndex == inStreamIndex)
return i;
return -1;
}
int SzFolderFindBindPairForOutStream(CFolder *folder, UInt32 outStreamIndex)
{
UInt32 i;
for(i = 0; i < folder->NumBindPairs; i++)
if (folder->BindPairs[i].OutIndex == outStreamIndex)
return i;
return -1;
}
CFileSize SzFolderGetUnPackSize(CFolder *folder)
{
int i = (int)SzFolderGetNumOutStreams(folder);
if (i == 0)
return 0;
for (i--; i >= 0; i--)
if (SzFolderFindBindPairForOutStream(folder, i) < 0)
return folder->UnPackSizes[i];
/* throw 1; */
return 0;
}
/*
int FindPackStreamArrayIndex(int inStreamIndex) const
{
for(int i = 0; i < PackStreams.Size(); i++)
if (PackStreams[i] == inStreamIndex)
return i;
return -1;
}
*/
void SzFileInit(CFileItem *fileItem)
{
fileItem->IsFileCRCDefined = 0;
fileItem->HasStream = 1;
fileItem->IsDirectory = 0;
fileItem->IsAnti = 0;
fileItem->Name = 0;
}
void SzFileFree(CFileItem *fileItem, void (*freeFunc)(void *p))
{
freeFunc(fileItem->Name);
SzFileInit(fileItem);
}
void SzArchiveDatabaseInit(CArchiveDatabase *db)
{
db->NumPackStreams = 0;
db->PackSizes = 0;
db->PackCRCsDefined = 0;
db->PackCRCs = 0;
db->NumFolders = 0;
db->Folders = 0;
db->NumFiles = 0;
db->Files = 0;
}
void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *))
{
UInt32 i;
for (i = 0; i < db->NumFolders; i++)
SzFolderFree(&db->Folders[i], freeFunc);
for (i = 0; i < db->NumFiles; i++)
SzFileFree(&db->Files[i], freeFunc);
freeFunc(db->PackSizes);
freeFunc(db->PackCRCsDefined);
freeFunc(db->PackCRCs);
freeFunc(db->Folders);
freeFunc(db->Files);
SzArchiveDatabaseInit(db);
}

View File

@ -1,90 +0,0 @@
/* 7zItem.h */
#ifndef __7Z_ITEM_H
#define __7Z_ITEM_H
#include "7zMethodID.h"
#include "7zHeader.h"
#include "7zBuffer.h"
typedef struct _CCoderInfo
{
UInt32 NumInStreams;
UInt32 NumOutStreams;
CMethodID MethodID;
CSzByteBuffer Properties;
}CCoderInfo;
void SzCoderInfoInit(CCoderInfo *coder);
void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p));
typedef struct _CBindPair
{
UInt32 InIndex;
UInt32 OutIndex;
}CBindPair;
typedef struct _CFolder
{
UInt32 NumCoders;
CCoderInfo *Coders;
UInt32 NumBindPairs;
CBindPair *BindPairs;
UInt32 NumPackStreams;
UInt32 *PackStreams;
CFileSize *UnPackSizes;
int UnPackCRCDefined;
UInt32 UnPackCRC;
UInt32 NumUnPackStreams;
}CFolder;
void SzFolderInit(CFolder *folder);
CFileSize SzFolderGetUnPackSize(CFolder *folder);
int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex);
UInt32 SzFolderGetNumOutStreams(CFolder *folder);
CFileSize SzFolderGetUnPackSize(CFolder *folder);
/* #define CArchiveFileTime UInt64 */
typedef struct _CFileItem
{
/*
CArchiveFileTime LastWriteTime;
CFileSize StartPos;
UInt32 Attributes;
*/
CFileSize Size;
UInt32 FileCRC;
char *Name;
Byte IsFileCRCDefined;
Byte HasStream;
Byte IsDirectory;
Byte IsAnti;
/*
int AreAttributesDefined;
int IsLastWriteTimeDefined;
int IsStartPosDefined;
*/
}CFileItem;
void SzFileInit(CFileItem *fileItem);
typedef struct _CArchiveDatabase
{
UInt32 NumPackStreams;
CFileSize *PackSizes;
Byte *PackCRCsDefined;
UInt32 *PackCRCs;
UInt32 NumFolders;
CFolder *Folders;
UInt32 NumFiles;
CFileItem *Files;
}CArchiveDatabase;
void SzArchiveDatabaseInit(CArchiveDatabase *db);
void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *));
#endif

View File

@ -1,14 +0,0 @@
/* 7zMethodID.c */
#include "7zMethodID.h"
int AreMethodsEqual(CMethodID *a1, CMethodID *a2)
{
int i;
if (a1->IDSize != a2->IDSize)
return 0;
for (i = 0; i < a1->IDSize; i++)
if (a1->ID[i] != a2->ID[i])
return 0;
return 1;
}

View File

@ -1,18 +0,0 @@
/* 7zMethodID.h */
#ifndef __7Z_METHOD_ID_H
#define __7Z_METHOD_ID_H
#include "7zTypes.h"
#define kMethodIDSize 15
typedef struct _CMethodID
{
Byte ID[kMethodIDSize];
Byte IDSize;
} CMethodID;
int AreMethodsEqual(CMethodID *a1, CMethodID *a2);
#endif

View File

@ -1,67 +0,0 @@
/* 7zTypes.h */
#ifndef __COMMON_TYPES_H
#define __COMMON_TYPES_H
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
#ifdef _LZMA_UINT32_IS_ULONG
typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
/* #define _SZ_NO_INT_64 */
/* define it your compiler doesn't support long long int */
#ifndef _7ZIP_UINT64_DEFINED
#define _7ZIP_UINT64_DEFINED
#ifdef _SZ_NO_INT_64
typedef unsigned long UInt64;
#else
#ifdef _MSC_VER
typedef unsigned __int64 UInt64;
#else
typedef unsigned long long int UInt64;
#endif
#endif
#endif
/* #define _SZ_FILE_SIZE_64 */
/* Use _SZ_FILE_SIZE_64 if you need support for files larger than 4 GB*/
#ifndef CFileSize
#ifdef _SZ_FILE_SIZE_64
typedef UInt64 CFileSize;
#else
typedef UInt32 CFileSize;
#endif
#endif
#define SZ_RESULT int
#define SZ_OK (0)
#define SZE_DATA_ERROR (1)
#define SZE_OUTOFMEMORY (2)
#define SZE_CRC_ERROR (3)
#define SZE_NOTIMPL (4)
#define SZE_FAIL (5)
#define SZE_ARCHIVE_ERROR (6)
#define RINOK(x) { int __result_ = (x); if(__result_ != 0) return __result_; }
#endif

View File

@ -1,94 +0,0 @@
(These are the licensing details for this directory, taken from lzma.txt in
the original source distribution. The basic gist is you can do what you want
with this code, including sell it in a closed-source app...changes to LZMA
itself must be released as source code, which in the case of PhysicsFS, you
can just point people to our source code repository unless you make further
changes yourself. --ryan.)
LZMA SDK 4.43
-------------
LZMA SDK Copyright (C) 1999-2006 Igor Pavlov
LZMA SDK provides the documentation, samples, header files, libraries,
and tools you need to develop applications that use LZMA compression.
LZMA is default and general compression method of 7z format
in 7-Zip compression program (www.7-zip.org). LZMA provides high
compression ratio and very fast decompression.
LZMA is an improved version of famous LZ77 compression algorithm.
It was improved in way of maximum increasing of compression ratio,
keeping high decompression speed and low memory requirements for
decompressing.
LICENSE
-------
LZMA SDK is available under any of the following licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
3) Simplified license for unmodified code (read SPECIAL EXCEPTION)
4) Proprietary license
It means that you can select one of these four options and follow rules of that license.
1,2) GNU LGPL and CPL licenses are pretty similar and both these
licenses are classified as
- "Free software licenses" at http://www.gnu.org/
- "OSI-approved" at http://www.opensource.org/
3) SPECIAL EXCEPTION
Igor Pavlov, as the author of this code, expressly permits you
to statically or dynamically link your code (or bind by name)
to the files from LZMA SDK without subjecting your linked
code to the terms of the CPL or GNU LGPL.
Any modifications or additions to files from LZMA SDK, however,
are subject to the GNU LGPL or CPL terms.
SPECIAL EXCEPTION allows you to use LZMA SDK in applications with closed code,
while you keep LZMA SDK code unmodified.
SPECIAL EXCEPTION #2: Igor Pavlov, as the author of this code, expressly permits
you to use this code under the same terms and conditions contained in the License
Agreement you have for any previous version of LZMA SDK developed by Igor Pavlov.
SPECIAL EXCEPTION #2 allows owners of proprietary licenses to use latest version
of LZMA SDK as update for previous versions.
SPECIAL EXCEPTION #3: Igor Pavlov, as the author of this code, expressly permits
you to use code of the following files:
BranchTypes.h, LzmaTypes.h, LzmaTest.c, LzmaStateTest.c, LzmaAlone.cpp,
LzmaAlone.cs, LzmaAlone.java
as public domain code.
4) Proprietary license
LZMA SDK also can be available under a proprietary license which
can include:
1) Right to modify code without subjecting modified code to the
terms of the CPL or GNU LGPL
2) Technical support for code
To request such proprietary license or any additional consultations,
send email message from that page:
http://www.7-zip.org/support.html
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the Common Public License
along with this library.

View File

@ -1,584 +0,0 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
#include "LzmaDecode.h"
#define kNumTopBits 24
#define kTopValue ((UInt32)1 << kNumTopBits)
#define kNumBitModelTotalBits 11
#define kBitModelTotal (1 << kNumBitModelTotalBits)
#define kNumMoveBits 5
#define RC_READ_BYTE (*Buffer++)
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
{ int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
#ifdef _LZMA_IN_CB
#define RC_TEST { if (Buffer == BufferLim) \
{ SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \
BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }}
#define RC_INIT Buffer = BufferLim = 0; RC_INIT2
#else
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
res -= (1 << numLevels); }
#define kNumPosBitsMax 4
#define kNumPosStatesMax (1 << kNumPosBitsMax)
#define kLenNumLowBits 3
#define kLenNumLowSymbols (1 << kLenNumLowBits)
#define kLenNumMidBits 3
#define kLenNumMidSymbols (1 << kLenNumMidBits)
#define kLenNumHighBits 8
#define kLenNumHighSymbols (1 << kLenNumHighBits)
#define LenChoice 0
#define LenChoice2 (LenChoice + 1)
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
#define kNumLitStates 7
#define kStartPosModelIndex 4
#define kEndPosModelIndex 14
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
#define kNumPosSlotBits 6
#define kNumLenToPosStates 4
#define kNumAlignBits 4
#define kAlignTableSize (1 << kNumAlignBits)
#define kMatchMinLen 2
#define IsMatch 0
#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
#define IsRepG0 (IsRep + kNumStates)
#define IsRepG1 (IsRepG0 + kNumStates)
#define IsRepG2 (IsRepG1 + kNumStates)
#define IsRep0Long (IsRepG2 + kNumStates)
#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
#define LenCoder (Align + kAlignTableSize)
#define RepLenCoder (LenCoder + kNumLenProbs)
#define Literal (RepLenCoder + kNumLenProbs)
#if Literal != LZMA_BASE_SIZE
StopCompilingDueBUG
#endif
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
{
unsigned char prop0;
if (size < LZMA_PROPERTIES_SIZE)
return LZMA_RESULT_DATA_ERROR;
prop0 = propsData[0];
if (prop0 >= (9 * 5 * 5))
return LZMA_RESULT_DATA_ERROR;
{
for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
propsRes->lc = prop0;
/*
unsigned char remainder = (unsigned char)(prop0 / 9);
propsRes->lc = prop0 % 9;
propsRes->pb = remainder / 5;
propsRes->lp = remainder % 5;
*/
}
#ifdef _LZMA_OUT_READ
{
int i;
propsRes->DictionarySize = 0;
for (i = 0; i < 4; i++)
propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
if (propsRes->DictionarySize == 0)
propsRes->DictionarySize = 1;
}
#endif
return LZMA_RESULT_OK;
}
#define kLzmaStreamWasFinishedId (-1)
int LzmaDecode(CLzmaDecoderState *vs,
#ifdef _LZMA_IN_CB
ILzmaInCallback *InCallback,
#else
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
#endif
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
{
CProb *p = vs->Probs;
SizeT nowPos = 0;
Byte previousByte = 0;
UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
const Byte *Buffer = vs->Buffer;
const Byte *BufferLim = vs->BufferLim;
#else
const Byte *Buffer = inStream;
const Byte *BufferLim = inStream + inSize;
#endif
int state = vs->State;
UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
int len = vs->RemainLen;
UInt32 globalPos = vs->GlobalPos;
UInt32 distanceLimit = vs->DistanceLimit;
Byte *dictionary = vs->Dictionary;
UInt32 dictionarySize = vs->Properties.DictionarySize;
UInt32 dictionaryPos = vs->DictionaryPos;
Byte tempDictionary[4];
#ifndef _LZMA_IN_CB
*inSizeProcessed = 0;
#endif
*outSizeProcessed = 0;
if (len == kLzmaStreamWasFinishedId)
return LZMA_RESULT_OK;
if (dictionarySize == 0)
{
dictionary = tempDictionary;
dictionarySize = 1;
tempDictionary[0] = vs->TempDictionary[0];
}
if (len == kLzmaNeedInitId)
{
{
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
distanceLimit = 0;
dictionaryPos = 0;
dictionary[dictionarySize - 1] = 0;
#ifdef _LZMA_IN_CB
RC_INIT;
#else
RC_INIT(inStream, inSize);
#endif
}
len = 0;
}
while(len != 0 && nowPos < outSize)
{
UInt32 pos = dictionaryPos - rep0;
if (pos >= dictionarySize)
pos += dictionarySize;
outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
if (++dictionaryPos == dictionarySize)
dictionaryPos = 0;
len--;
}
if (dictionaryPos == 0)
previousByte = dictionary[dictionarySize - 1];
else
previousByte = dictionary[dictionaryPos - 1];
#else /* if !_LZMA_OUT_READ */
int state = 0;
UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
int len = 0;
const Byte *Buffer;
const Byte *BufferLim;
UInt32 Range;
UInt32 Code;
#ifndef _LZMA_IN_CB
*inSizeProcessed = 0;
#endif
*outSizeProcessed = 0;
{
UInt32 i;
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
RC_INIT(inStream, inSize);
#endif
#endif /* _LZMA_OUT_READ */
while(nowPos < outSize)
{
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
)
& posStateMask);
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
IfBit0(prob)
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
)
& literalPosMask) << lc) + (previousByte >> (8 - lc))));
if (state >= kNumLitStates)
{
int matchByte;
#ifdef _LZMA_OUT_READ
UInt32 pos = dictionaryPos - rep0;
if (pos >= dictionarySize)
pos += dictionarySize;
matchByte = dictionary[pos];
#else
matchByte = outStream[nowPos - rep0];
#endif
do
{
int bit;
CProb *probLit;
matchByte <<= 1;
bit = (matchByte & 0x100);
probLit = prob + 0x100 + bit + symbol;
RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
}
while (symbol < 0x100);
}
while (symbol < 0x100)
{
CProb *probLit = prob + symbol;
RC_GET_BIT(probLit, symbol)
}
previousByte = (Byte)symbol;
outStream[nowPos++] = previousByte;
#ifdef _LZMA_OUT_READ
if (distanceLimit < dictionarySize)
distanceLimit++;
dictionary[dictionaryPos] = previousByte;
if (++dictionaryPos == dictionarySize)
dictionaryPos = 0;
#endif
if (state < 4) state = 0;
else if (state < 10) state -= 3;
else state -= 6;
}
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
IfBit0(prob)
{
UpdateBit0(prob);
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
state = state < kNumLitStates ? 0 : 3;
prob = p + LenCoder;
}
else
{
UpdateBit1(prob);
prob = p + IsRepG0 + state;
IfBit0(prob)
{
UpdateBit0(prob);
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
IfBit0(prob)
{
#ifdef _LZMA_OUT_READ
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
if (pos >= dictionarySize)
pos += dictionarySize;
previousByte = dictionary[pos];
dictionary[dictionaryPos] = previousByte;
if (++dictionaryPos == dictionarySize)
dictionaryPos = 0;
#else
previousByte = outStream[nowPos - rep0];
#endif
outStream[nowPos++] = previousByte;
#ifdef _LZMA_OUT_READ
if (distanceLimit < dictionarySize)
distanceLimit++;
#endif
continue;
}
else
{
UpdateBit1(prob);
}
}
else
{
UInt32 distance;
UpdateBit1(prob);
prob = p + IsRepG1 + state;
IfBit0(prob)
{
UpdateBit0(prob);
distance = rep1;
}
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
IfBit0(prob)
{
UpdateBit0(prob);
distance = rep2;
}
else
{
UpdateBit1(prob);
distance = rep3;
rep3 = rep2;
}
rep2 = rep1;
}
rep1 = rep0;
rep0 = distance;
}
state = state < kNumLitStates ? 8 : 11;
prob = p + RepLenCoder;
}
{
int numBits, offset;
CProb *probLen = prob + LenChoice;
IfBit0(probLen)
{
UpdateBit0(probLen);
probLen = prob + LenLow + (posState << kLenNumLowBits);
offset = 0;
numBits = kLenNumLowBits;
}
else
{
UpdateBit1(probLen);
probLen = prob + LenChoice2;
IfBit0(probLen)
{
UpdateBit0(probLen);
probLen = prob + LenMid + (posState << kLenNumMidBits);
offset = kLenNumLowSymbols;
numBits = kLenNumMidBits;
}
else
{
UpdateBit1(probLen);
probLen = prob + LenHigh;
offset = kLenNumLowSymbols + kLenNumMidSymbols;
numBits = kLenNumHighBits;
}
}
RangeDecoderBitTreeDecode(probLen, numBits, len);
len += offset;
}
if (state < 4)
{
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
{
int numDirectBits = ((posSlot >> 1) - 1);
rep0 = (2 | ((UInt32)posSlot & 1));
if (posSlot < kEndPosModelIndex)
{
rep0 <<= numDirectBits;
prob = p + SpecPos + rep0 - posSlot - 1;
}
else
{
numDirectBits -= kNumAlignBits;
do
{
RC_NORMALIZE
Range >>= 1;
rep0 <<= 1;
if (Code >= Range)
{
Code -= Range;
rep0 |= 1;
}
}
while (--numDirectBits != 0);
prob = p + Align;
rep0 <<= kNumAlignBits;
numDirectBits = kNumAlignBits;
}
{
int i = 1;
int mi = 1;
do
{
CProb *prob3 = prob + mi;
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
i <<= 1;
}
while(--numDirectBits != 0);
}
}
else
rep0 = posSlot;
if (++rep0 == (UInt32)(0))
{
/* it's for stream version */
len = kLzmaStreamWasFinishedId;
break;
}
}
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif
return LZMA_RESULT_DATA_ERROR;
#ifdef _LZMA_OUT_READ
if (dictionarySize - distanceLimit > (UInt32)len)
distanceLimit += len;
else
distanceLimit = dictionarySize;
#endif
do
{
#ifdef _LZMA_OUT_READ
UInt32 pos = dictionaryPos - rep0;
if (pos >= dictionarySize)
pos += dictionarySize;
previousByte = dictionary[pos];
dictionary[dictionaryPos] = previousByte;
if (++dictionaryPos == dictionarySize)
dictionaryPos = 0;
#else
previousByte = outStream[nowPos - rep0];
#endif
len--;
outStream[nowPos++] = previousByte;
}
while(len != 0 && nowPos < outSize);
}
}
RC_NORMALIZE;
#ifdef _LZMA_OUT_READ
vs->Range = Range;
vs->Code = Code;
vs->DictionaryPos = dictionaryPos;
vs->GlobalPos = globalPos + (UInt32)nowPos;
vs->DistanceLimit = distanceLimit;
vs->Reps[0] = rep0;
vs->Reps[1] = rep1;
vs->Reps[2] = rep2;
vs->Reps[3] = rep3;
vs->State = state;
vs->RemainLen = len;
vs->TempDictionary[0] = tempDictionary[0];
#endif
#ifdef _LZMA_IN_CB
vs->Buffer = Buffer;
vs->BufferLim = BufferLim;
#else
*inSizeProcessed = (SizeT)(Buffer - inStream);
#endif
*outSizeProcessed = nowPos;
return LZMA_RESULT_OK;
}

View File

@ -1,113 +0,0 @@
/*
LzmaDecode.h
LZMA Decoder interface
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
#ifndef __LZMADECODE_H
#define __LZMADECODE_H
#include "LzmaTypes.h"
/* #define _LZMA_IN_CB */
/* Use callback for input data */
/* #define _LZMA_OUT_READ */
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */
/* Enable local speed optimizations inside code */
#ifdef _LZMA_PROB32
#define CProb UInt32
#else
#define CProb UInt16
#endif
#define LZMA_RESULT_OK 0
#define LZMA_RESULT_DATA_ERROR 1
#ifdef _LZMA_IN_CB
typedef struct _ILzmaInCallback
{
int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
} ILzmaInCallback;
#endif
#define LZMA_BASE_SIZE 1846
#define LZMA_LIT_SIZE 768
#define LZMA_PROPERTIES_SIZE 5
typedef struct _CLzmaProperties
{
int lc;
int lp;
int pb;
#ifdef _LZMA_OUT_READ
UInt32 DictionarySize;
#endif
}CLzmaProperties;
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
#define kLzmaNeedInitId (-2)
typedef struct _CLzmaDecoderState
{
CLzmaProperties Properties;
CProb *Probs;
#ifdef _LZMA_IN_CB
const unsigned char *Buffer;
const unsigned char *BufferLim;
#endif
#ifdef _LZMA_OUT_READ
unsigned char *Dictionary;
UInt32 Range;
UInt32 Code;
UInt32 DictionaryPos;
UInt32 GlobalPos;
UInt32 DistanceLimit;
UInt32 Reps[4];
int State;
int RemainLen;
unsigned char TempDictionary[4];
#endif
} CLzmaDecoderState;
#ifdef _LZMA_OUT_READ
#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
#endif
int LzmaDecode(CLzmaDecoderState *vs,
#ifdef _LZMA_IN_CB
ILzmaInCallback *inCallback,
#else
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
#endif
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
#endif

View File

View File

View File

@ -1,45 +0,0 @@
/*
LzmaTypes.h
Types for LZMA Decoder
This file written and distributed to public domain by Igor Pavlov.
This file is part of LZMA SDK 4.40 (2006-05-01)
*/
#ifndef __LZMATYPES_H
#define __LZMATYPES_H
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
#ifdef _LZMA_UINT32_IS_ULONG
typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
/* #define _LZMA_SYSTEM_SIZE_T */
/* Use system's size_t. You can use it to enable 64-bit sizes supporting */
#ifndef _7ZIP_SIZET_DEFINED
#define _7ZIP_SIZET_DEFINED
#ifdef _LZMA_SYSTEM_SIZE_T
#include <stddef.h>
typedef size_t SizeT;
#else
typedef UInt32 SizeT;
#endif
#endif
#endif

View File

@ -1,181 +0,0 @@
@echo off
rem this is a simple batch file to build PhysicsFS on OS/2. You need to have
rem the Innotek libc and GCC (or "kLIBC") installed for this to work:
rem
rem http://svn.netlabs.org/libc
rem
rem This script (and, indeed, our OS/2 support) could use some tweaking.
rem Patches go to icculus@icculus.org ...
set PHYSFSLANG=PHYSFS_LANG_ENGLISH
set DEBUGFLAGS=-D_NDEBUG -O2 -s
rem set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib123 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_7Z -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DPHYSFS_LANG=%PHYSFSLANG% -DHAVE_ASSERT_H
set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -I. -Iz -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_7Z -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DHAVE_ASSERT_H
rem goto :dolinking
@echo cleaning up any previous build...
@mkdir bin 2>NUL
@erase /N bin\*.* 2>NUL
@echo Building export definitions...
@echo ;don't edit this directly! It is rewritten by makeos2.cmd! > bin\test_physfs.def
@echo NAME TESTPHYSFS WINDOWCOMPAT >> bin\test_physfs.def
@echo DESCRIPTION 'PhysicsFS: http://icculus.org/physfs/' >> bin\test_physfs.def
@echo STACKSIZE 0x10000 >> bin\test_physfs.def
@echo BASE=0x10000 >> bin\test_physfs.def
@echo PROTMODE >> bin\test_physfs.def
@echo ;don't edit this directly! It is rewritten by makeos2.cmd! > bin\physfs.def
@echo LIBRARY 'physfs' INITINSTANCE TERMINSTANCE >> bin\physfs.def
@echo STACKSIZE 0x10000 >> bin\physfs.def
@echo CODE LOADONCALL >> bin\physfs.def
@echo DATA LOADONCALL NONSHARED MULTIPLE >> bin\physfs.def
@echo DESCRIPTION 'PhysicsFS: http://icculus.org/physfs/' >> bin\physfs.def
@echo EXPORTS >> bin\physfs.def
@echo "_PHYSFS_getLinkedVersion" >> bin\physfs.def
@echo "_PHYSFS_init" >> bin\physfs.def
@echo "_PHYSFS_deinit" >> bin\physfs.def
@echo "_PHYSFS_isInit" >> bin\physfs.def
@echo "_PHYSFS_supportedArchiveTypes" >> bin\physfs.def
@echo "_PHYSFS_freeList" >> bin\physfs.def
@echo "_PHYSFS_getLastError" >> bin\physfs.def
@echo "_PHYSFS_getDirSeparator" >> bin\physfs.def
@echo "_PHYSFS_permitSymbolicLinks" >> bin\physfs.def
@echo "_PHYSFS_symbolicLinksPermitted" >> bin\physfs.def
@echo "_PHYSFS_getCdRomDirs" >> bin\physfs.def
@echo "_PHYSFS_getBaseDir" >> bin\physfs.def
@echo "_PHYSFS_getUserDir" >> bin\physfs.def
@echo "_PHYSFS_getWriteDir" >> bin\physfs.def
@echo "_PHYSFS_setWriteDir" >> bin\physfs.def
@echo "_PHYSFS_addToSearchPath" >> bin\physfs.def
@echo "_PHYSFS_removeFromSearchPath" >> bin\physfs.def
@echo "_PHYSFS_getSearchPath" >> bin\physfs.def
@echo "_PHYSFS_setSaneConfig" >> bin\physfs.def
@echo "_PHYSFS_mkdir" >> bin\physfs.def
@echo "_PHYSFS_delete" >> bin\physfs.def
@echo "_PHYSFS_getRealDir" >> bin\physfs.def
@echo "_PHYSFS_enumerateFiles" >> bin\physfs.def
@echo "_PHYSFS_exists" >> bin\physfs.def
@echo "_PHYSFS_isDirectory" >> bin\physfs.def
@echo "_PHYSFS_isSymbolicLink" >> bin\physfs.def
@echo "_PHYSFS_openWrite" >> bin\physfs.def
@echo "_PHYSFS_openAppend" >> bin\physfs.def
@echo "_PHYSFS_openRead" >> bin\physfs.def
@echo "_PHYSFS_close" >> bin\physfs.def
@echo "_PHYSFS_read" >> bin\physfs.def
@echo "_PHYSFS_write" >> bin\physfs.def
@echo "_PHYSFS_eof" >> bin\physfs.def
@echo "_PHYSFS_tell" >> bin\physfs.def
@echo "_PHYSFS_seek" >> bin\physfs.def
@echo "_PHYSFS_fileLength" >> bin\physfs.def
@echo "_PHYSFS_swapSLE16" >> bin\physfs.def
@echo "_PHYSFS_swapULE16" >> bin\physfs.def
@echo "_PHYSFS_swapSLE32" >> bin\physfs.def
@echo "_PHYSFS_swapULE32" >> bin\physfs.def
@echo "_PHYSFS_swapSLE64" >> bin\physfs.def
@echo "_PHYSFS_swapULE64" >> bin\physfs.def
@echo "_PHYSFS_swapSBE16" >> bin\physfs.def
@echo "_PHYSFS_swapUBE16" >> bin\physfs.def
@echo "_PHYSFS_swapSBE32" >> bin\physfs.def
@echo "_PHYSFS_swapUBE32" >> bin\physfs.def
@echo "_PHYSFS_swapSBE64" >> bin\physfs.def
@echo "_PHYSFS_swapUBE64" >> bin\physfs.def
@echo "_PHYSFS_getLastModTime" >> bin\physfs.def
@echo "_PHYSFS_readSLE16" >> bin\physfs.def
@echo "_PHYSFS_readULE16" >> bin\physfs.def
@echo "_PHYSFS_readSLE32" >> bin\physfs.def
@echo "_PHYSFS_readULE32" >> bin\physfs.def
@echo "_PHYSFS_readSLE64" >> bin\physfs.def
@echo "_PHYSFS_readULE64" >> bin\physfs.def
@echo "_PHYSFS_readSBE16" >> bin\physfs.def
@echo "_PHYSFS_readUBE16" >> bin\physfs.def
@echo "_PHYSFS_readSBE32" >> bin\physfs.def
@echo "_PHYSFS_readUBE32" >> bin\physfs.def
@echo "_PHYSFS_readSBE64" >> bin\physfs.def
@echo "_PHYSFS_readUBE64" >> bin\physfs.def
@echo "_PHYSFS_writeSLE16" >> bin\physfs.def
@echo "_PHYSFS_writeULE16" >> bin\physfs.def
@echo "_PHYSFS_writeSLE32" >> bin\physfs.def
@echo "_PHYSFS_writeULE32" >> bin\physfs.def
@echo "_PHYSFS_writeSLE64" >> bin\physfs.def
@echo "_PHYSFS_writeULE64" >> bin\physfs.def
@echo "_PHYSFS_writeSBE16" >> bin\physfs.def
@echo "_PHYSFS_writeUBE16" >> bin\physfs.def
@echo "_PHYSFS_writeSBE32" >> bin\physfs.def
@echo "_PHYSFS_writeUBE32" >> bin\physfs.def
@echo "_PHYSFS_writeSBE64" >> bin\physfs.def
@echo "_PHYSFS_writeUBE64" >> bin\physfs.def
@echo "_PHYSFS_setBuffer" >> bin\physfs.def
@echo "_PHYSFS_flush" >> bin\physfs.def
@echo "_PHYSFS_mount" >> bin\physfs.def
@echo "_PHYSFS_getMountPoint" >> bin\physfs.def
@echo "_PHYSFS_setAllocator" >> bin\physfs.def
@echo "_PHYSFS_getCdRomDirsCallback" >> bin\physfs.def
@echo "_PHYSFS_getSearchPathCallback" >> bin\physfs.def
@echo "_PHYSFS_enumerateFilesCallback" >> bin\physfs.def
@echo "_PHYSFS_utf8ToUcs2" >> bin\physfs.def
@echo "_PHYSFS_utf8FromUcs2" >> bin\physfs.def
@echo "_PHYSFS_utf8ToUcs4" >> bin\physfs.def
@echo "_PHYSFS_utf8FromUcs4" >> bin\physfs.def
@echo "_PHYSFS_utf8FromLatin1" >> bin\physfs.def
@echo Building export library...
emximp -o bin/physfs.lib bin/physfs.def
emximp -o bin/physfs.a bin/physfs.def
@echo Compiling PhysicsFS library...
@echo on
gcc %CFLAGS% -o bin/physfs.obj physfs.c
gcc %CFLAGS% -o bin/physfs_byteorder.obj physfs_byteorder.c
gcc %CFLAGS% -o bin/physfs_unicode.obj physfs_unicode.c
gcc %CFLAGS% -o bin/os2.obj platform/os2.c
gcc %CFLAGS% -o bin/dir.obj archivers/dir.c
gcc %CFLAGS% -o bin/grp.obj archivers/grp.c
gcc %CFLAGS% -o bin/wad.obj archivers/wad.c
gcc %CFLAGS% -o bin/lzma.obj archivers/lzma.c
gcc %CFLAGS% -o bin/zip.obj archivers/zip.c
gcc %CFLAGS% -o bin/qpak.obj archivers/qpak.c
gcc %CFLAGS% -o bin/hog.obj archivers/hog.c
gcc %CFLAGS% -o bin/mvl.obj archivers/mvl.c
gcc %CFLAGS% -o bin/adler32.obj zlib123/adler32.c
gcc %CFLAGS% -o bin/compress.obj zlib123/compress.c
gcc %CFLAGS% -o bin/crc32.obj zlib123/crc32.c
gcc %CFLAGS% -o bin/deflate.obj zlib123/deflate.c
gcc %CFLAGS% -o bin/gzio.obj zlib123/gzio.c
gcc %CFLAGS% -o bin/infback.obj zlib123/infback.c
gcc %CFLAGS% -o bin/inffast.obj zlib123/inffast.c
gcc %CFLAGS% -o bin/inflate.obj zlib123/inflate.c
gcc %CFLAGS% -o bin/inftrees.obj zlib123/inftrees.c
gcc %CFLAGS% -o bin/trees.obj zlib123/trees.c
gcc %CFLAGS% -o bin/uncompr.obj zlib123/uncompr.c
gcc %CFLAGS% -o bin/zutil.obj zlib123/zutil.c
gcc %CFLAGS% -o bin/7zBuffer.obj lzma/7zBuffer.c
gcc %CFLAGS% -o bin/7zCrc.obj lzma/7zCrc.c
gcc %CFLAGS% -o bin/7zDecode.obj lzma/7zDecode.c
gcc %CFLAGS% -o bin/7zExtract.obj lzma/7zExtract.c
gcc %CFLAGS% -o bin/7zHeader.obj lzma/7zHeader.c
gcc %CFLAGS% -o bin/7zIn.obj lzma/7zIn.c
gcc %CFLAGS% -o bin/7zItem.obj lzma/7zItem.c
gcc %CFLAGS% -o bin/7zMethodID.obj lzma/7zMethodID.c
gcc %CFLAGS% -o bin/LzmaDecode.obj lzma/LzmaDecode.c
gcc %CFLAGS% -o bin/LzmaStateDecode.obj lzma/LzmaStateDecode.c
@echo off
:dolinking
@echo Linking PhysicsFS library...
gcc %DEBUGFLAGS% -Zdll -Zcrtdll -Zomf -o bin/physfs.dll bin/*.obj bin/physfs.def
rem goto :builddone
@echo Compiling test program...
gcc %CFLAGS% -o bin/test_physfs.obj test/test_physfs.c
@echo Linking test program...
gcc %DEBUGFLAGS% -Zomf -Zcrtdll -o bin/test_physfs.exe bin/test_physfs.obj bin/physfs.lib bin/test_physfs.def
:builddone
@echo "All done!"
rem end of makeos2.cmd ...

2220
physfs.c

File diff suppressed because it is too large Load Diff

2390
physfs.h

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +0,0 @@
%define version @VERSION@
%define release 1
%define name physfs
%define prefix /usr
Summary: PhysicsFS file abstraction layer for games
Name: %{name}
Version: %{version}
Release: %{release}
Prefix: %{prefix}
Copyright: zlib license
Group: System Environment/Libraries
URL: http://www.icculus/physfs/
Source: physfs-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}
BuildRequires: doxygen, readline-devel, ncurses-devel
Requires: readline, ncurses, zlib
%description
PhysicsFS is a library to provide abstract access to various archives.
It is intended for use in video games, and the design was somewhat inspired
by Quake 3's file subsystem. The programmer defines a "write directory" on
the physical filesystem. No file writing done through the PhysicsFS API can
leave that write directory, for security. For example, an embedded scripting
language cannot write outside of this path if it uses PhysFS for all of its
I/O, which means that untrusted scripts can run more safely. Symbolic links
can be disabled as well, for added safety. For file reading, the programmer
lists directories and archives that form a "search path". Once the search
path is defined, it becomes a single, transparent hierarchical filesystem.
This makes for easy access to ZIP files in the same way as you access a file
directly on the disk, and it makes it easy to ship a new archive that will
override a previous archive on a per-file basis. Finally, PhysicsFS gives
you platform-abstracted means to determine if CD-ROMs are available, the
user's home directory, where in the real filesystem your program is running,
etc.
%package devel
Summary: Development headers, libraries, and documentation for PhysicsFS
Group: Development/Libraries
Requires: %{name} = %{version}
%description devel
PhysicsFS is a library to provide abstract access to various archives.
This package contains the development headers, libraries, and documentaion to
build programs using PhysicsFS.
%prep
%setup
export CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}";
./configure --prefix=/usr
%build
export CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}";
make
# Make doxygen docs
doxygen
%install
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
make DESTDIR=${RPM_BUILD_ROOT} install
%clean
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc CHANGELOG.txt CREDITS.txt INSTALL.txt LICENSE.txt TODO.txt
%{_bindir}/test_physfs
%{_libdir}/*so.*
%files devel
%defattr(-,root,root)
%doc docs/*
%{_libdir}/*.so
%{_includedir}/physfs.h
%changelog
* Sun Mar 11 2007 Ryan C. Gordon <icculus@icculus.org>
- Updated filenames in documents.
* Thu Dec 18 2002 Edward Rudd <eddie@omegaware.com>
- added zlib_license_change.txt to documents
* Wed Jul 10 2002 Edward Rudd <eddie@omegaware.com>
- added doxygen to build requirements
* Wed Jul 10 2002 Edward Rudd <eddie@omegaware.com>
- updated to release 0.17
* Tue May 15 2002 Edward Rudd <eddie@omegaware.com>
- updated to latest CVS and modified spec file to use
the autoconf/automake support in the latest CVS
* Tue Apr 30 2002 Edward Rudd <eddie@omegaware.com>
- Initial spec file

View File

@ -1,324 +0,0 @@
/**
* PhysicsFS; a portable, flexible file i/o abstraction.
*
* Documentation is in physfs.h. It's verbose, honest. :)
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#include <stdio.h>
#include <stdlib.h>
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
/* The macros used to swap values */
/* Try to use superfast macros on systems that support them */
#ifdef linux
#include <asm/byteorder.h>
#ifdef __arch__swab16
#define PHYSFS_Swap16 __arch__swab16
#endif
#ifdef __arch__swab32
#define PHYSFS_Swap32 __arch__swab32
#endif
#endif /* linux */
#if (defined macintosh) && !(defined __MWERKS__)
#define __inline__
#endif
#if (defined _MSC_VER)
#define __inline__ __inline
#endif
#ifndef PHYSFS_Swap16
static __inline__ PHYSFS_uint16 PHYSFS_Swap16(PHYSFS_uint16 D)
{
return((D<<8)|(D>>8));
}
#endif
#ifndef PHYSFS_Swap32
static __inline__ PHYSFS_uint32 PHYSFS_Swap32(PHYSFS_uint32 D)
{
return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
}
#endif
#ifndef PHYSFS_NO_64BIT_SUPPORT
#ifndef PHYSFS_Swap64
static __inline__ PHYSFS_uint64 PHYSFS_Swap64(PHYSFS_uint64 val) {
PHYSFS_uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = (PHYSFS_uint32)(val&0xFFFFFFFF);
val >>= 32;
hi = (PHYSFS_uint32)(val&0xFFFFFFFF);
val = PHYSFS_Swap32(lo);
val <<= 32;
val |= PHYSFS_Swap32(hi);
return(val);
}
#endif
#else
#ifndef PHYSFS_Swap64
/* This is mainly to keep compilers from complaining in PHYSFS code.
If there is no real 64-bit datatype, then compilers will complain about
the fake 64-bit datatype that PHYSFS provides when it compiles user code.
*/
#define PHYSFS_Swap64(X) (X)
#endif
#endif /* PHYSFS_NO_64BIT_SUPPORT */
/* Byteswap item from the specified endianness to the native endianness */
#if PHYSFS_BYTEORDER == PHYSFS_LIL_ENDIAN
PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 x) { return(x); }
PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 x) { return(x); }
PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 x) { return(x); }
PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 x) { return(x); }
PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 x) { return(x); }
PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 x) { return(x); }
PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 x) { return(PHYSFS_Swap16(x)); }
PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 x) { return(PHYSFS_Swap16(x)); }
PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 x) { return(PHYSFS_Swap32(x)); }
PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 x) { return(PHYSFS_Swap32(x)); }
PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 x) { return(PHYSFS_Swap64(x)); }
PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 x) { return(PHYSFS_Swap64(x)); }
#else
PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 x) { return(PHYSFS_Swap16(x)); }
PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 x) { return(PHYSFS_Swap16(x)); }
PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 x) { return(PHYSFS_Swap32(x)); }
PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 x) { return(PHYSFS_Swap32(x)); }
PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 x) { return(PHYSFS_Swap64(x)); }
PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 x) { return(PHYSFS_Swap64(x)); }
PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 x) { return(x); }
PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 x) { return(x); }
PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 x) { return(x); }
PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 x) { return(x); }
PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 x) { return(x); }
PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 x) { return(x); }
#endif
int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val)
{
PHYSFS_sint16 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapSLE16(in);
return(1);
} /* PHYSFS_readSLE16 */
int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val)
{
PHYSFS_uint16 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapULE16(in);
return(1);
} /* PHYSFS_readULE16 */
int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val)
{
PHYSFS_sint16 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapSBE16(in);
return(1);
} /* PHYSFS_readSBE16 */
int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val)
{
PHYSFS_uint16 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapUBE16(in);
return(1);
} /* PHYSFS_readUBE16 */
int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val)
{
PHYSFS_sint32 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapSLE32(in);
return(1);
} /* PHYSFS_readSLE32 */
int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val)
{
PHYSFS_uint32 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapULE32(in);
return(1);
} /* PHYSFS_readULE32 */
int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val)
{
PHYSFS_sint32 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapSBE32(in);
return(1);
} /* PHYSFS_readSBE32 */
int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val)
{
PHYSFS_uint32 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapUBE32(in);
return(1);
} /* PHYSFS_readUBE32 */
int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val)
{
PHYSFS_sint64 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapSLE64(in);
return(1);
} /* PHYSFS_readSLE64 */
int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val)
{
PHYSFS_uint64 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapULE64(in);
return(1);
} /* PHYSFS_readULE64 */
int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val)
{
PHYSFS_sint64 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapSBE64(in);
return(1);
} /* PHYSFS_readSBE64 */
int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val)
{
PHYSFS_uint64 in;
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
*val = PHYSFS_swapUBE64(in);
return(1);
} /* PHYSFS_readUBE64 */
int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val)
{
PHYSFS_sint16 out = PHYSFS_swapSLE16(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeSLE16 */
int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val)
{
PHYSFS_uint16 out = PHYSFS_swapULE16(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeULE16 */
int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val)
{
PHYSFS_sint16 out = PHYSFS_swapSBE16(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeSBE16 */
int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val)
{
PHYSFS_uint16 out = PHYSFS_swapUBE16(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeUBE16 */
int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val)
{
PHYSFS_sint32 out = PHYSFS_swapSLE32(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeSLE32 */
int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val)
{
PHYSFS_uint32 out = PHYSFS_swapULE32(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeULE32 */
int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val)
{
PHYSFS_sint32 out = PHYSFS_swapSBE32(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeSBE32 */
int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val)
{
PHYSFS_uint32 out = PHYSFS_swapUBE32(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeUBE32 */
int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val)
{
PHYSFS_sint64 out = PHYSFS_swapSLE64(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeSLE64 */
int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val)
{
PHYSFS_uint64 out = PHYSFS_swapULE64(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeULE64 */
int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val)
{
PHYSFS_sint64 out = PHYSFS_swapSBE64(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeSBE64 */
int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val)
{
PHYSFS_uint64 out = PHYSFS_swapUBE64(val);
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
return(1);
} /* PHYSFS_writeUBE64 */
/* end of physfs_byteorder.c ... */

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More