Compare commits

...

932 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
Ryan C. Gordon 8db7b0a622 Updated. 2007-04-03 05:24:08 +00:00
Ryan C. Gordon d4d3d52fc5 Fixes to the makedist.sh script. 2007-04-03 05:13:49 +00:00
Ryan C. Gordon ad430a8816 Updated. 2007-04-03 05:01:23 +00:00
Ryan C. Gordon 515f409083 Reverted change r857:858...recursive mutex APIs sort of suck for portability. 2007-04-03 05:01:13 +00:00
Ryan C. Gordon cacd778311 Updated. 2007-04-03 02:17:43 +00:00
Ryan C. Gordon 4343984522 More svn:ignore... 2007-04-03 02:03:56 +00:00
Ryan C. Gordon ded756bbe5 Ignore generated source tarballs. 2007-04-03 01:52:08 +00:00
Ryan C. Gordon 41ede697d0 Added a hack for "make dist" functionality. 2007-04-03 01:48:09 +00:00
Ryan C. Gordon d6647fa86d Updated. 2007-04-03 01:08:50 +00:00
Ryan C. Gordon 7ed45636ae Fixed Doxygen comment (this was probably a Doxygen bug that was since fixed). 2007-04-03 00:57:11 +00:00
Ryan C. Gordon 6ee992c1d9 Improved Doxygen comments. 2007-04-02 23:35:09 +00:00
Ryan C. Gordon bc1c890468 It's now safe to call PHYSFS_* functions from callbacks, since mutexes are now
recursive internally...removed warning in headers.
2007-04-02 21:08:05 +00:00
Ryan C. Gordon 1622f171f4 Updated. 2007-04-02 20:57:53 +00:00
Ryan C. Gordon 40ab6d277f Added initial work on a wxWidgets-based test app. 2007-04-02 20:57:39 +00:00
Ryan C. Gordon 0d45ce01c4 Added PHYSFS_symbolicLinksPermitted(). 2007-04-01 22:06:37 +00:00
Ryan C. Gordon 777eec4254 Added PHYSFS_isInit() function. 2007-04-01 21:24:19 +00:00
Ryan C. Gordon b572b556d2 Patched to compile, and work with pre-Vista versions of the Platform SDK. 2007-04-01 03:04:20 +00:00
Ryan C. Gordon 9af599504d Symlink support for Windows Vista. Untested code. 2007-03-31 23:44:42 +00:00
Ryan C. Gordon 45967499d0 Updated. 2007-03-31 06:59:02 +00:00
Ryan C. Gordon 3bd2db53ae Fixed typo in documentation. 2007-03-31 06:58:55 +00:00
Ryan C. Gordon 4176049c43 Fixed typos in export names. 2007-03-31 06:58:38 +00:00
Ryan C. Gordon 60dfcae88b Try the DIR archiver first, since there's no sense in trying to open a
directory as a file in all the other archivers first.
2007-03-31 06:52:27 +00:00
Ryan C. Gordon a8de53670d Added a simple unpacker example. 2007-03-31 06:34:51 +00:00
Ryan C. Gordon 0e3233a205 Don't put comments in BAIL_* macros where we want an empty argument...
apparently it aggravates some compilers. Thanks to Chris Taylor for this one.
2007-03-29 05:39:16 +00:00
Ryan C. Gordon 1e6550292d Logic bug in MVL/HOG/GRP archivers: these archives never contain subdirs...but they
only enumerated their files when looking in a directory other than the root,
 instead of enumerating only for the root. Thanks to Chris Taylor for the
 catch.
2007-03-28 17:29:52 +00:00
Ryan C. Gordon ded10c9238 Bumped version numbers. 2007-03-26 07:53:43 +00:00
Ryan C. Gordon 49c576280d Man, I knew I would need getOSInfo() as soon as I deleted it!
Apparently Win9x has the Unicode entry points, they just don't work, so
 only do a real lookup on NT-based platforms, and just force the
 fallbacks on 95/98/ME systems.
2007-03-26 07:51:57 +00:00
Ryan C. Gordon c771a650ce Ignore Visual C++ 6.0 build files. 2007-03-26 06:46:03 +00:00
Ryan C. Gordon aad1408594 Whoops, forgot to uncomment this from my testing... 2007-03-26 06:38:36 +00:00
Ryan C. Gordon d8845b0be5 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. Other minor Windows
 cleanups and corrections.
2007-03-26 06:36:39 +00:00
Ryan C. Gordon da2d3ede59 Reworked getExePath() to remove some FIXMEs and respect Unicode. 2007-03-25 06:26:53 +00:00
Ryan C. Gordon dc0d27228c Improved dynamic loader and initial Unicode work in windows.c ... 2007-03-25 05:17:08 +00:00
Ryan C. Gordon 71e6a8dc3f Patched to compile on MSVC. 2007-03-25 04:59:11 +00:00
Ryan C. Gordon 75a4f4ffe1 Pushed a bunch of FIXMEs into the Windows platform layer. 2007-03-25 00:38:14 +00:00
Ryan C. Gordon 4fe2134a3c Updated. 2007-03-24 05:42:29 +00:00
Ryan C. Gordon 63f9a21c44 Replaced BeOS mutex implementation. Now all platforms have recursive mutexes. 2007-03-24 05:42:22 +00:00
Ryan C. Gordon 4396d7b3ba Added some FIXME comments. 2007-03-24 05:13:54 +00:00
Ryan C. Gordon 7386320811 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).
2007-03-24 03:54:58 +00:00
Ryan C. Gordon 80ec45d88a Apparently this is how you do 64-bit literals in MSVC...untested. 2007-03-21 20:19:20 +00:00
Ryan C. Gordon b2f9b61715 Replaced LONGLONGLITERAL with __PHYSFS_UI64/__PHYSFS_SI64. 2007-03-21 20:14:46 +00:00
Ryan C. Gordon 68027001f8 Updated. 2007-03-21 20:06:29 +00:00
Ryan C. Gordon 030e84f356 Cleanups in calculateBaseDir. 2007-03-21 05:22:48 +00:00
Ryan C. Gordon 075e6769e2 Split out Mac OS X code from unix.c and added some Carbon-specific code...
moved some stuff around and implemented a few things in BeOS and POSIX bits
 to accomodate this.
2007-03-21 05:03:17 +00:00
Ryan C. Gordon 03fe5bb823 Replaced manual management of recursive pthread mutexes with
PTHREAD_MUTEX_RECURSIVE.
2007-03-21 04:31:13 +00:00
Ryan C. Gordon 857d9bc84d Since all the platform layers were using the same cut-and-paste of the
malloc/realloc/free allocator, I moved it into physfs.c as a default, which
 is used if the platform layer doesn't offer a platform-specific default
 allocator, which none do at this point, but will soon.
2007-03-20 18:33:56 +00:00
Ryan C. Gordon bb1d757244 Removed __PHYSFS_platformTimeslice()...we don't actually use this anymore. 2007-03-20 17:57:45 +00:00
Ryan C. Gordon 7703202ee5 Fixed a FIXME in the documentation comments. 2007-03-20 17:53:42 +00:00
Ryan C. Gordon 75e467576d Removed skeleton.c from the repository...it's out of date. 2007-03-20 11:11:36 +00:00
Ryan C. Gordon 5eab0737b8 Updated. 2007-03-19 20:15:16 +00:00
Ryan C. Gordon b68495e760 Try to use /proc/self/exe to determine the base dir. This lets systems with a
Linux-like /proc filesystem work with PHYSFS_init(NULL). Other cleanups in
 Unix basedir calculation.
2007-03-19 20:15:09 +00:00
Ryan C. Gordon 4530776d5b PHYSFS_init() should fail if argv0 is NULL and we can't do without it. 2007-03-19 20:13:37 +00:00
Ryan C. Gordon 2ce4b64a73 Added a FIXME. 2007-03-19 20:12:54 +00:00
Ryan C. Gordon fde676b2dc Updated. 2007-03-19 07:45:28 +00:00
Ryan C. Gordon 6fe37fd840 Patched to compile with latest Platform SDK. 2007-03-19 07:44:04 +00:00
Ryan C. Gordon f6c383ff24 More svn:ignore for CMake Visual Studio output. 2007-03-19 06:58:49 +00:00
Ryan C. Gordon 8a3220fa1b Updated svn:ignore for some CMake/cygwin output. 2007-03-19 06:39:14 +00:00
Ryan C. Gordon 2caa3b94e3 Whoops, switched two strings in CMakeLists.txt 2007-03-19 04:30:10 +00:00
Ryan C. Gordon 733f59cd8c Removed the strict-ANSI crap. 2007-03-18 22:16:26 +00:00
Ryan C. Gordon 5bc21ecf59 Fixed Doxygen comments for UTF-8 functions. 2007-03-16 23:48:19 +00:00
Ryan C. Gordon 237170ebcb Changed PHYSFS_file from a typedef to a #define for legacy code. 2007-03-16 22:06:04 +00:00
Ryan C. Gordon 503fafad9b Updated. 2007-03-15 08:19:17 +00:00
Ryan C. Gordon 607d39a1d3 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.
2007-03-15 08:16:23 +00:00
Ryan C. Gordon 52cb5bac69 More Mac Classic removal. 2007-03-15 07:33:14 +00:00
Ryan C. Gordon 5331c984da Updated. 2007-03-14 08:03:22 +00:00
Ryan C. Gordon 0ed7bbc3cf Dropped classic Mac OS support. Mac OS X remains supported, though. 2007-03-14 07:20:59 +00:00
Ryan C. Gordon 31ff24a38f Mac Classic platform layer: don't strcmp() a NULL string. 2007-03-14 06:39:17 +00:00
Ryan C. Gordon 5908057d71 Minor comment removal. 2007-03-14 06:30:52 +00:00
Ryan C. Gordon a600edf8ab Patched to compile on Mac OS X. 2007-03-14 06:30:20 +00:00
Ryan C. Gordon 1a6f1787fa Fixes for BeOS and gcc2. 2007-03-12 03:41:20 +00:00
Ryan C. Gordon 1da70fd66b Updated. 2007-03-12 01:07:45 +00:00
Ryan C. Gordon a3a0846701 First shot at updating makeos2.cmd for Innotek/kLIBC's build tools. Farewell,
EMX, you have served me well. Thanks to Dave Yeo for the details on this.

(This is untested at the moment.)
2007-03-12 01:01:58 +00:00
Ryan C. Gordon 69598e49ab 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.
2007-03-11 22:50:53 +00:00
Ryan C. Gordon 839f7334a8 Minor OS 9 note. 2007-03-11 10:52:35 +00:00
Ryan C. Gordon 6731c7b0e5 Cleaned out some TODOs. 2007-03-11 10:30:43 +00:00
Ryan C. Gordon b133b5dfce Moved more files from FILENAME to FILENAME.txt ... 2007-03-11 10:19:52 +00:00
Ryan C. Gordon 230c63cfb3 Updated. 2007-03-11 10:17:37 +00:00
Ryan C. Gordon be8216d868 Removed physfs.rc (CMake should handle this, right?!) 2007-03-11 10:17:11 +00:00
Ryan C. Gordon 5f0aa93cc7 Updated INSTALL.txt with updated info. 2007-03-11 10:16:15 +00:00
Ryan C. Gordon 2c506f8ce8 Renamed INSTALL to INSTALL.txt. 2007-03-11 10:15:42 +00:00
Ryan C. Gordon e029cb54e5 Fixed some comments. 2007-03-11 10:12:39 +00:00
Ryan C. Gordon 53bbe35ddd Renamed LICENSE to LICENSE.txt 2007-03-11 10:10:28 +00:00
Ryan C. Gordon ca2489418e Removed config.h references from old autotools build system. 2007-03-11 09:44:21 +00:00
Ryan C. Gordon 54ba6773b0 More ranting and raving about Unicode. 2007-03-11 09:30:08 +00:00
Ryan C. Gordon 0a4ee52e31 svn:ignore update. 2007-03-11 09:14:08 +00:00
Ryan C. Gordon 902b7b9bae Install libraries with a VERSION and SOVERSION. 2007-03-11 09:13:55 +00:00
Ryan C. Gordon e4a317401d Added install targets for "make install" 2007-03-11 08:56:23 +00:00
Ryan C. Gordon e3c3acb3b6 Clarified a comment. 2007-03-11 08:40:51 +00:00
Ryan C. Gordon 94496e3302 Can now build shared or static (or both) libraries. 2007-03-11 08:37:01 +00:00
Ryan C. Gordon a1bb93b43f Fixes to CMakeLists.txt for Intel Mac. 2007-03-11 08:33:15 +00:00
Ryan C. Gordon c0baa55549 Removed zlib_license_change.txt. 2007-03-11 08:11:36 +00:00
Ryan C. Gordon c6273ae317 Killed MIX archiver. 2007-03-10 06:41:26 +00:00
Ryan C. Gordon 6cdd5b5e57 Moved to CMake! 2007-03-10 06:32:52 +00:00
Ryan C. Gordon 7fc64a99cc Patched to compile. 2007-03-10 06:26:11 +00:00
Ryan C. Gordon 9d42a71574 Killed some #ifdefs and whitespace. 2007-03-10 06:24:56 +00:00
Ryan C. Gordon d8f69c0e93 Changed PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. 2007-03-09 08:17:56 +00:00
Ryan C. Gordon 048851d244 Updated. 2007-03-09 08:16:32 +00:00
Ryan C. Gordon d5327897cb Updated PocketPC code to handle UTF-8 strings. 2007-03-09 08:15:47 +00:00
Ryan C. Gordon a41e32d112 Ryanized the formatting in pocketpc.c 2007-03-08 22:37:51 +00:00
Ryan C. Gordon f6790ee34e Renamed win32.c to windows.c (since it would be used for Win64, too.) 2007-03-08 22:22:24 +00:00
Ryan C. Gordon 42e21ff4df Outlined TODOs for Unicode support. 2007-03-08 21:31:59 +00:00
Ryan C. Gordon ad6d05c95b Fixed a comment in physfs.h. 2007-03-08 21:31:35 +00:00
Ryan C. Gordon afd7163321 Apparently BeOS's BPath constructor doesn't actually _need_ leaf to be
manually split out.
2006-11-05 19:06:23 +00:00
Ryan C. Gordon 95cbc6bed2 Initial add. 2006-11-05 11:32:18 +00:00
Ryan C. Gordon 49f0f536cb Ignore automake files. 2006-11-05 11:30:48 +00:00
Ryan C. Gordon 7fcc071ca8 Initial Unicode work. 2006-11-05 11:10:14 +00:00
Ryan C. Gordon 5a25658811 Silly comment typo. 2006-11-05 11:09:42 +00:00
Ryan C. Gordon a9d65e6d59 More 7zip work (thanks, Dennis!) 2006-11-05 10:06:02 +00:00
Ryan C. Gordon 64cb8c260e More corrections to lzma support from Dennis. 2006-09-27 09:21:56 +00:00
Ryan C. Gordon f9b8dec5cc Whoops, forgot to add this to Subversion. 2006-09-27 09:18:07 +00:00
Ryan C. Gordon ab32c0313d Rewritten 7zip/lzma support (thanks, Dennis!) 2006-09-27 07:05:03 +00:00
Ryan C. Gordon 25909afde4 Fixed typo in Doxygen comment. 2006-09-23 10:49:10 +00:00
Ryan C. Gordon 8a86d04945 testing svn repo, ignore this commit. 2006-06-25 10:43:07 +00:00
Ryan C. Gordon a9108ed3ba testing svn repo, ignore this commit. 2006-06-25 10:31:38 +00:00
Ryan C. Gordon 1c3d7dcc7c Some minor fixes and cleanups. 2006-04-11 15:01:15 +00:00
Ryan C. Gordon c527092aed 7zip support, written by Dennis Schridde, and heavily Ryanified by me. 2006-04-11 14:33:48 +00:00
Ryan C. Gordon 91d1ecc161 Updated. 2006-03-23 10:19:55 +00:00
Ryan C. Gordon 1444557273 Apparently the visibility attribute only exists in gcc3 and up. 2006-03-23 10:15:29 +00:00
Ryan C. Gordon 5d26eca4a4 Added -fvisibility=hidden support, for builds by gcc4 and later.
All the sordid reasons for this are laid out here:

   http://gcc.gnu.org/wiki/Visibility
