Compare commits

...

1026 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
Ryan C. Gordon d43ca254c1 Last minute changes, fixes, and build system updates for 1.0. 2004-01-08 05:53:28 +00:00
Ryan C. Gordon 19f5b8651d Updated. 2004-01-08 05:52:41 +00:00
Ryan C. Gordon dd3008f799 Initial add. 2003-12-29 11:16:52 +00:00
Ryan C. Gordon 24c8651f7f Patches to get this building on Mac Classic again. 2003-12-29 08:50:21 +00:00
Ryan C. Gordon 56606fa65c Updated. 2003-12-29 08:49:58 +00:00
Ryan C. Gordon 81c06f3c9e Renamed from CWProjects.sit...moved from CodeWarrior 6 to 7, and archived with
Stuffit 8.0.2 (SITX format). Other tweaks in preparation for 1.0 release.
2003-12-29 08:46:28 +00:00
Ryan C. Gordon ee41546b4c Replaced by CWProjects.sitx 2003-12-29 07:44:18 +00:00
Ryan C. Gordon 46fe99b378 Minor OS/2 build tweak. 2003-12-29 07:42:51 +00:00
bhook 86dc6d9ebc Converted VC6 project to use zlib121, fixed some link warnings that
Z_PREFIX=1 missed by default, enabled Z_PREFIX=1 by default in VC6
dsp file, updated changelog.
2003-12-22 18:19:09 +00:00
Ryan C. Gordon 02866267d5 Updated. 2003-12-22 17:12:51 +00:00
Ryan C. Gordon ffb2e6ca45 Fixed search-and-replace fuckup (thanks, Brian!). 2003-12-22 17:12:00 +00:00
Ryan C. Gordon 6d45e5b718 Updated. 2003-12-19 01:53:06 +00:00
Ryan C. Gordon ce799b99a8 Added zlib_license_change.txt to EXTRA_DIST. 2003-12-19 01:52:07 +00:00
Ryan C. Gordon 564d485f82 Added zlib_license_change.txt to RPM spec (thanks, Edward!) 2003-12-19 01:49:12 +00:00
Ryan C. Gordon 4bbb4ea217 Updated. 2003-12-18 19:54:41 +00:00
Ryan C. Gordon f2ebb00ef9 Says Travis Wells:
"Meh. I just realized the wad archiver isn't considering ExMx or MAPxx entries
correctly, it treats them as files,when it should consider them directories,
and place the next 11 entries in that directory.Right now it's making it
impossible to open maps, since they all have the same names, they all overlap.
So it's not very useful right now.

...

Here's the patch to wad.c, it should now correctly place the map-files into
subdirectories."

Thanks, Travis!
2003-12-18 19:53:20 +00:00
Ryan C. Gordon efdc4ac8a6 Added Doom WAD support. 2003-12-15 04:01:18 +00:00
Ryan C. Gordon 3a5f64ff06 Updated. 2003-12-15 04:00:53 +00:00
Ryan C. Gordon f6234dbc2a Updated. 2003-12-08 12:38:10 +00:00
Ryan C. Gordon 9ac33cdcbe Fixed Win32 seeking on > 2gig files, other Cygwin issues. 2003-12-08 12:37:58 +00:00
Ryan C. Gordon 4e58f93af9 Updated 2003-12-07 05:39:54 +00:00
Ryan C. Gordon cd08ed589b Make physfs itself not link against readline and ncurses (just
test_physfs).
2003-12-07 05:39:23 +00:00
Ryan C. Gordon caf828b73d Updated. 2003-12-07 05:30:06 +00:00
Ryan C. Gordon c7fb2e4cba Upgraded internal zlib to 1.2.1 (thanks, Adam!) 2003-12-07 05:29:20 +00:00
bhook e3e3270b0f *** empty log message *** 2003-12-04 07:20:32 +00:00
Ryan C. Gordon 4f0b5d6e47 Updated. 2003-11-11 14:11:00 +00:00
Ryan C. Gordon 1822399aec Patched to compile on OS/2. 2003-11-11 14:08:32 +00:00
Ryan C. Gordon e04c24cbcd Updated. 2003-11-09 21:07:12 +00:00
Ryan C. Gordon 9dcb15fa2c Made QPAK archiver case insensitive again. 2003-11-09 21:06:15 +00:00
Ryan C. Gordon 09ef260209 Added internal function __PHYSFS_platformStrnicmp(). 2003-11-09 20:59:07 +00:00
Ryan C. Gordon 13d6a130fd Updated. 2003-09-13 02:30:55 +00:00
Ryan C. Gordon f49ab5f7d4 Updated. 2003-08-26 19:43:17 +00:00
Ryan C. Gordon f7577d417f MiNT detection, cross-compiling fixes. 2003-08-26 19:43:04 +00:00
bhook f920549378 default to supporting all file formats 2003-08-09 15:10:11 +00:00
bhook b035d272ec removed a warning by adding a cast 2003-08-09 15:07:08 +00:00
bhook 5b6e1d4cee updated to reflect info on VC6 static lib files 2003-08-09 15:04:32 +00:00
bhook 83cdb49cd3 *** empty log message *** 2003-08-09 02:37:21 +00:00
Ryan C. Gordon 83fde3e480 Upped version to 0.1.9. 2003-07-23 04:13:21 +00:00
Ryan C. Gordon c951ab5cb9 Updated. 2003-07-21 04:07:36 +00:00
Ryan C. Gordon d21eaf18dc Updated. 2003-07-21 04:01:10 +00:00
Ryan C. Gordon 52fc473ddb Readded Russian translations, since contributor approved zlib license change. 2003-07-21 03:58:03 +00:00
Ryan C. Gordon e0208e089f Readded Ruby bindings, since contributor contacted me with permission to
switch to zlib license.
2003-07-21 03:46:50 +00:00
Ryan C. Gordon a4276d9a61 Updated. 2003-07-21 00:28:21 +00:00
Ryan C. Gordon 1400b98be7 Readded new qpak archiver. 2003-07-21 00:27:27 +00:00
Ryan C. Gordon ccfa99fb61 Reimplemented qpak.c for relicensing. 2003-07-21 00:27:09 +00:00
Ryan C. Gordon d59c03cc8b Updated. 2003-07-20 21:14:12 +00:00
Ryan C. Gordon f3191d0e85 Off-by-one fix by Dieter Baron...fixes segfault in zip archive searching in
certain cases.
2003-07-20 21:13:25 +00:00
Ryan C. Gordon f4309f51e8 Tabs-to-spaces patch by James Turk. 2003-07-20 21:08:24 +00:00
Ryan C. Gordon db279de4d1 Updated. 2003-07-20 21:07:53 +00:00
Ryan C. Gordon 025aef8a15 Switched to zlib license. 2003-07-20 20:57:55 +00:00
Ryan C. Gordon 33be461bcb Fixes for corner cases (thanks, Bradley!) 2003-06-11 09:05:47 +00:00
Ryan C. Gordon adc1f9a434 Updated. 2003-06-11 09:02:12 +00:00
Ryan C. Gordon 6f3eda601e First stab at globbing extension. 2003-06-11 02:10:49 +00:00
Ryan C. Gordon 4454511ca0 Updated. 2003-05-24 03:38:58 +00:00
Ryan C. Gordon 3e2885afda MacOSX/Darwin tweaks, other corrections. 2003-05-24 03:37:52 +00:00
Ryan C. Gordon 01b8809162 Rewrote MacOSX/Darwin CD detection to use IOKit, for accurate results. 2003-05-24 03:36:36 +00:00
Ryan C. Gordon 593bca81ff Updated. 2003-05-22 04:01:47 +00:00
Ryan C. Gordon 8dbc9bf877 Fixed crash if PHYSFS_init(NULL) is used... 2003-05-22 04:01:19 +00:00
Ryan C. Gordon 4bf1b305e3 Updated. 2003-05-18 07:52:53 +00:00
Ryan C. Gordon b50342ad13 PocketPC fixes (thanks, David Hedbor!) 2003-05-18 07:52:28 +00:00
Ryan C. Gordon 283c6291a7 Updated. 2003-05-16 15:32:46 +00:00
Ryan C. Gordon 3a3451c4be Patched compiler warnings (thanks, Bradley Bell!) 2003-05-16 15:31:42 +00:00
Ryan C. Gordon 23dcba1970 Updated. 2003-04-08 05:51:19 +00:00
Ryan C. Gordon a56ea0a917 Minor patches from Adam. 2003-04-08 05:51:11 +00:00
bhook 585860f7c1 *** empty log message *** 2003-04-02 06:56:47 +00:00
Ryan C. Gordon 76fbe60a41 Added Descent archives to OS/2 build system. 2003-03-30 20:50:09 +00:00
Ryan C. Gordon 90060615ab Forgot to mention qpak in the docs. 2003-03-30 20:48:28 +00:00
Ryan C. Gordon fbbaf19a4f Minor strcasecmp optimization. 2003-03-30 20:46:45 +00:00
Ryan C. Gordon f22dfbf214 Minor cosmetic tweak. 2003-03-30 20:46:25 +00:00
Ryan C. Gordon c3ebe9f352 Updated. 2003-03-30 20:45:57 +00:00
Ryan C. Gordon 753f624be4 Initial add. 2003-03-30 20:44:57 +00:00
Ryan C. Gordon ef16139d8b Updated. 2003-03-30 19:00:27 +00:00
Ryan C. Gordon 3a27dd9310 Descent I/II HOG and MVL archive support (thanks, Bradley Bell!). 2003-03-30 18:59:54 +00:00
Ryan C. Gordon 433d7f0f44 Updated. 2003-03-30 18:46:29 +00:00
Ryan C. Gordon 1344feceda Fixed seeking in uncompressed zip entries and handle Java-created JAR files.
(Thanks to "Tree" for pointing out these bugs).
2003-03-30 18:44:59 +00:00
Ryan C. Gordon 3744f54064 Minor brainfart fix in verifySecurity() and optimized mkdir(). 2003-03-19 06:31:53 +00:00
Ryan C. Gordon 8bdc0ea570 Two important PHYSFS_mkdir() fixes (one involving a change to
__PHYSFS_verifySecurity()...).
2003-03-19 06:04:09 +00:00
Ryan C. Gordon 8295a783d2 Updated. 2003-03-19 06:01:41 +00:00
bhook 433ae86ef8 *** empty log message *** 2003-03-16 03:30:43 +00:00
bhook f101472293 *** empty log message *** 2003-03-16 03:26:52 +00:00
bhook e83d8bc71c *** empty log message *** 2003-03-12 21:13:29 +00:00
Ryan C. Gordon c064749ad8 Updated. 2003-03-12 09:04:19 +00:00
Ryan C. Gordon f3f15edb4a Made archiver case-insensitive for Quake 2 compatibility. 2003-03-12 09:02:02 +00:00
Ryan C. Gordon 0e334ae164 Updated. 2003-03-12 06:24:26 +00:00
Ryan C. Gordon 6f1d693fe8 Another attempt at type size correctness. 2003-03-12 06:19:37 +00:00
Ryan C. Gordon 01505d8d58 Attempt at type correctness. 2003-03-12 05:39:51 +00:00
Ryan C. Gordon 1c8cec3d3e Updated. 2003-01-31 04:10:19 +00:00
Ryan C. Gordon 3a479b6cd8 Now compiles on CodeWarrior 6 for MacOS Classic again. 2003-01-31 04:07:48 +00:00
Ryan C. Gordon b35cef5ee2 Updated. 2003-01-31 02:11:59 +00:00
Ryan C. Gordon ea760f1247 Added buffering API to list of exported symbols in OS/2 build. 2003-01-31 02:10:15 +00:00
Ryan C. Gordon 0330dfac4f Updated. 2003-01-28 18:31:15 +00:00
Ryan C. Gordon c518013bc3 Updated. 2003-01-28 18:29:10 +00:00
Ryan C. Gordon 7246213c2f Fixed seeking in readable, buffered files. 2003-01-28 18:27:44 +00:00
Gregory S. Read 48cb3c70ef -First version of PhysFS.NET. 2003-01-07 23:35:10 +00:00
157 changed files with 30698 additions and 20665 deletions

