Commit Graph

479 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 cfbbb255a2 minor warning fixes 2022-06-15 08:56:02 +03: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 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
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
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
Matthew Albrecht d24ce15922 Include alloca.h on Solaris and Linux platforms. 2021-06-30 08:52:57 -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 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 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 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 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 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