2006-03-23 06:49:01 +00:00
Ryan C. Gordon e459e0714d Removed acconfig.h. 2006-01-01 13:03:22 +00:00
Ryan C. Gordon c81367d0ca Changed my email address. 2006-01-01 12:33:19 +00:00
Ryan C. Gordon 3e912c3c1b Added physfs.rc for Windows builds (thanks, Dennis!). 2006-01-01 12:28:53 +00:00
Ryan C. Gordon a66c36b42a Cleaned up overflow checks in platform memory allocators (thanks to Nicolas
Lebedenco for pointing out the original issue with long long literals).
2006-01-01 12:19:44 +00:00
Ryan C. Gordon 8544ea9431 Fixed documentation for PHYSFS_setWriteDir(). 2005-11-28 13:28:33 +00:00
Ryan C. Gordon 361c434180 Patched archivers/wad.c to compile again. 2005-10-12 22:03:56 +00:00
Ryan C. Gordon b7a3aeaccd Fixed version of locateInStringList() from Matze Braun. 2005-10-12 22:03:28 +00:00
Ryan C. Gordon c28540fe89 Made unix mutexes recursive. 2005-09-20 04:01:36 +00:00
Ryan C. Gordon a1208dae33 Updated. 2005-09-18 22:27:57 +00:00
Ryan C. Gordon 499631936f Don't leave internal structures temporarily modified before calling an
application callback, so that state is sane if they call into the API
 from inside the callback.
2005-09-18 22:27:05 +00:00
Ryan C. Gordon 6e7e45cdaf API BREAKAGE: Changed PHYSFS_enumerateFilesCallback() to pass the originally
requested directory back to the app.
2005-09-18 21:44:42 +00:00
Ryan C. Gordon 24ce834f44 Hopefully fixing ABI with 1.0... 2005-09-09 20:35:18 +00:00
Ryan C. Gordon 0e54e2a4cf Subversion should ignore "docs" directory if it exists. 2005-09-09 14:08:44 +00:00
Ryan C. Gordon 67746179d3 Some tweaks to PHYSFS_Allocator. 2005-09-09 14:07:43 +00:00
Ryan C. Gordon 0d43bf1eb1 Updated. 2005-09-06 06:28:35 +00:00
Ryan C. Gordon 2362abe855 Some minor (albeit incomplete) MingW fixes. 2005-09-06 06:25:48 +00:00
Ryan C. Gordon 64599213f1 Don't use size_t in physfs.h, since it relies on C runtime headers. 2005-09-06 06:24:42 +00:00
Ryan C. Gordon bbb0cab5ee Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig() and other
corner cases.
2005-08-20 04:46:25 +00:00
Ryan C. Gordon 7b4181684e Patched to compile again on BeOS. 2005-07-25 01:38:07 +00:00
Ryan C. Gordon 823baad1e1 Assert define fix. 2005-07-24 01:01:35 +00:00
Ryan C. Gordon c2b1932747 Whoops, prop typo. 2005-07-24 00:19:11 +00:00
Ryan C. Gordon fc4b5f2c69 Updated svn:ignore. 2005-07-24 00:17:05 +00:00
Ryan C. Gordon 36005323fe Updated MacOS 9 Codewarrior project. 2005-07-24 00:16:47 +00:00
Ryan C. Gordon 84b03eba46 Updated. 2005-07-23 23:39:49 +00:00
Ryan C. Gordon 6e33ae594d Fixed warning in physfs.c. 2005-07-23 23:39:37 +00:00
Ryan C. Gordon 19d99f222f Updated. 2005-07-23 23:10:51 +00:00
Ryan C. Gordon 779e526014 Allow a mount point of NULL to mean "/". 2005-07-23 23:10:27 +00:00
Ryan C. Gordon 54969f6075 Version bump for test program. 2005-07-23 22:59:47 +00:00
Ryan C. Gordon 80a63bb1cd Added some files to the dist. 2005-07-23 22:56:45 +00:00
Ryan C. Gordon d8a2b4be1e Removed debian directory. 2005-07-23 22:47:08 +00:00
Ryan C. Gordon 8365cbdd07 Remove .svn dirs from release tarball. 2005-07-23 22:22:47 +00:00
Ryan C. Gordon 31443d2c81 Upped version to 1.1.0 2005-07-23 22:19:01 +00:00
Ryan C. Gordon d8541f7ae4 Fixed "make dist". 2005-07-23 22:17:29 +00:00
Ryan C. Gordon 3f6c5e6348 Moved to actual zlib 1.2.3. 2005-07-23 22:02:00 +00:00
Ryan C. Gordon 49ebc305ac More minor OS/2 tweaks. 2005-07-23 22:01:03 +00:00
Ryan C. Gordon 8f3ab12d22 From: Jorg Walter
To: icculus@clutteredmind.org
Subject: Bug in zip archiver
Date: Sat, 23 Jul 2005 22:19:09 +0200

Hi!

PhysFS has a bug in the ZIP archive module, function zip_find_start_of_dir.
Upon encountering a substring match, rc is set to a wrong value. The fix is
simple: swap both assignments like this:

[patch below  --Ed.]

Some additional info for testing: Symptoms when you encounter this bug: A dir
is reported as empty although it has files in it; prerequisites or
encountering it: two dirs, one a substring of another, like "data/txt" and
"data/txt2", laid out in a way so that variable "middle" points to a file in
txt2 at some point during zip_find_start_of_dir

By the way, if you're interested in where PhysFS is used: I found this bug
while writing a patch for DOSBox (http://dosbox.sourceforge.net) to support
ZIP files. And I'd love to see that enhanced PHYSFS_mount syntax in an
official release soon *hint* ;);)
2005-07-23 21:46:07 +00:00
Ryan C. Gordon 507b099d5d Patched to compile on OS/2 again. 2005-07-21 18:10:17 +00:00
Ryan C. Gordon f114094fa8 Whoops, missed a zlib121 reference... 2005-07-13 15:21:21 +00:00
Ryan C. Gordon c794701885 Patched zlib security hole discussed here:
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2096
2005-07-13 15:10:00 +00:00
Ryan C. Gordon ec86fac0bb Updated zlib to 1.2.2. 2005-07-13 15:06:21 +00:00
Ryan C. Gordon 91319260b1 Added mingw support to the build process (thanks, Matze!). 2005-06-13 01:13:21 +00:00
Ryan C. Gordon af6fa158f0 Updated. 2005-03-16 13:10:40 +00:00
Ryan C. Gordon 63b29f78c1 Updated. 2005-03-16 13:07:22 +00:00
Ryan C. Gordon d18fb707b0 Changed CWProjects from SITX to SIT format, so OS9 users can unpack it. 2005-03-16 12:15:22 +00:00
Ryan C. Gordon 34f60ab12d Updated. 2005-03-16 12:11:44 +00:00
Ryan C. Gordon e9cf90feda Ehh...I lied. Reverting change. 2005-03-16 12:07:10 +00:00
Ryan C. Gordon 5c7308cdd3 Whoops, this goes here. 2005-03-16 12:06:18 +00:00
Ryan C. Gordon 8bfdf7c9e7 More translation patches. 2005-03-16 12:01:40 +00:00
Ryan C. Gordon 7a62100d99 Updated. 2005-03-16 11:48:10 +00:00
Ryan C. Gordon 12684647dc MacOS Classic fixes and MPW support (thanks, Chris!). 2005-03-16 11:42:54 +00:00
Ryan C. Gordon 16e00ed962 Added translation for WAD file type. 2005-03-16 11:27:31 +00:00
Ryan C. Gordon 3749633f88 Updated. 2005-03-16 11:20:43 +00:00
Ryan C. Gordon 3a0e6fa051 Builds on Mac Classic again. 2005-03-14 12:05:07 +00:00
Ryan C. Gordon d840403c1c All memory management now goes through allocation hooks instead of directly to
C runtime malloc/realloc/free...
2005-03-14 11:49:30 +00:00
Ryan C. Gordon 4787894ffa Updated. 2005-03-14 11:48:29 +00:00
Ryan C. Gordon c799a14c70 Commented out a printf() and cleaned up some mallocs. 2005-03-14 11:47:42 +00:00
Ryan C. Gordon 2211ea7240 Fixed an error string. 2005-03-14 07:33:37 +00:00
Ryan C. Gordon a2cc461727 More mountpoint work and other cleanups. 2005-03-14 07:15:40 +00:00
Ryan C. Gordon ae093ff0fc Added more entry points. 2005-03-14 07:14:58 +00:00
Ryan C. Gordon d992f4325a Cleaned up some mallocs. 2005-03-13 21:16:15 +00:00
Ryan C. Gordon 38a1c7f559 If rejecting an archive for not matching a mount point, set an error state,
otherwise, PHYSFS_openRead could fail with a null error message.
2005-03-13 21:03:31 +00:00
Ryan C. Gordon 67776da8cc Split off sanitizePlatformIndependentPath() from verifySecurity(), which makes
this faster and reduces malloc() pressure. Plus cleanups, and other mount
 work.
2005-03-13 12:03:05 +00:00
Ryan C. Gordon c557443265 Updated. 2005-03-13 12:01:59 +00:00
Ryan C. Gordon 71da6381ad Some mount functionality stuff. 2005-03-13 11:59:53 +00:00
Ryan C. Gordon 8786d07f5d Updated. 2005-03-13 09:16:26 +00:00
Ryan C. Gordon 93adbf1d88 First chunk of PHYSFS_mount() implementation. Incomplete! 2005-03-13 09:09:26 +00:00
Ryan C. Gordon 389a4d826a Cleaned up some minor bloat with my new evil GOTO_*_MACRO macros. 2005-03-13 03:33:11 +00:00
Ryan C. Gordon 9f9800928d Fixed unix.c to compile again on MacOS X. 2005-03-13 03:18:18 +00:00
Ryan C. Gordon bdb7f54bd9 Added evil GOTO_*_MACRO_* macros. 2005-03-13 03:04:04 +00:00
Ryan C. Gordon 0dd93d3c13 Updated. 2005-02-15 22:26:05 +00:00
Ryan C. Gordon ed5de27c73 Fixed incorrect comment. 2005-02-15 22:25:03 +00:00
Ryan C. Gordon 5c313d7a93 Fixed filename sorting, to fix lookups that shouldn't fail (thanks, Chris!). 2005-01-05 05:15:12 +00:00
Ryan C. Gordon d19d7b5a59 Fixed some documentation/header comment typos (thanks, Gaetan!) 2004-12-16 16:20:46 +00:00
Ryan C. Gordon e2c199b8ab Fixed infinite loop in enum code (thanks, Adam!) 2004-10-31 12:20:00 +00:00
Ryan C. Gordon a27c289f29 CFLAGS is used after PHYSFSCFLAGS, so you can override optimization flags, etc. 2004-10-30 23:45:29 +00:00
Ryan C. Gordon bdd4ca0d93 Fixed a strcpy bug. 2004-10-30 09:31:54 +00:00
Ryan C. Gordon 3e06b381e9 Removed profiling code. 2004-10-07 02:10:01 +00:00
Ryan C. Gordon 35ec4ba395 Updated. 2004-10-01 07:58:12 +00:00
Ryan C. Gordon 4b02bb0c64 Updated. 2004-10-01 07:47:32 +00:00
Ryan C. Gordon c2c71fb55f Removed LinkedStringList and related code. 2004-09-29 06:37:20 +00:00
Ryan C. Gordon 0492580bda Removed all the forward declaration cruft from the archivers. 2004-09-29 06:18:04 +00:00
Ryan C. Gordon c2765f8571 Added callback APIs and ripped up the internals everywhere to use them. 2004-09-29 06:09:29 +00:00
Ryan C. Gordon 80535e9b83 Updated. 2004-09-29 06:03:44 +00:00
Ryan C. Gordon 8641e4e7ef Changed PHYSFS_file to PHYSFS_File to match rest of API's naming
convention. This won't break binary compat (function signatures are
extern "C" so name mangling doesn't apply), and I've placed a typedef
for the old name to support legacy source code.
2004-09-26 13:17:54 +00:00
Ryan C. Gordon 221a2303be Updated. 2004-09-26 13:16:06 +00:00
Ryan C. Gordon e0da355650 Updated. 2004-09-26 13:15:03 +00:00
Ryan C. Gordon 27f82cc5e2 Changed vars named "FileHandle" to "Handle" to not cause confusion with
new type in physfs.c ...
2004-09-26 13:03:00 +00:00
Ryan C. Gordon 90031c81f3 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.
2004-09-26 13:00:59 +00:00
Ryan C. Gordon 73044892fa Updated. 2004-09-26 12:56:23 +00:00
Ryan C. Gordon 94759513d9 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.
Also 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.
2004-09-26 00:25:04 +00:00
Ryan C. Gordon c02b0db3ec Updated. 2004-09-26 00:24:05 +00:00
Ryan C. Gordon 7553af8acf Minor allocation hook corrections. 2004-09-23 23:59:17 +00:00
Ryan C. Gordon 0030a3cd04 Updated. 2004-09-23 06:53:16 +00:00
Ryan C. Gordon c0acfc0118 Initial structure for replacable allocator work. 2004-09-23 06:45:36 +00:00
Ryan C. Gordon d9675edf4b Updated with current 2.0 wishlist. 2004-09-23 06:38:51 +00:00
Ryan C. Gordon cd942faff4 Updated. 2004-09-23 03:49:59 +00:00
Ryan C. Gordon 1ba7972aa9 Readded Spanish translation:
From: 	Pedro J Perez
To: 	icculus@clutteredmind.org
Subject: 	PhysicsFS license change - Spanish translation
Date: 	Tue, 2 Mar 2004 19:10:20 -0500