View File

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

342
CHANGELOG
View File

@ -1,342 +0,0 @@
/*
* CHANGELOG.
*/
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 ...

69
CREDITS
View File

@ -1,69 +0,0 @@
Initial API interface and implementation,
GRP driver,
DIR driver,
Unix support,
Win32 support,
BeOS support,
POSIX support,
OS/2 support,
ZIP driver,
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
Spanish translation:
Pedro J. Pérez
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
Other stuff:
Your name here! Patches go to icculus@clutteredmind.org ...
/* end of CREDITS ... */

Binary file not shown.

123
INSTALL
View File

@ -1,123 +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.
Visual Studio.NET users should do the same thing, but use the "physfs.vcproj"
and "test_physfs.vcproj" project files instead.
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)

504
LICENSE
View File

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

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,146 +0,0 @@
lib_LTLIBRARIES = libphysfs.la
libphysfsincludedir = $(includedir)
libphysfsinclude_HEADERS = \
physfs.h
if BUILD_MACOSX
ZLIB_FILES = zlib114/adler32.c \
zlib114/compress.c \
zlib114/crc32.c \
zlib114/deflate.c \
zlib114/deflate.h \
zlib114/infblock.c \
zlib114/infblock.h \
zlib114/infcodes.c \
zlib114/infcodes.h \
zlib114/inffast.c \
zlib114/inffast.h \
zlib114/inffixed.h \
zlib114/inflate.c \
zlib114/inftrees.c \
zlib114/inftrees.h \
zlib114/infutil.c \
zlib114/infutil.h \
zlib114/trees.c \
zlib114/trees.h \
zlib114/uncompr.c \
zlib114/zconf.h \
zlib114/zlib.h \
zlib114/zutil.c \
zlib114/zutil.h
if BUILD_ZLIB
ZLIB_SRC = $(ZLIB_FILES)
ZLIB_INC = -I$(top_srcdir)/zlib114
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/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.sit \
physfs.spec \
physfs.dsp \
test_physfs.dsp \
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 \
makeos2.cmd \
$(ZLIB_EXTRADIST) $(BEOS_EXTRADIST) $(TEST_EXTRADIST)
else
SUBDIRS = platform archivers zlib114 . test extras
libphysfs_la_SOURCES = \
physfs.c \
physfs_internal.h \
physfs_byteorder.c
if BUILD_ZLIB
ZLIB_LIB = zlib114/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 \
CWProjects.sit \
physfs.spec.in \
physfs.spec \
physfs.dsp \
test_physfs.dsp \
makeos2.cmd
endif
dist-hook:
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,47 +0,0 @@
lib_LTLIBRARIES = libphysfs.la
SUBDIRS = platform archivers zlib114 . test extras
libphysfsincludedir = $(includedir)
libphysfsinclude_HEADERS = \
physfs.h
libphysfs_la_SOURCES = \
physfs.c \
physfs_internal.h \
physfs_byteorder.c
if BUILD_ZLIB
ZLIB_LIB = zlib114/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 \
CWProjects.sit \
physfs.spec.in \
physfs.spec \
physfs.dsp \
test_physfs.dsp \
makeos2.cmd
dist-hook:
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

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.8
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 GNU LGPL license: http://www.gnu.org/copyleft/lesser.html

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 0.1.8
Version 1
Description PhysFS 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 0.1.8
Version 1
Description PhysFS 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 GNU LGPL license: http://www.gnu.org/copyleft/lesser.html

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.

31
TODO
View File

@ -1,31 +0,0 @@
Stuff that needs to be done and wishlist:
These are in no particular order. A 1.0 release is reliant on doing some of
this stuff. 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. I thought it might be neat to have MBOX and Maildir
support so that both "archives" look identical to an application; might be
nice for an email program. That's blue sky, unless someone wants to tackle
it.
- I'm a little nervous about the use of linked lists in qpak.c.
- Add qpak.c and PHYSFS_SUPPORTS_QPAK to mac classic projects.
- macclassic.c :
"/* (Hmm. Default behaviour is broken in the base library. :) ) */"
- Platforms to be verified as working: Solaris, WinNT 3.1, WinME, WinXP,
MacOS 8.1
- Platforms to port to: PocketPC (Maybe can just use win32.c?),
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).
- Check for tab chars in the source.
- Probably other stuff. Requests and recommendations are welcome.
// end of TODO ...

View File

@ -1,9 +0,0 @@
#undef DEBUG
#undef DEBUG_CHATTER
#undef NDEBUG
#undef PHYSFS_SUPPORTS_ZIP
#undef PHYSFS_SUPPORTS_GRP
#undef PHYSFS_HAVE_READLINE
#undef PHYSFS_HAVE_LLSEEK

View File

@ -1,10 +0,0 @@
Makefile
.deps
.libs
unzip.lo
dir.lo
Makefile.in
grp.lo
zip.lo
libarchivers.la
qpak.lo

View File

