Commit Graph

479 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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
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 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
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
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 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 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 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 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 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 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 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 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 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 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 65497160f7 Removed deprecated Mac OS X APIs. 2011-07-25 11:29:44 -07:00
Ryan C. Gordon f94d227945 Fixed basedir calculation on Mac OS X. 2011-07-09 23:11:17 -07: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 660c7f9823 Fixed bug in directory search for zip and qpak archivers (thanks, Michal!) 2011-02-18 12:38:05 -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 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 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 8d1cff2bdf Fix for the Hurd, from the debian project. 2010-03-15 09:46:33 -04:00
Ryan C. Gordon 71dd0f7a6c Added a FIXME. 2010-03-01 08:49:04 -08: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