Hi Ryan,

You have my permission to change the spanish translation license to fit with the
rest of PhysicsFS.


|Pedro Javier Prez Rodrguez -- [email removed] |
|                                              |
|Homepage (Spanish) @ http://icculus.org/~pj/  |
2004-09-23 03:48:27 +00:00
Ryan C. Gordon 0cc3dea44f Removed more .cvsignore files from Subversion repository. 2004-09-23 03:33:17 +00:00
Ryan C. Gordon d7b46c9697 Removed from Subversion. 2004-09-23 03:31:54 +00:00
Ryan C. Gordon f3af262a99 Don't throw away buffer if a seek is totally within existing cache. 2004-08-23 03:34:03 +00:00
Ryan C. Gordon bf41b44099 Initial add. 2004-08-13 15:54:10 +00:00
Ryan C. Gordon a7fe9bcdad Updated. 2004-04-09 06:37:03 +00:00
Ryan C. Gordon 44cd602b46 Westwood MIX archive support. 2004-04-09 06:36:09 +00:00
Ryan C. Gordon 87d412da79 MacOS X build compatibility. 2004-04-09 06:35:49 +00:00
Ryan C. Gordon bb09a88a67 Moved byte order defines into internal header. 2004-04-09 06:33:49 +00:00
Ryan C. Gordon 7988aab2e4 Updated. 2004-04-09 06:32:25 +00:00
Ryan C. Gordon 579c5ff438 Added Brazillian Portuguese translation (thanks, Danny!) 2004-01-15 14:53:27 +00:00
Ryan C. Gordon 1ed3abfcab Updated. 2004-01-15 14:51:59 +00:00
199 changed files with 29924 additions and 34547 deletions

View File

@ -1,53 +0,0 @@
physfs_static_debug
physfs_static_release
depcomp
Makefile
.deps
.libs
aclocal.m4
config.status
ltmain.sh
configure
libtool
physfs.lo
config.guess
install-sh
config.log
config.sub
missing
stamp-h
mkinstalldirs
config.h
Makefile.in
config.h.in
libphysfs.la
stamp-h.in
stamp-h1
physfs_byteorder.lo
ltconfig
inftrees.lo
trees.lo
uncompr.lo
zutil.lo
infcodes.lo
unzip.lo
inflate.lo
adler32.lo
posix.lo
infblock.lo
compress.lo
dir.lo
inffast.lo
grp.lo
test_physfs
unix.lo
crc32.lo
zip.lo
infutil.lo
deflate.lo
beos.lo
Makefile.am
config.cache
autom4te.cache
configure.lineno
physfs.spec

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

410
CHANGELOG
View File

@ -1,410 +0,0 @@
/*
* CHANGELOG.
*/
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@clutteredmind.org)
/* end of CHANGELOG ... */

345
CMakeLists.txt Normal file
View File

@ -0,0 +1,345 @@
# PhysicsFS; a portable, flexible file i/o abstraction.
#
# Please see the file LICENSE.txt in the source's root directory.
# 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.
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(APPLE)
set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework IOKit -framework Foundation")
list(APPEND PHYSFS_M_SRCS src/physfs_platform_apple.m)
endif()
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()
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
add_definitions(-xldscope=hidden)
endif()
if(HAIKU)
# We add this explicitly, since we don't want CMake to think this
# 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
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}
)
# 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(NOT PHYSFS_ARCHIVE_ZIP)
add_definitions(-DPHYSFS_SUPPORTS_ZIP=0)
endif()
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(NOT PHYSFS_ARCHIVE_GRP)
add_definitions(-DPHYSFS_SUPPORTS_GRP=0)
endif()
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(NOT PHYSFS_ARCHIVE_HOG)
add_definitions(-DPHYSFS_SUPPORTS_HOG=0)
endif()
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(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()
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()
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(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 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)
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_DISABLE_INSTALL "Disable installing PhysFS" OFF)
if(NOT PHYSFS_DISABLE_INSTALL)
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})
install(EXPORT PhysFSExport
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/PhysFS"
FILE PhysFSConfig.cmake
NAMESPACE PhysFS::
)
if(NOT MSVC)
configure_file(
"extras/physfs.pc.in"
"extras/physfs.pc"
@ONLY
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/extras/physfs.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
endif()
endif()
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 ...

71
CREDITS
View File

@ -1,71 +0,0 @@
Initial API interface and implementation,
Unix support,
Win32 support,
BeOS support,
POSIX support,
OS/2 support,
GRP archiver,
DIR archiver,
ZIP archiver,
QPAK archiver,
MacOS Classic support:
Ryan C. Gordon
Tons of win32 help:
Adam Gates
More win32 hacking:
Gregory S. Read
Fixes for missing current working directories,
PHYSFS_setSaneConfig() improvements,
other bugfixes:
David Hedbor
Darwin support:
Patrick Stein
configure fixes,
RPM specfile:
Edward Rudd
GetLastModTime API,
other stuff:
John R. Hall
Various support, fixes and suggestions:
Alexander Pipelka
Russian translation,
Ruby bindings,
QPAK archiver:
Ed Sinjiashvili
French translation:
Stéphane Peter
Debian package support:
Colin Bayer
"abs-file.h" in "extras" dir:
Adam D. Moss
WinCE port and other Win32 patches:
Corona688
German translation:
Michael Renner
Apple Project Builder support,
MacOS X improvements:
Eric Wing
HOG archiver,
MVL archiver,
Bradley Bell
Other stuff:
Your name here! Patches go to icculus@clutteredmind.org ...
/* end of CREDITS ... */

Binary file not shown.

133
INSTALL
View File

@ -1,133 +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 in the root
of the source tree. If you can't abide by it, delete this source tree now.
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. This is optional. You can browse the API docs online
here: http://icculus.org/physfs/docs/
UNIX:
(If you got this code from CVS, run "./bootstrap" first.)
Run ./configure --help and see what features can be optionally enabled or
disabled. "./configure" does its best to pick optimal defaults for your
platform.
Run "make".
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.
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@clutteredmind.org.
BeOS:
Use the "Unix" instructions, above.
AtheOS:
Use the "Unix" instructions, above.
WIN32:
If building with CygWin, mingw32 or something else that uses the GNU
toolchain, follow the Unix instructions, above.
If you're using Visual C++ 6, point it at "physfs.dsp" in the root of the
source tree, and build. This will produce a "physfs.dll" and "physfs.lib"
(shared library and import lib, respectively) in either a "Debug" or
"Release" directory, depending on what configuration you chose to build.
After building the lib, you can make sure it works by building the
"test_physfs.dsp" project file, which will create "test_physfs.exe" in
"Debug" or "Release". This EXE is linked against the DLL you built
previously.
If you're using Visual C++ 6 and want to generate a static LIB file, point
it at "physfs_static.dsp" in the root of the source tree and build. This
will produce a "physfs_static.lib" in either a "physfs_static_debug"
or a "physfs_static_release" directory, depending on what configuration
you chose to build. NOPE: "test_physfs.dsp" does not work with the
statically linked build.
Visual Studio.NET users should do the same thing, but use the "physfs.vcproj"
and "test_physfs.vcproj" project files instead.
NOTE: to change build options such as which drivers are loaded (ZIP, QPAK,
etc.) modify the appropriate manifest constants under the Project Settings.
By default the LIB version supports all drivers, but the DLL build does
not support MVL or HOG file formats.
If you're using another compiler, send me a patch when you get it working. :)
No one's tried building this for a WinCE (PocketPC) platform, but it may or
may not work. Patches are welcome.
If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear
from you; send an email to icculus@clutteredmind.org.
MACOS 8/9:
Double-click on "CWProjects.sit" in the root of the source tree. This will
unpack into a folder called "Mac Classic Support", which has CodeWarrior 6
project files.
Point CodeWarrior at "physfs.mcp" in that new folder, and build. This will
produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what
configuration you chose to build. After building the lib, you can make sure
it works by building the "test_physfs.mcp" project file, which will create
"test_physfs" or "test_physfs Debug". These binaries are linked against the
DLLs you built previously.
If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for
the Mac, I'd like to hear from you; send an email to icculus@clutteredmind.org.
MACOS X:
You (currently) need to use the freeware Apple Developer Tools, which are
based on the GNU toolchain. Fire up a terminal and run "cc"...if this reports
"no input files" then you've got the tools installed.
Follow the Unix directions, above (configure, make, make install).
If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for
MacOS X, I'd like to hear from you; send an email to icculus@clutteredmind.org.
OS/2:
You need EMX installed. I tried this on a stock Warp 4 install, no fixpaks.
I used the latest EMX and patches (which are several years old now). You need
to install link386.exe (Selective Install, "link object modules" option). Once
EMX is 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 (While several exist, EMX
doesn't come with one). If someone wants to hack some REXX to make this a bit
more piccky about recompiling, I'll accept the patch.
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@clutteredmind.org.
OTHER PLATFORMS:
Many Unix-like platforms might "just work" with the GNU autoconf tools. 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@clutteredmind.org)

29
LICENSE
View File

@ -1,29 +0,0 @@
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
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@clutteredmind.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.)

17
LICENSE.txt Normal file
View File

@ -0,0 +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.
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.

View File