@ -1,14 +0,0 @@
noinst_LTLIBRARIES = libarchivers.la
if BUILD_ZLIB
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/zlib114
else
INCLUDES = -I$(top_srcdir)
endif
libarchivers_la_SOURCES = \
dir.c \
grp.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,778 +0,0 @@
/*
* Quake PAK support routines for PhysicsFS.
*
* This driver handles id Software Quake PAK files.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ed Sinjiashvili.
*/
#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"
#define QPAK_MAXDIRLEN 60
typedef struct
{
char name[56];
PHYSFS_uint32 offset;
PHYSFS_uint32 size;
} QPAKentry;
typedef struct tagQPAKdirentry
{
char *name;
QPAKentry *entry;
struct tagQPAKdirentry *next;
} QPAKdirentry;
typedef struct QPAKDirectory
{
char name[QPAK_MAXDIRLEN];
struct QPAKDirectory *dirs, *next;
QPAKdirentry *files;
} QPAKdirectory;
typedef struct
{
void *handle;
char *filename;
PHYSFS_uint32 dirOffset;
PHYSFS_uint32 totalEntries;
QPAKentry *entries;
QPAKdirectory *root;
} QPAKinfo;
typedef struct
{
void *handle;
QPAKentry *entry;
PHYSFS_sint64 curPos;
} QPAKfileinfo;
static int QPAK_isArchive(const char *filename, int forWriting);
static DirHandle *QPAK_openArchive(const char *name, int forWriting);
static void QPAK_dirClose(DirHandle *h);
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 *e);
static int QPAK_isSymLink(DirHandle *h, const char *name, int *e);
static PHYSFS_sint64 QPAK_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *QPAK_openRead(DirHandle *h, const char *name, int *e);
static FileHandle *QPAK_openWrite(DirHandle *h, const char *name);
static FileHandle *QPAK_openAppend(DirHandle *h, const char *name);
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_remove(DirHandle *h, const char *name);
static int QPAK_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
{
"PAK",
"Quake PAK file format",
"Ed Sinjiashvili <slimb@swes.saren.ru>",
"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 */
};
#define QPAK_MAGIC 0x4B434150 /* look like "PACK" in ascii. */
/*
* Read an unsigned 32-bit int and swap to native byte order.
*/
static int readui32(void *in, PHYSFS_uint32 *val)
{
PHYSFS_uint32 v;
BAIL_IF_MACRO(__PHYSFS_platformRead(in, &v, sizeof (v), 1) != 1, NULL, 0);
*val = PHYSFS_swapULE32(v);
return(1);
} /* readui32 */
static int openQPak(const char *filename, int forWriting, void **fileHandle)
{
PHYSFS_uint32 sig;
*fileHandle = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fileHandle = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fileHandle == NULL, NULL, 0);
if (!readui32(*fileHandle, &sig))
goto openPak_failed;
if (sig != QPAK_MAGIC)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openPak_failed;
} /* if */
return(1);
openPak_failed:
if (*fileHandle != NULL)
__PHYSFS_platformClose(*fileHandle);
*fileHandle = NULL;
return(0);
} /* openQPak */
static int QPAK_isArchive(const char *filename, int forWriting)
{
void *fileHandle;
int retval = openQPak(filename, forWriting, &fileHandle);
if (fileHandle != NULL)
__PHYSFS_platformClose(fileHandle);
return(retval);
} /* QPAK_isArchive */
static int qpak_loadEntries(void *fh, int dirOffset, int numEntries,
QPAKentry *entries)
{
PHYSFS_sint32 i;
BAIL_IF_MACRO(__PHYSFS_platformSeek(fh, dirOffset) == 0, NULL, 0);
for (i = 0; i < numEntries; i++, entries++)
{
PHYSFS_sint64 r = __PHYSFS_platformRead(fh, entries->name, 56, 1);
BAIL_IF_MACRO(r == 0, NULL, 0);
BAIL_IF_MACRO(!readui32(fh, &entries->offset), NULL, 0);
BAIL_IF_MACRO(!readui32(fh, &entries->size), NULL, 0);
} /* for */
return(1);
} /* qpak_loadEntries */
static QPAKdirentry *qpak_newDirentry(char *name, QPAKentry *entry)
{
QPAKdirentry *retval = (QPAKdirentry *) malloc(sizeof (QPAKdirentry));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, 0);
retval->name = name;
retval->entry = entry;
retval->next = NULL;
return(retval);
} /* qpak_newDirentry */
static void qpak_deleteDirentry(QPAKdirentry *e)
{
while (e != NULL)
{
QPAKdirentry *next = e->next;
free(e);
e = next;
} /* while */
} /* qpak_deleteDirentry */
static QPAKdirectory *qpak_newDirectory(char *name)
{
QPAKdirectory *dir = (QPAKdirectory *) malloc(sizeof (QPAKdirectory));
BAIL_IF_MACRO(dir == NULL, ERR_OUT_OF_MEMORY, 0);
strcpy(dir->name, name);
dir->dirs = NULL;
dir->next = NULL;
dir->files = NULL;
return dir;
} /* qpak_newDirectory */
static void qpak_deleteDirectory(QPAKdirectory *d)
{
while (d != NULL)
{
QPAKdirectory *next = d->next;
qpak_deleteDirentry(d->files);
qpak_deleteDirectory(d->dirs);
free(d);
d = next;
} /* while */
} /* qpak_deleteDirectory */
static int qpak_addFile(QPAKdirectory *dir, char *name, QPAKentry *entry)
{
QPAKdirentry *file = qpak_newDirentry(name, entry);
if (file == NULL)
return(0);
/* !!! FIXME: Traversing a linkedlist gets slower with each added file. */
if (dir->files == NULL)
{
dir->files = file;
} /* if */
else
{
QPAKdirentry *tail = dir->files;
while (tail->next != NULL)
tail = tail->next;
tail->next = file;
} /* else */
return(1);
} /* qpak_addFile */
static QPAKdirectory *qpak_findDirectory(QPAKdirectory *root, const char *name)
{
char *p = strchr(name, '/');
if (p == NULL)
{
QPAKdirectory *thisDir = root->dirs;
while (thisDir != NULL)
{
if (strcmp(thisDir->name, name) == 0)
return(thisDir);
thisDir = thisDir->next;
} /* while */
} /* if */
else
{
char temp[QPAK_MAXDIRLEN];
QPAKdirectory *thisDir = root->dirs;
strncpy (temp, name, p - name);
temp[p - name] = '\0';
while (thisDir != NULL)
{
if (strcmp(thisDir->name, temp) == 0)
return(qpak_findDirectory(thisDir, p + 1));
thisDir = thisDir->next;
} /* while */
} /* else */
BAIL_MACRO(ERR_NO_SUCH_PATH, 0);
} /* qpak_findDirectory */
static QPAKdirectory *qpak_addDir(QPAKdirectory *dir, char *name)
{
QPAKdirectory *newDir = qpak_findDirectory(dir, name);
if (newDir != 0)
return(newDir);
newDir = qpak_newDirectory(name);
if (newDir == 0)
return 0;
if (dir->dirs == NULL)
{
dir->dirs = newDir;
} /* if */
else
{
QPAKdirectory *tail = dir->dirs;
while (tail->next != NULL)
tail = tail->next;
tail->next = newDir;
} /* else */
return(newDir);
} /* qpak_addDir */
static int qpak_addEntry(QPAKdirectory *dir, char *name, QPAKentry *entry)
{
char tempName[QPAK_MAXDIRLEN];
QPAKdirectory *child;
char *p = strchr(name, '/');
if (p == NULL)
return(qpak_addFile(dir, name, entry));
strncpy(tempName, name, p - name);
tempName[p - name] = '\0';
child = qpak_addDir(dir, tempName);
return(qpak_addEntry(child, p + 1, entry));
} /* qpak_addEntry */
static QPAKentry *qpak_findEntry(QPAKdirectory *root, const char *name)
{
QPAKdirectory *dir = NULL;
QPAKdirentry *thisFile = NULL;
const char *t = strrchr (name, '/');
if (t == NULL)
{
dir = root;
t = name;
} /* if */
else
{
char temp[QPAK_MAXDIRLEN];
strncpy(temp, name, t - name);
temp[t - name] = '\0';
dir = qpak_findDirectory(root, temp);
t++;
} /* else */
if (dir == NULL)
return(0);
thisFile = dir->files;
while (thisFile != NULL)
{
if (strcmp(thisFile->name, t) == 0)
return(thisFile->entry);
thisFile = thisFile->next;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, 0);
} /* qpak_findEntry */
static int qpak_populateDirectories(QPAKentry *entries, int numEntries,
QPAKdirectory *root)
{
PHYSFS_sint32 i;
QPAKentry *entry = entries;
for (i = 0; i < numEntries; i++, entry++)
{
if (qpak_addEntry(root, entry->name, entry) == 0)
return(0);
} /* for */
return(1);
} /* qpak_populateDirectories */
static void qpak_deletePakInfo(QPAKinfo *pakInfo)
{
if (pakInfo->handle != NULL)
__PHYSFS_platformClose(pakInfo->handle);
if (pakInfo->filename != NULL)
free(pakInfo->filename);
if (pakInfo->entries != NULL)
free(pakInfo->entries);
qpak_deleteDirectory(pakInfo->root);
free(pakInfo);
} /* qpak_deletePakInfo */
static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
QPAKentry *a = (QPAKentry *) _a;
return(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 DirHandle *QPAK_openArchive(const char *name, int forWriting)
{
void *fh = NULL;
PHYSFS_uint32 dirOffset, dirLength;
QPAKinfo *pi;
DirHandle *retval;
retval = (DirHandle *) malloc(sizeof (DirHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
pi = (QPAKinfo *) malloc(sizeof (QPAKinfo));
if (pi == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
retval->opaque = pi;
pi->filename = (char *) malloc(strlen(name) + 1);
if (pi->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto QPAK_openArchive_failed;
} /* if */
if (!openQPak(name, forWriting, &fh))
goto QPAK_openArchive_failed;
if (!readui32(fh, &dirOffset))
goto QPAK_openArchive_failed;
if (!readui32(fh, &dirLength))
goto QPAK_openArchive_failed;
if (__PHYSFS_platformFileLength(fh) < dirOffset + dirLength)
goto QPAK_openArchive_failed;
strcpy(pi->filename, name);
pi->handle = fh;
pi->dirOffset = dirOffset;
pi->totalEntries = dirLength / 64;
pi->entries = (QPAKentry *) malloc(pi->totalEntries * sizeof (QPAKentry));
if (pi->entries == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto QPAK_openArchive_failed;
} /* if */
if (qpak_loadEntries(fh, dirOffset, pi->totalEntries, pi->entries) == 0)
goto QPAK_openArchive_failed;
__PHYSFS_sort(pi->entries, pi->totalEntries,
qpak_entry_cmp, qpak_entry_swap);
pi->root = qpak_newDirectory("");
if (pi->root == NULL)
goto QPAK_openArchive_failed;
if (qpak_populateDirectories(pi->entries, pi->totalEntries, pi->root) == 0)
goto QPAK_openArchive_failed;
retval->funcs = &__PHYSFS_DirFunctions_QPAK;
return(retval);
QPAK_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
qpak_deletePakInfo((QPAKinfo *) retval->opaque);
free(retval);
} /* if */
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(0);
} /* QPAK_openArchive */
static void QPAK_dirClose(DirHandle *dirHandle)
{
qpak_deletePakInfo((QPAKinfo *) dirHandle->opaque);
free(dirHandle);
} /* QPAK_dirClose */
static LinkedStringList *QPAK_enumerateFiles(DirHandle *h, const char *dirname,
int omitSymLinks)
{
LinkedStringList *retval = NULL, *p = NULL;
QPAKdirectory *dir;
QPAKinfo *info = (QPAKinfo *) h->opaque;
if ((dirname == NULL) || (*dirname == '\0'))
dir = info->root;
else
dir = qpak_findDirectory(info->root, dirname);
if (dir != NULL)
{
QPAKdirectory *child = dir->dirs;
QPAKdirentry *file = dir->files;
while (child != NULL)
{
retval = __PHYSFS_addToLinkedStringList(retval, &p, child->name, -1);
child = child->next;
} /* while */
while (file != NULL)
{
retval = __PHYSFS_addToLinkedStringList(retval, &p, file->name, -1);
file = file->next;
} /* while */
} /* if */
return(retval);
} /* QPAK_enumerateFiles */
static int QPAK_exists(DirHandle *h, const char *name)
{
QPAKinfo *driver = (QPAKinfo *) h->opaque;
if ((name == NULL) || (*name == '\0'))
return(0);
if (qpak_findDirectory(driver->root, name) != 0)
return(1);
if (qpak_findEntry(driver->root, name) != 0)
return(1);
return(0);
} /* QPAK_exists */
static int QPAK_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
QPAKinfo *info = (QPAKinfo *) h->opaque;
*fileExists = (qpak_findDirectory(info->root, name) != 0);
return(*fileExists);
} /* QPAK_isDirectory */
static int QPAK_isSymLink(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = QPAK_exists(h, name);
return(0); /* we don't support symlinks for now */
} /* QPAK_isSymlink */
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 */
static PHYSFS_sint64 QPAK_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
QPAKinfo *info = (QPAKinfo *) h->opaque;
PHYSFS_sint64 retval = -1;
*fileExists = QPAK_exists(h, name);
if (*fileExists)
retval = __PHYSFS_platformGetLastModTime(info->filename);
return(retval);
} /* QPAK_getLastModTime */
static void *qpak_getFileHandle(const char *name, QPAKentry *entry)
{
void *retval = __PHYSFS_platformOpenRead(name);
if (retval == NULL)
return(NULL);
if (!__PHYSFS_platformSeek(retval, entry->offset))
{
__PHYSFS_platformClose(retval);
return(NULL);
} /* if */
return(retval);
} /* qpak_getFileHandle */
static FileHandle *QPAK_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
QPAKinfo *driver = (QPAKinfo *) h->opaque;
QPAKentry *entry = qpak_findEntry(driver->root, fnm);
QPAKfileinfo *fileDriver = 0;
FileHandle *result = 0;
*fileExists = (entry != NULL);
if (entry == NULL)
return(NULL);
fileDriver = (QPAKfileinfo *) malloc(sizeof (QPAKfileinfo));
BAIL_IF_MACRO(fileDriver == NULL, ERR_OUT_OF_MEMORY, NULL);
fileDriver->handle = qpak_getFileHandle(driver->filename, entry);
if (fileDriver->handle == NULL)
{
free(fileDriver);
return(NULL);
} /* if */
fileDriver->entry = entry;
fileDriver->curPos = 0;
result = (FileHandle *)malloc(sizeof (FileHandle));
if (result == NULL)
{
__PHYSFS_platformClose(fileDriver->handle);
free(fileDriver);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
result->opaque = fileDriver;
result->dirHandle = h;
result->funcs = &__PHYSFS_FileFunctions_QPAK;
return(result);
} /* 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 PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
QPAKentry *entry = finfo->entry;
PHYSFS_uint64 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint64 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = (PHYSFS_uint32) objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (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 >= (PHYSFS_sint64) 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;
PHYSFS_uint64 newPos = entry->offset + offset;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(newPos > entry->offset + entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, newPos);
if (rc)
finfo->curPos = offset;
return(rc);
} /* QPAK_seek */
static PHYSFS_sint64 QPAK_fileLength(FileHandle *handle)
{
return ((QPAKfileinfo *) handle->opaque)->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 */
#endif /* defined PHYSFS_SUPPORTS_QPAK */
/* end of qpak.c ... */

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
#!/bin/sh
set -e
echo "Initial preparation...this can take awhile, so sit tight..."
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,480 +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=0
MINOR_VERSION=1
MICRO_VERSION=8
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_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
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 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])
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])
LIBS="$LIBS -lreadline -lcurses"
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 = 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
if test x$physfslang = xspanish; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_SPANISH, [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 = xgerman; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_GERMAN, [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=spanish])
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([*** --enable-language=french])
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$build_os = xbeos; then
this_is_beos=yes
enable_pthreads=no
have_non_posix_threads=yes
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$build_os = xcygwin; then
this_is_cygwin=yes
PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32"
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 $build_os |sed "s/darwin.*/darwin/"`
if test x$x = xdarwin -a x$build_vendor = xapple; then
this_is_macosx=yes
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 $build_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 $build_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 $build_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 $build_os |tr A-Z a-z |sed "s/.*os2.*/os2/"`
if test x$x = xos2; then
this_is_os2=yes
PHYSFSCFLAGS="$PHYSFSCFLAGS -DOS2"
fi
AC_MSG_RESULT([$this_is_os2])
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)
AC_OUTPUT([
Makefile
archivers/Makefile
platform/Makefile
zlib114/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.

13
debian/copyright vendored
View File

@ -1,13 +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.
You are free to distribute this software under the terms of the GNU Lesser
General Public License.
On Debian systems, the complete text of the GNU Lesser General Public License
can be found in the file `/usr/share/common-licenses/LGPL'.

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

@ -1,4 +1,4 @@
# Doxyfile 1.2.16
# Doxyfile 1.3.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@ -11,7 +11,7 @@
# Values that contain spaces should be placed between quotes (" ")
#---------------------------------------------------------------------------
# General configuration options
# Project related configuration options
#---------------------------------------------------------------------------
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
@ -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 = 0.1.8
# (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.
@ -36,50 +37,22 @@ OUTPUT_DIRECTORY = docs
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Brazilian, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean,
# Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovene,
# Spanish, Swedish and Ukrainian.
# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese,
# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
# This tag can be used to specify the encoding used in the generated output.
# The encoding is not always determined by the language that is chosen,
# but also whether or not the output is meant for Windows or non-Windows users.
# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
# forces the Windows encoding (this is the default for the Windows binary),
# whereas setting the tag to NO uses a Unix-style encoding (the default for
# all platforms other than Windows).
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these class will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
USE_WINDOWS_ENCODING = NO
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
@ -115,65 +88,34 @@ INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user defined part of the path. Stripping is
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. It is allowed to use relative paths in the argument list.
STRIP_FROM_PATH =
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower case letters. If set to YES upper case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# users are adviced to set this option to NO.
CASE_SENSE_NAMES = YES
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like the Qt-style comments (thus requiring an
# comments will behave just like the Qt-style comments (thus requiring an
# explict @brief command for a brief description.
JAVADOC_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
# will output the detailed description near the top, like JavaDoc.
# If set to NO, the detailed description appears after the member
@ -187,18 +129,6 @@ DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
@ -211,6 +141,132 @@ DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 4
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = YES
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
# only. Doxygen will then generate output that is more tailored for Java.
# For instance, namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# users are advised to set this option to NO.
CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
@ -229,14 +285,11 @@ GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
ALIASES =
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
@ -244,7 +297,7 @@ ALIASES =
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or define consist of for it to appear in
# the initial value of a variable or define consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and defines in the
@ -253,20 +306,6 @@ ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C.
# For instance some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = YES
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
# only. Doxygen will then generate output that is more tailored for Java.
# For instance namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
@ -294,6 +333,13 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
@ -316,14 +362,14 @@ 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
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
# *.h++ *.idl *.odl
# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc
FILE_PATTERNS =
@ -387,7 +433,7 @@ INPUT_FILTER =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse.
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
@ -405,6 +451,12 @@ SOURCE_BROWSER = NO
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES (the default)
# then for each documented function all documented
# functions referencing it will be listed.
@ -417,6 +469,12 @@ REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@ -438,7 +496,7 @@ COLS_IN_ALPHA_INDEX = 5
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
@ -473,7 +531,7 @@ HTML_HEADER =
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet
@ -493,6 +551,20 @@ HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output dir.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
@ -506,7 +578,7 @@ GENERATE_CHI = NO
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the Html help documentation and to the tree view.
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
@ -524,10 +596,9 @@ ENUM_VALUES_PER_LINE = 4
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
# generated containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
# or Internet explorer 4.0+). Note that for large projects the tree generation
# can take a very long time. In such cases it is better to disable this feature.
# Windows users are probably better off using the HTML help feature.
# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
# probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
@ -552,7 +623,8 @@ GENERATE_LATEX = YES
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
LATEX_CMD_NAME = latex
@ -606,6 +678,12 @@ USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
@ -688,6 +766,24 @@ MAN_LINKS = YES
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@ -700,6 +796,39 @@ GENERATE_XML = NO
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader. This is useful
# if you want to understand what is going on. On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
@ -747,9 +876,11 @@ INCLUDE_FILE_PATTERNS =
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed.
PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 __EXPORT__=
PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \
PHYSFS_DECL= \
PHYSFS_DEPRECATED=
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
# 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.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
@ -758,8 +889,9 @@ EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
# on a line and do not end with a semicolon. Such function macros are typically
# used for boiler-plate code, and will confuse the parser if not removed.
# on a line, have an all uppercase name, and do not end with a semicolon. Such
# function macros are typically used for boiler-plate code, and will confuse the
# parser if not removed.
SKIP_FUNCTION_MACROS = YES
@ -767,7 +899,20 @@ SKIP_FUNCTION_MACROS = YES
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
# The TAGFILES tag can be used to specify one or more tagfiles.
# The TAGFILES option can be used to specify one or more tagfiles.
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
# Note that each tag file must have a unique name
# (where the name does NOT include the path)
# If a tag file is not located in the directory in which doxygen
# is run, you must also specify the path to the tagfile here.
TAGFILES =
@ -798,7 +943,7 @@ PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
# super classes. Setting the tag to NO turns the diagrams off. Note that this
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
# recommended to install and use dot, since it yields more powerful graphs.
@ -832,6 +977,12 @@ CLASS_GRAPH = NO
COLLABORATION_GRAPH = NO
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similiar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
@ -851,6 +1002,14 @@ INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
# generate a call dependency graph for every global function or class method.
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command.
CALL_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
@ -889,6 +1048,17 @@ MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes that
# lay further from the root node will be omitted. Note that setting this option to
# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
# note that a graph may be further truncated if the graph's image dimensions are
# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
# If 0 is used for the depth value (the default), the graph is not depth-constrained.
MAX_DOT_GRAPH_DEPTH = 0
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
@ -896,7 +1066,7 @@ MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermedate dot files that are used to generate
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
@ -909,38 +1079,3 @@ DOT_CLEANUP = YES
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
# The CGI_NAME tag should be the name of the CGI script that
# starts the search engine (doxysearch) with the correct parameters.
# A script with this name will be generated by doxygen.
CGI_NAME = search.cgi
# The CGI_URL tag should be the absolute URL to the directory where the
# cgi binaries are located. See the documentation of your http daemon for
# details.
CGI_URL =
# The DOC_URL tag should be the absolute URL to the directory where the
# documentation is located. If left blank the absolute path to the
# documentation, with file:// prepended to it, will be used.
DOC_URL =
# The DOC_ABSPATH tag should be the absolute path to the directory where the
# documentation is located. If left blank the directory on the local machine
# will be used.
DOC_ABSPATH =
# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
# is installed.
BIN_ABSPATH = /usr/local/bin/
# The EXT_DOC_PATHS tag can be used to specify one or more paths to
# documentation generated for other projects. This allows doxysearch to search
# the documentation for these projects as well.
EXT_DOC_PATHS =

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

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

@ -1,5 +1,5 @@
/*
* stdio/physfs abstraction layer 2002-12-03
* stdio/physfs abstraction layer 2003-04-02
*
* Adam D. Moss <adam@gimp.org> <aspirin@icculus.org>
*
@ -15,7 +15,7 @@ you may embed this wrapper code within commercial software); PhysicsFS itself
is (at the time of writing) released under a different license with
additional restrictions.
Copyright (C) 2002 Adam D. Moss (the "Author"). All Rights Reserved.
Copyright (C) 2002-2003 Adam D. Moss (the "Author"). All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -55,6 +55,8 @@ from the Author.
* MY_GETC fgetc(...)
* MY_GETS fgets(...)
* MY_ATEOF feof(...)
* MY_TELL ftell(...)
* MY_SEEK fseek(..., SEEK_SET)
* MY_REWIND rewind(...)
* MY_SETBUFFER (not a standard for stdio, does nothing there)
*/
@ -90,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
@ -116,8 +118,8 @@ static int MY_GETC(MY_FILETYPE *const fp) {
}
return c;
}
static char * MY_GETS(char * const str, const int size,
MY_FILETYPE *const fp) {
static char * MY_GETS(char * const str, const int size,
MY_FILETYPE *const fp) {
int i = 0;
int c;
do {
@ -129,9 +131,9 @@ static char * MY_GETS(char * const str, const int size,
break;
}
str[i++] = c;
} while (c != '\0' &&
c != -1 &&
c != '\n');
} while (c != '\0' &&
c != -1 &&
c != '\n');
str[i] = '\0';
if (i == 0) {
return NULL;
@ -140,7 +142,9 @@ static char * MY_GETS(char * const str, const int size,
}
#define MY_CLOSE(fp) PHYSFS_close(fp)
#define MY_ATEOF(fp) PHYSFS_eof(fp)
#define MY_REWIND(fp) PHYSFS_seek(fp,0)
#define MY_TELL(fp) PHYSFS_tell(fp)
#define MY_SEEK(fp,o) PHYSFS_seek(fp,o)
#define MY_REWIND(fp) MY_SEEK(fp,0)
#else
@ -151,8 +155,11 @@ static char * MY_GETS(char * const str, const int size,
#define MY_GETS(str,size,fp) fgets(str,size,fp)
#define MY_CLOSE(fp) fclose(fp)
#define MY_ATEOF(fp) feof(fp)
#define MY_TELL(fp) ftell(fp)
#define MY_SEEK(fp,o) fseek(fp,o, SEEK_SET)
#define MY_REWIND(fp) rewind(fp)
static void MY_SETBUFFER(const MY_FILETYPE *const file, const int num) { }
/*static void MY_SETBUFFER(const MY_FILETYPE *const file, const int num) { }*/
#define MY_SETBUFFER(fp,size)
#endif
#endif

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

239
extras/globbing.c Normal file
View File

@ -0,0 +1,239 @@
/** \file globbing.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "globbing.h"
/**
* Please see globbing.h for details.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see the file LICENSE.txt in the source's root directory.
*
* \author Ryan C. Gordon.
*/
static int matchesPattern(const char *fname, const char *wildcard,
int caseSensitive)
{
char x, y;
const char *fnameptr = fname;
const char *wildptr = wildcard;
while ((*wildptr) && (*fnameptr))
{
y = *wildptr;
if (y == '*')
{
do
{
wildptr++; /* skip multiple '*' in a row... */
} while (*wildptr == '*');
y = (caseSensitive) ? *wildptr : (char) tolower(*wildptr);
while (1)
{
x = (caseSensitive) ? *fnameptr : (char) tolower(*fnameptr);
if ((!x) || (x == y))
break;
else
fnameptr++;
} /* while */
} /* if */
else if (y == '?')
{
wildptr++;
fnameptr++;
} /* else if */
else
{
if (caseSensitive)
x = *fnameptr;
else
{
x = tolower(*fnameptr);
y = tolower(y);
} /* if */
wildptr++;
fnameptr++;
if (x != y)
return 0;
} /* else */
} /* while */
while (*wildptr == '*')
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)
{
const PHYSFS_Allocator *allocator = PHYSFS_getAllocator();
char **list = PHYSFS_enumerateFiles(dir);
char **retval = NULL;
int totalmatches = 0;
int matches = 0;
char **i;
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))
totalmatches++;
} /* for */
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 */
#ifdef TEST_PHYSFSEXT_ENUMERATEFILESWILDCARD
int main(int argc, char **argv)
{
int rc;
char **flist;
char **i;
if (argc != 3)
{
printf("USAGE: %s <pattern> <caseSen>\n"
" where <caseSen> is 1 or 0.\n", argv[0]);
return 1;
} /* if */
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 1;
} /* if */
if (!PHYSFS_addToSearchPath(".", 1))
{
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
flist = PHYSFSEXT_enumerateFilesWildcard("/", argv[1], atoi(argv[2]));
rc = 0;
for (i = flist; *i; i++)
{
printf("%s\n", *i);
rc++;
} /* for */
printf("\n total %d files.\n\n", rc);
PHYSFSEXT_freeEnumeration(flist);
PHYSFS_deinit();
return 0;
} /* main */
#endif
/* end of globbing.c ... */

165
extras/globbing.h Normal file
View File

@ -0,0 +1,165 @@
#ifndef INCL_PHYSFSEXT_GLOBBING_H
#define INCL_PHYSFSEXT_GLOBBING_H
/** \file globbing.h */
#include "physfs.h"
/**
* \mainpage PhysicsFS globbing
*
* This is an extension to PhysicsFS to let you search for files with basic
* wildcard matching, regardless of what sort of filesystem or archive they
* reside in. It does this by enumerating directories as needed and manually
* locating matching entries.
*
* Usage: Set up PhysicsFS as you normally would, then use
* PHYSFSEXT_enumerateFilesWildcard() when enumerating files. This is just
* like PHYSFS_enumerateFiles(), but it returns a subset that matches your
* 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.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* 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, 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",
* "y.Sav", and "z.txt", and there is also a "C:\userdir" in the search path
* that has a "savegames" subdirectory with "w.sav", then the following code:
*
* \code
* char **rc = PHYSFS_enumerateFilesWildcard("savegames", "*.sav", 0);
* char **i;
*
* for (i = rc; *i != NULL; i++)
* printf(" * We've got [%s].\n", *i);
*
* PHYSFS_freeList(rc);
* \endcode
*
* ...will print:
*
* \verbatim
* We've got [x.sav].
* We've got [y.Sav].
* We've got [w.sav].\endverbatim
*
* Feel free to sort the list however you like. We only promise there will
* be no duplicates, but not what order the final list will come back in.
*
* 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 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
*/
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 ... */

203
extras/ignorecase.c Normal file
View File

@ -0,0 +1,203 @@
/** \file ignorecase.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "physfs.h"
#include "ignorecase.h"
/**
* Please see ignorecase.h for details.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* \author Ryan C. Gordon.
*/
static int locateOneElement(char *buf)
{
char *ptr;
char **rc;
char **i;
if (PHYSFS_exists(buf))
return 1; /* quick rejection: exists in current case. */
ptr = strrchr(buf, '/'); /* find entry at end of path. */
if (ptr == NULL)
{
rc = PHYSFS_enumerateFiles("/");
ptr = buf;
} /* if */
else
{
*ptr = '\0';
rc = PHYSFS_enumerateFiles(buf);
*ptr = '/';
ptr++; /* point past dirsep to entry itself. */
} /* else */
if (rc != NULL)
{
for (i = rc; *i != NULL; i++)
{
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... */
return 0;
} /* locateOneElement */
int PHYSFSEXT_locateCorrectCase(char *buf)
{
int rc;
char *ptr;
while (*buf == '/') /* skip any '/' at start of string... */
buf++;
ptr = buf;
if (*ptr == '\0')
return 0; /* Uh...I guess that's success. */
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. */
} /* while */
/* check final element... */
return locateOneElement(buf) ? 0 : -1;
} /* PHYSFSEXT_locateCorrectCase */
#ifdef TEST_PHYSFSEXT_LOCATECORRECTCASE
int main(int argc, char **argv)
{
int rc;
char buf[128];
PHYSFS_File *f;
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 1;
} /* if */
if (!PHYSFS_addToSearchPath(".", 1))
{
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
if (!PHYSFS_setWriteDir("."))
{
fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
if (!PHYSFS_mkdir("/a/b/c"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
if (!PHYSFS_mkdir("/a/b/C"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
f = PHYSFS_openWrite("/a/b/c/x.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
f = PHYSFS_openWrite("/a/b/C/X.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
strcpy(buf, "/a/b/c/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 1 failed\n");
strcpy(buf, "/a/B/c/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 2 failed\n");
strcpy(buf, "/a/b/C/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/C/X.txt") != 0))
printf("test 3 failed\n");
strcpy(buf, "/a/b/c/X.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 4 failed\n");
strcpy(buf, "/a/b/c/z.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != -1) || (strcmp(buf, "/a/b/c/z.txt") != 0))
printf("test 5 failed\n");
strcpy(buf, "/A/B/Z/z.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != -2) || (strcmp(buf, "/a/b/Z/z.txt") != 0))
printf("test 6 failed\n");
printf("Testing completed.\n");
printf(" If no errors were reported, you're good to go.\n");
PHYSFS_delete("/a/b/c/x.txt");
PHYSFS_delete("/a/b/C/X.txt");
PHYSFS_delete("/a/b/c");
PHYSFS_delete("/a/b/C");
PHYSFS_delete("/a/b");
PHYSFS_delete("/a");
PHYSFS_deinit();
return 0;
} /* main */
#endif
/* end of ignorecase.c ... */

86
extras/ignorecase.h Normal file
View File

@ -0,0 +1,86 @@
#ifndef INCL_PHYSFSEXT_IGNORECASE_H
#define INCL_PHYSFSEXT_IGNORECASE_H
/** \file ignorecase.h */
/**
* \mainpage PhysicsFS ignorecase
*
* This is an extension to PhysicsFS to let you handle files in a
* case-insensitive manner, regardless of what sort of filesystem or
* archive they reside in. It does this by enumerating directories as
* needed and manually locating matching entries.
*
* Please note that this brings with it some caveats:
* - On filesystems that are case-insensitive to start with, such as those
* used on Windows or MacOS, you are adding extra overhead.
* - On filesystems that are case-sensitive, you might select the wrong dir
* 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 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 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
* functions like PHYSFS_openRead(), etc.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* \author Ryan C. Gordon.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \fn int PHYSFSEXT_locateCorrectCase(char *buf)
* \brief Find an existing filename with matching case.
*
* This function will look for a path/filename that matches the passed in
* buffer. Each element of the buffer's path is checked for a
* case-insensitive match. The buffer must specify a null-terminated string
* in platform-independent notation.
*
* Please note results may be skewed differently depending on whether symlinks
* are enabled or not.
*
* Each element of the buffer is overwritten with the actual case of an
* 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 legacy code.
*
* \param buf Buffer with null-terminated string of path/file to locate.
* This buffer will be modified by this function.
* \return zero if match was found, -1 if the final element (the file itself)
* is missing, -2 if one of the parent directories is missing.
*/
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.1 2002/12/11 15:37:23 icculus Exp $
require 'rbconfig'
require 'find'
require 'ftools'
include Config
module Slimb
class Installer
def initialize target_dir = "", &user_skip
@user_skip = user_skip or proc {|f| false}
@version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
@libdir = File.join(CONFIG["libdir"], "ruby", @version)
@sitedir = CONFIG["sitedir"] || File.join(@libdir, "site_ruby")
@dest = File.join @sitedir, target_dir
File::makedirs @dest
File::chmod 0755, @dest, true
end
def skip? file
@user_skip[file] or
file[0] == ?. or file[-1] == ?~ or file[-1] == ?#
end
def install_dir dir
File::makedirs(File.join(@dest, dir))
File::chmod(0755, File.join(@dest, dir), true)
Dir.foreach(dir) {|file|
next if skip? file
if File.ftype(File.join(dir, file)) == "directory"
install_dir File.join(dir, file)
else
install_file File.join(dir, file)
end
}
end
def install_file file
if file =~ /\.so$/
install_so file
else
File::install file, File.join(@dest, file), 0644, true
end
end
def install_so file
File::install file, File.join(CONFIG["sitearchdir"], file), 0644, true
end
def uninstall_so file
file = File.join(CONFIG["sitearchdir"], file)
File::safe_unlink file
end
def install something
case something
when Array
something.each {|x|
install x if x.is_a? String
}
when String
if File.ftype(something) == "directory"
install_dir something
else
install_file something
end
end
end
def uninstall what = "*"
case what
when Array
files = what.map {|x| File.join(@dest, x)}
when String
files = Dir[File.join(@dest, what)]
end
files.each {|x|
# FIXME: recursive uninstall is a must
next if FileTest.directory? x
File::safe_unlink x
}
end
def run files, argv
if !argv.grep(/--uninstall/).empty?
uninstall files
else
install files
end
end
end
end
# self-installation
if $0 == __FILE__
$stderr.puts "Installing slimb installer..."
Slimb::Installer.new("slimb").install File.basename(__FILE__)
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
* ./physfshttpd archive1.zip archive2.zip /path/to/a/real/dir etc...
*
* The files are appended in order to the PhysicsFS search path, and when
* a client request comes it, it looks for the file in said search path.
* a client request comes in, it looks for the file in said search path.
*
* My goal was to make this work in less than 300 lines of C, so again, it's
* not to be used for any serious purpose. Patches to make this application
@ -23,16 +23,18 @@
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes.
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
* General Public License: http://www.gnu.org/licenses/lgpl.txt
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* This file was written by Ryan C. Gordon. (icculus@clutteredmind.org).
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@ -53,7 +55,7 @@
#include "physfs.h"
#define DEFAULT_PORTNUM 6667
#define DEFAULT_PORTNUM 8080
typedef struct
{
@ -63,45 +65,153 @@ typedef struct
} http_args;
static char *txt404 =
"HTTP/1.0 404 Not Found\n"
"Connection: close\n"
"Content-type: text/html\n"
"\n"
"<html><head><title>404 Not Found</title></head>\n"
"<body>Can't find that.</body></html>\n\n";
#define txt404 \
"HTTP/1.0 404 Not Found\n" \
"Connection: close\n" \
"Content-Type: text/html; charset=utf-8\n" \
"\n" \
"<html><head><title>404 Not Found</title></head>\n" \
"<body>Can't find '%s'.</body></html>\n\n" \
#define txt200 \
"HTTP/1.0 200 OK\n" \
"Connection: close\n" \
"Content-Type: %s\n" \
"\n"
static const char *lastError(void)
{
return PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
} /* lastError */
static int writeAll(const char *ipstr, const int sock, void *buf, const size_t len)
{
if (write(sock, buf, len) != len)
{
printf("%s: Write error to socket.\n", ipstr);
return 0;
} /* if */
return 1;
} /* writeAll */
static int writeString(const char *ipstr, const int sock, const char *fmt, ...)
{
/* none of this is robust against large strings or HTML escaping. */
char buffer[1024];
int len;
va_list ap;
va_start(ap, fmt);
len = vsnprintf(buffer, sizeof (buffer), fmt, ap);
va_end(ap);
if (len < 0)
{
printf("uhoh, vsnprintf() failed!\n");
return 0;
} /* if */
return writeAll(ipstr, sock, buffer, len);
} /* writeString */
static void feed_file_http(const char *ipstr, int sock, const char *fname)
{
PHYSFS_file *in = PHYSFS_openRead(fname);
char buffer[1024];
printf("%s: requested [%s].\n", ipstr, fname);
PHYSFS_File *in = PHYSFS_openRead(fname);
if (in == NULL)
{
printf("%s: Can't open [%s]: %s.\n",
ipstr, fname, PHYSFS_getLastError());
write(sock, txt404, strlen(txt404)); /* !!! FIXME: Check retval */
printf("%s: Can't open [%s]: %s.\n", ipstr, fname, lastError());
writeString(ipstr, sock, txt404, fname);
return;
} /* if */
else
/* !!! FIXME: mimetype */
if (writeString(ipstr, sock, txt200, "text/plain; charset=utf-8"))
{
do
{
PHYSFS_sint64 br = PHYSFS_read(in, buffer, 1, sizeof (buffer));
char buffer[1024];
PHYSFS_sint64 br = PHYSFS_readBytes(in, buffer, sizeof (buffer));
if (br == -1)
{
printf("%s: Read error: %s.\n", ipstr, PHYSFS_getLastError());
printf("%s: Read error: %s.\n", ipstr, lastError());
break;
} /* if */
write(sock, buffer, (int) br); /* !!! FIXME: CHECK THIS RETVAL! */
else if (!writeAll(ipstr, sock, buffer, (size_t) br))
{
break;
} /* else if */
} while (!PHYSFS_eof(in));
} /* if */
PHYSFS_close(in);
} /* else */
PHYSFS_close(in);
} /* feed_file_http */
static void feed_dirlist_http(const char *ipstr, int sock,
const char *dname, char **list)
{
int i;
if (!writeString(ipstr, sock, txt200, "text/html; charset=utf-8"))
return;
else if (!writeString(ipstr, sock,
"<html><head><title>Directory %s</title></head>"
"<body><p><h1>Directory %s</h1></p><p><ul>\n",
dname, dname))
return;
if (strcmp(dname, "/") == 0)
dname = "";
for (i = 0; list[i]; i++)
{
const char *fname = list[i];
if (!writeString(ipstr, sock,
"<li><a href='%s/%s'>%s</a></li>\n", dname, fname, fname))
break;
} /* for */
writeString(ipstr, sock, "</ul></body></html>\n");
} /* feed_dirlist_http */
static void feed_dir_http(const char *ipstr, int sock, const char *dname)
{
char **list = PHYSFS_enumerateFiles(dname);
if (list == NULL)
{
printf("%s: Can't enumerate directory [%s]: %s.\n",
ipstr, dname, lastError());
writeString(ipstr, sock, txt404, dname);
return;
} /* if */
feed_dirlist_http(ipstr, sock, dname, list);
PHYSFS_freeList(list);
} /* feed_dir_http */
static void feed_http_request(const char *ipstr, int sock, const char *fname)
{
PHYSFS_Stat statbuf;
printf("%s: requested [%s].\n", ipstr, fname);
if (!PHYSFS_stat(fname, &statbuf))
{
printf("%s: Can't stat [%s]: %s.\n", ipstr, fname, lastError());
writeString(ipstr, sock, txt404, fname);
return;
} /* if */
if (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY)
feed_dir_http(ipstr, sock, fname);
else
feed_file_http(ipstr, sock, fname);
} /* feed_http_request */
static void *do_http(void *_args)
{
http_args *args = (http_args *) _args;
@ -134,7 +244,7 @@ static void *do_http(void *_args)
ptr = strchr(buffer + 5, ' ');
if (ptr != NULL)
*ptr = '\0';
feed_file_http(ipstr, args->sock, buffer + 4);
feed_http_request(ipstr, args->sock, buffer + 4);
} /* if */
} /* else */
@ -143,7 +253,7 @@ static void *do_http(void *_args)
close(args->sock);
free(args->addr);
free(args);
return(NULL);
return NULL;
} /* do_http */
@ -155,14 +265,14 @@ static void serve_http_request(int sock, struct sockaddr *addr,
{
printf("out of memory.\n");
return;
} // if
} /* if */
args->addr = (struct sockaddr *) malloc(addrlen);
if (args->addr == NULL)
{
free(args);
printf("out of memory.\n");
return;
} // if
} /* if */
args->sock = sock;
args->addrlen = addrlen;
@ -193,7 +303,7 @@ static int create_listen_socket(short portnum)
addr.sin_family = AF_INET;
addr.sin_port = htons(portnum);
addr.sin_addr.s_addr = INADDR_ANY;
if ((bind(retval, &addr, (socklen_t) sizeof (addr)) == -1) ||
if ((bind(retval, (struct sockaddr *) &addr, (socklen_t) sizeof (addr)) == -1) ||
(listen(retval, 5) == -1))
{
close(retval);
@ -201,7 +311,7 @@ static int create_listen_socket(short portnum)
} /* if */
} /* if */
return(retval);
return retval;
} /* create_listen_socket */
@ -218,7 +328,7 @@ void at_exit_cleanup(void)
close(listensocket);
if (!PHYSFS_deinit())
printf("PHYSFS_deinit() failed: %s\n", PHYSFS_getLastError());
printf("PHYSFS_deinit() failed: %s\n", lastError());
} /* at_exit_cleanup */
@ -243,13 +353,13 @@ int main(int argc, char **argv)
if (argc == 1)
{
printf("USAGE: %s <archive1> [archive2 [... archiveN]]\n", argv[0]);
return(42);
return 42;
} /* if */
if (!PHYSFS_init(argv[0]))
{
printf("PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
return(42);
printf("PHYSFS_init() failed: %s\n", lastError());
return 42;
} /* if */
/* normally, this is bad practice, but oh well. */
@ -257,7 +367,7 @@ int main(int argc, char **argv)
for (i = 1; i < argc; i++)
{
if (!PHYSFS_addToSearchPath(argv[i], 1))
if (!PHYSFS_mount(argv[i], NULL, 1))
printf(" WARNING: failed to add [%s] to search path.\n", argv[i]);
} /* else */
@ -265,7 +375,7 @@ int main(int argc, char **argv)
if (listensocket < 0)
{
printf("listen socket failed to create.\n");
return(42);
return 42;
} /* if */
while (1) /* infinite loop for now. */
@ -277,13 +387,13 @@ int main(int argc, char **argv)
{
printf("accept() failed: %s\n", strerror(errno));
close(listensocket);
return(42);
return 42;
} /* if */
serve_http_request(s, &addr, len);
} /* while */
return(0);
return 0;
} /* main */
/* end of physfshttpd.c ... */

View File

@ -9,143 +9,202 @@
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes.
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
* General Public License: http://www.gnu.org/licenses/lgpl.txt
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* SDL falls under the LGPL, too. You can get SDL at http://www.libsdl.org/
* SDL 1.2 falls under the LGPL license. SDL 1.3+ is zlib, like PhysicsFS.
* You can get SDL at https://www.libsdl.org/
*
* This file was written by Ryan C. Gordon. (icculus@clutteredmind.org).
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#include <stdio.h> /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */
#include "physfsrwops.h"
static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
/* SDL's RWOPS interface changed a little in SDL 2.0... */
#if defined(SDL_VERSION_ATLEAST)
#if SDL_VERSION_ATLEAST(2, 0, 0)
#define TARGET_SDL2 1
#endif
#endif
#if !TARGET_SDL2
#ifndef RW_SEEK_SET
#define RW_SEEK_SET SEEK_SET
#endif
#ifndef RW_SEEK_CUR
#define RW_SEEK_CUR SEEK_CUR
#endif
#ifndef RW_SEEK_END
#define RW_SEEK_END SEEK_END
#endif
#endif
#if TARGET_SDL2
static Sint64 SDLCALL physfsrwops_size(struct SDL_RWops *rw)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
int pos = 0;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
return (Sint64) PHYSFS_fileLength(handle);
} /* physfsrwops_size */
#endif
if (whence == SEEK_SET)
{
pos = offset;
} /* if */
else if (whence == SEEK_CUR)
#if TARGET_SDL2
static Sint64 SDLCALL physfsrwops_seek(struct SDL_RWops *rw, Sint64 offset, int whence)
#else
static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
#endif
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 pos = 0;
if (whence == RW_SEEK_SET)
pos = (PHYSFS_sint64) offset;
else if (whence == RW_SEEK_CUR)
{
PHYSFS_sint64 current = PHYSFS_tell(handle);
const PHYSFS_sint64 current = PHYSFS_tell(handle);
if (current == -1)
{
SDL_SetError("Can't find position in file: %s",
PHYSFS_getLastError());
return(-1);
} /* if */
pos = (int) current;
if ( ((PHYSFS_sint64) pos) != current )
{
SDL_SetError("Can't fit current file position in an int!");
return(-1);
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
if (offset == 0) /* this is a "tell" call. We're done. */
return(pos);
{
#if TARGET_SDL2
return (Sint64) current;
#else
return (int) current;
#endif
} /* if */
pos += offset;
pos = current + ((PHYSFS_sint64) offset);
} /* else if */
else if (whence == SEEK_END)
else if (whence == RW_SEEK_END)
{
PHYSFS_sint64 len = PHYSFS_fileLength(handle);
const PHYSFS_sint64 len = PHYSFS_fileLength(handle);
if (len == -1)
{
SDL_SetError("Can't find end of file: %s", PHYSFS_getLastError());
return(-1);
SDL_SetError("Can't find end of file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
pos = (int) len;
if ( ((PHYSFS_sint64) pos) != len )
{
SDL_SetError("Can't fit end-of-file position in an int!");
return(-1);
} /* if */
pos += offset;
pos = len + ((PHYSFS_sint64) offset);
} /* else if */
else
{
SDL_SetError("Invalid 'whence' parameter.");
return(-1);
return -1;
} /* else */
if ( pos < 0 )
{
SDL_SetError("Attempt to seek past start of file.");
return(-1);
return -1;
} /* if */
if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
return(pos);
#if TARGET_SDL2
return (Sint64) pos;
#else
return (int) pos;
#endif
} /* physfsrwops_seek */
#if TARGET_SDL2
static size_t SDLCALL physfsrwops_read(struct SDL_RWops *rw, void *ptr,
size_t size, size_t maxnum)
#else
static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
#endif
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
if (rc != maxnum)
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
const PHYSFS_uint64 readlen = (PHYSFS_uint64) (maxnum * size);
const PHYSFS_sint64 rc = PHYSFS_readBytes(handle, ptr, readlen);
if (rc != ((PHYSFS_sint64) readlen))
{
if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
#if TARGET_SDL2
return 0;
#else
return -1;
#endif
} /* if */
} /* if */
return((int) rc);
#if TARGET_SDL2
return (size_t) rc / size;
#else
return (int) rc / size;
#endif
} /* physfsrwops_read */
#if TARGET_SDL2
static size_t SDLCALL physfsrwops_write(struct SDL_RWops *rw, const void *ptr,
size_t size, size_t num)
#else
static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
#endif
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
if (rc != num)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
const PHYSFS_uint64 writelen = (PHYSFS_uint64) (num * size);
const PHYSFS_sint64 rc = PHYSFS_writeBytes(handle, ptr, writelen);
if (rc != ((PHYSFS_sint64) writelen))
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return((int) rc);
#if TARGET_SDL2
return (size_t) rc;
#else
return (int) rc;
#endif
} /* physfsrwops_write */
static int physfsrwops_close(SDL_RWops *rw)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
if (!PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return -1;
} /* if */
SDL_FreeRW(rw);
return(0);
return 0;
} /* physfsrwops_close */
static SDL_RWops *create_rwops(PHYSFS_file *handle)
static SDL_RWops *create_rwops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;
if (handle == NULL)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
else
{
retval = SDL_AllocRW();
if (retval != NULL)
{
#if TARGET_SDL2
retval->size = physfsrwops_size;
#endif
retval->seek = physfsrwops_seek;
retval->read = physfsrwops_read;
retval->write = physfsrwops_write;
@ -154,11 +213,11 @@ static SDL_RWops *create_rwops(PHYSFS_file *handle)
} /* if */
} /* else */
return(retval);
return retval;
} /* create_rwops */
SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;
if (handle == NULL)
@ -166,25 +225,25 @@ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
else
retval = create_rwops(handle);
return(retval);
return retval;
} /* PHYSFSRWOPS_makeRWops */
SDL_RWops *PHYSFSRWOPS_openRead(const char *fname)
{
return(create_rwops(PHYSFS_openRead(fname)));
return create_rwops(PHYSFS_openRead(fname));
} /* PHYSFSRWOPS_openRead */
SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname)
{
return(create_rwops(PHYSFS_openWrite(fname)));
return create_rwops(PHYSFS_openWrite(fname));
} /* PHYSFSRWOPS_openWrite */
SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname)
{
return(create_rwops(PHYSFS_openAppend(fname)));
return create_rwops(PHYSFS_openAppend(fname));
} /* PHYSFSRWOPS_openAppend */

View File

@ -9,14 +9,16 @@
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes.
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
* General Public License: http://www.gnu.org/licenses/lgpl.txt
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* SDL falls under the LGPL, too. You can get SDL at http://www.libsdl.org/
* SDL 1.2 falls under the LGPL license. SDL 1.3+ is zlib, like PhysicsFS.
* You can get SDL at https://www.libsdl.org/
*
* This file was written by Ryan C. Gordon. (icculus@clutteredmind.org).
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#ifndef _INCLUDE_PHYSFSRWOPS_H_
@ -39,7 +41,7 @@ extern "C" {
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
/**
* Open a platform-independent filename for writing, and make it accessible
@ -51,7 +53,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
/**
* Open a platform-independent filename for appending, and make it accessible
@ -63,7 +65,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
/**
* Make a SDL_RWops from an existing PhysicsFS file handle. You should
@ -75,7 +77,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
#ifdef __cplusplus
}

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