@ -1,158 +0,0 @@
lib_LTLIBRARIES = libphysfs.la
libphysfsincludedir = $(includedir)
libphysfsinclude_HEADERS = \
physfs.h
if BUILD_MACOSX
ZLIB_FILES = zlib121/adler32.c \
zlib121/compress.c \
zlib121/crc32.c \
zlib121/crc32.h \
zlib121/deflate.c \
zlib121/deflate.h \
zlib121/gzio.c \
zlib121/infback.c \
zlib121/inffast.c \
zlib121/inffast.h \
zlib121/inffixed.h \
zlib121/inflate.c \
zlib121/inflate.h \
zlib121/inftrees.c \
zlib121/inftrees.h \
zlib121/trees.c \
zlib121/trees.h \
zlib121/uncompr.c \
zlib121/zconf.h \
zlib121/zlib.h \
zlib121/zutil.c \
zlib121/zutil.h
if BUILD_ZLIB
ZLIB_SRC = $(ZLIB_FILES)
ZLIB_INC = -I$(top_srcdir)/zlib121
ZLIB_EXTRADIST =
else
ZLIB_SRC =
ZLIB_INC =
ZLIB_EXTRADIST = $(ZLIB_FILES)
endif
libphysfs_la_SOURCES = \
physfs.c \
physfs_internal.h \
physfs_byteorder.c \
archivers/dir.c \
archivers/grp.c \
archivers/wad.c \
archivers/hog.c \
archivers/mvl.c \
archivers/zip.c \
archivers/qpak.c \
platform/unix.c \
platform/posix.c \
$(ZLIB_SRC)
libphysfs_la_INCLUDES = $(ZLIB_INC)
libphysfs_la_LDFLAGS = \
-release $(LT_RELEASE) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
if BUILD_TEST_PHYSFS
bin_PROGRAMS = test_physfs
test_physfs_INCLUDES = -I$(top_srcdir)
test_physfs_LDADD = $(top_srcdir)/libphysfs.la
test_physfs_SOURCES = test/test_physfs.c
TEST_EXTRADIST =
else
TEST_EXTRADIST = test/test_physfs.c
endif
EXTRA_DIST = \
CREDITS \
LICENSE \
CHANGELOG \
INSTALL \
TODO \
Doxyfile \
CWProjects.sitx \
physfs.spec \
physfs.dsp \
test_physfs.dsp \
physfs_static.dsp \
physfs.vcproj \
test_physfs.vcproj \
platform/skeleton.c \
platform/macclassic.c \
platform/win32.c \
platform/beos.cpp \
platform/os2.c \
extras/physfsrwops.h \
extras/physfsrwops.c \
extras/physfshttpd.c \
Makefile.am.oldautomake \
Makefile.am.newautomake \
zlib_license_change.txt \
makeos2.cmd \
PBProjects \
$(ZLIB_EXTRADIST) $(BEOS_EXTRADIST) $(TEST_EXTRADIST)
else
SUBDIRS = platform archivers zlib121 . test extras
libphysfs_la_SOURCES = \
physfs.c \
physfs_internal.h \
physfs_byteorder.c
if BUILD_ZLIB
ZLIB_LIB = zlib121/libz.la
else
ZLIB_LIB =
endif
libphysfs_la_LDFLAGS = \
-release $(LT_RELEASE) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libphysfs_la_LIBADD = \
archivers/libarchivers.la \
platform/libplatform.la \
$(ZLIB_LIB)
EXTRA_DIST = \
CREDITS \
LICENSE \
CHANGELOG \
INSTALL \
TODO \
Doxyfile \
PBProjects \
CWProjects.sitx \
physfs.spec.in \
physfs.spec \
physfs.dsp \
test_physfs.dsp \
physfs_static.dsp \
physfs.vcproj \
test_physfs.vcproj \
zlib_license_change.txt \
makeos2.cmd
endif
dist-hook:
perl -w -pi -e 'chomp; $$_ .= "\r\n";' $(distdir)/*.dsp $(distdir)/*.vcproj
mkdir $(distdir)/docs
echo "Docs are generated with the program "Doxygen" (http://www.doxygen.org/)," >> $(distdir)/docs/README
echo " or can be read online at http://icculus.org/physfs/docs/" >> $(distdir)/docs/README
echo >> $(distdir)/docs/README
rm -rf `find $(distdir) -name "CVS" -type d`

View File

@ -1,53 +0,0 @@
lib_LTLIBRARIES = libphysfs.la
SUBDIRS = platform archivers zlib121 . test extras
libphysfsincludedir = $(includedir)
libphysfsinclude_HEADERS = \
physfs.h
libphysfs_la_SOURCES = \
physfs.c \
physfs_internal.h \
physfs_byteorder.c
if BUILD_ZLIB
ZLIB_LIB = zlib121/libz.la
else
ZLIB_LIB =
endif
libphysfs_la_LDFLAGS = \
-release $(LT_RELEASE) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libphysfs_la_LIBADD = \
archivers/libarchivers.la \
platform/libplatform.la \
$(ZLIB_LIB)
EXTRA_DIST = \
CREDITS \
LICENSE \
CHANGELOG \
INSTALL \
TODO \
Doxyfile \
PBProjects \
CWProjects.sitx \
physfs.spec.in \
physfs.spec \
physfs.dsp \
physfs_static.dsp \
test_physfs.dsp \
physfs.vcproj \
test_physfs.vcproj \
zlib_license_change.txt \
makeos2.cmd
dist-hook:
perl -w -pi -e 'chomp; $$_ .= "\r\n";' $(distdir)/*.dsp $(distdir)/*.vcproj
mkdir $(distdir)/docs
echo "Docs are generated with the program "Doxygen" (http://www.doxygen.org/)," >> $(distdir)/docs/README
echo " or can be read online at http://icculus.org/physfs/docs/" >> $(distdir)/docs/README
echo >> $(distdir)/docs/README
rm -rf `find $(distdir) -name "CVS" -type d`

View File

@ -1,25 +0,0 @@
This is an unofficial OS X Project Builder environment to build a physfs Framework.
Built with:
physfs 0.1.9
Project Builder 2.0.1
OS X (10.2 Jaguar)
This project was created by brainlessly mimicking the SDL (Simple Direct Media
Layer) Project Builder projects. The scripts were also shamelessly taken from
SDL as well. There may be errors. Use at your own risk!
This project creates 2 installer packages:
- A physfs framework for development (for people who wish to link to physfs)
- A physfs framework for users (for users who run programs that used the above
package
This project also builds static libraries for physfs (to build physfs and physfsc) but
they are not installed anywhere. If you wish to use them, you will need to
copy them out of the build directory.
Eric Wing <ewing2121@yahoo.com>

View File

@ -1,12 +0,0 @@
EXPORTS = SDL_sound.x
HEADERS = \
../../SDL_sound.h
all: $(EXPORTS)
$(EXPORTS): $(HEADERS)
perl gendef.pl $(HEADERS) >$@ || rm $@
clean:
rm -f $(EXPORTS)

View File

@ -1,20 +0,0 @@
#!/usr/bin/perl
#
# Program to take a set of header files and generate DLL export definitions
while ( ($file = shift(@ARGV)) ) {
if ( ! defined(open(FILE, $file)) ) {
warn "Couldn't open $file: $!\n";
next;
}
$printed_header = 0;
$file =~ s,.*/,,;
while (<FILE>) {
if ( /^__EXPORT__.*\s\**([^\s\(]+)\(/ ) {
print "\t_$1\n";
} elsif ( /^__EXPORT__.*\s\**([^\s\(]+)$/ ) {
print "\t_$1\n";
}
}
close(FILE);
}

View File

@ -1,73 +0,0 @@
_PHYSFS_getLinkedVersion
_PHYSFS_init
_PHYSFS_deinit
_PHYSFS_supportedArchiveTypes
_PHYSFS_freeList
_PHYSFS_getLastError
_PHYSFS_getDirSeparator
_PHYSFS_permitSymbolicLinks
_PHYSFS_getCdRomDirs
_PHYSFS_getBaseDir
_PHYSFS_getUserDir
_PHYSFS_getWriteDir
_PHYSFS_setWriteDir
_PHYSFS_addToSearchPath
_PHYSFS_removeFromSearchPath
_PHYSFS_getSearchPath
_PHYSFS_setSaneConfig
_PHYSFS_mkdir
_PHYSFS_delete
_PHYSFS_getRealDir
_PHYSFS_enumerateFiles
_PHYSFS_exists
_PHYSFS_isDirectory
_PHYSFS_isSymbolicLink
_PHYSFS_getLastModTime
_PHYSFS_openWrite
_PHYSFS_openAppend
_PHYSFS_openRead
_PHYSFS_close
_PHYSFS_read
_PHYSFS_write
_PHYSFS_eof
_PHYSFS_tell
_PHYSFS_seek
_PHYSFS_fileLength
_PHYSFS_setBuffer
_PHYSFS_flush
_PHYSFS_swapSLE16
_PHYSFS_swapULE16
_PHYSFS_swapSLE32
_PHYSFS_swapULE32
_PHYSFS_swapSLE64
_PHYSFS_swapULE64
_PHYSFS_swapSBE16
_PHYSFS_swapUBE16
_PHYSFS_swapSBE32
_PHYSFS_swapUBE32
_PHYSFS_swapSBE64
_PHYSFS_swapUBE64
_PHYSFS_readSLE16
_PHYSFS_readULE16
_PHYSFS_readSBE16
_PHYSFS_readUBE16
_PHYSFS_readSLE32
_PHYSFS_readULE32
_PHYSFS_readSBE32
_PHYSFS_readUBE32
_PHYSFS_readSLE64
_PHYSFS_readULE64
_PHYSFS_readSBE64
_PHYSFS_readUBE64
_PHYSFS_writeSLE16
_PHYSFS_writeULE16
_PHYSFS_writeSBE16
_PHYSFS_writeUBE16
_PHYSFS_writeSLE32
_PHYSFS_writeULE32
_PHYSFS_writeSBE32
_PHYSFS_writeUBE32
_PHYSFS_writeSLE64
_PHYSFS_writeULE64
_PHYSFS_writeSBE64
_PHYSFS_writeUBE64

View File

@ -1,20 +0,0 @@
#!/bin/csh
###
## This script creates "PBProjects.tar.gz" in the parent directory
###
# remove build products
rm -rf build
# remove Finder info files
find . -name ".DS_Store" -exec rm "{}" ";"
# remove user project prefs
find . -name "*.pbxuser" -exec rm "{}" ";"
# create the archive
(cd .. && gnutar -zcvf PBProjects.tar.gz PBProjects)

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
This is an example portable filesystem.
The API can be found in the file ~/Library/Frameworks/physfs.framework/Headers/physfs.h
The source code is available from:
http://www.icculus.org/physfs/
This library is distributed under the terms of the zlib license: http://www.opensource.org/licenses/zlib-license.php

View File

@ -1,3 +0,0 @@
This package installs the developer version of the physfs library and associated files.
The physfs Framework is installed into ~/Library/Frameworks.

View File

@ -1,19 +0,0 @@
#!/bin/sh
# finish up the installation
# this script should be executed using the sudo command
# this file is copied to physfs.post_install and physfs.post_upgrade
# inside the .pkg bundle
echo "Running post-install script"
umask 022
ROOT=/Developer/Documentation/SDL
echo "Moving physfs.framework to ~/Library/Frameworks"
# move SDL to its proper home, so the target stationary works
mkdir -p ~/Library/Frameworks
/Developer/Tools/CpMac -r $ROOT/physfs.framework ~/Library/Frameworks
rm -rf $ROOT/physfs.framework
echo "Precompiling Header"
# precompile header for speedier compiles
/usr/bin/cc -I $HOME/Library/Frameworks/SDL.framework/Headers -precomp ~/Library/Frameworks/physfs.framework/Headers/physfs.h -o ~/Library/Frameworks/physfs.framework/Headers/physfs.p

View File

@ -1,51 +0,0 @@
#!/bin/sh
# Generic script to create a package with Project Builder in mind
# There should only be one version of this script for all projects!
FRAMEWORK="$1"
VARIANT="$2"
if test "$VARIANT" = "devel" ; then
PACKAGE="$FRAMEWORK-devel"
PACKAGE_RESOURCES="pkg-support/devel-resources"
else
PACKAGE="$FRAMEWORK"
PACKAGE_RESOURCES="pkg-support/resources"
fi
echo "Building package for $FRAMEWORK.framework"
echo "Will fetch resources from $PACKAGE_RESOURCES"
echo "Will create the package $PACKAGE.pkg"
# create a copy of the framework
mkdir -p build/pkg-tmp
/Developer/Tools/CpMac -r "build/$FRAMEWORK.framework" build/pkg-tmp/
if test "$VARIANT" = "standard" ; then
rm -rf "build/pkg-tmp/$FRAMEWORK.framework/Headers"
rm -rf "build/pkg-tmp/$FRAMEWORK.framework/Versions/Current/Headers"
fi
rm -rf build/pkg-tmp/$FRAMEWORK.framework/Resources/pbdevelopment.plist
rm -rf $PACKAGE_RESOURCES/.DS_Store
# create the .pkg
package build/pkg-tmp "pkg-support/$PACKAGE.info" -d build -r "$PACKAGE_RESOURCES"
if test "$VARIANT" = "devel" ; then
# create install scripts
DIR="build/$PACKAGE.pkg"
cp "$DIR/install.sh" "$DIR/$PACKAGE.post_install"
mv "$DIR/install.sh" "$DIR/$PACKAGE.post_upgrade"
# add execute flag to scripts
chmod 755 "$DIR/$PACKAGE.post_install" "$DIR/$PACKAGE.post_upgrade"
fi
# remove temporary files
rm -rf build/pkg-tmp
# compress
(cd build; tar -zcvf "$PACKAGE.pkg.tar.gz" "$PACKAGE.pkg")

View File

@ -1,15 +0,0 @@
Title PhysFS-Devel 1.0.0
Version 1
Description PhysicsFS Library for Mac OS X (http://www.icculus.org/physfs/)
DefaultLocation /Developer/Documentation/physfs
Diskname (null)
DeleteWarning
NeedsAuthorization YES
DisableStop NO
UseUserMask YES
Application NO
Relocatable NO
Required NO
InstallOnly NO
RequiresReboot NO
InstallFat NO

View File

@ -1,15 +0,0 @@
Title PhysFS 1.0.0
Version 1
Description PhysicsFS Library for Mac OS X (http://www.icculus.org/physfs/)
DefaultLocation /Library/Frameworks
Diskname (null)
DeleteWarning
NeedsAuthorization NO
DisableStop NO
UseUserMask NO
Application NO
Relocatable YES
Required NO
InstallOnly NO
RequiresReboot NO
InstallFat NO

View File

@ -1,6 +0,0 @@
This is an example portable file system.
The source code is available from:
http://www.icculus.org/physfs/
This library is distributed under the terms of the zlib license: http://www.opensource.org/licenses/zlib-license.php

View File

@ -1,3 +0,0 @@
This package installs the physfs library into /Library/Frameworks. You can also install it in
<your home directory>/Library/Frameworks if your access privileges are not high enough.

View File

@ -1,29 +0,0 @@
#!/bin/csh
###
## This script removes the Developer physfs package
###
setenv HOME_DIR ~
sudo -v -p "Enter administrator password to remove physfs: "
sudo rm -rf "$HOME_DIR/Library/Frameworks/physfs.framework"
# will only remove the Frameworks dir if empty (since we put it there)
sudo rmdir "$HOME_DIR/Library/Frameworks"
#sudo rm -r "$HOME_DIR/Readme physfs Developer.txt"
sudo rm -r "/Developer/Documentation/physfs"
sudo rm -r "/Developer/Documentation/ManPages/man1/physfs"*
#sudo rm -r "/Developer/ProjectBuilder Extras/Project Templates/Application/physfs Application"
#sudo rm -r "/Developer/ProjectBuilder Extras/Target Templates/physfs"
sudo rm -r "/Library/Receipts/physfs-devel.pkg"
# rebuild apropos database
sudo /usr/libexec/makewhatis
unsetenv HOME_DIR

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.

24
TODO
View File

@ -1,24 +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.
- 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.
- Stack allocate in stripAppleBundle() (platform/unix.c) instead of calloc().
- Reduce malloc() pressure all over the place. We fragment memory like mad.
- macclassic.c :
"/* (Hmm. Default behaviour is broken in the base library. :) ) */"
- Platforms to port to: Amiga (needs platform driver), DOS4GW (platform driver).
- 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).
- Probably other stuff. Requests and recommendations are welcome.
// end of TODO ...

View File

@ -1,11 +0,0 @@
#undef DEBUG
#undef DEBUG_CHATTER
#undef NDEBUG
#undef PHYSFS_SUPPORTS_ZIP
#undef PHYSFS_SUPPORTS_GRP
#undef PHYSFS_SUPPORTS_HOG
#undef PHYSFS_SUPPORTS_MVL
#undef PHYSFS_HAVE_READLINE
#undef PHYSFS_HAVE_LLSEEK

View File

@ -1,13 +0,0 @@
Makefile
.deps
.libs
unzip.lo
dir.lo
Makefile.in
grp.lo
hog.lo
mvl.lo
zip.lo
libarchivers.la
qpak.lo
wad.lo

View File

@ -1,17 +0,0 @@
noinst_LTLIBRARIES = libarchivers.la
if BUILD_ZLIB
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/zlib121
else
INCLUDES = -I$(top_srcdir)
endif
libarchivers_la_SOURCES = \
dir.c \
grp.c \
wad.c \
hog.c \
mvl.c \
zip.c \
qpak.c

View File

@ -1,376 +0,0 @@
/*
* Standard directory I/O support routines for PhysicsFS.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
static PHYSFS_sint64 DIR_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 DIR_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 DIR_dummyRead(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 DIR_dummyWrite(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int DIR_eof(FileHandle *handle);
static PHYSFS_sint64 DIR_tell(FileHandle *handle);
static int DIR_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 DIR_fileLength(FileHandle *handle);
static int DIR_fileClose(FileHandle *handle);
static int DIR_isArchive(const char *filename, int forWriting);
static DirHandle *DIR_openArchive(const char *name, int forWriting);
static LinkedStringList *DIR_enumerateFiles(DirHandle *h,
const char *dname,
int omitSymLinks);
static int DIR_exists(DirHandle *h, const char *name);
static int DIR_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int DIR_isSymLink(DirHandle *h, const char *name, int *fileExists);
static FileHandle *DIR_openRead(DirHandle *h, const char *fnm, int *exist);
static PHYSFS_sint64 DIR_getLastModTime(DirHandle *h, const char *f, int *e);
static FileHandle *DIR_openWrite(DirHandle *h, const char *filename);
static FileHandle *DIR_openAppend(DirHandle *h, const char *filename);
static int DIR_remove(DirHandle *h, const char *name);
static int DIR_mkdir(DirHandle *h, const char *name);
static void DIR_dirClose(DirHandle *h);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
{
"",
DIR_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_DIR =
{
DIR_read, /* read() method */
DIR_dummyWrite, /* write() method */
DIR_eof, /* eof() method */
DIR_tell, /* tell() method */
DIR_seek, /* seek() method */
DIR_fileLength, /* fileLength() method */
DIR_fileClose /* fileClose() method */
};
static const FileFunctions __PHYSFS_FileFunctions_DIRW =
{
DIR_dummyRead, /* 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 */
};
const DirFunctions __PHYSFS_DirFunctions_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 */
};
static PHYSFS_sint64 DIR_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
PHYSFS_sint64 retval;
retval = __PHYSFS_platformRead(handle->opaque, buffer, objSize, objCount);
return(retval);
} /* DIR_read */
static PHYSFS_sint64 DIR_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
PHYSFS_sint64 retval;
retval = __PHYSFS_platformWrite(handle->opaque, buffer, objSize, objCount);
return(retval);
} /* DIR_write */
static PHYSFS_sint64 DIR_dummyRead(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* DIR_dummyRead */
static PHYSFS_sint64 DIR_dummyWrite(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* DIR_dummyWrite */
static int DIR_eof(FileHandle *handle)
{
return(__PHYSFS_platformEOF(handle->opaque));
} /* DIR_eof */
static PHYSFS_sint64 DIR_tell(FileHandle *handle)
{
return(__PHYSFS_platformTell(handle->opaque));
} /* DIR_tell */
static int DIR_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
return(__PHYSFS_platformSeek(handle->opaque, offset));
} /* DIR_seek */
static PHYSFS_sint64 DIR_fileLength(FileHandle *handle)
{
return(__PHYSFS_platformFileLength(handle->opaque));
} /* DIR_fileLength */
static int DIR_fileClose(FileHandle *handle)
{
/*
* 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(handle->opaque), NULL, 0);
BAIL_IF_MACRO(!__PHYSFS_platformClose(handle->opaque), NULL, 0);
free(handle);
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 DirHandle *DIR_openArchive(const char *name, int forWriting)
{
const char *dirsep = PHYSFS_getDirSeparator();
DirHandle *retval = NULL;
size_t namelen = strlen(name);
size_t seplen = strlen(dirsep);
BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
ERR_UNSUPPORTED_ARCHIVE, NULL);
retval = (DirHandle *) malloc(sizeof (DirHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
retval->opaque = malloc(namelen + seplen + 1);
if (retval->opaque == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
/* make sure there's a dir separator at the end of the string */
strcpy((char *) (retval->opaque), name);
if (strcmp((name + namelen) - seplen, dirsep) != 0)
strcat((char *) (retval->opaque), dirsep);
retval->funcs = &__PHYSFS_DirFunctions_DIR;
return(retval);
} /* DIR_openArchive */
static LinkedStringList *DIR_enumerateFiles(DirHandle *h,
const char *dname,
int omitSymLinks)
{
char *d = __PHYSFS_platformCvtToDependent((char *)(h->opaque),dname,NULL);
LinkedStringList *retval;
BAIL_IF_MACRO(d == NULL, NULL, NULL);
retval = __PHYSFS_platformEnumerateFiles(d, omitSymLinks);
free(d);
return(retval);
} /* DIR_enumerateFiles */
static int DIR_exists(DirHandle *h, const char *name)
{
char *f = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
int retval;
BAIL_IF_MACRO(f == NULL, NULL, 0);
retval = __PHYSFS_platformExists(f);
free(f);
return(retval);
} /* DIR_exists */
static int DIR_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
char *d = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
int retval = 0;
BAIL_IF_MACRO(d == NULL, NULL, 0);
*fileExists = __PHYSFS_platformExists(d);
if (*fileExists)
retval = __PHYSFS_platformIsDirectory(d);
free(d);
return(retval);
} /* DIR_isDirectory */
static int DIR_isSymLink(DirHandle *h, const char *name, int *fileExists)
{
char *f = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
int retval = 0;
BAIL_IF_MACRO(f == NULL, NULL, 0);
*fileExists = __PHYSFS_platformExists(f);
if (*fileExists)
retval = __PHYSFS_platformIsSymLink(f);
free(f);
return(retval);
} /* DIR_isSymLink */
static PHYSFS_sint64 DIR_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
char *d = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
PHYSFS_sint64 retval = -1;
BAIL_IF_MACRO(d == NULL, NULL, 0);
*fileExists = __PHYSFS_platformExists(d);
if (*fileExists)
retval = __PHYSFS_platformGetLastModTime(d);
free(d);
return(retval);
} /* DIR_getLastModTime */
static FileHandle *doOpen(DirHandle *h, const char *name,
void *(*openFunc)(const char *filename),
int *fileExists, const FileFunctions *fileFuncs)
{
char *f = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
void *rc;
FileHandle *retval;
BAIL_IF_MACRO(f == NULL, NULL, NULL);
if (fileExists != NULL)
{
*fileExists = __PHYSFS_platformExists(f);
if (!(*fileExists))
{
free(f);
return(NULL);
} /* if */
} /* if */
retval = (FileHandle *) malloc(sizeof (FileHandle));
if (!retval)
{
free(f);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
rc = openFunc(f);
free(f);
if (!rc)
{
free(retval);
return(NULL);
} /* if */
retval->opaque = (void *) rc;
retval->dirHandle = h;
retval->funcs = fileFuncs;
return(retval);
} /* doOpen */
static FileHandle *DIR_openRead(DirHandle *h, const char *fnm, int *exist)
{
return(doOpen(h, fnm, __PHYSFS_platformOpenRead, exist,
&__PHYSFS_FileFunctions_DIR));
} /* DIR_openRead */
static FileHandle *DIR_openWrite(DirHandle *h, const char *filename)
{
return(doOpen(h, filename, __PHYSFS_platformOpenWrite, NULL,
&__PHYSFS_FileFunctions_DIRW));
} /* DIR_openWrite */
static FileHandle *DIR_openAppend(DirHandle *h, const char *filename)
{
return(doOpen(h, filename, __PHYSFS_platformOpenAppend, NULL,
&__PHYSFS_FileFunctions_DIRW));
} /* DIR_openAppend */
static int DIR_remove(DirHandle *h, const char *name)
{
char *f = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
int retval;
BAIL_IF_MACRO(f == NULL, NULL, 0);
retval = __PHYSFS_platformDelete(f);
free(f);
return(retval);
} /* DIR_remove */
static int DIR_mkdir(DirHandle *h, const char *name)
{
char *f = __PHYSFS_platformCvtToDependent((char *)(h->opaque), name, NULL);
int retval;
BAIL_IF_MACRO(f == NULL, NULL, 0);
retval = __PHYSFS_platformMkDir(f);
free(f);
return(retval);
} /* DIR_mkdir */
static void DIR_dirClose(DirHandle *h)
{
free(h->opaque);
free(h);
} /* DIR_dirClose */
/* end of dir.c ... */

View File

@ -1,533 +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 in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#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(DirHandle *h);
static PHYSFS_sint64 GRP_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 GRP_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int GRP_eof(FileHandle *handle);
static PHYSFS_sint64 GRP_tell(FileHandle *handle);
static int GRP_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 GRP_fileLength(FileHandle *handle);
static int GRP_fileClose(FileHandle *handle);
static int GRP_isArchive(const char *filename, int forWriting);
static DirHandle *GRP_openArchive(const char *name, int forWriting);
static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks);
static int GRP_exists(DirHandle *h, const char *name);
static int GRP_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int GRP_isSymLink(DirHandle *h, const char *name, int *fileExists);
static PHYSFS_sint64 GRP_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *GRP_openRead(DirHandle *h, const char *name, int *exist);
static FileHandle *GRP_openWrite(DirHandle *h, const char *name);
static FileHandle *GRP_openAppend(DirHandle *h, const char *name);
static int GRP_remove(DirHandle *h, const char *name);
static int GRP_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP =
{
"GRP",
GRP_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_GRP =
{
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 */
};
const DirFunctions __PHYSFS_DirFunctions_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 */
};
static void GRP_dirClose(DirHandle *h)
{
GRPinfo *info = ((GRPinfo *) h->opaque);
free(info->filename);
free(info->entries);
free(info);
free(h);
} /* GRP_dirClose */
static PHYSFS_sint64 GRP_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
GRPfileinfo *finfo = (GRPfileinfo *) (handle->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(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* GRP_write */
static int GRP_eof(FileHandle *handle)
{
GRPfileinfo *finfo = (GRPfileinfo *) (handle->opaque);
GRPentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* GRP_eof */
static PHYSFS_sint64 GRP_tell(FileHandle *handle)
{
return(((GRPfileinfo *) (handle->opaque))->curPos);
} /* GRP_tell */
static int GRP_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
GRPfileinfo *finfo = (GRPfileinfo *) (handle->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(FileHandle *handle)
{
GRPfileinfo *finfo = ((GRPfileinfo *) handle->opaque);
return((PHYSFS_sint64) finfo->entry->size);
} /* GRP_fileLength */
static int GRP_fileClose(FileHandle *handle)
{
GRPfileinfo *finfo = ((GRPfileinfo *) handle->opaque);
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
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 *) 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 DirHandle *GRP_openArchive(const char *name, int forWriting)
{
GRPinfo *info;
DirHandle *retval = malloc(sizeof (DirHandle));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
info = retval->opaque = malloc(sizeof (GRPinfo));
if (info == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto GRP_openArchive_failed;
} /* if */
memset(info, '\0', sizeof (GRPinfo));
info->filename = (char *) malloc(strlen(name) + 1);
if (info->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto GRP_openArchive_failed;
} /* if */
if (!grp_load_entries(name, forWriting, info))
goto GRP_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
retval->funcs = &__PHYSFS_DirFunctions_GRP;
return(retval);
GRP_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
{
if (info->filename != NULL)
free(info->filename);
if (info->entries != NULL)
free(info->entries);
free(info);
} /* if */
free(retval);
} /* if */
return(NULL);
} /* GRP_openArchive */
static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks)
{
GRPinfo *info = ((GRPinfo *) h->opaque);
GRPentry *entry = info->entries;
LinkedStringList *retval = NULL, *p = NULL;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
/* no directories in GRP files. */
BAIL_IF_MACRO(*dirname != '\0', ERR_NOT_A_DIR, NULL);
for (i = 0; i < max; i++, entry++)
retval = __PHYSFS_addToLinkedStringList(retval, &p, entry->name, -1);
return(retval);
} /* 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(DirHandle *h, const char *name)
{
return(grp_find_entry(((GRPinfo *) h->opaque), name) != NULL);
} /* GRP_exists */
static int GRP_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = GRP_exists(h, name);
return(0); /* never directories in a groupfile. */
} /* GRP_isDirectory */
static int GRP_isSymLink(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = GRP_exists(h, name);
return(0); /* never symlinks in a groupfile. */
} /* GRP_isSymLink */
static PHYSFS_sint64 GRP_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
GRPinfo *info = ((GRPinfo *) h->opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (grp_find_entry(info, name) != NULL);
if (*fileExists) /* use time of GRP itself in the physical filesystem. */
retval = ((GRPinfo *) h->opaque)->last_mod_time;
return(retval);
} /* GRP_getLastModTime */
static FileHandle *GRP_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
GRPinfo *info = ((GRPinfo *) h->opaque);
FileHandle *retval;
GRPfileinfo *finfo;
GRPentry *entry;
entry = grp_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
retval = (FileHandle *) malloc(sizeof (FileHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo = (GRPfileinfo *) malloc(sizeof (GRPfileinfo));
if (finfo == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
free(finfo);
free(retval);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_GRP;
retval->dirHandle = h;
return(retval);
} /* GRP_openRead */
static FileHandle *GRP_openWrite(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* GRP_openWrite */
static FileHandle *GRP_openAppend(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* GRP_openAppend */
static int GRP_remove(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* GRP_remove */
static int GRP_mkdir(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* GRP_mkdir */
#endif /* defined PHYSFS_SUPPORTS_GRP */
/* end of grp.c ... */

View File

@ -1,573 +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 in the source's root directory.
*
* This file written by Bradley Bell.
* Based on grp.c by Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#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(DirHandle *h);
static PHYSFS_sint64 HOG_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 HOG_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int HOG_eof(FileHandle *handle);
static PHYSFS_sint64 HOG_tell(FileHandle *handle);
static int HOG_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 HOG_fileLength(FileHandle *handle);
static int HOG_fileClose(FileHandle *handle);
static int HOG_isArchive(const char *filename, int forWriting);
static DirHandle *HOG_openArchive(const char *name, int forWriting);
static LinkedStringList *HOG_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks);
static int HOG_exists(DirHandle *h, const char *name);
static int HOG_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int HOG_isSymLink(DirHandle *h, const char *name, int *fileExists);
static PHYSFS_sint64 HOG_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *HOG_openRead(DirHandle *h, const char *name, int *exist);
static FileHandle *HOG_openWrite(DirHandle *h, const char *name);
static FileHandle *HOG_openAppend(DirHandle *h, const char *name);
static int HOG_remove(DirHandle *h, const char *name);
static int HOG_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG =
{
"HOG",
HOG_ARCHIVE_DESCRIPTION,
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_HOG =
{
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 */
};
const DirFunctions __PHYSFS_DirFunctions_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 */
};
static void HOG_dirClose(DirHandle *h)
{
HOGinfo *info = ((HOGinfo *) h->opaque);
free(info->filename);
free(info->entries);
free(info);
free(h);
} /* HOG_dirClose */
static PHYSFS_sint64 HOG_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
HOGfileinfo *finfo = (HOGfileinfo *) (handle->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(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* HOG_write */
static int HOG_eof(FileHandle *handle)
{
HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
HOGentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* HOG_eof */
static PHYSFS_sint64 HOG_tell(FileHandle *handle)
{
return(((HOGfileinfo *) (handle->opaque))->curPos);
} /* HOG_tell */
static int HOG_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
HOGfileinfo *finfo = (HOGfileinfo *) (handle->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(FileHandle *handle)
{
HOGfileinfo *finfo = ((HOGfileinfo *) handle->opaque);
return((PHYSFS_sint64) finfo->entry->size);
} /* HOG_fileLength */
static int HOG_fileClose(FileHandle *handle)
{
HOGfileinfo *finfo = ((HOGfileinfo *) handle->opaque);
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
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(strcmp(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 *) 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 DirHandle *HOG_openArchive(const char *name, int forWriting)
{
HOGinfo *info;
DirHandle *retval = malloc(sizeof (DirHandle));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
info = retval->opaque = malloc(sizeof (HOGinfo));
if (info == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto HOG_openArchive_failed;
} /* if */
memset(info, '\0', sizeof (HOGinfo));
info->filename = (char *) malloc(strlen(name) + 1);
if (info->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto HOG_openArchive_failed;
} /* if */
if (!hog_load_entries(name, forWriting, info))
goto HOG_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
retval->funcs = &__PHYSFS_DirFunctions_HOG;
return(retval);
HOG_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
{
if (info->filename != NULL)
free(info->filename);
if (info->entries != NULL)
free(info->entries);
free(info);
} /* if */
free(retval);
} /* if */
return(NULL);
} /* HOG_openArchive */
static LinkedStringList *HOG_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks)
{
HOGinfo *info = ((HOGinfo *) h->opaque);
HOGentry *entry = info->entries;
LinkedStringList *retval = NULL, *p = NULL;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
/* no directories in HOG files. */
BAIL_IF_MACRO(*dirname != '\0', ERR_NOT_A_DIR, NULL);
for (i = 0; i < max; i++, entry++)
retval = __PHYSFS_addToLinkedStringList(retval, &p, entry->name, -1);
return(retval);
} /* 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_platformStricmp(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(DirHandle *h, const char *name)
{
return(hog_find_entry(((HOGinfo *) h->opaque), name) != NULL);
} /* HOG_exists */
static int HOG_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = HOG_exists(h, name);
return(0); /* never directories in a groupfile. */
} /* HOG_isDirectory */
static int HOG_isSymLink(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = HOG_exists(h, name);
return(0); /* never symlinks in a groupfile. */
} /* HOG_isSymLink */
static PHYSFS_sint64 HOG_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
HOGinfo *info = ((HOGinfo *) h->opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (hog_find_entry(info, name) != NULL);
if (*fileExists) /* use time of HOG itself in the physical filesystem. */
retval = ((HOGinfo *) h->opaque)->last_mod_time;
return(retval);
} /* HOG_getLastModTime */
static FileHandle *HOG_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
HOGinfo *info = ((HOGinfo *) h->opaque);
FileHandle *retval;
HOGfileinfo *finfo;
HOGentry *entry;
entry = hog_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
retval = (FileHandle *) malloc(sizeof (FileHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo = (HOGfileinfo *) malloc(sizeof (HOGfileinfo));
if (finfo == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
free(finfo);
free(retval);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_HOG;
retval->dirHandle = h;
return(retval);
} /* HOG_openRead */
static FileHandle *HOG_openWrite(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* HOG_openWrite */
static FileHandle *HOG_openAppend(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* HOG_openAppend */
static int HOG_remove(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* HOG_remove */
static int HOG_mkdir(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* HOG_mkdir */
#endif /* defined PHYSFS_SUPPORTS_HOG */
/* end of hog.c ... */

View File

@ -1,531 +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 in the source's root directory.
*
* This file written by Bradley Bell.
* Based on grp.c by Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#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(DirHandle *h);
static PHYSFS_sint64 MVL_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 MVL_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int MVL_eof(FileHandle *handle);
static PHYSFS_sint64 MVL_tell(FileHandle *handle);
static int MVL_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 MVL_fileLength(FileHandle *handle);
static int MVL_fileClose(FileHandle *handle);
static int MVL_isArchive(const char *filename, int forWriting);
static DirHandle *MVL_openArchive(const char *name, int forWriting);
static LinkedStringList *MVL_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks);
static int MVL_exists(DirHandle *h, const char *name);
static int MVL_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int MVL_isSymLink(DirHandle *h, const char *name, int *fileExists);
static PHYSFS_sint64 MVL_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *MVL_openRead(DirHandle *h, const char *name, int *exist);
static FileHandle *MVL_openWrite(DirHandle *h, const char *name);
static FileHandle *MVL_openAppend(DirHandle *h, const char *name);
static int MVL_remove(DirHandle *h, const char *name);
static int MVL_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL =
{
"MVL",
MVL_ARCHIVE_DESCRIPTION,
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_MVL =
{
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 */
};
const DirFunctions __PHYSFS_DirFunctions_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 */
};
static void MVL_dirClose(DirHandle *h)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
free(info->filename);
free(info->entries);
free(info);
free(h);
} /* MVL_dirClose */
static PHYSFS_sint64 MVL_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
MVLfileinfo *finfo = (MVLfileinfo *) (handle->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(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* MVL_write */
static int MVL_eof(FileHandle *handle)
{
MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
MVLentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* MVL_eof */
static PHYSFS_sint64 MVL_tell(FileHandle *handle)
{
return(((MVLfileinfo *) (handle->opaque))->curPos);
} /* MVL_tell */
static int MVL_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
MVLfileinfo *finfo = (MVLfileinfo *) (handle->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(FileHandle *handle)
{
MVLfileinfo *finfo = ((MVLfileinfo *) handle->opaque);
return((PHYSFS_sint64) finfo->entry->size);
} /* MVL_fileLength */
static int MVL_fileClose(FileHandle *handle)
{
MVLfileinfo *finfo = ((MVLfileinfo *) handle->opaque);
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
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 *) 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 DirHandle *MVL_openArchive(const char *name, int forWriting)
{
MVLinfo *info;
DirHandle *retval = malloc(sizeof (DirHandle));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
info = retval->opaque = malloc(sizeof (MVLinfo));
if (info == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto MVL_openArchive_failed;
} /* if */
memset(info, '\0', sizeof (MVLinfo));
info->filename = (char *) malloc(strlen(name) + 1);
if (info->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto MVL_openArchive_failed;
} /* if */
if (!mvl_load_entries(name, forWriting, info))
goto MVL_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
retval->funcs = &__PHYSFS_DirFunctions_MVL;
return(retval);
MVL_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
{
if (info->filename != NULL)
free(info->filename);
if (info->entries != NULL)
free(info->entries);
free(info);
} /* if */
free(retval);
} /* if */
return(NULL);
} /* MVL_openArchive */
static LinkedStringList *MVL_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
MVLentry *entry = info->entries;
LinkedStringList *retval = NULL, *p = NULL;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
/* no directories in MVL files. */
BAIL_IF_MACRO(*dirname != '\0', ERR_NOT_A_DIR, NULL);
for (i = 0; i < max; i++, entry++)
retval = __PHYSFS_addToLinkedStringList(retval, &p, entry->name, -1);
return(retval);
} /* 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_platformStricmp(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(DirHandle *h, const char *name)
{
return(mvl_find_entry(((MVLinfo *) h->opaque), name) != NULL);
} /* MVL_exists */
static int MVL_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = MVL_exists(h, name);
return(0); /* never directories in a groupfile. */
} /* MVL_isDirectory */
static int MVL_isSymLink(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = MVL_exists(h, name);
return(0); /* never symlinks in a groupfile. */
} /* MVL_isSymLink */
static PHYSFS_sint64 MVL_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (mvl_find_entry(info, name) != NULL);
if (*fileExists) /* use time of MVL itself in the physical filesystem. */
retval = ((MVLinfo *) h->opaque)->last_mod_time;
return(retval);
} /* MVL_getLastModTime */
static FileHandle *MVL_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
FileHandle *retval;
MVLfileinfo *finfo;
MVLentry *entry;
entry = mvl_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
retval = (FileHandle *) malloc(sizeof (FileHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo = (MVLfileinfo *) malloc(sizeof (MVLfileinfo));
if (finfo == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
free(finfo);
free(retval);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_MVL;
retval->dirHandle = h;
return(retval);
} /* MVL_openRead */
static FileHandle *MVL_openWrite(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* MVL_openWrite */
static FileHandle *MVL_openAppend(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* MVL_openAppend */
static int MVL_remove(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* MVL_remove */
static int MVL_mkdir(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* MVL_mkdir */
#endif /* defined PHYSFS_SUPPORTS_MVL */
/* end of mvl.c ... */

View File

@ -1,674 +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 in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#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_platformStricmp(x, y)
#define QPAK_strncmp(x, y, z) __PHYSFS_platformStrnicmp(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_SIGNATURE 0x4b434150 /* "PACK" in ASCII. */
static void QPAK_dirClose(DirHandle *h);
static PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 QPAK_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int QPAK_eof(FileHandle *handle);
static PHYSFS_sint64 QPAK_tell(FileHandle *handle);
static int QPAK_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 QPAK_fileLength(FileHandle *handle);
static int QPAK_fileClose(FileHandle *handle);
static int QPAK_isArchive(const char *filename, int forWriting);
static DirHandle *QPAK_openArchive(const char *name, int forWriting);
static LinkedStringList *QPAK_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks);
static int QPAK_exists(DirHandle *h, const char *name);
static int QPAK_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int QPAK_isSymLink(DirHandle *h, const char *name, int *fileExists);
static PHYSFS_sint64 QPAK_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *QPAK_openRead(DirHandle *h, const char *name, int *exist);
static FileHandle *QPAK_openWrite(DirHandle *h, const char *name);
static FileHandle *QPAK_openAppend(DirHandle *h, const char *name);
static int QPAK_remove(DirHandle *h, const char *name);
static int QPAK_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
{
"PAK",
QPAK_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_QPAK =
{
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 */
};
const DirFunctions __PHYSFS_DirFunctions_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 */
};
static void QPAK_dirClose(DirHandle *h)
{
QPAKinfo *info = ((QPAKinfo *) h->opaque);
free(info->filename);
free(info->entries);
free(info);
free(h);
} /* QPAK_dirClose */
static PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->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(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* QPAK_write */
static int QPAK_eof(FileHandle *handle)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
QPAKentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* QPAK_eof */
static PHYSFS_sint64 QPAK_tell(FileHandle *handle)
{
return(((QPAKfileinfo *) (handle->opaque))->curPos);
} /* QPAK_tell */
static int QPAK_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->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(FileHandle *handle)
{
QPAKfileinfo *finfo = ((QPAKfileinfo *) handle->opaque);
return((PHYSFS_sint64) finfo->entry->size);
} /* QPAK_fileLength */
static int QPAK_fileClose(FileHandle *handle)
{
QPAKfileinfo *finfo = ((QPAKfileinfo *) handle->opaque);
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
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);
if (buf != QPAK_SIGNATURE)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openQpak_failed;
} /* if */
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);
if ((*count % 64) != 0) /* corrupted archive? */
{
__PHYSFS_setError(ERR_CORRUPTED);
goto openQpak_failed;
} /* if */
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 *) 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 DirHandle *QPAK_openArchive(const char *name, int forWriting)
{
QPAKinfo *info;
DirHandle *retval = malloc(sizeof (DirHandle));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
info = retval->opaque = malloc(sizeof (QPAKinfo));
if (info == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto QPAK_openArchive_failed;
} /* if */
memset(info, '\0', sizeof (QPAKinfo));
info->filename = (char *) 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;
retval->funcs = &__PHYSFS_DirFunctions_QPAK;
return(retval);
QPAK_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
{
if (info->filename != NULL)
free(info->filename);
if (info->entries != NULL)
free(info->entries);
free(info);
} /* if */
free(retval);
} /* 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 */
static LinkedStringList *QPAK_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks)
{
QPAKinfo *info = ((QPAKinfo *) h->opaque);
LinkedStringList *retval = NULL, *p = NULL;
PHYSFS_sint32 dlen, dlen_inc, max, i;
i = qpak_find_start_of_dir(info, dirname, 0);
BAIL_IF_MACRO(i == -1, ERR_NO_SUCH_FILE, NULL);
dlen = strlen(dirname);
if ((dlen > 0) && (dirname[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, dirname, 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));
retval = __PHYSFS_addToLinkedStringList(retval, &p, 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 */
return(retval);
} /* 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(DirHandle *h, const char *name)
{
int isDir;
QPAKinfo *info = (QPAKinfo *) h->opaque;
QPAKentry *entry = qpak_find_entry(info, name, &isDir);
return((entry != NULL) || (isDir));
} /* QPAK_exists */
static int QPAK_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
QPAKinfo *info = (QPAKinfo *) h->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(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = QPAK_exists(h, name);
return(0); /* never symlinks in a quake pak. */
} /* QPAK_isSymLink */
static PHYSFS_sint64 QPAK_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
int isDir;
QPAKinfo *info = ((QPAKinfo *) h->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 FileHandle *QPAK_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
QPAKinfo *info = ((QPAKinfo *) h->opaque);
FileHandle *retval;
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);
retval = (FileHandle *) malloc(sizeof (FileHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo = (QPAKfileinfo *) malloc(sizeof (QPAKfileinfo));
if (finfo == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
free(finfo);
free(retval);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_QPAK;
retval->dirHandle = h;
return(retval);
} /* QPAK_openRead */
static FileHandle *QPAK_openWrite(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* QPAK_openWrite */
static FileHandle *QPAK_openAppend(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* QPAK_openAppend */
static int QPAK_remove(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* QPAK_remove */
static int QPAK_mkdir(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* QPAK_mkdir */
#endif /* defined PHYSFS_SUPPORTS_QPAK */
/* end of qpak.c ... */

View File

@ -1,597 +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 in the source's root directory.
*
* This file written by Travis Wells, based on the GRP archiver by
* Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#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(DirHandle *h);
static PHYSFS_sint64 WAD_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 WAD_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int WAD_eof(FileHandle *handle);
static PHYSFS_sint64 WAD_tell(FileHandle *handle);
static int WAD_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 WAD_fileLength(FileHandle *handle);
static int WAD_fileClose(FileHandle *handle);
static int WAD_isArchive(const char *filename, int forWriting);
static DirHandle *WAD_openArchive(const char *name, int forWriting);
static LinkedStringList *WAD_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks);
static int WAD_exists(DirHandle *h, const char *name);
static int WAD_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int WAD_isSymLink(DirHandle *h, const char *name, int *fileExists);
static PHYSFS_sint64 WAD_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *WAD_openRead(DirHandle *h, const char *name, int *exist);
static FileHandle *WAD_openWrite(DirHandle *h, const char *name);
static FileHandle *WAD_openAppend(DirHandle *h, const char *name);
static int WAD_remove(DirHandle *h, const char *name);
static int WAD_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD =
{
"WAD",
/* !!! FIXME WAD_ARCHIVE_DESCRIPTION, */ "DOOM engine format",
"Travis Wells <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
};
static const FileFunctions __PHYSFS_FileFunctions_WAD =
{
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 */
};
const DirFunctions __PHYSFS_DirFunctions_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 */
};
static void WAD_dirClose(DirHandle *h)
{
WADinfo *info = ((WADinfo *) h->opaque);
free(info->filename);
free(info->entries);
free(info);
free(h);
} /* WAD_dirClose */
static PHYSFS_sint64 WAD_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
WADfileinfo *finfo = (WADfileinfo *) (handle->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(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* WAD_write */
static int WAD_eof(FileHandle *handle)
{
WADfileinfo *finfo = (WADfileinfo *) (handle->opaque);
WADentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* WAD_eof */
static PHYSFS_sint64 WAD_tell(FileHandle *handle)
{
return(((WADfileinfo *) (handle->opaque))->curPos);
} /* WAD_tell */
static int WAD_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
WADfileinfo *finfo = (WADfileinfo *) (handle->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(FileHandle *handle)
{
WADfileinfo *finfo = ((WADfileinfo *) handle->opaque);
return((PHYSFS_sint64) finfo->entry->size);
} /* WAD_fileLength */
static int WAD_fileClose(FileHandle *handle)
{
WADfileinfo *finfo = ((WADfileinfo *) handle->opaque);
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
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 *) 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 DirHandle *WAD_openArchive(const char *name, int forWriting)
{
WADinfo *info;
DirHandle *retval = malloc(sizeof (DirHandle));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
info = retval->opaque = malloc(sizeof (WADinfo));
if (info == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto WAD_openArchive_failed;
} /* if */
memset(info, '\0', sizeof (WADinfo));
info->filename = (char *) malloc(strlen(name) + 1);
if (info->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto WAD_openArchive_failed;
} /* if */
if (!wad_load_entries(name, forWriting, info))
goto WAD_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
retval->funcs = &__PHYSFS_DirFunctions_WAD;
return(retval);
WAD_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
{
if (info->filename != NULL)
free(info->filename);
if (info->entries != NULL)
free(info->entries);
free(info);
} /* if */
free(retval);
} /* if */
return(NULL);
} /* WAD_openArchive */
static LinkedStringList *WAD_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks)
{
WADinfo *info = ((WADinfo *) h->opaque);
WADentry *entry = info->entries;
LinkedStringList *retval = NULL, *p = NULL;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
char *sep;
if (dirname[0] == 0)
{
for (i = 0; i < max; i++, entry++)
{
if (strchr(entry->name, '/') == NULL)
{
retval = __PHYSFS_addToLinkedStringList(retval, &p,
entry->name, -1);
} /* if */
} /* for */
} /* if */
else
{
for (i = 0; i < max; i++, entry++)
{
sep = strchr(entry->name, '/');
if (sep != NULL)
{
if (strncmp(dirname, entry->name, (sep-entry->name)) == 0)
{
retval = __PHYSFS_addToLinkedStringList(retval, &p,
sep + 1, -1);
} /* if */
} /* if */
} /* for */
} /* else */
return(retval);
} /* 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(DirHandle *h, const char *name)
{
return(wad_find_entry(((WADinfo *) h->opaque), name) != NULL);
} /* WAD_exists */
static int WAD_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
WADentry *entry = wad_find_entry(((WADinfo *) h->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(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = WAD_exists(h, name);
return(0); /* never symlinks in a wad. */
} /* WAD_isSymLink */
static PHYSFS_sint64 WAD_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
WADinfo *info = ((WADinfo *) h->opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (wad_find_entry(info, name) != NULL);
if (*fileExists) /* use time of WAD itself in the physical filesystem. */
retval = ((WADinfo *) h->opaque)->last_mod_time;
return(retval);
} /* WAD_getLastModTime */
static FileHandle *WAD_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
WADinfo *info = ((WADinfo *) h->opaque);
FileHandle *retval;
WADfileinfo *finfo;
WADentry *entry;
entry = wad_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
retval = (FileHandle *) malloc(sizeof (FileHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo = (WADfileinfo *) malloc(sizeof (WADfileinfo));
if (finfo == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
free(finfo);
free(retval);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_WAD;
retval->dirHandle = h;
return(retval);
} /* WAD_openRead */
static FileHandle *WAD_openWrite(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* WAD_openWrite */
static FileHandle *WAD_openAppend(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* WAD_openAppend */
static int WAD_remove(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* WAD_remove */
static int WAD_mkdir(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* WAD_mkdir */
#endif /* defined PHYSFS_SUPPORTS_WAD */
/* end of wad.c ... */

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
#!/bin/sh
set -e
echo "Initial preparation...this can take awhile, so sit tight..."
rm -f Makefile.am
perl -w -e 'use File::Copy; exit 0 if (-f "Makefile.am"); my $x = `automake --version |head -n 1`; chomp($x); $x = 0.0 if ($x !~ s/\A.*?(\d+\.\d+).*\Z/$1/); if ($x < 1.5) { copy("./Makefile.am.oldautomake", "./Makefile.am"); } else { copy("./Makefile.am.newautomake", "./Makefile.am"); }'
aclocal
libtoolize --automake --copy --force
autoheader
automake --foreign --add-missing --copy
autoconf
echo "You are now ready to run ./configure ..."

View File

@ -1,518 +0,0 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(physfs.c)
dnl ---------------------------------------------------------------------
dnl System/version info
dnl ---------------------------------------------------------------------
# Making releases:
# MICRO_VERSION += 1;
# INTERFACE_AGE += 1;
# BINARY_AGE += 1;
# if any functions have been added, set INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set BINARY_AGE and INTERFACE_AGE to 0.
MAJOR_VERSION=1
MINOR_VERSION=0
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(MICRO_VERSION)
AC_SUBST(INTERFACE_AGE)
AC_SUBST(BINARY_AGE)
AC_SUBST(VERSION)
# libtool versioning
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
LT_REVISION=$INTERFACE_AGE
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
dnl Detect the canonical host and target build environment
AC_CANONICAL_SYSTEM
dnl Setup for automake
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(physfs, $VERSION)
dnl ---------------------------------------------------------------------
dnl Compilers and other tools
dnl ---------------------------------------------------------------------
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
LIBTOOL="libtool"
AM_PROG_LIBTOOL
AC_CHECK_PROG(we_have_sed, sed, yes, no)
dnl ---------------------------------------------------------------------
dnl Debug mode?
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(debug,
[ --enable-debug enable debug mode [default=no]],
, enable_debug=no)
if test x$enable_debug = xyes; then
if test x$ac_cv_prog_cc_g = xyes; then
PHYSFSCFLAGS="-g -O0"
else
PHYSFSCFLAGS="-O0"
fi
PHYSFSCFLAGS="$PHYSFSCFLAGS -Werror -Wall"
AC_DEFINE([DEBUG], 1, [define if debug build is enabled])
AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled])
else
PHYSFSCFLAGS="-O2"
AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
fi
dnl ---------------------------------------------------------------------
dnl Profile sorts, etc?
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(profiling,
[ --enable-profiling do algorithm profiling [default=no]],
, enable_profiling=no)
if test x$enable_profiling = xyes; then
AC_DEFINE([PHYSFS_PROFILING], 1, [define to profile sorting, etc algorithms])
fi
dnl ---------------------------------------------------------------------
dnl Build test program?
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(testprog,
[ --enable-testprog build test program [default=yes]],
, enable_testprog=yes)
dnl ---------------------------------------------------------------------
dnl Checks for libraries.
dnl ---------------------------------------------------------------------
require_zlib="no"
dnl Check for zip archiver inclusion...
AC_ARG_ENABLE(zip,
[ --enable-zip enable ZIP support [default=yes]],
, enable_zip=yes)
if test x$enable_zip = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_ZIP], 1, [define if zip support is enabled])
require_zlib="yes"
fi
dnl Check for grp archiver inclusion...
AC_ARG_ENABLE(grp,
[ --enable-grp enable Build Engine GRP support [default=yes]],
, enable_grp=yes)
if test x$enable_grp = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_GRP], 1, [define if grp support is enabled])
fi
dnl Check for wad archiver inclusion...
AC_ARG_ENABLE(wad,
[ --enable-wad enable Doom WAD support [default=yes]],
, enable_wad=yes)
if test x$enable_wad = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_WAD], 1, [define if wad support is enabled])
fi
dnl Check for hog archiver inclusion...
AC_ARG_ENABLE(hog,
[ --enable-hog enable Descent I/II HOG support [default=yes]],
, enable_hog=yes)
if test x$enable_hog = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_HOG], 1, [define if hog support is enabled])
fi
dnl Check for mvl archiver inclusion...
AC_ARG_ENABLE(mvl,
[ --enable-mvl enable Descent II MVL support [default=yes]],
, enable_mvl=yes)
if test x$enable_mvl = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_MVL], 1, [define if mvl support is enabled])
fi
dnl Check for qpak archiver inclusion...
AC_ARG_ENABLE(qpak,
[ --enable-qpak enable Quake PAK support [default=yes]],
, enable_qpak=yes)
if test x$enable_qpak = xyes; then
AC_DEFINE([PHYSFS_SUPPORTS_QPAK], 1, [define if qpak support is enabled])
fi
dnl Check if we should statically link the included zlib...
AC_ARG_ENABLE(internal-zlib,
[ --enable-internal-zlib use included zlib [default=only if needed]],
, enable_internal_zlib=maybe)
dnl Check for zlib if needed.
have_external_zlib="no"
if test x$enable_internal_zlib != xyes; then
if test x$require_zlib = xyes; then
AC_CHECK_HEADER(zlib.h, have_zlib_hdr=yes)
AC_CHECK_LIB(z, zlibVersion, have_zlib_lib=yes)
if test x$have_zlib_hdr = xyes -a x$have_zlib_lib = xyes; then
have_external_zlib="yes"
fi
fi
fi
AC_MSG_CHECKING([what zlib to use])
dnl no zlib is needed at all if we aren't supporting ZIP files.
if test x$require_zlib = xno; then
enable_internal_zlib="no"
enable_external_zlib="no"
AC_MSG_RESULT([no zlib needed])
else
if test x$enable_internal_zlib = xmaybe; then
if test x$have_external_zlib = xyes; then
enable_internal_zlib="no"
enable_external_zlib="yes"
else
enable_internal_zlib="yes"
enable_external_zlib="no"
fi
else
if test x$enable_internal_zlib = xno -a x$have_external_zlib = xyes; then
enable_internal_zlib="no"
enable_external_zlib="yes"
fi
fi
if test x$enable_internal_zlib = xyes; then
AC_MSG_RESULT([internal zlib])
PHYSFSCFLAGS="$PHYSFSCFLAGS -DZ_PREFIX"
else
if test x$enable_external_zlib = xyes; then
AC_MSG_RESULT([external zlib])
LIBS="$LIBS -lz"
else
AC_MSG_ERROR([Need zlib, but you disabled our copy and have no system lib])
fi
fi
fi
dnl determine if we should include readline support...
AC_ARG_ENABLE(readline,
[ --enable-readline use GNU readline in test program [default=yes]],
, enable_readline=yes)
if test x$enable_readline = xyes; then
AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses)
AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses)
if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
AC_DEFINE([PHYSFS_HAVE_READLINE], 1, [define if we have readline])
have_readline="yes"
fi
fi
fi
dnl !!! FIXME: Not sure how to detect this...
dnl check for 64-bit llseek()...
dnl AC_CHECK_LIB(c, llseek, have_llseek=yes)
if test x$have_llseek = xyes; then
AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek])
fi
dnl determine if we should use the stubbed pthread code.
AC_ARG_ENABLE(pthreads,
[ --enable-pthreads include POSIX threads support [default=yes]],
, enable_pthreads=yes)
if test x$enable_pthreads = xyes; then
AC_CHECK_HEADER(pthread.h, have_pthread_hdr=yes)
if test x$have_pthread_hdr != xyes; then
enable_pthreads=no
fi
fi
dnl determine if we should use the stubbed CD-ROM detection code.
AC_ARG_ENABLE(cdrom,
[ --enable-cdrom include CD-ROM support [default=yes]],
, enable_cdrom=yes)
if test x$enable_cdrom = xyes; then
dnl reset this and let header detection reenable...
enable_cdrom=no
dnl BSD systems use sys/ucred.h for getting mounted volumes.
dnl Linux and others use mntent.h.
AC_CHECK_HEADER(sys/ucred.h, have_ucred_hdr=yes)
if test x$have_ucred_hdr = xyes; then
AC_DEFINE([PHYSFS_HAVE_SYS_UCRED_H], 1, [define if we have sys/ucred.h])
enable_cdrom=yes
fi
AC_CHECK_HEADER(mntent.h, have_mntent_hdr=yes)
if test x$have_mntent_hdr = xyes; then
AC_DEFINE([PHYSFS_HAVE_MNTENT_H], 1, [define if we have mntent.h])
enable_cdrom=yes
fi
fi
dnl determine language.
AC_ARG_ENABLE(language,
[ --enable-language=lang Select natural language. [default=english]],
physfslang=`echo $enable_language |tr A-Z a-z`, physfslang=english)
AC_MSG_CHECKING([if language choice is supported])
physfs_valid_lang=no
if test x$physfslang = xenglish; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_ENGLISH, [define desired natural language])
fi
if test x$physfslang = xgerman; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_GERMAN, [define desired natural language])
fi
if test x$physfslang = xfrench; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_FRENCH, [define desired natural language])
fi
if test x$physfslang = xrussian-koi8-r; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_KOI8_R, [define desired natural language])
fi
if test x$physfslang = xrussian-cp1251; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_CP866, [define desired natural language])
fi
if test x$physfslang = xrussian-cp866; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_CP866, [define desired natural language])
fi
if test x$physfslang = xrussian-iso-8859-5; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_ISO_8859_5, [define desired natural language])
fi
dnl Add other language checks here...
AC_MSG_RESULT([$physfs_valid_lang])
if test x$physfs_valid_lang = xno; then
AC_MSG_WARN([***])
AC_MSG_WARN([*** You've asked for "$physfslang" language support...])
AC_MSG_WARN([*** ...but we don't support that.])
AC_MSG_WARN([*** You could choose another language,])
AC_MSG_WARN([*** but is this what you REALLY wanted?])
AC_MSG_WARN([*** Please see the LANG section of physfs_internal.h])
AC_MSG_WARN([*** for info on writing a translation.])
AC_MSG_WARN([***])
AC_MSG_WARN([*** Currently known languages:])
AC_MSG_WARN([*** --enable-language=english])
AC_MSG_WARN([*** --enable-language=german])
AC_MSG_WARN([*** --enable-language=french])
AC_MSG_WARN([*** --enable-language=russian-koi8-r])
AC_MSG_WARN([*** --enable-language=russian-cp1251])
AC_MSG_WARN([*** --enable-language=russian-cp866])
AC_MSG_WARN([*** --enable-language=russian-iso-8859-5])
AC_MSG_WARN([***])
AC_MSG_ERROR([*** unsupported language. stop.])
fi
have_non_posix_threads=no
AC_MSG_CHECKING([if this is BeOS])
if test x$target_os = xbeos; then
this_is_beos=yes
have_non_posix_threads=yes
enable_cdrom=yes
enable_pthreads=no
LIBS="$LIBS -lroot -lbe"
else
this_is_beos=no
fi
AC_MSG_RESULT([$this_is_beos])
AC_MSG_CHECKING([if this is Cygwin])
if test x$target_os = xcygwin; then
this_is_cygwin=yes
PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32"
enable_cdrom=yes
enable_pthreads=no
have_non_posix_threads=yes
else
this_is_cygwin=no
fi
AC_MSG_RESULT([$this_is_cygwin])
this_is_macosx=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is MacOS X])
x=`echo $target_os |sed "s/darwin.*/darwin/"`
if test x$x = xdarwin -a x$target_vendor = xapple; then
this_is_macosx=yes
PHYSFSLDFLAGS="$PHYSFSLDFLAGS -Wl,-framework -Wl,Carbon -Wl,-framework -Wl,IOKit"
fi
AC_MSG_RESULT([$this_is_macosx])
fi
this_is_freebsd=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is FreeBSD])
x=`echo $target_os |tr A-Z a-z |sed "s/.*freebsd.*/freebsd/"`
if test x$x = xfreebsd; then
this_is_freebsd=yes
PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread"
fi
AC_MSG_RESULT([$this_is_freebsd])
fi
this_is_openbsd=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is OpenBSD])
x=`echo $target_os |tr A-Z a-z |sed "s/.*openbsd.*/openbsd/"`
if test x$x = xopenbsd; then
this_is_openbsd=yes
PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread"
fi
AC_MSG_RESULT([$this_is_openbsd])
fi
this_is_atheos=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is AtheOS])
x=`echo $target_os |tr A-Z a-z |sed "s/.*atheos.*/atheos/"`
if test x$x = xatheos; then
this_is_atheos=yes
enable_cdrom=no
enable_pthreads=no
fi
AC_MSG_RESULT([$this_is_atheos])
fi
this_is_os2=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is OS/2])
x=`echo $target_os |tr A-Z a-z |sed "s/.*os2.*/os2/"`
if test x$x = xos2; then
this_is_os2=yes
have_non_posix_threads=yes
enable_cdrom=yes
enable_pthreads=no
PHYSFSCFLAGS="$PHYSFSCFLAGS -DOS2"
fi
AC_MSG_RESULT([$this_is_os2])
fi
this_is_mint=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is MiNT])
x=`echo $target_os |tr A-Z a-z |sed "s/.*mint.*/mint/"`
if test x$x = xmint; then
this_is_mint=yes
enable_cdrom=no
enable_pthreads=no
fi
AC_MSG_RESULT([$this_is_mint])
fi
dnl Some platform might disable this, so check this down here...
if test x$enable_cdrom != xyes; then
AC_DEFINE([PHYSFS_NO_CDROM_SUPPORT], 1, [define if we have no CD support])
AC_MSG_WARN([***])
AC_MSG_WARN([*** There is no CD-ROM support in this build!])
AC_MSG_WARN([*** PhysicsFS will just pretend there are no discs.])
AC_MSG_WARN([*** This may be fine, depending on how PhysicsFS is used,])
AC_MSG_WARN([*** but is this what you REALLY wanted?])
AC_MSG_WARN([*** (Maybe fix configure.in, or write a platform driver?)])
AC_MSG_WARN([***])
fi
if test x$enable_pthreads != xyes; then
AC_DEFINE([PHYSFS_NO_PTHREADS_SUPPORT], 1, [define if we have no POSIX threads support])
if test x$have_non_posix_threads != xyes; then
AC_MSG_WARN([***])
AC_MSG_WARN([*** There is no thread support in this build!])
AC_MSG_WARN([*** PhysicsFS will NOT be reentrant!])
AC_MSG_WARN([*** This may be fine, depending on how PhysicsFS is used,])
AC_MSG_WARN([*** but is this what you REALLY wanted?])
AC_MSG_WARN([*** (Maybe fix configure.in, or write a platform driver?)])
AC_MSG_WARN([***])
fi
fi
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h assert.h])
# Checks for typedefs, structures, and compiler characteristics.
dnl AC_C_CONST
dnl AC_TYPE_SIZE_T
# Checks for library functions.
# This is only in the bleeding edge autoconf distro...
#AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_CHECK_FUNCS([memset strrchr])
AC_CHECK_SIZEOF(int, 4)
CFLAGS="$CFLAGS $PHYSFSCFLAGS -D_REENTRANT -D_THREAD_SAFE"
LDFLAGS="$LDFLAGS $PHYSFSLDFLAGS -no-undefined"
dnl Add Makefile conditionals
AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes)
AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes)
AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes)
AM_CONDITIONAL(BUILD_READLINE, test x$have_readline = xyes)
AC_OUTPUT([
Makefile
archivers/Makefile
platform/Makefile
zlib121/Makefile
test/Makefile
extras/Makefile
physfs.spec
])
dnl end of configure.in ...

17
debian/changelog vendored
View File

@ -1,17 +0,0 @@
libphysfs0 (0.1.7-cvs20020729) unstable; urgency=low
* Updated control files merged with CVS tree.
-- Colin Bayer <cbayer@localhost> Mon, 29 Jul 2002 23:03:58 -0700
libphysfs0 (0.1.7-2) unstable; urgency=low
* Fixed manpage install locations.
-- Colin Bayer <cbayer@localhost> Mon, 29 Jul 2002 22:24:02 -0700
libphysfs0 (0.1.7-1) unstable; urgency=low
* Initial Release.
-- Colin Bayer <vogon@icculus.org> Mon, 29 Jul 2002 07:47:31 -0700

22
debian/control vendored
View File

@ -1,22 +0,0 @@
Source: libphysfs0
Priority: optional
Maintainer: Colin Bayer <vogon@icculus.org>
Build-Depends: debhelper (>> 3.0.0), binutils (>= 2.12.90.0.1-4 ), fileutils (>= 4.1-10 ), gcc-2.95 (>= 1 ), libc6 (>= 2.2.5-10 ), libncurses5 (>= 5.2.20020112a-8 ), zlib1g (>= 1 ), libncurses5-dev (>= 5.2.20020112a-8 ), zlib1g-dev (>= 1 ), doxygen, autoconf2.13 (>= 2.13-44 ), autoconf (>= 2.53-4 ), automake (>= 1)
Standards-Version: 3.5.2
Package: libphysfs0-dev
Section: devel
Architecture: any
Depends: libphysfs0 (= ${Source-Version})
Description: A filesystem abstraction for game programmers.
libphysfs0-dev is the set of header files needed to compile programs that
utilize the libphysfs0 library.
Package: libphysfs0
Section: libs
Architecture: any
Depends: ${shlibs:Depends}
Description: A filesystem abstraction for game programmers.
libphysfs0 is the PhysicsFS filesystem abstraction library, a library that
provides a simple C interface to aid game programmers in utilizing game
assets packaged in many different types of archive files.

33
debian/copyright vendored
View File

@ -1,33 +0,0 @@
This package was debianized by Colin Bayer <vogon@icculus.org> on
Mon, 29 Jul 2002 04:41:27 -0700.
It was downloaded from http://icculus.org/physfs/downloads/physfs-0.1.7.tar.gz
Upstream Author(s): Ryan Gordon <icculus@icculus.org>
This software is copyright (c) 2001-02 by Ryan Gordon, icculus.org.
This library is distributed under the terms of the zlib license:
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
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@clutteredmind.org>

2
debian/docs vendored
View File

@ -1,2 +0,0 @@
TODO
CREDITS

2
debian/files vendored
View File

@ -1,2 +0,0 @@
libphysfs0-dev_0.1.7-cvs20020729_i386.deb devel optional
libphysfs0_0.1.7-cvs20020729_i386.deb libs optional

View File

@ -1,6 +0,0 @@
usr/lib
usr/include
usr/share/man/man3
usr/share/doc/libphysfs0-dev
usr/share/doc/libphysfs0-dev/latex
usr/share/doc/libphysfs0-dev/html

View File

@ -1,9 +0,0 @@
Document: libphysfs0-api
Title: PhysicsFS API Documentation
Author: Ryan Gordon <icculus@icculus.org>
Abstract: This document outlines the C API for libphysfs0.
Section: unknown
Format: HTML
Index: /usr/share/doc/libphysfs0-dev/html/index.html
Files: /usr/share/doc/libphysfs0-dev/html/*.html

View File

@ -1,5 +0,0 @@
usr/include/*
usr/lib/lib*.a
usr/lib/lib*.so
usr/share/doc/libphysfs0-dev/*
usr/share/man/man3/*

View File

@ -1,5 +0,0 @@
# Automatically added by dh_installdocs
if [ "$1" = configure ] && which install-docs >/dev/null 2>&1; then
install-docs -i /usr/share/doc-base/libphysfs0-api
fi
# End automatically added section

View File

@ -1,6 +0,0 @@
# Automatically added by dh_installdocs
if [ "$1" = remove ] || [ "$1" = upgrade ] && \
which install-docs >/dev/null 2>&1; then
install-docs -r libphysfs0-api
fi
# End automatically added section

View File

@ -1 +0,0 @@
usr/lib

View File

@ -1 +0,0 @@
usr/lib/lib*.so.*

View File

@ -1,5 +0,0 @@
# Automatically added by dh_makeshlibs
if [ "$1" = "configure" ]; then
ldconfig
fi
# End automatically added section

View File

@ -1,5 +0,0 @@
# Automatically added by dh_makeshlibs
if [ "$1" = "remove" ]; then
ldconfig
fi
# End automatically added section

View File

@ -1 +0,0 @@
shlibs:Depends=libc6 (>= 2.2.4-4), zlib1g (>= 1:1.1.4)

47
debian/postinst vendored
View File

@ -1,47 +0,0 @@
#! /bin/sh
# postinst script for libphysfs0
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

38
debian/postrm vendored
View File

@ -1,38 +0,0 @@
#! /bin/sh
# postrm script for libphysfs0
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

44
debian/preinst vendored
View File

@ -1,44 +0,0 @@
#! /bin/sh
# preinst script for libphysfs0
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
#
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
# if [ "$1" = "upgrade" ]
# then
# start-stop-daemon --stop --quiet --oknodo \
# --pidfile /var/run/libphysfs0.pid \
# --exec /usr/sbin/libphysfs0 2>/dev/null || true
# fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

40
debian/prerm vendored
View File

@ -1,40 +0,0 @@
#! /bin/sh
# prerm script for libphysfs0
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
# install-info --quiet --remove /usr/info/libphysfs0.info.gz
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

118
debian/rules vendored
View File

@ -1,118 +0,0 @@
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
export DH_COMPAT=3
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
# shared library versions, option 1
version=0.1.9
major=0
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
#version=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
#major=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
config.status: configure
dh_testdir
# Add here commands to configure the package.
./bootstrap
CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
build: build-stamp
build-stamp: config.status
dh_testdir
# Add here commands to compile the package.
$(MAKE)
doxygen
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) distclean
-test -r /usr/share/misc/config.sub && \
cp -f /usr/share/misc/config.sub config.sub
-test -r /usr/share/misc/config.guess && \
cp -f /usr/share/misc/config.guess config.guess
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/tmp
$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr
install -d $(CURDIR)/debian/tmp/usr/share/doc/libphysfs0-dev/latex
install -d $(CURDIR)/debian/tmp/usr/share/doc/libphysfs0-dev/html
install -d $(CURDIR)/debian/tmp/usr/share/man/man3
# install -D docs/README $(CURDIR)/debian/tmp/usr/share/doc/libphysfs0-dev/README
install -D docs/latex/* $(CURDIR)/debian/tmp/usr/share/doc/libphysfs0-dev/latex
install -D docs/html/* $(CURDIR)/debian/tmp/usr/share/doc/libphysfs0-dev/html
install -D docs/man/man3/* $(CURDIR)/debian/tmp/usr/share/man/man3
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_movefiles
# dh_installdebconf
dh_installdocs
dh_installexamples
dh_installmenu
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
dh_installcron
dh_installman
dh_installinfo
# dh_undocumented
dh_installchangelogs CHANGELOG
dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
# dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

1
debian/shlibs.local vendored
View File

@ -1 +0,0 @@
libPACKAGE# 0.1.7 libphysfs0 (>> 0.1.7-0), libphysfs0 (<< 0.1.7-99)

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/

174
docs/CREDITS.txt Normal file
View File

@ -0,0 +1,174 @@
Maintainer and general codemonkey:
Ryan C. Gordon
Tons of win32 help:
Adam Gates
More win32 hacking:
Gregory S. Read
Fixes for missing current working directories,
PHYSFS_setSaneConfig() improvements,
other bugfixes:
David Hedbor
Darwin support:
Patrick Stein
configure fixes,
RPM specfile:
Edward Rudd
GetLastModTime API,
other stuff:
John R. Hall
Various support, fixes and suggestions:
Alexander Pipelka
Russian translation,
QPAK archiver:
Ed Sinjiashvili
French translation:
Stéphane Peter
Debian package support:
Colin Bayer
"abs-file.h" in "extras" dir:
Adam D. Moss
WinCE port and other Win32 patches:
Corona688
German translation:
Michael Renner
Apple Project Builder support,
Mac OS X improvements:
Eric Wing
iPhone support:
Christian Gmeiner
WinRT support:
Martin Ahrnbom
HOG archiver,
MVL archiver:
Bradley Bell
MIX archiver:
Sebastian Steinhauer
Bug fixes:
Tolga Dalman
Initial PHYSFS_mount() work:
Philip D. Bober
Brazillian Portuguese translation:
Danny Angelo Carminati Grein
Spanish translation:
Pedro J. Pérez
MacOS Classic fixes,
MPW support,
bug fixes:
Chris Taylor
Mingw support,
General bug fixes:
Matze Braun
Haiku support:
scott mc
Bug fixes:
Jörg Walter
Bug fixes:
Olivier Boudeville
Bug fixes:
Henk Boom
Build system fixes:
Marc Kleine-Budde
Windows .rc file,
7zip/lzma archiver:
Dennis Schridde
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 ...
/* end of CREDITS.txt ... */

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.0.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,5 +0,0 @@
Makefile
.deps
.libs
Makefile.in

View File

@ -1,7 +0,0 @@
EXTRA_DIST = \
physfsrwops.c \
physfsrwops.h \
abs-file.h \
physfshttpd.c \
physfs_rb

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.

View File

@ -92,7 +92,7 @@ from the Author.
#ifdef USE_PHYSFS
#include <physfs.h>
#define MY_FILETYPE PHYSFS_file
#define MY_FILETYPE PHYSFS_File
#define MY_SETBUFFER(fp,size) PHYSFS_setBuffer(fp,size)
#define MY_READ(p,s,n,fp) PHYSFS_read(fp,p,s,n)
#if PHYSFS_DEFAULT_READ_BUFFER

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."

1414
extras/casefolding.txt Normal file

File diff suppressed because it is too large Load Diff

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 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 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

@ -22,29 +22,11 @@
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE in the root of the source tree.
* Please see LICENSE.txt in the root of the source tree.
*
* \author Ryan C. Gordon.
*/
/* I'm not screwing around with stricmp vs. strcasecmp... */
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;
@ -52,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)
@ -68,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 */
@ -88,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 */
@ -116,58 +101,58 @@ int main(int argc, char **argv)
{
int rc;
char buf[128];
PHYSFS_file *f;
PHYSFS_File *f;
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");
@ -210,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
@ -39,11 +42,14 @@
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE in the root of the source tree.
* Please see LICENSE.txt in the root of the source tree.
*
* \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 ... */

276
extras/makecasefoldhashtable.pl Executable file
View File

@ -0,0 +1,276 @@
#!/usr/bin/perl -w
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 (https://icculus.org/physfs/)
*
* This data generated by physfs/extras/makecasefoldhashtable.pl ...
* Do not manually edit this file!
*
* 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 @foldPairs1_16;
my @foldPairs2_16;
my @foldPairs3_16;
my @foldPairs1_32;
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");
while (<FH>) {
chomp;
# strip comments from textfile...
s/\#.*\Z//;
# strip whitespace...
s/\A\s+//;
s/\s+\Z//;
next if not /\A([a-fA-F0-9]+)\;\s*(.)\;\s*(.+)\;/;
my ($code, $status, $mapping) = ($1, $2, $3);
my $hexxed = hex($code);
#print("// code '$code' status '$status' mapping '$mapping'\n");
if (($status eq 'C') or ($status eq 'F')) {
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 '');
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 < $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_fold1_16_${num}";
print("static const CaseFoldMapping1_16 ${sym}[] = {\n$str\n};\n\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 < $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(" { NULL, 0 },\n");
} else {
my $num = '000' . $i;
$num =~ s/\A.*?(\d\d\d)\Z/$1/;
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 ...

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

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