Compare commits

...

84 Commits

Author SHA1 Message Date
Ryan C. Gordon 15073ad63f Fixed Win10's GetUserProfileDirectory() bug in stable-1.0 branch. 2018-10-03 22:45:05 -04:00
Ryan C. Gordon c65c196152 Fix bug with copying z_stream objects around in zip archiver (thanks, Andrei!).
zlib expects us to use inflateCopy() to move a z_stream, then inflateEnd()
the original, and apparently fails in later versions if you just try to
memcpy() it.

This is only a bug in the stable-2.0 and stable-1.0 branches; we replaced
zlib with miniz on the development branch, which doesn't have this
requirement (or an inflateCopy() function at all!).
(transplanted from 090cb9c74b87198e6d520afca9d649ca0d84669f)
2017-02-17 20:48:02 -05:00
Ryan C. Gordon 77f939cb43 Updated copyright date. 2017-02-17 20:43:27 -05:00
Ryan C. Gordon cdbd264cb4 The stable-1.0 branch didn't support Unicode at all. 2014-08-14 21:57:36 -04:00
Ryan C. Gordon e095ee4303 Backport from default branch: corrected PHYSFS_enumerateFiles() documentation.
(transplanted from aaa1204a4426c5412d9c2814e41e0b7066db060c)
2014-08-14 21:27:00 -04:00
Ryan C. Gordon 9977f5c9b4 Don't sort if there's nothing to do (prevents array underflow, too).
(transplanted from 662a7e180c480ff7731493b688aee27e8e010887)
2012-06-07 10:21:43 -04:00
Ryan C. Gordon 0ba88e4714 Put some include-once and extern "C" blocks in the extras' headers.
(transplanted from 9ba19d71cc4a4dd5c5fafe0de37d09fff75e57f6)
2011-09-24 00:55:15 -07:00
Ryan C. Gordon 8ae1b528a0 Fixed __PHYSFS_platformTell() things in stable-1.0 branch. 2011-08-01 17:55:45 -04:00
Ryan C. Gordon 1921be0ddf Fixed Windows/PocketPC __PHYSFS_platformEOF() for zero-length files.
(transplanted from e55bbdb69dfd9771a5222b6a406a9c418ffbe53b)
2011-08-01 17:37:06 -04:00
Ryan C. Gordon 08a15ea0c6 Backport from dev branch: infinite loop in zip_expand_symlink_path(). 2011-06-01 03:16:15 -04:00
Ryan C. Gordon 5a07f78897 Corrected copyright dates in stable-1.0 branch's license. 2011-02-18 16:16:19 -05:00
Ryan C. Gordon 205a7d3e63 Backported zip/qpak dir fix from dev branch to stable-1.0. 2011-02-18 12:44:30 -05:00
Ryan C. Gordon ef63e223c3 Updated copyright date in stable-1.0 branch. 2010-03-23 13:40:00 -04:00
Ryan C. Gordon 7888c05d4d Added an .hgignore to the stable-1.0 branch. 2010-02-28 17:24:03 -05:00
Ryan C. Gordon 5db500ac4e Fixed compiler warning on newer Linux systems.
(transplanted from 3ab4702d6313b2590f202f1475cd68976765f02f)
2010-02-01 03:02:18 -05:00
Ryan C. Gordon 8ff89ca115 Merged 1018:23aee7da04e0 from default branch: C++-style comment fixes. 2010-01-28 02:45:58 -05:00
Ryan C. Gordon c973e5a46b Fixed some wrong parentheses in the OS/2 code.
(transplanted from 1b4730384fc3b006d84c267fcd3e948510740ecf)
2010-01-28 02:38:57 -05:00
Ryan C. Gordon ea1b848580 Tagging 1.0.2 release. 2009-03-23 01:43:14 -04:00
Ryan C. Gordon 6667d42c31 Updated version to 1.0.2 in configure.in ... 2009-03-23 01:43:05 -04:00
Ryan C. Gordon 0314ea857b "make dist" removes Mercurial directory. 2009-03-23 01:36:05 -04:00
Ryan C. Gordon b35a36ddaa Upped version to 1.0.2. 2009-03-23 01:34:52 -04:00
Ryan C. Gordon 87aeb4dd16 Updated copyright. 2009-03-23 01:34:34 -04:00
Ryan C. Gordon 836c941bc7 Removed a reference to CVS. 2009-03-23 01:30:36 -04:00
Ryan C. Gordon 552769be6b Ripped out hand-crafted changelog. 2009-03-23 01:30:22 -04:00
Ryan C. Gordon d407ca2266 Updated copyright. 2009-03-23 01:27:48 -04:00
Ryan C. Gordon 2470672852 Tagging 1.0.1 release. 2009-03-22 21:46:01 -04:00
Ryan C. Gordon 42eb0768d5 Merged changeset 948:923323444178 from default branch: valgrind sorting fix. 2009-02-28 01:37:57 -05:00
Ryan C. Gordon ab4e94c49e Merged r939:940 from trunk: Fix PHYSFS_openAppend() on Unix. 2008-04-03 05:07:35 +00:00
Ryan C. Gordon f1ba7f8112 Removed a FIXME. 2008-03-12 21:21:40 +00:00
Ryan C. Gordon 27d1a25b24 Had a "msgbuf" where I should have had a "msgbuf[0]" (thanks, James!). 2008-03-11 05:14:35 +00:00
Ryan C. Gordon c14984f70e Fixed compiler warnings in win32 API calls (thanks, Dennis!). 2008-03-09 02:44:50 +00:00
Ryan C. Gordon 32fb2ab4a9 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 0e720678af Minor Windows fix (thanks, fydo!). 2008-02-13 05:48:57 +00:00
Ryan C. Gordon 81d6df6972 Updated copyright date. 2008-01-23 05:14:15 +00:00
Ryan C. Gordon aee6bd359e Added zlib README and updated license notes. 2008-01-23 05:01:50 +00:00
Ryan C. Gordon 0abf1d7584 Corrected credit in Changelog. 2008-01-22 03:46:44 +00:00
Ryan C. Gordon 6ec1239122 Fixed HTTP header in physfshttpd.c. 2008-01-22 03:44:49 +00:00
Ryan C. Gordon 9c8f5312de 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 be12a5bdc5 Mingw32 fix for 64-bit literals. 2007-10-01 15:47:40 +00:00
Ryan C. Gordon 782bb8a06f Whoops, it's malloc.h, not alloca.h ... 2007-07-12 10:37:56 +00:00
Ryan C. Gordon 8d1003ce7f Fixed missing alloc macro on mingw32, I think. 2007-07-12 08:58:09 +00:00
Ryan C. Gordon 87f7eb152a Fixed crash on zero-byte read/write (thanks, Ensiform!). 2007-07-11 22:11:29 +00:00
Ryan C. Gordon fc6d85b2f4 Backport from devbranch:
Fixed zip archiver: could do bogus seek if a small, non-zip file got put
 through isArchive().
2007-05-05 05:53:03 +00:00
Ryan C. Gordon 625e8e8f87 Merged r893:894 from trunk: Doxygen correction. 2007-04-03 00:58:32 +00:00
Ryan C. Gordon 785d617e74 Backport of r880:881 from trunk: try DIR archiver first. 2007-03-31 06:56:15 +00:00
Ryan C. Gordon bc14217e36 Whoops, this should probably be chopping the string instead of turning
the first newline it sees into a space character...
2007-03-26 06:34:55 +00:00
Ryan C. Gordon 994e62e5f2 Fixed typo in Doxygen comment. 2006-09-23 10:49:10 +00:00
Ryan C. Gordon cbf1dc67f3 Apparently the visibility attribute only exists in gcc3 and up. 2006-03-23 10:15:29 +00:00
Ryan C. Gordon 0d9f7c7b8a 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 c08f79715b Changed my email address. 2006-01-01 12:31:34 +00:00
Ryan C. Gordon cf12ff2b96 Added physfs.rc for Windows builds (thanks, Dennis!) 2006-01-01 12:29:18 +00:00
Ryan C. Gordon 57b48ae7f6 Fixed documentation for PHYSFS_setWriteDir(). 2005-11-28 13:28:12 +00:00
Ryan C. Gordon f71362cbb7 Fixed minor whitespace issue. 2005-11-28 13:25:18 +00:00
Ryan C. Gordon 7130cea2bf Minor MingW patches backported from dev branch. 2005-09-06 06:31:04 +00:00
Ryan C. Gordon 33ce47743f Assert define fix. 2005-07-24 01:02:11 +00:00
Ryan C. Gordon 7840ae68a6 Updated MacOS Classic CodeWarrior project. 2005-07-24 00:21:00 +00:00
Ryan C. Gordon 69d796fc7b Set svn:ignore. 2005-07-24 00:20:25 +00:00
Ryan C. Gordon a2ca51373c Fixed compiler warning in physfs.c. 2005-07-23 23:39:12 +00:00
Ryan C. Gordon caf1c499be Version bump for test program. 2005-07-23 23:00:08 +00:00
Ryan C. Gordon 14993f806e Added some files to dist. 2005-07-23 22:54:50 +00:00
Ryan C. Gordon 55c8465eeb Removed debian directory. 2005-07-23 22:46:30 +00:00
Ryan C. Gordon 8593f1484e Remove .svn dirs from release tarballs. 2005-07-23 22:23:07 +00:00
Ryan C. Gordon f5195696b6 Fixed "make dist". 2005-07-23 22:16:30 +00:00
Ryan C. Gordon 661a359586 Whoops, missed one. 2005-07-23 22:14:12 +00:00
Ryan C. Gordon 481f85a91c Upped version to 1.0.1. 2005-07-23 22:04:23 +00:00
Ryan C. Gordon 5e0de7cc73 Moved to zlib 1.2.3 proper. 2005-07-23 22:02:32 +00:00
Ryan C. Gordon 1affc74230 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:46 +00:00
Ryan C. Gordon 092abfdeda Removed old dir. 2005-07-13 15:23:02 +00:00
Ryan C. Gordon 68f832b9f7 Moved to zlib122 and security fix discussed here:
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2096
2005-07-13 15:22:08 +00:00
Ryan C. Gordon 12353f5346 Backport from devbranch: mingw support. 2005-06-13 01:16:13 +00:00
Ryan C. Gordon 804d364506 MacOS Classic fixes, MPW support, and removal of SITX for SIT (no SITX support
in the final Stuffit Expander for OS9, apparently).
2005-03-16 12:18:17 +00:00
Ryan C. Gordon e7a9d06206 Fixed untranslated string (thanks, Danny!) 2005-03-16 12:00:54 +00:00
Ryan C. Gordon cd065471c8 Spanish and Brazillian Portuguese translations. 2005-03-16 12:00:07 +00:00
Ryan C. Gordon ab1fd8a763 Minor comment fix (stable branch backport) 2005-02-15 22:30:28 +00:00
Ryan C. Gordon 73fc0593bf 2.0.0 backport: Fixed HOG archiver sorting/lookups (thanks Chris!) 2005-01-05 05:16:53 +00:00
Ryan C. Gordon df02d9722d Fixed some documentation/header comment typos (thanks, Gaetan!) 2004-12-16 16:25:42 +00:00
Ryan C. Gordon a63b842e24 CFLAGS fix backported from devbranch. 2004-10-30 23:47:00 +00:00
Ryan C. Gordon 791d52465c Removed .cvsignore files 2004-10-30 09:59:38 +00:00
Ryan C. Gordon 4b036dc0a2 strcpy/strcat fix, backported from devbranch. 2004-10-30 09:57:56 +00:00
Ryan C. Gordon c5bf5c15d7 PHYSFS_file is now PHYSFS_File to match 2.0 API (but has a typedef for
legacy support).
2004-09-26 13:37:42 +00:00
Ryan C. Gordon 7521634ee6 Updated. 2004-09-21 17:36:50 +00:00
Ryan C. Gordon 58fac19bb4 Backported buffered seeking fix from dev branch. 2004-09-21 17:34:27 +00:00
Ryan C. Gordon 969bf3d341 MacOSX build fix, backported from development branch. 2004-09-21 17:30:23 +00:00
Ryan C. Gordon c495f050e6 Forked stable 1.0 branch. 2004-09-21 17:27:55 +00:00
96 changed files with 1946 additions and 1558 deletions

View File

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

2
.hgignore Normal file
View File

@ -0,0 +1,2 @@
syntax:glob
cmake-build

412
CHANGELOG
View File

@ -1,410 +1,10 @@
/*
* CHANGELOG.
*/
12292003 - Updated CodeWarrior projects from CW6 to CW7, and made a bunch of
patches to get the Mac Classic target building again. Removed
zlib114 from CVS repository. Updated OS/2 build batch file.
Added Z_PREFIX define to Unix builds that use internal zlib.
Patched up some (outdated?) Visual C project files for zlib121.
Patched Doxyfile and physfs.h for newer Doxygen. Fixed OS/2
build script. Tweaked Project Builder files to at least compile.
Added some last minute BeOS and Cygwin build fixes. Updated
Visual Studio projects and tweaked some Makefile.am crap. Made
changes so Visual Studio files would pack with DOS endlines and...
Upped version to 1.0.0 (woohoo!).
12222003 - Fixed a search-and-replace mistake in win32.c that preventing
compiling on Windows. (thanks, Brian!) Converted VC6 .dsp to use
zlib121; made Z_PREFIX=1 enabled by default to avoid link clashes;
put zlib files in separate logical folder in .dsp project; updated
zlib121/zconf.h to address remaining symbols that were still
causing link warnings.
12182003 - WAD archiver now puts maps into subdirectories, making them
accessible to the application. (Thanks, Travis!) RPM spec and
Makefile.am* now package zlib_license_change.txt (Thanks, Edward!)
12142003 - Added Doom WAD support (Thanks, Travis!)
12082003 - Fixed some win32.c deficiencies that Robby Dermody pointed
out (thanks!)
12072003 - Upgraded internal zlib to 1.2.1 (thanks, Adam!) Other
Unix build fixes.
11112003 - Patches to make OS/2 support compile again.
11092003 - Added __PHYSFS_platformStrnicmp(), and made qpak.c case-insensitive.
09122003 - Happy September. Actually released current tree as 0.1.9.
08262003 - Added MiNT support to build process and fixed cross-compiling
(thanks Patrice Mandin!)
08092003 - Some Windows build fixes (thanks, Brian Hook!)
07232003 - Upped version to 0.1.9.
07202003 - Switched to zlib license (see new LICENSE text in root of source
tree, and zlib_license_switch.txt for details). Had to remove
archivers/qpak.c, the Ruby bindings from the extras directory, and
the Russian and Spanish translations, since those contributors
couldn't be contacted. If they show up, we'll readd them to the
project, otherwise we'll eventually replace their work...everyone
else signed on for the change. Committed a patch to convert all
tabs to spaces (Thanks, James!). Added patch to zip.c to fix
crash (thanks, dillo!). Reimplmented qpak.c, by welding together
bits of grp.c and zip.c. Ed contacted me, so I could readd his
contributions post-license change...I'm going to keep the new
qpak.c, but I've readded his Ruby bindings and Russian translations.
06112003 - Patches to globbing.c to handle corner cases (thanks, Bradley!).
06102003 - Added globbing.c to "extras" directory.
05232003 - Rewrote MacOSX/Darwin CD-ROM detection code to use IOKit, which is
much much more accurate than the previous code. Updated
configure.in and Makefile.am.newautomake for some MacOSX stuff.
05222003 - Fixed win32 crash if PHYSFS_init() is called with a NULL.
05182003 - PocketPC fixes (thanks, David Hedbor!)
05162003 - Compiler warning cleanup in HOG and MVL archivers (Thanks, Bradley!)
04082003 - Minor changes to extras/abs-file.h (Thanks, Adam!)
03302003 - Fixed seeking in uncompressed ZIP entries, and handle a
misbehaviour in Java's JAR creation tools. Thanks to "Tree" for
pointing these bugs out. Added HOG and MVL archive support for
Descent I and II (Thanks, Bradley Bell!). Added example code to
do case-insensitive file searches ("extras/ignorecase.*").
03192003 - Fixed problem in PHYSFS_mkdir() when dirs to be created already
exist. Fixed problem where PHYSFS_mkdir() incorrectly tripped an
alarm in __PHYSFS_verifySecurity().
03122003 - Attempt at cleaning up some type correctness for VC++6. Made QPAK
archiver case-insensitive (since Quake2 has problems without it).
01302003 - Added buffering API to OS/2 build's exported symbol list. Updated
CWProjects.sit and made several fixes to get physfs building on
MacOS Classic again.
01282003 - Fixed seeking in buffered files opened for read.
01072003 - .NET assembly and C# wrapper by Gregory S. Read in the extras dir.
01042003 - Added a hack for dealing with OSX bundles and newer PBProjects
(thanks, Eric Wing!). Added some missing files to "make dist".
Fixed minor Doxygen typo in PHYSFS_flush() docs. Upped version to
0.1.8.
12172002 - Added Apple Project Builder support files (thanks, Eric Wing!).
12112002 - Added Ruby bindings to extras directory (thanks, Ed Sinjiashvili!).
Patched win32.c to compile with Mingw32 (thanks, Niels Wagenaar!).
12032002 - Adam updated his extras/abs-file.h for the new buffering API.
12022002 - German translation added, compliments of Michael Renner.
12012002 - Minor fix to configure.in: reported --enable-debug's default
setting incorrectly. Added buffering to the API: you can now
buffer a file with PHYSFS_setBuffer(), and flush the buffer to
disk with PHYSFS_flush(). PhysicsFS file handles are unbuffered
by default (as they were before this API addition), so this does
not break the API. Other fixes for bugs I stumbled upon during
this work are in CVS, too.
11292002 - Minor fix for strange PATH strings in unix.c (thanks, Alexander!)
11222002 - Initial PocketPC port by Corona688.
10222002 - Fixed segfault in test_physfs.c when user hits CTRL-D (and
readline() thus returns NULL)...now gracefully exits, as it should.
10142002 - Added check for AMD's x86-64 ("Hammer") architecture when
determining platform byte order.
10112002 - Fixed "setsaneconfig" command in test_physfs.c ...
09232002 - Happy September. Updated VC++6 project files, fixed some
VC++ compile nags (more work to be done in zip.c).
08302002 - Cleaned tab stops out of zip.c, and fixed a possible infinite loop
in zip_find_entry().
08292002 - Fixed a mistake in makeos2.cmd, and updated the INSTALL docs.
Added physfs.spec.in to EXTRA_DIST in Makefile.am*
08292002 - Added a physfs/stdio wrapper header to the "extras" dir,
compliments of Adam D. Moss (file is "abs-file.h").
08282002 - Cleanups in grp.c so that Visual C++ doesn't complain anymore.
zip.c now works correctly when PhysicsFS is disallowing symlinks.
A few minor optimizations in zip.c, with a few more to come later.
Added VS.NET project files to CVS.
08222002 - Fixed ZIP_exists() to work with directories. Now breaks out of
__PHYSFS_verifySecurity() early if a path element is missing
(since all the others will be, too)...this check is only done
if symlinks are disabled, but we might as well save easy cycles
where we can.
08212002 - Did a couple tedious-for-small-rewards cleanups, optimizations,
corrections and streamlinings I've been meaning to do. Touched a
lot of code. One of the side results is that ZIP_isDirectory()
got fixed.
08192002 - Generalized sorting routines, moved them into physfs.c and removed
the multiple copies from the various archivers. Adding profiling
code (currently only for sort routines)...enable it with
--enable-profiling in the configure script. Fixed incorrect
behaviours in configure.in.
08172002 - Patched configure.in to work around buggy autoconfs.
08162002 - Fixed QPAK archiver, since I broke it (sorry!). Also fixed a
qpak memory leak.
08092002 - Added Quake PAK archiver (qpak.c) by Ed Sinjiashvili. Thanks!
Made (successful?) attempt to fix pthread-to-ui64 cast problem.
Check for OS/2 in configure.in, in case anyone gets autoconf and
such to work right on their OS/2 box.
08012002 - Patched win32.c to compile.
07302002 - Minor error handling fix (thanks, Alexander!)
07292002 - Found some memory leaks, thanks to Valgrind (which rules, btw).
Added Russian translations (koi8-r, cp1251, cp866, and iso-8859-5)
by Ed Sinjiashvili. Added Spanish translation by Pedro J. Pérez.
Debian package support in CVS, thanks to Colin Bayer. French
translation by Stéphane Peter.
07282002 - macclassic.c now returns human readable error messages instead of
ERR_OS_ERROR. Closing files on MacOS no longer fails if the volume
info can't be flushed. Minor error message tweak in os2.c. All
possible human-readable literal strings (including all those OS/2
and MacOS error messages) have moved to constants in
physfs_internal.h...this allows the library to be translated to
other spoken languages fairly easily.
07272002 - Patched the OS/2 code to be useful...works pretty well, now. Added
makeos2.cmd for building (not an ideal solution, but oh well).
Initialized some variables in zip.c to prevent compiler whining.
07262002 - Fixed a typo in documentation. Archivers with matching file
extensions are now given first shot at opening an archive, but if
they fail, the other archivers are tried. More fixes to zip.c's
ZIP_enumerateFiles(). Wrote an OS/2 platform driver based on API
specs and a heavy pounding of Google Groups...as I don't have an
OS/2 compiler at the moment, it probably doesn't even compile. :)
07252002 - configure.in and unix.c now deal with platforms that lack a
functional pthread library. Edward Rudd sent in a patch to the RPM
specfile to have the build system set the correct version.
Clean ups in grp.c, beos.cpp and macclassic.c.
07242002 - Rewrote ZIP_enumerate(). Hopefully it sucks less this time.
unix.c and configure.in now have the infrastructure to disable
the CD-ROM detection code, and use a stub that successfully (and
unconditionally) reports no detected discs. Currently this is
used on AtheOS (which doesn't have CD-ROM support at the moment
anyhow), but it will be useful to get the library up on odd,
Unix-like systems that don't use either getmntinfo() or getmntent().
07232002 - Cleaned up the cut-and-pastes in the various file enumeration
routines and moved it into __PHYSFS_addToLinkedStringList().
Tons more ZIP file enhancing. I'm fairly certain it's robust and
fast in every reasonable respect, now. GRP archiver now caches
the file table...it was generally overhauled like the ZIP driver.
Added "ls" as an alias of "enumerate" in test_physfs.
I lied about zip.c's robustness; disabled the enumeration code.
07212002 - More FreeBSD build system patches. Added some new autoconf spew to
.cvsignore. bootstrap now copies the appropriate Makefile.am
instead of rename()ing it.
07192002 - Cleaned up configure.in and unix.c so that we check by available
header to determine the appropriate CD-ROM detection code...this
should make this more future-proof (and probably get it building
out of the box on other BSD platforms.)
07172002 - Fixed seeking backwards in ZIP_seek(). Changed the error message
ERR_TOO_MANY_SYMLINKS to ERR_SYMLINK_LOOP. Patches to build system
and unix.c for FreeBSD compatibility. Added physfs.spec to
"make dist" archives (thanks, Edward Rudd!).
07152002 - Symlinks in ZIP archives are detected correctly now, I think.
07142002 - Use GetVolumeInformation() instead of GetDiskFreeSpace() in
win32.c's mediaInDrive() function. This allows Windows NT 3.x to
correctly detect CD-ROM drives. Library now appears to be fully
functional on WinNT 3.51...need to try NT 3.1 still. :)
Patches to new ZIP code; cleaned up bugs in symlink reading code,
but we incorrectly identify some entries as symlinks, which doesn't
fly...for now, symlink code is commented out, so symlinks look
like regular files (and reading from a symlink entry gives you
the link as file data).
07122002 - Rewrote the ZIP archiver to no longer use Gilles Vollant's unzip.c
code. Losing that abstraction should make the ZIP archiver
significantly more efficient, and halved the amount of code used.
Plus, being a control freak, I like my coding style more than
Gilles's. :) There are still bugs to shake out, but this is good
progress.
07112002 - configure.in updated to make it happier on newer autoconfs
(thanks again, Alexander!). FIXME cleanups.
07102002 - Added a byteorder-friendly convenience API, so you can read/write
data and convert to the native byteorder without too much effort.
Upped version to 0.1.7.
Build system corrections for BeOS and Cygwin (thanks, Alexander!).
Added RPM specfile for PhysicsFS (thanks, Edward Rudd!).
06292002 - Fixed incorrect error message when opening a file for read without
defining a search path. LOTS of win32 updates and fixes; lots of
things that were broken work now, and we are slowly becoming
more compatible with legacy win32 systems. Builds on Cygwin again.
All platform drivers (except beos.cpp) had a buffer overflow when
detecting mounted CD-ROM drives...it only occurs when a drive is
detected, and it probably won't result in your box getting rooted,
but upgrade soon anyhow. Readded the .cvsignore files from the old
build system.
06282002 - Reworked build system _AGAIN_.
06222002 - Alexander Pipelka spotted a bug in the file open routines in
posix.c; patched.
06152002 - Autoconf build system will now generate shared libraries on BeOS,
and (supposedly) Cygwin.
06142002 - Rewrote autoconf build system. It now works around the MacOS X bug
that prevented shared libraries from building.
06112002 - Updated CodeWarrior projects and added them to CVS. _Finally_
officially released 0.1.6.
06102002 - Major overhauls to platform/win32.c ... should work on all Windows
platforms, including 95/98/ME and NT/2K/XP flavors. Someone should
see if this builds on WinCE! :) You no longer need the latest
platform SDK to build it, either; the questionable DLL is accessed
with LoadLibrary() at runtime now, and handled if not present. This
now builds correctly on a freshly installed Visual Studio 6.0, and
the DLL it builds works everywhere. Plus, a bunch of other bugs
and incorrect behaviours were squashed. Visual Studio 6.0 project
file added to CVS.
06082002 - Fixes to __PHYSFS_platformEnumerateFiles() in win32.c: cleaned up
memory leak, handles paths more robustly, and prevents possible
skipped file entries. Removed AC_C_CONST and AC_TYPE_SIZE_T checks
from configure.in (not needed, and they broke BeOS build). Clean
out the docs/ directory when doing a "make dist". Fixed crashbug
when calling PHYSFS_deinit() more than once in a row. Tried to get
MacOS X to build a shared library, gave up; I'm doing something
wrong in my Makefile.am, I think. On MacOS X, running ./configure
--enable-static --disable-shared works, though. Hopefully someone
will fix this soon. In unix.c, the Darwin version of
__PHYSFS_platformDetectAvailableCDs() was free()ing a static
buffer; fixed.
06072002 - Manpages! Finally installed Doxygen and scratched together a
Doxyfile. After some revision to physfs.h, we've got a rather
nice API reference.
06062002 - Fixed __PHYSFS_platformSeek() in archivers/posix.c. Implemented the
getLastModTime method in archivers/zip.c (returns legitimate info)
and archivers/grp.c (returns lastmodtime of GRPfile itself in the
physical filesystem). Put a 64-bit _llseek() version of the seek()
and tell() methods in platform/posix.c, but you need to hack (or
rather, fix) configure.in to enable it. From Greg on win32.c: Fixed
file enumerator function (needed a wildcard '*' specification), CD
enumeration only reports CDs that have media, getLastModTime() has
been implemented.
06012002 - Added -Wall to debug builds. Removed ANSI stdio calls from
platform/posix.c, and replaced them with actual POSIX calls (that
is, fopen() became open(), fseek() became lseek(), etc...)
05272002 - Added some explicit casts when calling malloc() in platform/posix.c
05252002 - Added John Hall's file modification time patch, and added a
getlastmodtime command to test_physfs. Corrected error reporting
for missing files a little bit. Changed build system to only try
building beos.cpp if on a BeOS system (since we need a C++ compiler
available to do so). Implemented getLastModTime in macclassic.c.
05242002 - Upped version to 0.1.6 (not officially released yet).
05232002 - Fixed the build system to always package the complete source, not
just what we built for a given system, when doing a "make dist".
Updated INSTALL. Wrote BeOS platform code (platform/beos.cpp).
Split unix.c into unix.c and posix.c. Linux and BeOS both share
posix.c, although I don't think it's completely POSIX compliant at
this point (not that it matters much).
05212002 - Cleaned up some FIXMEs.
05202002 - Added .cvsignore files.
05162002 - Edward Rudd also caught an embarrassing screwup by me in
unix.c: the open-for-append call was using "wb+" instead of
"ab" when calling fopen(). Doh!
05152002 - configure script now deals with systems that have a readline
lib, but require it to be linked with curses. Thanks to Edward
Rudd for the patch.
05102002 - A trimmed-down zlib 1.1.4 is now included in the source distro, for
use by win32, MacOS, and Unix systems that don't have it installed
on the system. Autoconf support! Initial attempt at this. Lots of
stuff may be very broken.
05082002 - From Greg: More win32 work. Library is now 95% functional on win32.
Only known win32 problem is that the CD drives are reported whether
they contain a disc or not).
05062002 - From Greg: Win32 boxes without the latest Platform SDK can now
#define DISABLE_NT_SUPPORT. Other fixes.
04242002 - Updated win32 info in INSTALL to discuss Platform SDK issues.
04202002 - Added a (very) quick and (very) dirty http server to the
extras directory (public domain), as another example of using
the library.
04192002 - Corrected some win32 info in INSTALL. Changed Makefile to
package releases as .tar.gz instead of .tar.bz2.
04122002 - Some win32 cleanups and fixes across several files. Upped
version to 0.1.5.
04082002 - Fixed problem when calling __PHYSFS_setError before PHYSFS_init.
04062002 - Added MacOS info, etc to INSTALL. Patched unix.c and
test_physfs.c to compile on Darwin again.
04052002 - Added byte ordering API. Byte ordering fixes in grp.c, and some
cleanups in unzip.c. Mac work is more or less complete.
04042002 - Mac work continues. Almost complete, now. test_physfs now has
tests for write, append, and filelength, and most of the
commands can tolerate a quoted argument (although this is
hacky, it's good enough for these purposes). Upped test_physfs
version to 0.1.1. Added a malloc-failure check in the Unix
CD-ROM detection code.
04032002 - PHYSFS_init always makes sure the calling thread initializes its
error state. Win32 codebase is updated with mutex implementation
(thanks, Greg!).
04022002 - Mac work continues. Found a bug where we put a double dir
separator in if we had to resort to the fallback userdir (if
__PHYSFS_platformGetUserDir() returned NULL to calculateUserDir().
Made note of potential infinite recursion in platform driver docs.
04012002 - (_NOT_ an April Fool's Joke:) Started working on MacOS Classic
port. Added skeleton.c to platform directory. Minor patches to
get things compiling on Mac (notably, DirInfo conflicts with
a type exposed by MacOS's namespace-polluting API, and some
typecasting issues). Found a call to ferror() I had missed in
unzip.c.
03302002 - Mutexes! PhysicsFS should be thread safe now, so long as you
don't try to do something like close a file at the same time as
you are reading from it in another thread. All reasonable race
conditions should now be gone, but the new code will need some
eyeballing before we install it on life support systems or anything.
The mutex abstraction is implemented in unix.c, win32.c will be
updated shortly.
03292002 - Fixed a potential problem in ZIP_realpath() and some byte order
issues in zip.c. Converted unzip.c to use physfs file i/o
abstractions. Converted CHANGELOG to list latest entries first.
03242002 - Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit(). Win32
improvements by Gregory S. Read. Added PHYSFS_[us]int(8|16|32)
types...this breaks binary compatibility with previous PhysicsFS
releases! Added platform specific i/o functions, so we don't have
to rely on stdio anymore. Updated TODO with my comments on the
physfs mailing list. 1.0, here we come! Removed race condition from
grp.c and converted to file i/o abstraction layer calls from stdio.
Tons of other fixes and enhancements.
03202002 - Patched platform/win32.c to compile.
03152002 - PHYSFS_setSaneConfig() now handles failure to set the write dir
better. Patched makefile to link the test program. Changed all the
"write" functions to get data from a "const" buffer. Added an
"extras" dir, which currently contains PhysFS->SDL_RWops glue code.
03052002 - Made unix.c's timeslice implementation more portable, and added a
Darwin-specific means to detect CDs (thanks to Patrick Stein).
Minor cleanup in win32.c (changed "for (; condition ;)" into
"while (condition)" ...)
11142001 - Removed a redundant error check in platform/win32.c
10092001 - Syntax fixes in dir.c, a FIXME in grp.c, and a "cat" command in
the test program. Apparently I had accidentally removed a rather
crucial line from dir.c a few revisions ago, and no one noticed. :(
Fixed. The win32 userdir will default to the base dir, now.
09252001 - Changed API: PHYSFS_setSaneConfig() takes an organization name, and
sets up less directories. Be warned. Fixes from David Hedbor:
make setSaneConfig() set write directory correctly if it had to
create the directory, and make sure that the writing functions
get used in dir.c when a file is opened for writing/appending.
Updated CREDITS.
09142001 - David Hedbor submitted a patch to handle a case where the
current working directory has been deleted out from under the
process (both in platform/unix.c and physfs.c itself). Thanks,
David! Added a CREDITS file. Changed the format of the author field
in PHYSFS_ArchiveInfo to put the email address between "<>" instead
of "()" chars. Updated TODO. make install now deletes previous
revisions of the library. Changed version to 0.1.4.
09012001 - Happy September. Moved the Visual C project files and the zlib
source to a separate download. Look for it at
http://icculus.org/physfs/downloads/physfs-win32-support.zip ...
Updated the INSTALL doc for Win32 building. Rewrote win32.c's
__PHYSFS_platformRealPath() to not rely on Visual C's runtime lib,
which was the last Cygwin incompatibility (although the Makefile
needs to be updated to build a DLL under Cygwin). Tinkered with the
Makefile a little, but it needs more work. Started working on a
MacOS version. All I have is CodeWarrior 4, which is way out of
date, and (for what is supposed to be an ultra-user-friendly
environment) is completely uninituitive to me. Still, managed to
get most everything compiling, which improved the quality of the
code somewhat). Haven't tried to compile the zipfile support, and
I still can't link the library. Dunno what the hell I'm supposed
to do there. Isn't Unix supposed to be hard compared to this?
08312001 - Built PhysicsFS on Mandrake 8.0 for the PowerPC. Compiles clean,
but there's at least one byte-ordering issue in zip.c that needs
to be fixed.
08292001 - win32.c calculates the base dir with GetModuleFileName() first, now,
and falls back to SearchPath() if there were problems. Changed an
occurence of _MAX_PATH to MAX_PATH, so both CygWin and Visual C can
handle it.
08282001 - win32.c now checks HOMEDRIVE, HOMEPATH, and HOME when calculating
the userdir. Added include files that make it a little closer to
compiling under Cygwin. Added a TODO file. Fixed unix.c's
__PHYSFS_platformCalcBaseDir() so that it actually works. Fixed
Makefile so that it links the test program properly.
Changed version to 0.1.3.
08232001 - Fixed a potential free()ing of a NULL pointer in
__PHYSFS_platformEnumerateFiles() in platform/unix.c. Added
platform/win32.c. Other cleanups to get this compiling with
Visual C and CygWin. Added BAIL_MACRO for times when we were doing
BAIL_IF_MACRO(1, ...). Abstracted mkdir() in the platform drivers.
Added GRP setting output to showcfg in the Makefile. Updated INSTALL
with license info and Win32 build instructions. Dependency on the
readline library in test_physfs.c is now optional.
Changed version to 0.1.2.
08072001 - Changed version to 0.1.1.
08062001 - Added CD-ROM detection code to the unix platform driver.
08012001 - Added a safety memset in error setting, fixed URLs and email addr.
07282001 - Initial release.
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.
--ryan. (icculus@clutteredmind.org)
If you want a list of changes, updated in real time, just point your web
browser here:
/* end of CHANGELOG ... */
http://hg.icculus.org/icculus/physfs/

21
CREDITS
View File

@ -64,8 +64,27 @@ HOG archiver,
MVL archiver,
Bradley Bell
Bug fixes:
Tolga Dalman
Brazillian Portuguese translation:
Danny Angelo Carminati Grein
Spanish translation:
Pedro J. Pérez
Mingw support:
Matze Braun
Bug fixes:
Jörg Walter
James Haley
Windows .rc file:
Dennis Schridde
Other stuff:
Your name here! Patches go to icculus@clutteredmind.org ...
Your name here! Patches go to icculus@icculus.org ...
/* end of CREDITS ... */

BIN
CWProjects.sit Executable file

Binary file not shown.

Binary file not shown.

View File

@ -23,7 +23,7 @@ PROJECT_NAME = physfs
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.0.0
PROJECT_NUMBER = 1.0.2
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

14
INSTALL
View File

@ -18,7 +18,7 @@ If you've got Doxygen (http://www.doxygen.org/) installed, you can run it
UNIX:
(If you got this code from CVS, run "./bootstrap" first.)
(If you got this code from Mercurial, 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
@ -31,7 +31,7 @@ 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.
to get it running can be sent to icculus@icculus.org.
BeOS:
@ -76,7 +76,7 @@ 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.
from you; send an email to icculus@icculus.org.
MACOS 8/9:
Double-click on "CWProjects.sit" in the root of the source tree. This will
@ -91,7 +91,7 @@ it works by building the "test_physfs.mcp" project file, which will create
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.
the Mac, I'd like to hear from you; send an email to icculus@icculus.org.
@ -103,7 +103,7 @@ based on the GNU toolchain. Fire up a terminal and run "cc"...if this reports
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.
MacOS X, I'd like to hear from you; send an email to icculus@icculus.org.
OS/2:
@ -117,7 +117,7 @@ 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.
OS/2, I'd like to hear from you; send an email to icculus@icculus.org.
OTHER PLATFORMS:
@ -129,5 +129,5 @@ 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)
--ryan. (icculus@icculus.org)

22
LICENSE
View File

@ -1,5 +1,5 @@
Copyright (c) 2003 Ryan C. Gordon and others.
Copyright (c) 2001-2017 Ryan C. Gordon and others.
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
@ -19,11 +19,21 @@
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@clutteredmind.org>
Ryan C. Gordon <icculus@icculus.org>
(Please note that versions of PhysicsFS prior to 0.1.9 are licensed under
the GNU Lesser General Public License, which restricts you significantly more.
For your own safety, please make sure you've got 0.1.9 or later if you plan
to use physfs in a commercial or closed-source project.)
Notes, separate from the license. This is not legal advice.
Versions of PhysicsFS prior to 0.1.9 are licensed under the GNU Lesser General
Public License, which restricts you significantly more. For your own safety,
please make sure you've got 0.1.9 or later if you plan to use physfs in a
commercial or closed-source project.
Optional pieces of PhysicsFS may fall under other licenses, please consult
your lawyer for legal advice, which this is not...
zlib: if you enable ZIP archive support, PhysicsFS uses zlib. Its license
requirements are identical to PhysicsFS.
Please see zlib123/README for details.

View File

@ -6,33 +6,33 @@ libphysfsinclude_HEADERS = \
if BUILD_MACOSX
ZLIB_FILES = zlib121/adler32.c \
zlib121/compress.c \
zlib121/crc32.c \
zlib121/crc32.h \
zlib121/deflate.c \
zlib121/deflate.h \
zlib121/gzio.c \
zlib121/infback.c \
zlib121/inffast.c \
zlib121/inffast.h \
zlib121/inffixed.h \
zlib121/inflate.c \
zlib121/inflate.h \
zlib121/inftrees.c \
zlib121/inftrees.h \
zlib121/trees.c \
zlib121/trees.h \
zlib121/uncompr.c \
zlib121/zconf.h \
zlib121/zlib.h \
zlib121/zutil.c \
zlib121/zutil.h
ZLIB_FILES = zlib123/adler32.c \
zlib123/compress.c \
zlib123/crc32.c \
zlib123/crc32.h \
zlib123/deflate.c \
zlib123/deflate.h \
zlib123/gzio.c \
zlib123/infback.c \
zlib123/inffast.c \
zlib123/inffast.h \
zlib123/inffixed.h \
zlib123/inflate.c \
zlib123/inflate.h \
zlib123/inftrees.c \
zlib123/inftrees.h \
zlib123/trees.c \
zlib123/trees.h \
zlib123/uncompr.c \
zlib123/zconf.h \
zlib123/zlib.h \
zlib123/zutil.c \
zlib123/zutil.h
if BUILD_ZLIB
ZLIB_SRC = $(ZLIB_FILES)
ZLIB_INC = -I$(top_srcdir)/zlib121
ZLIB_INC = -I$(top_srcdir)/zlib123
ZLIB_EXTRADIST =
else
ZLIB_SRC =
@ -80,7 +80,7 @@ EXTRA_DIST = \
INSTALL \
TODO \
Doxyfile \
CWProjects.sitx \
CWProjects.sit \
physfs.spec \
physfs.dsp \
test_physfs.dsp \
@ -104,7 +104,7 @@ EXTRA_DIST = \
else
SUBDIRS = platform archivers zlib121 . test extras
SUBDIRS = platform archivers zlib123 . test extras
libphysfs_la_SOURCES = \
physfs.c \
@ -112,7 +112,7 @@ libphysfs_la_SOURCES = \
physfs_byteorder.c
if BUILD_ZLIB
ZLIB_LIB = zlib121/libz.la
ZLIB_LIB = zlib123/libz.la
else
ZLIB_LIB =
endif
@ -133,7 +133,7 @@ EXTRA_DIST = \
TODO \
Doxyfile \
PBProjects \
CWProjects.sitx \
CWProjects.sit \
physfs.spec.in \
physfs.spec \
physfs.dsp \
@ -155,4 +155,6 @@ dist-hook:
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`
rm -rf `find $(distdir) -name ".svn" -type d`
rm -rf $(distdir)/.hg

View File

@ -1,6 +1,6 @@
lib_LTLIBRARIES = libphysfs.la
SUBDIRS = platform archivers zlib121 . test extras
SUBDIRS = platform archivers zlib123 . test extras
libphysfsincludedir = $(includedir)
libphysfsinclude_HEADERS = \
@ -12,7 +12,7 @@ libphysfs_la_SOURCES = \
physfs_byteorder.c
if BUILD_ZLIB
ZLIB_LIB = zlib121/libz.la
ZLIB_LIB = zlib123/libz.la
else
ZLIB_LIB =
endif
@ -33,7 +33,7 @@ EXTRA_DIST = \
TODO \
Doxyfile \
PBProjects \
CWProjects.sitx \
CWProjects.sit \
physfs.spec.in \
physfs.spec \
physfs.dsp \
@ -51,3 +51,5 @@ dist-hook:
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`
rm -rf `find $(distdir) -name ".svn" -type d`
rm -rf $(distdir)/.hg

View File

@ -898,8 +898,8 @@
F8FDCE5D03AEDE1F01A8000A,
);
isa = PBXGroup;
name = zlib121;
path = ../zlib121;
name = zlib123;
path = ../zlib123;
refType = 2;
};
F8FDCE4303AEDE1F01A8000A = {

View File

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

View File

@ -1,7 +1,7 @@
noinst_LTLIBRARIES = libarchivers.la
if BUILD_ZLIB
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/zlib121
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/zlib123
else
INCLUDES = -I$(top_srcdir)
endif

View File

@ -52,7 +52,7 @@ const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
{
"",
DIR_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};

View File

@ -90,7 +90,7 @@ const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP =
{
"GRP",
GRP_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};
@ -263,19 +263,27 @@ static int GRP_isArchive(const char *filename, int forWriting)
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));
if (one != two)
{
const GRPentry *a = (const GRPentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* 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));
if (one != 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));
} /* if */
} /* grp_entry_swap */

View File

@ -300,19 +300,27 @@ static int HOG_isArchive(const char *filename, int forWriting)
static int hog_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
HOGentry *a = (HOGentry *) _a;
return(strcmp(a[one].name, a[two].name));
if (one != two)
{
const HOGentry *a = (const HOGentry *) _a;
return(__PHYSFS_platformStricmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* hog_entry_cmp */
static void hog_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
HOGentry tmp;
HOGentry *first = &(((HOGentry *) _a)[one]);
HOGentry *second = &(((HOGentry *) _a)[two]);
memcpy(&tmp, first, sizeof (HOGentry));
memcpy(first, second, sizeof (HOGentry));
memcpy(second, &tmp, sizeof (HOGentry));
if (one != two)
{
HOGentry tmp;
HOGentry *first = &(((HOGentry *) _a)[one]);
HOGentry *second = &(((HOGentry *) _a)[two]);
memcpy(&tmp, first, sizeof (HOGentry));
memcpy(first, second, sizeof (HOGentry));
memcpy(second, &tmp, sizeof (HOGentry));
} /* if */
} /* hog_entry_swap */

View File

@ -266,19 +266,27 @@ static int MVL_isArchive(const char *filename, int forWriting)
static int mvl_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
MVLentry *a = (MVLentry *) _a;
return(strcmp(a[one].name, a[two].name));
if (one != two)
{
const MVLentry *a = (const MVLentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* mvl_entry_cmp */
static void mvl_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
MVLentry tmp;
MVLentry *first = &(((MVLentry *) _a)[one]);
MVLentry *second = &(((MVLentry *) _a)[two]);
memcpy(&tmp, first, sizeof (MVLentry));
memcpy(first, second, sizeof (MVLentry));
memcpy(second, &tmp, sizeof (MVLentry));
if (one != two)
{
MVLentry tmp;
MVLentry *first = &(((MVLentry *) _a)[one]);
MVLentry *second = &(((MVLentry *) _a)[two]);
memcpy(&tmp, first, sizeof (MVLentry));
memcpy(first, second, sizeof (MVLentry));
memcpy(second, &tmp, sizeof (MVLentry));
} /* if */
} /* mvl_entry_swap */

View File

@ -107,7 +107,7 @@ const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
{
"PAK",
QPAK_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};
@ -296,19 +296,27 @@ static int QPAK_isArchive(const char *filename, int forWriting)
static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
QPAKentry *a = (QPAKentry *) _a;
return(QPAK_strcmp(a[one].name, a[two].name));
if (one != two)
{
const QPAKentry *a = (const QPAKentry *) _a;
return(QPAK_strcmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* 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));
if (one != 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));
} /* if */
} /* qpak_entry_swap */
@ -546,8 +554,11 @@ static QPAKentry *qpak_find_entry(QPAKinfo *info, const char *path, int *isDir)
if (thispath[pathlen] == '\0') /* found entry? */
return(&a[middle]);
/* adjust search params, try again. */
else if (thispath[pathlen] > '/')
hi = middle - 1;
else
hi = middle - 1; /* adjust search params, try again. */
lo = middle + 1;
} /* if */
} /* while */

View File

@ -108,7 +108,7 @@ static int WAD_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD =
{
"WAD",
/* !!! FIXME WAD_ARCHIVE_DESCRIPTION, */ "DOOM engine format",
WAD_ARCHIVE_DESCRIPTION,
"Travis Wells <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
};
@ -287,19 +287,27 @@ static int WAD_isArchive(const char *filename, int forWriting)
static int wad_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
WADentry *a = (WADentry *) _a;
return(strcmp(a[one].name, a[two].name));
if (one != two)
{
const WADentry *a = (const WADentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* wad_entry_cmp */
static void wad_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
WADentry tmp;
WADentry *first = &(((WADentry *) _a)[one]);
WADentry *second = &(((WADentry *) _a)[two]);
memcpy(&tmp, first, sizeof (WADentry));
memcpy(first, second, sizeof (WADentry));
memcpy(second, &tmp, sizeof (WADentry));
if (one != two)
{
WADentry tmp;
WADentry *first = &(((WADentry *) _a)[one]);
WADentry *second = &(((WADentry *) _a)[two]);
memcpy(&tmp, first, sizeof (WADentry));
memcpy(first, second, sizeof (WADentry));
memcpy(second, &tmp, sizeof (WADentry));
} /* if */
} /* wad_entry_swap */

View File

@ -147,7 +147,7 @@ const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
{
"ZIP",
ZIP_ARCHIVE_DESCRIPTION,
"Ryan C. Gordon <icculus@clutteredmind.org>",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
};
@ -368,7 +368,8 @@ static int ZIP_seek(FileHandle *handle, PHYSFS_uint64 offset)
return(0);
inflateEnd(&finfo->stream);
memcpy(&finfo->stream, &str, sizeof (z_stream));
inflateCopy(&finfo->stream, &str);
inflateEnd(&str);
finfo->uncompressed_position = finfo->compressed_position = 0;
} /* if */
@ -489,6 +490,8 @@ static PHYSFS_sint64 zip_find_end_of_central_dir(void *in, PHYSFS_sint64 *len)
break;
filepos -= (maxread - 4);
if (filepos < 0)
filepos = 0;
} /* while */
BAIL_IF_MACRO(!found, ERR_NOT_AN_ARCHIVE, -1);
@ -584,8 +587,11 @@ static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path, int *isDir)
if (thispath[pathlen] == '\0') /* found entry? */
return(&a[middle]);
/* adjust search params, try again. */
else if (thispath[pathlen] > '/')
hi = middle - 1;
else
hi = middle - 1; /* adjust search params, try again. */
lo = middle + 1;
} /* if */
} /* while */
@ -665,6 +671,7 @@ static void zip_expand_symlink_path(char *path)
else
{
prevptr = ptr;
ptr++;
} /* else */
} /* while */
} /* zip_expand_symlink_path */
@ -990,19 +997,27 @@ zip_load_entry_puked:
static int zip_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
ZIPentry *a = (ZIPentry *) _a;
return(strcmp(a[one].name, a[two].name));
if (one != two)
{
const ZIPentry *a = (const ZIPentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* zip_entry_cmp */
static void zip_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
ZIPentry tmp;
ZIPentry *first = &(((ZIPentry *) _a)[one]);
ZIPentry *second = &(((ZIPentry *) _a)[two]);
memcpy(&tmp, first, sizeof (ZIPentry));
memcpy(first, second, sizeof (ZIPentry));
memcpy(second, &tmp, sizeof (ZIPentry));
if (one != two)
{
ZIPentry tmp;
ZIPentry *first = &(((ZIPentry *) _a)[one]);
ZIPentry *second = &(((ZIPentry *) _a)[two]);
memcpy(&tmp, first, sizeof (ZIPentry));
memcpy(first, second, sizeof (ZIPentry));
memcpy(second, &tmp, sizeof (ZIPentry));
} /* if */
} /* zip_entry_swap */
@ -1208,9 +1223,9 @@ static PHYSFS_sint32 zip_find_start_of_dir(ZIPinfo *info, const char *path,
if (rc == 0)
{
char ch = name[dlen];
if (ch < '/') /* make sure this isn't just a substr match. */
if ('/' < ch) /* make sure this isn't just a substr match. */
rc = -1;
else if (ch > '/')
else if ('/' > ch)
rc = 1;
else
{

View File

@ -5,7 +5,15 @@ echo "Initial preparation...this can take awhile, so sit tight..."
rm -f Makefile.am
perl -w -e 'use File::Copy; exit 0 if (-f "Makefile.am"); my $x = `automake --version |head -n 1`; chomp($x); $x = 0.0 if ($x !~ s/\A.*?(\d+\.\d+).*\Z/$1/); if ($x < 1.5) { copy("./Makefile.am.oldautomake", "./Makefile.am"); } else { copy("./Makefile.am.newautomake", "./Makefile.am"); }'
aclocal
libtoolize --automake --copy --force
# MacOS X renames GNU libtool to "glibtool", since they have something
# else called "libtool" already...
if [ -x /usr/bin/glibtoolize ]; then
glibtoolize --automake --copy --force
else
libtoolize --automake --copy --force
fi
autoheader
automake --foreign --add-missing --copy
autoconf

View File

@ -15,9 +15,9 @@ dnl ---------------------------------------------------------------------
MAJOR_VERSION=1
MINOR_VERSION=0
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
MICRO_VERSION=2
INTERFACE_AGE=2
BINARY_AGE=2
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
AC_SUBST(MAJOR_VERSION)
@ -68,18 +68,39 @@ AC_ARG_ENABLE(debug,
, enable_debug=no)
if test x$enable_debug = xyes; then
if test x$ac_cv_prog_cc_g = xyes; then
PHYSFSCFLAGS="-g -O0"
PHYSFSCFLAGS="$PHYSFSCFLAGS -g -O0"
else
PHYSFSCFLAGS="-O0"
PHYSFSCFLAGS="$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"
PHYSFSCFLAGS="$PHYSFSCFLAGS -O2"
AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
fi
dnl ---------------------------------------------------------------------
dnl Have GCC's -fvisibility option?
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
have_gcc_fvisibility=no
visibility_CFLAGS="-fvisibility=hidden"
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS $visibility_CFLAGS"
AC_TRY_COMPILE([
int placeholder = 1;
],[
],[
have_gcc_fvisibility=yes
])
AC_MSG_RESULT($have_gcc_fvisibility)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_fvisibility = xyes; then
PHYSFSCFLAGS="$PHYSFSCFLAGS $visibility_CFLAGS"
fi
dnl ---------------------------------------------------------------------
dnl Profile sorts, etc?
@ -298,6 +319,16 @@ if test x$physfslang = xfrench; then
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_FRENCH, [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 = xportuguese-br; then
physfs_valid_lang=yes
AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [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])
@ -335,6 +366,8 @@ if test x$physfs_valid_lang = xno; then
AC_MSG_WARN([*** --enable-language=english])
AC_MSG_WARN([*** --enable-language=german])
AC_MSG_WARN([*** --enable-language=french])
AC_MSG_WARN([*** --enable-language=spanish])
AC_MSG_WARN([*** --enable-language=portuguese-br])
AC_MSG_WARN([*** --enable-language=russian-koi8-r])
AC_MSG_WARN([*** --enable-language=russian-cp1251])
AC_MSG_WARN([*** --enable-language=russian-cp866])
@ -368,9 +401,25 @@ if test x$target_os = xcygwin; then
else
this_is_cygwin=no
fi
AC_MSG_RESULT([$this_is_cygwin])
AC_MSG_CHECKING([if this is mingw])
if test x$target_os = xmingw32; then
this_is_mingw=yes
fi
if test x$target_os = xmingw32msvc; then
this_is_mingw=yes
fi
if test x$this_is_mingw = xyes; then
PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32"
enable_cdrom=yes
enable_pthreads=no
have_non_posix_threads=yes
else
this_is_mingw=no
fi
AC_MSG_RESULT([$this_is_mingw])
this_is_macosx=no
if test x$we_have_sed = xyes; then
AC_MSG_CHECKING([if this is MacOS X])
@ -493,7 +542,7 @@ AC_CHECK_FUNCS([memset strrchr])
AC_CHECK_SIZEOF(int, 4)
CFLAGS="$CFLAGS $PHYSFSCFLAGS -D_REENTRANT -D_THREAD_SAFE"
CFLAGS="$PHYSFSCFLAGS $CFLAGS -D_REENTRANT -D_THREAD_SAFE"
LDFLAGS="$LDFLAGS $PHYSFSLDFLAGS -no-undefined"
dnl Add Makefile conditionals
@ -508,7 +557,7 @@ AC_OUTPUT([
Makefile
archivers/Makefile
platform/Makefile
zlib121/Makefile
zlib123/Makefile
test/Makefile
extras/Makefile
physfs.spec

17
debian/changelog vendored
View File

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

22
debian/control vendored
View File

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

33
debian/copyright vendored
View File

@ -1,33 +0,0 @@
This package was debianized by Colin Bayer <vogon@icculus.org> on
Mon, 29 Jul 2002 04:41:27 -0700.
It was downloaded from http://icculus.org/physfs/downloads/physfs-0.1.7.tar.gz
Upstream Author(s): Ryan Gordon <icculus@icculus.org>
This software is copyright (c) 2001-02 by Ryan Gordon, icculus.org.
This library is distributed under the terms of the zlib license:
Copyright (c) 2003 Ryan C. Gordon and others.
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ryan C. Gordon <icculus@clutteredmind.org>

2
debian/docs vendored
View File

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

2
debian/files vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

47
debian/postinst vendored
View File

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

38
debian/postrm vendored
View File

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

44
debian/preinst vendored
View File

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

40
debian/prerm vendored
View File

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

118
debian/rules vendored
View File

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

1
debian/shlibs.local vendored
View File

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

View File

@ -1,5 +0,0 @@
Makefile
.deps
.libs
Makefile.in

View File

@ -3,5 +3,10 @@ EXTRA_DIST = \
physfsrwops.h \
abs-file.h \
physfshttpd.c \
globbing.h \
globbing.c \
ignorecase.c \
ignorecase.h \
PhysFS.NET \
physfs_rb

View File

@ -1,3 +1,6 @@
#ifndef INCL_PHYSFSEXT_GLOBBING_H
#define INCL_PHYSFSEXT_GLOBBING_H
/** \file globbing.h */
/**
@ -30,6 +33,9 @@
* \author Ryan C. Gordon.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \fn char **PHYSFS_enumerateFilesWildcard(const char *dir, const char *wildcard, int caseSensitive)
@ -73,5 +79,11 @@ __EXPORT__ char **PHYSFSEXT_enumerateFilesWildcard(const char *dir,
const char *wildcard,
int caseSensitive);
#ifdef __cplusplus
}
#endif
#endif /* include-once blocker. */
/* end of globbing.h ... */

View File

@ -1,3 +1,6 @@
#ifndef INCL_PHYSFSEXT_IGNORECASE_H
#define INCL_PHYSFSEXT_IGNORECASE_H
/** \file ignorecase.h */
/**
@ -44,6 +47,9 @@
* \author Ryan C. Gordon.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \fn int PHYSFSEXT_locateCorrectCase(char *buf)
@ -71,5 +77,11 @@
*/
int PHYSFSEXT_locateCorrectCase(char *buf);
#ifdef __cplusplus
}
#endif
#endif /* include-once blocker. */
/* end of ignorecase.h ... */

View File

@ -16,7 +16,7 @@
*
* 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).
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#include <stdio.h> /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */

View File

@ -16,7 +16,7 @@
*
* 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).
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
*/
#ifndef _INCLUDE_PHYSFSRWOPS_H_

View File

@ -29,7 +29,7 @@
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE 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>
@ -67,7 +67,7 @@ typedef struct
static char *txt404 =
"HTTP/1.0 404 Not Found\n"
"Connection: close\n"
"Content-type: text/html\n"
"Content-type: text/html; charset=utf-8\n"
"\n"
"<html><head><title>404 Not Found</title></head>\n"
"<body>Can't find that.</body></html>\n\n";
@ -156,14 +156,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;

View File

@ -17,7 +17,7 @@
*
* SDL falls under the LGPL license. You can get SDL at http://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 ... */

View File

@ -17,7 +17,7 @@
*
* SDL falls under the LGPL license. You can get SDL at http://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_

View File

@ -3,12 +3,12 @@ rem this is a simple batch file to build PhysicsFS on OS/2. You need to have
rem the EMX development tools installed for this to work.
rem
rem This script (and, indeed, our OS/2 support) could use some tweaking.
rem Patches go to icculus@clutteredmind.org ...
rem Patches go to icculus@icculus.org ...
set PHYSFSLANG=PHYSFS_LANG_ENGLISH
set DEBUGFLAGS=-D_NDEBUG -O2 -s
rem set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib121 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DPHYSFS_LANG=%PHYSFSLANG% -DHAVE_ASSERT_H
set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib121 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DHAVE_ASSERT_H
rem set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib123 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DPHYSFS_LANG=%PHYSFSLANG% -DHAVE_ASSERT_H
set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib123 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DHAVE_ASSERT_H
rem goto :dolinking
@ -120,18 +120,18 @@ gcc %CFLAGS% -o bin/zip.obj archivers/zip.c
gcc %CFLAGS% -o bin/qpak.obj archivers/qpak.c
gcc %CFLAGS% -o bin/hog.obj archivers/hog.c
gcc %CFLAGS% -o bin/mvl.obj archivers/mvl.c
gcc %CFLAGS% -o bin/adler32.obj zlib121/adler32.c
gcc %CFLAGS% -o bin/compress.obj zlib121/compress.c
gcc %CFLAGS% -o bin/crc32.obj zlib121/crc32.c
gcc %CFLAGS% -o bin/deflate.obj zlib121/deflate.c
gcc %CFLAGS% -o bin/gzio.obj zlib121/gzio.c
gcc %CFLAGS% -o bin/infback.obj zlib121/infback.c
gcc %CFLAGS% -o bin/inffast.obj zlib121/inffast.c
gcc %CFLAGS% -o bin/inflate.obj zlib121/inflate.c
gcc %CFLAGS% -o bin/inftrees.obj zlib121/inftrees.c
gcc %CFLAGS% -o bin/trees.obj zlib121/trees.c
gcc %CFLAGS% -o bin/uncompr.obj zlib121/uncompr.c
gcc %CFLAGS% -o bin/zutil.obj zlib121/zutil.c
gcc %CFLAGS% -o bin/adler32.obj zlib123/adler32.c
gcc %CFLAGS% -o bin/compress.obj zlib123/compress.c
gcc %CFLAGS% -o bin/crc32.obj zlib123/crc32.c
gcc %CFLAGS% -o bin/deflate.obj zlib123/deflate.c
gcc %CFLAGS% -o bin/gzio.obj zlib123/gzio.c
gcc %CFLAGS% -o bin/infback.obj zlib123/infback.c
gcc %CFLAGS% -o bin/inffast.obj zlib123/inffast.c
gcc %CFLAGS% -o bin/inflate.obj zlib123/inflate.c
gcc %CFLAGS% -o bin/inftrees.obj zlib123/inftrees.c
gcc %CFLAGS% -o bin/trees.obj zlib123/trees.c
gcc %CFLAGS% -o bin/uncompr.obj zlib123/uncompr.c
gcc %CFLAGS% -o bin/zutil.obj zlib123/zutil.c
@echo off
:dolinking

View File

@ -108,12 +108,13 @@ static const PHYSFS_ArchiveInfo *supported_types[] =
&__PHYSFS_ArchiveInfo_WAD,
#endif
NULL
};
static const DirFunctions *dirFunctions[] =
{
&__PHYSFS_DirFunctions_DIR,
#if (defined PHYSFS_SUPPORTS_ZIP)
&__PHYSFS_DirFunctions_ZIP,
#endif
@ -138,7 +139,6 @@ static const DirFunctions *dirFunctions[] =
&__PHYSFS_DirFunctions_WAD,
#endif
&__PHYSFS_DirFunctions_DIR,
NULL
};
@ -214,7 +214,8 @@ static void __PHYSFS_quick_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi,
break;
swapfn(a, i, j);
} /* while */
swapfn(a, i, hi-1);
if (i != (hi-1))
swapfn(a, i, hi-1);
__PHYSFS_quick_sort(a, lo, j, cmpfn, swapfn);
__PHYSFS_quick_sort(a, i+1, hi, cmpfn, swapfn);
} /* else */
@ -229,7 +230,8 @@ void __PHYSFS_sort(void *entries, PHYSFS_uint32 max,
* Quicksort w/ Bubblesort fallback algorithm inspired by code from here:
* http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html
*/
__PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn);
if (max > 0)
__PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn);
} /* __PHYSFS_sort */
@ -1090,7 +1092,7 @@ int PHYSFS_setSaneConfig(const char *organization, const char *appName,
} /* if */
else
{
no_write = 1;
no_write = 1;
} /* else */
if (no_write)
@ -1224,7 +1226,7 @@ char * __PHYSFS_convertToDependent(const char *prepend,
if (append)
{
strcat(str, dirsep);
strcpy(str, append);
strcat(str, append);
} /* if */
return(str);
@ -1797,6 +1799,8 @@ PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, void *buffer,
FileHandle *h = (FileHandle *) handle->opaque;
BAIL_IF_MACRO(!h->forReading, ERR_FILE_ALREADY_OPEN_W, -1);
BAIL_IF_MACRO(objSize == 0, NULL, 0);
BAIL_IF_MACRO(objCount == 0, NULL, 0);
if (h->buffer != NULL)
return(doBufferedRead(handle, buffer, objSize, objCount));
@ -1830,6 +1834,8 @@ PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, const void *buffer,
FileHandle *h = (FileHandle *) handle->opaque;
BAIL_IF_MACRO(h->forReading, ERR_FILE_ALREADY_OPEN_R, -1);
BAIL_IF_MACRO(objSize == 0, NULL, 0);
BAIL_IF_MACRO(objCount == 0, NULL, 0);
if (h->buffer != NULL)
return(doBufferedWrite(handle, buffer, objSize, objCount));
@ -1863,7 +1869,22 @@ int PHYSFS_seek(PHYSFS_file *handle, PHYSFS_uint64 pos)
{
FileHandle *h = (FileHandle *) handle->opaque;
BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, 0);
h->buffill = h->bufpos = 0; /* just in case. */
if (h->buffer && h->forReading)
{
/* avoid throwing away our precious buffer if seeking within it. */
PHYSFS_sint64 offset = pos - PHYSFS_tell(handle);
if ( /* seeking within the already-buffered range? */
((offset >= 0) && (offset <= h->buffill - h->bufpos)) /* forwards */
|| ((offset < 0) && (-offset <= h->bufpos)) /* backwards */ )
{
h->bufpos += (PHYSFS_uint32) offset;
return(1); /* successful seek */
} /* if */
} /* if */
/* we have to fall back to a 'raw' seek. */
h->buffill = h->bufpos = 0;
return(h->funcs->seek(h, pos));
} /* PHYSFS_seek */

View File

@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /WX /Gm /ZI /Od /I "." /I "zlibwin32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Z_PREFIX" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_MVL" /D "PHYSFS_SUPPORTS_HOG" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /WX /Zi /Od /I "." /I "zlib121" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Z_PREFIX" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_MVL" /D "PHYSFS_SUPPORTS_HOG" /FR /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /WX /Zi /Od /I "." /I "zlib123" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Z_PREFIX" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_MVL" /D "PHYSFS_SUPPORTS_HOG" /FR /YX /FD /GZ /c
# SUBTRACT CPP /X
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -74,7 +74,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /WX /O2 /I "." /I "zlibwin32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /YX /FD /c
# ADD CPP /nologo /MD /W3 /WX /O2 /I "." /I "zlib121" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_HOG" /D "PHYSFS_SUPPORTS_MVL" /YX /FD /c
# ADD CPP /nologo /MD /W3 /WX /O2 /I "." /I "zlib123" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_HOG" /D "PHYSFS_SUPPORTS_MVL" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@ -97,19 +97,19 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\zlib121\adler32.c
SOURCE=.\zlib123\adler32.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\compress.c
SOURCE=.\zlib123\compress.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\crc32.c
SOURCE=.\zlib123\crc32.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\deflate.c
SOURCE=.\zlib123\deflate.c
# End Source File
# Begin Source File
@ -125,15 +125,15 @@ SOURCE=.\archivers\hog.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\inffast.c
SOURCE=.\zlib123\inffast.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\inflate.c
SOURCE=.\zlib123\inflate.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\inftrees.c
SOURCE=.\zlib123\inftrees.c
# End Source File
# Begin Source File
@ -153,11 +153,11 @@ SOURCE=.\archivers\qpak.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\trees.c
SOURCE=.\zlib123\trees.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\uncompr.c
SOURCE=.\zlib123\uncompr.c
# End Source File
# Begin Source File
@ -173,7 +173,7 @@ SOURCE=.\archivers\zip.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\zutil.c
SOURCE=.\zlib123\zutil.c
# End Source File
# End Group
# Begin Group "Header Files"
@ -181,31 +181,31 @@ SOURCE=.\zlib121\zutil.c
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\zlib121\deflate.h
SOURCE=.\zlib123\deflate.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\infblock.h
SOURCE=.\zlib123\infblock.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\infcodes.h
SOURCE=.\zlib123\infcodes.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\inffast.h
SOURCE=.\zlib123\inffast.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\inffixed.h
SOURCE=.\zlib123\inffixed.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\inftrees.h
SOURCE=.\zlib123\inftrees.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\infutil.h
SOURCE=.\zlib123\infutil.h
# End Source File
# Begin Source File
@ -217,19 +217,19 @@ SOURCE=.\physfs_internal.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\trees.h
SOURCE=.\zlib123\trees.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\zconf.h
SOURCE=.\zlib123\zconf.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\zlib.h
SOURCE=.\zlib123\zlib.h
# End Source File
# Begin Source File
SOURCE=.\zlib121\zutil.h
SOURCE=.\zlib123\zutil.h
# End Source File
# End Group
# Begin Group "Resource Files"

View File

@ -153,6 +153,8 @@ extern "C" {
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if (defined _MSC_VER)
#define __EXPORT__ __declspec(dllexport)
#elif (__GNUC__ >= 3)
#define __EXPORT__ __attribute__((visibility("default")))
#else
#define __EXPORT__
#endif
@ -269,8 +271,9 @@ PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
typedef struct
{
void *opaque; /**< That's all you get. Don't touch. */
} PHYSFS_file;
} PHYSFS_File;
typedef PHYSFS_File PHYSFS_file; /* for backwards compatibility with 1.0 */
/**
@ -308,7 +311,7 @@ typedef struct
* revision).
*
* \sa PHYSFS_VERSION
* \sa PHYFS_getLinkedVersion
* \sa PHYSFS_getLinkedVersion
*/
typedef struct
{
@ -320,7 +323,7 @@ typedef struct
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#define PHYSFS_VER_MAJOR 1
#define PHYSFS_VER_MINOR 0
#define PHYSFS_VER_PATCH 0
#define PHYSFS_VER_PATCH 2
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
@ -496,7 +499,7 @@ __EXPORT__ const char *PHYSFS_getLastError(void);
* \fn const char *PHYSFS_getDirSeparator(void)
* \brief Get platform-dependent dir separator string.
*
* This returns "\\\\" on win32, "/" on Unix, and ":" on MacOS. It may be more
* This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more
* than one character, depending on the platform, and your code should take
* that into account. Note that this is only useful for setting up the
* search/write paths, since access into those dirs always use '/'
@ -634,9 +637,7 @@ __EXPORT__ const char *PHYSFS_getWriteDir(void);
* \fn int PHYSFS_setWriteDir(const char *newDir)
* \brief Tell PhysicsFS where it may write files.
*
* Set a new write dir. This will override the previous setting. If the
* directory or a parent directory doesn't exist in the physical filesystem,
* PhysicsFS will attempt to create them as needed.
* Set a new write dir. This will override the previous setting.
*
* This call will fail (and fail to change the write dir) if the current
* write dir still has files open in it.
@ -896,8 +897,9 @@ __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
* We've got [z.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.
* Feel free to sort the list however you like. However, the returned data
* will always contain no duplicates, and will be always sorted in alphabetic
* (rather: Latin1, probably) order for you.
*
* Don't forget to call PHYSFS_freeList() with the return value from this
* function when you are done with it.
@ -1431,7 +1433,7 @@ __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_readSLE16(PHYSFS_file *file, PHYSFS_sint16 *val);
@ -1447,7 +1449,7 @@ __EXPORT__ int PHYSFS_readSLE16(PHYSFS_file *file, PHYSFS_sint16 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
*/
__EXPORT__ int PHYSFS_readULE16(PHYSFS_file *file, PHYSFS_uint16 *val);
@ -1464,7 +1466,7 @@ __EXPORT__ int PHYSFS_readULE16(PHYSFS_file *file, PHYSFS_uint16 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_readSBE16(PHYSFS_file *file, PHYSFS_sint16 *val);
@ -1480,7 +1482,7 @@ __EXPORT__ int PHYSFS_readSBE16(PHYSFS_file *file, PHYSFS_sint16 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
*/
__EXPORT__ int PHYSFS_readUBE16(PHYSFS_file *file, PHYSFS_uint16 *val);
@ -1497,7 +1499,7 @@ __EXPORT__ int PHYSFS_readUBE16(PHYSFS_file *file, PHYSFS_uint16 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_readSLE32(PHYSFS_file *file, PHYSFS_sint32 *val);
@ -1513,7 +1515,7 @@ __EXPORT__ int PHYSFS_readSLE32(PHYSFS_file *file, PHYSFS_sint32 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
*/
__EXPORT__ int PHYSFS_readULE32(PHYSFS_file *file, PHYSFS_uint32 *val);
@ -1530,7 +1532,7 @@ __EXPORT__ int PHYSFS_readULE32(PHYSFS_file *file, PHYSFS_uint32 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_readSBE32(PHYSFS_file *file, PHYSFS_sint32 *val);
@ -1546,7 +1548,7 @@ __EXPORT__ int PHYSFS_readSBE32(PHYSFS_file *file, PHYSFS_sint32 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
*/
__EXPORT__ int PHYSFS_readUBE32(PHYSFS_file *file, PHYSFS_uint32 *val);
@ -1563,7 +1565,7 @@ __EXPORT__ int PHYSFS_readUBE32(PHYSFS_file *file, PHYSFS_uint32 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1582,7 +1584,7 @@ __EXPORT__ int PHYSFS_readSLE64(PHYSFS_file *file, PHYSFS_sint64 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1601,7 +1603,7 @@ __EXPORT__ int PHYSFS_readULE64(PHYSFS_file *file, PHYSFS_uint64 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1620,7 +1622,7 @@ __EXPORT__ int PHYSFS_readSBE64(PHYSFS_file *file, PHYSFS_sint64 *val);
* \param val pointer to where value should be stored.
* \return zero on failure, non-zero on success. If successful, (*val) will
* store the result. On failure, you can find out what went wrong
* from PHYSFS_GetLastError().
* from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1638,7 +1640,7 @@ __EXPORT__ int PHYSFS_readUBE64(PHYSFS_file *file, PHYSFS_uint64 *val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeSLE16(PHYSFS_file *file, PHYSFS_sint16 val);
@ -1653,7 +1655,7 @@ __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_file *file, PHYSFS_sint16 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeULE16(PHYSFS_file *file, PHYSFS_uint16 val);
@ -1668,7 +1670,7 @@ __EXPORT__ int PHYSFS_writeULE16(PHYSFS_file *file, PHYSFS_uint16 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeSBE16(PHYSFS_file *file, PHYSFS_sint16 val);
@ -1683,7 +1685,7 @@ __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_file *file, PHYSFS_sint16 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeUBE16(PHYSFS_file *file, PHYSFS_uint16 val);
@ -1698,7 +1700,7 @@ __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_file *file, PHYSFS_uint16 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeSLE32(PHYSFS_file *file, PHYSFS_sint32 val);
@ -1713,7 +1715,7 @@ __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_file *file, PHYSFS_sint32 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeULE32(PHYSFS_file *file, PHYSFS_uint32 val);
@ -1728,7 +1730,7 @@ __EXPORT__ int PHYSFS_writeULE32(PHYSFS_file *file, PHYSFS_uint32 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeSBE32(PHYSFS_file *file, PHYSFS_sint32 val);
@ -1743,7 +1745,7 @@ __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_file *file, PHYSFS_sint32 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*/
__EXPORT__ int PHYSFS_writeUBE32(PHYSFS_file *file, PHYSFS_uint32 val);
@ -1758,7 +1760,7 @@ __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_file *file, PHYSFS_uint32 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1776,7 +1778,7 @@ __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_file *file, PHYSFS_sint64 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1794,7 +1796,7 @@ __EXPORT__ int PHYSFS_writeULE64(PHYSFS_file *file, PHYSFS_uint64 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
* any sort of 64-bit support.
@ -1812,7 +1814,7 @@ __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_file *file, PHYSFS_sint64 val);
* \param file PhysicsFS file handle to which to write.
* \param val Value to convert and write.
* \return zero on failure, non-zero on success. On failure, you can
* find out what went wrong from PHYSFS_GetLastError().
* find out what went wrong from PHYSFS_getLastError().
*
* \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
* any sort of 64-bit support.

27
physfs.rc Normal file
View File

@ -0,0 +1,27 @@
1 VERSIONINFO
FILEVERSION 1,0,2,0
PRODUCTVERSION 1,0,2,0
FILEOS 0x40004
FILETYPE 0x2
{
BLOCK "StringFileInfo"
{
BLOCK "040904B0"
{
VALUE "CompanyName", ""
VALUE "FileDescription", "PhysicsFS"
VALUE "FileVersion", "1, 0, 2, 0"
VALUE "InternalName", "PhysFS"
VALUE "LegalCopyright", "Copyright © 2009 Ryan C. Gordon"
VALUE "OriginalFilename", "physfs.dll"
VALUE "ProductName", "PhysicsFS"
VALUE "ProductVersion", "1, 0, 2, 0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0409 0x04B0
}
}

View File

@ -22,7 +22,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".,zlib121"
AdditionalIncludeDirectories=".,zlib123"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;Z_PREFIX;PHYSFS_EXPORTS;PHYSFS_SUPPORTS_GRP;PHYSFS_SUPPORTS_WAD;PHYSFS_SUPPORTS_ZIP;PHYSFS_SUPPORTS_QPAK;PHYSFS_SUPPORTS_HOG;PHYSFS_SUPPORTS_MVL"
ExceptionHandling="FALSE"
BasicRuntimeChecks="3"
@ -93,7 +93,7 @@
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="FALSE"
AdditionalIncludeDirectories=".,zlib121"
AdditionalIncludeDirectories=".,zlib123"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;Z_PREFIX;PHYSFS_EXPORTS;PHYSFS_SUPPORTS_GRP;PHYSFS_SUPPORTS_WAD;PHYSFS_SUPPORTS_ZIP;PHYSFS_SUPPORTS_QPAK;PHYSFS_SUPPORTS_HOG;PHYSFS_SUPPORTS_MVL"
StringPooling="TRUE"
ExceptionHandling="FALSE"
@ -155,16 +155,16 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\zlib121\adler32.c">
RelativePath=".\zlib123\adler32.c">
</File>
<File
RelativePath=".\zlib121\compress.c">
RelativePath=".\zlib123\compress.c">
</File>
<File
RelativePath=".\zlib121\crc32.c">
RelativePath=".\zlib123\crc32.c">
</File>
<File
RelativePath=".\zlib121\deflate.c">
RelativePath=".\zlib123\deflate.c">
</File>
<File
RelativePath=".\archivers\dir.c">
@ -176,13 +176,13 @@
RelativePath="archivers\hog.c">
</File>
<File
RelativePath=".\zlib121\inffast.c">
RelativePath=".\zlib123\inffast.c">
</File>
<File
RelativePath=".\zlib121\inflate.c">
RelativePath=".\zlib123\inflate.c">
</File>
<File
RelativePath=".\zlib121\inftrees.c">
RelativePath=".\zlib123\inftrees.c">
</File>
<File
RelativePath="archivers\mvl.c">
@ -197,10 +197,10 @@
RelativePath="archivers\qpak.c">
</File>
<File
RelativePath=".\zlib121\trees.c">
RelativePath=".\zlib123\trees.c">
</File>
<File
RelativePath=".\zlib121\uncompr.c">
RelativePath=".\zlib123\uncompr.c">
</File>
<File
RelativePath=".\archivers\wad.c">
@ -212,32 +212,32 @@
RelativePath=".\archivers\zip.c">
</File>
<File
RelativePath=".\zlib121\zutil.c">
RelativePath=".\zlib123\zutil.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath=".\zlib121\deflate.h">
RelativePath=".\zlib123\deflate.h">
</File>
<File
RelativePath=".\zlib121\infblock.h">
RelativePath=".\zlib123\infblock.h">
</File>
<File
RelativePath=".\zlib121\infcodes.h">
RelativePath=".\zlib123\infcodes.h">
</File>
<File
RelativePath=".\zlib121\inffast.h">
RelativePath=".\zlib123\inffast.h">
</File>
<File
RelativePath=".\zlib121\inffixed.h">
RelativePath=".\zlib123\inffixed.h">
</File>
<File
RelativePath=".\zlib121\inftrees.h">
RelativePath=".\zlib123\inftrees.h">
</File>
<File
RelativePath=".\zlib121\infutil.h">
RelativePath=".\zlib123\infutil.h">
</File>
<File
RelativePath=".\physfs.h">
@ -246,16 +246,16 @@
RelativePath=".\physfs_internal.h">
</File>
<File
RelativePath=".\zlib121\trees.h">
RelativePath=".\zlib123\trees.h">
</File>
<File
RelativePath=".\zlib121\zconf.h">
RelativePath=".\zlib123\zconf.h">
</File>
<File
RelativePath=".\zlib121\zlib.h">
RelativePath=".\zlib123\zlib.h">
</File>
<File
RelativePath=".\zlib121\zutil.h">
RelativePath=".\zlib123\zutil.h">
</File>
</Filter>
<Filter

View File

@ -47,6 +47,10 @@
#endif
#endif /* linux */
#if (defined macintosh) && !(defined __MWERKS__)
#define __inline__
#endif
#if (defined _MSC_VER)
#define __inline__ __inline
#endif

View File

@ -18,17 +18,21 @@
#ifdef HAVE_ASSERT_H
#include <assert.h>
#else
#elif (!defined assert)
#define assert(x)
#endif
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <malloc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* The LANG section. */
/* please send questions/translations to Ryan: icculus@clutteredmind.org. */
/* please send questions/translations to Ryan: icculus@icculus.org. */
#if (!defined PHYSFS_LANG)
# define PHYSFS_LANG PHYSFS_LANG_ENGLISH
@ -39,9 +43,10 @@ extern "C" {
#define PHYSFS_LANG_RUSSIAN_CP1251 3 /* Russian by Ed Sinjiashvili */
#define PHYSFS_LANG_RUSSIAN_CP866 4 /* Russian by Ed Sinjiashvili */
#define PHYSFS_LANG_RUSSIAN_ISO_8859_5 5 /* Russian by Ed Sinjiashvili */
/* need spanish. */
#define PHYSFS_LANG_SPANISH 6 /* Spanish by Pedro J. Pérez */
#define PHYSFS_LANG_FRENCH 7 /* French by Stéphane Peter */
#define PHYSFS_LANG_GERMAN 8 /* German by Michael Renner */
#define PHYSFS_LANG_PORTUGUESE_BR 9 /* pt-br by Danny Angelo Carminati Grein */
#if (PHYSFS_LANG == PHYSFS_LANG_ENGLISH)
#define DIR_ARCHIVE_DESCRIPTION "Non-archive, direct filesystem I/O"
@ -50,6 +55,7 @@ extern "C" {
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
#define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip compatible"
#define WAD_ARCHIVE_DESCRIPTION "DOOM engine format"
#define ERR_IS_INITIALIZED "Already initialized"
#define ERR_NOT_INITIALIZED "Not initialized"
@ -147,6 +153,7 @@ extern "C" {
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
#define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip kompatibel"
#define WAD_ARCHIVE_DESCRIPTION "DOOM engine format"
#define ERR_IS_INITIALIZED "Bereits initialisiert"
#define ERR_NOT_INITIALIZED "Nicht initialisiert"
@ -243,6 +250,7 @@ extern "C" {
#define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip ÓÏ×ÍÅÓÔÉÍÙÊ"
#define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" // !!! FIXME: translate this line if needed
#define ERR_IS_INITIALIZED "õÖÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎ"
#define ERR_NOT_INITIALIZED "îÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎ"
@ -339,6 +347,7 @@ extern "C" {
#define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip ñîâìåñòèìûé"
#define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" // FIXME: translate this line if needed
#define ERR_IS_INITIALIZED "Óæå èíèöèàëèçèðîâàí"
#define ERR_NOT_INITIALIZED "Íå èíèöèàëèçèðîâàí"
@ -435,6 +444,7 @@ extern "C" {
#define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip ᮢ¬¥á⨬ë©"
#define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" // FIXME: Translate this line if needed
#define ERR_IS_INITIALIZED "“¦¥ ¨­¨æ¨ «¨§¨à®¢ ­"
#define ERR_NOT_INITIALIZED "<22>¥ ¨­¨æ¨ «¨§¨à®¢ ­"
@ -531,6 +541,7 @@ extern "C" {
#define HOG_ARCHIVE_DESCRIPTION "Descent I/II HOG file format"
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define ZIP_ARCHIVE_DESCRIPTION "PkZip/WinZip/Info-Zip áÞÒÜÕáâØÜëÙ"
#define WAD_ARCHIVE_DESCRIPTION "DOOM engine format" // FIXME: translate this line if needed
#define ERR_IS_INITIALIZED "ÃÖÕ ØÝØæØÐÛØ×ØàÞÒÐÝ"
#define ERR_NOT_INITIALIZED "½Õ ØÝØæØÐÛØ×ØàÞÒÐÝ"
@ -629,6 +640,7 @@ extern "C" {
#define MVL_ARCHIVE_DESCRIPTION "Descent II Movielib format"
#define QPAK_ARCHIVE_DESCRIPTION "Quake I/II format"
#define ZIP_ARCHIVE_DESCRIPTION "Compatible PkZip/WinZip/Info-Zip"
#define WAD_ARCHIVE_DESCRIPTION "Format WAD du moteur DOOM"
#define ERR_IS_INITIALIZED "Déjà initialisé"
#define ERR_NOT_INITIALIZED "Non initialisé"
@ -719,6 +731,201 @@ extern "C" {
#define ERR_PROT_VIOLATION "Violation de protection"
#define ERR_BROKEN_PIPE "Tube cassé"
#elif (PHYSFS_LANG == PHYSFS_LANG_PORTUGUESE_BR)
#define DIR_ARCHIVE_DESCRIPTION "Não arquivo, E/S sistema de arquivos direto"
#define GRP_ARCHIVE_DESCRIPTION "Formato Groupfile do engine Build"
#define HOG_ARCHIVE_DESCRIPTION "Formato Descent I/II HOG file"
#define MVL_ARCHIVE_DESCRIPTION "Formato Descent II Movielib"
#define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
#define ZIP_ARCHIVE_DESCRIPTION "Formato compatível PkZip/WinZip/Info-Zip"
#define WAD_ARCHIVE_DESCRIPTION "Formato WAD do engine DOOM"
#define ERR_IS_INITIALIZED "Já inicializado"
#define ERR_NOT_INITIALIZED "Não inicializado"
#define ERR_INVALID_ARGUMENT "Argumento inválido"
#define ERR_FILES_STILL_OPEN "Arquivos ainda abertos"
#define ERR_NO_DIR_CREATE "Falha na criação de diretórios"
#define ERR_OUT_OF_MEMORY "Memória insuficiente"
#define ERR_NOT_IN_SEARCH_PATH "Entrada não encontrada no caminho de busca"
#define ERR_NOT_SUPPORTED "Operação não suportada"
#define ERR_UNSUPPORTED_ARCHIVE "Tipo de arquivo não suportado"
#define ERR_NOT_A_HANDLE "Não é um handler de arquivo"
#define ERR_INSECURE_FNAME "Nome de arquivo inseguro"
#define ERR_SYMLINK_DISALLOWED "Links simbólicos desabilitados"
#define ERR_NO_WRITE_DIR "Diretório de escrita não definido"
#define ERR_NO_SUCH_FILE "Arquivo não encontrado"
#define ERR_NO_SUCH_PATH "Caminho não encontrado"
#define ERR_NO_SUCH_VOLUME "Volume não encontrado"
#define ERR_PAST_EOF "Passou o fim do arquivo"
#define ERR_ARC_IS_READ_ONLY "Arquivo é somente de leitura"
#define ERR_IO_ERROR "Erro de E/S"
#define ERR_CANT_SET_WRITE_DIR "Não foi possível definir diretório de escrita"
#define ERR_SYMLINK_LOOP "Loop infinito de link simbólico"
#define ERR_COMPRESSION "Erro de (Des)compressão"
#define ERR_NOT_IMPLEMENTED "Não implementado"
#define ERR_OS_ERROR "Erro reportado pelo Sistema Operacional"
#define ERR_FILE_EXISTS "Arquivo já existente"
#define ERR_NOT_A_FILE "Não é um arquivo"
#define ERR_NOT_A_DIR "Não é um diretório"
#define ERR_NOT_AN_ARCHIVE "Não é um pacote"
#define ERR_CORRUPTED "Pacote corrompido"
#define ERR_SEEK_OUT_OF_RANGE "Posicionamento além do tamanho"
#define ERR_BAD_FILENAME "Nome de arquivo inválido"
#define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS realizou uma chamada de sistema inválida"
#define ERR_ARGV0_IS_NULL "argv0 é NULL"
#define ERR_ZLIB_NEED_DICT "zlib: precisa de diretório"
#define ERR_ZLIB_DATA_ERROR "zlib: erro nos dados"
#define ERR_ZLIB_MEMORY_ERROR "zlib: erro de memória"
#define ERR_ZLIB_BUFFER_ERROR "zlib: erro de buffer"
#define ERR_ZLIB_VERSION_ERROR "zlib: erro na version"
#define ERR_ZLIB_UNKNOWN_ERROR "zlib: erro desconhecido"
#define ERR_SEARCHPATH_TRUNC "Caminho de procura quebrado"
#define ERR_GETMODFN_TRUNC "GetModuleFileName() foi quebrado"
#define ERR_GETMODFN_NO_DIR "GetModuleFileName() nao teve diretório"
#define ERR_DISK_FULL "Disco cheio"
#define ERR_DIRECTORY_FULL "Diretório cheio"
#define ERR_MACOS_GENERIC "MacOS reportou um erro (%d)"
#define ERR_OS2_GENERIC "OS/2 reportou um erro (%d)"
#define ERR_VOL_LOCKED_HW "Volume travado por hardware"
#define ERR_VOL_LOCKED_SW "Volume travado por software"
#define ERR_FILE_LOCKED "Arquivo travado"
#define ERR_FILE_OR_DIR_BUSY "Arquivo/Diretório está em uso"
#define ERR_FILE_ALREADY_OPEN_W "Arquivo já aberto para escrita"
#define ERR_FILE_ALREADY_OPEN_R "Arquivo já aberto para leitura"
#define ERR_INVALID_REFNUM "Número de referência"
#define ERR_GETTING_FILE_POS "Erro ao tentar obter posição do arquivo"
#define ERR_VOLUME_OFFLINE "Volume está indisponível"
#define ERR_PERMISSION_DENIED "Permissão negada"
#define ERR_VOL_ALREADY_ONLINE "Volume disponível"
#define ERR_NO_SUCH_DRIVE "Drive inexistente"
#define ERR_NOT_MAC_DISK "Não é um disco Macintosh"
#define ERR_VOL_EXTERNAL_FS "Volume pertence a um sistema de arquivos externo"
#define ERR_PROBLEM_RENAME "Problema durante renomeação"
#define ERR_BAD_MASTER_BLOCK "Bloco master do diretório inválido"
#define ERR_CANT_MOVE_FORBIDDEN "Tentativa de mover proibida"
#define ERR_WRONG_VOL_TYPE "Tipo inválido de volume"
#define ERR_SERVER_VOL_LOST "Volume servidor desconectado"
#define ERR_FILE_ID_NOT_FOUND "ID de Arquivo não encontrado"
#define ERR_FILE_ID_EXISTS "ID de Arquivo já existente"
#define ERR_SERVER_NO_RESPOND "Servidor não respondendo"
#define ERR_USER_AUTH_FAILED "Autenticação de usuário falhada"
#define ERR_PWORD_EXPIRED "Password foi expirada no servidor"
#define ERR_ACCESS_DENIED "Accesso negado"
#define ERR_NOT_A_DOS_DISK "Não é um disco DOS"
#define ERR_SHARING_VIOLATION "Violação de compartilhamento"
#define ERR_CANNOT_MAKE "Não pode ser feito"
#define ERR_DEV_IN_USE "Device já em uso"
#define ERR_OPEN_FAILED "Falaha na abertura"
#define ERR_PIPE_BUSY "Fila ocupada"
#define ERR_SHARING_BUF_EXCEEDED "Buffer de compartilhamento excedeu"
#define ERR_TOO_MANY_HANDLES "Muitos handles abertos"
#define ERR_SEEK_ERROR "Erro de posicionamento"
#define ERR_DEL_CWD "Tentando remover diretório de trabalho atual"
#define ERR_WRITE_PROTECT_ERROR "Erro de proteção de escrita"
#define ERR_WRITE_FAULT "Erro de escrita"
#define ERR_LOCK_VIOLATION "Violação de trava"
#define ERR_GEN_FAILURE "Falha geral"
#define ERR_UNCERTAIN_MEDIA "Media incerta"
#define ERR_PROT_VIOLATION "Violação de proteção"
#define ERR_BROKEN_PIPE "Fila quebrada"
#elif (PHYSFS_LANG == PHYSFS_LANG_SPANISH)
#define DIR_ARCHIVE_DESCRIPTION "No es un archivo, E/S directa al sistema de ficheros"
#define GRP_ARCHIVE_DESCRIPTION "Formato Build engine Groupfile"
#define HOG_ARCHIVE_DESCRIPTION "Formato Descent I/II HOG file"
#define MVL_ARCHIVE_DESCRIPTION "Formato Descent II Movielib"
#define QPAK_ARCHIVE_DESCRIPTION "Formato Quake I/II"
#define ZIP_ARCHIVE_DESCRIPTION "Compatible con PkZip/WinZip/Info-Zip"
#define ERR_IS_INITIALIZED "Ya estaba inicializado"
#define ERR_NOT_INITIALIZED "No está inicializado"
#define ERR_INVALID_ARGUMENT "Argumento inválido"
#define ERR_FILES_STILL_OPEN "Archivos aún abiertos"
#define ERR_NO_DIR_CREATE "Fallo al crear los directorios"
#define ERR_OUT_OF_MEMORY "Memoria agotada"
#define ERR_NOT_IN_SEARCH_PATH "No existe tal entrada en la ruta de búsqueda"
#define ERR_NOT_SUPPORTED "Operación no soportada"
#define ERR_UNSUPPORTED_ARCHIVE "Tipo de archivo no soportado"
#define ERR_NOT_A_HANDLE "No es un manejador de ficheo (file handle)"
#define ERR_INSECURE_FNAME "Nombre de archivo inseguro"
#define ERR_SYMLINK_DISALLOWED "Los enlaces simbólicos están desactivados"
#define ERR_NO_WRITE_DIR "No has configurado un directorio de escritura"
#define ERR_NO_SUCH_FILE "Archivo no encontrado"
#define ERR_NO_SUCH_PATH "Ruta no encontrada"
#define ERR_NO_SUCH_VOLUME "Volumen no encontrado"
#define ERR_PAST_EOF "Te pasaste del final del archivo"
#define ERR_ARC_IS_READ_ONLY "El archivo es de sólo lectura"
#define ERR_IO_ERROR "Error E/S"
#define ERR_CANT_SET_WRITE_DIR "No puedo configurar el directorio de escritura"
#define ERR_SYMLINK_LOOP "Bucle infnito de enlaces simbólicos"
#define ERR_COMPRESSION "Error de (des)compresión"
#define ERR_NOT_IMPLEMENTED "No implementado"
#define ERR_OS_ERROR "El sistema operativo ha devuelto un error"
#define ERR_FILE_EXISTS "El archivo ya existe"
#define ERR_NOT_A_FILE "No es un archivo"
#define ERR_NOT_A_DIR "No es un directorio"
#define ERR_NOT_AN_ARCHIVE "No es un archivo"
#define ERR_CORRUPTED "Archivo corrupto"
#define ERR_SEEK_OUT_OF_RANGE "Búsqueda fuera de rango"
#define ERR_BAD_FILENAME "Nombre de archivo incorrecto"
#define ERR_PHYSFS_BAD_OS_CALL "(BUG) PhysicsFS ha hecho una llamada incorrecta al sistema"
#define ERR_ARGV0_IS_NULL "argv0 es NULL"
#define ERR_ZLIB_NEED_DICT "zlib: necesito diccionario"
#define ERR_ZLIB_DATA_ERROR "zlib: error de datos"
#define ERR_ZLIB_MEMORY_ERROR "zlib: error de memoria"
#define ERR_ZLIB_BUFFER_ERROR "zlib: error de buffer"
#define ERR_ZLIB_VERSION_ERROR "zlib: error de versión"
#define ERR_ZLIB_UNKNOWN_ERROR "zlib: error desconocido"
#define ERR_SEARCHPATH_TRUNC "La ruta de búsqueda ha sido truncada"
#define ERR_GETMODFN_TRUNC "GetModuleFileName() ha sido truncado"
#define ERR_GETMODFN_NO_DIR "GetModuleFileName() no tenia directorio"
#define ERR_DISK_FULL "El disco está lleno"
#define ERR_DIRECTORY_FULL "El directorio está lleno"
#define ERR_MACOS_GENERIC "MacOS ha devuelto un error (%d)"
#define ERR_OS2_GENERIC "OS/2 ha devuelto un error (%d)"
#define ERR_VOL_LOCKED_HW "El volumen está bloqueado por el hardware"
#define ERR_VOL_LOCKED_SW "El volumen está bloqueado por el software"
#define ERR_FILE_LOCKED "El archivo está bloqueado"
#define ERR_FILE_OR_DIR_BUSY "Fichero o directorio ocupados"
#define ERR_FILE_ALREADY_OPEN_W "Fichero ya abierto para escritura"
#define ERR_FILE_ALREADY_OPEN_R "Fichero ya abierto para lectura"
#define ERR_INVALID_REFNUM "El número de referencia no es válido"
#define ERR_GETTING_FILE_POS "Error al tomar la posición del fichero"
#define ERR_VOLUME_OFFLINE "El volumen está desconectado"
#define ERR_PERMISSION_DENIED "Permiso denegado"
#define ERR_VOL_ALREADY_ONLINE "El volumen ya estaba conectado"
#define ERR_NO_SUCH_DRIVE "No existe tal unidad"
#define ERR_NOT_MAC_DISK "No es un disco Macintosh"
#define ERR_VOL_EXTERNAL_FS "El volumen pertence a un sistema de ficheros externo"
#define ERR_PROBLEM_RENAME "Problemas al renombrar"
#define ERR_BAD_MASTER_BLOCK "Bloque maestro de directorios incorrecto"
#define ERR_CANT_MOVE_FORBIDDEN "Intento de mover forbidden"
#define ERR_WRONG_VOL_TYPE "Tipo de volumen incorrecto"
#define ERR_SERVER_VOL_LOST "El servidor de volúmenes ha sido desconectado"
#define ERR_FILE_ID_NOT_FOUND "Identificador de archivo no encontrado"
#define ERR_FILE_ID_EXISTS "El identificador de archivo ya existe"
#define ERR_SERVER_NO_RESPOND "El servidor no responde"
#define ERR_USER_AUTH_FAILED "Fallo al autentificar el usuario"
#define ERR_PWORD_EXPIRED "La Password en el servidor ha caducado"
#define ERR_ACCESS_DENIED "Acceso denegado"
#define ERR_NOT_A_DOS_DISK "No es un disco de DOS"
#define ERR_SHARING_VIOLATION "Violación al compartir"
#define ERR_CANNOT_MAKE "No puedo hacer make"
#define ERR_DEV_IN_USE "El dispositivo ya estaba en uso"
#define ERR_OPEN_FAILED "Fallo al abrir"
#define ERR_PIPE_BUSY "Tubería ocupada"
#define ERR_SHARING_BUF_EXCEEDED "Buffer de compartición sobrepasado"
#define ERR_TOO_MANY_HANDLES "Demasiados manejadores (handles)"
#define ERR_SEEK_ERROR "Error de búsqueda"
#define ERR_DEL_CWD "Intentando borrar el directorio de trabajo actual"
#define ERR_WRITE_PROTECT_ERROR "Error de protección contra escritura"
#define ERR_WRITE_FAULT "Fallo al escribir"
#define ERR_LOCK_VIOLATION "Violación del bloqueo"
#define ERR_GEN_FAILURE "Fallo general"
#define ERR_UNCERTAIN_MEDIA "Medio incierto"
#define ERR_PROT_VIOLATION "Violación de la protección"
#define ERR_BROKEN_PIPE "Tubería rota"
#else
#error Please define PHYSFS_LANG.
#endif
@ -1224,8 +1431,7 @@ int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos);
*
* Not all file types can "tell"; this is to be expected by the caller.
*
* On error, call __PHYSFS_setError() and return zero. On success, return
* a non-zero value.
* On error, call __PHYSFS_setError() and return -1. On success, return >= 0.
*/
PHYSFS_sint64 __PHYSFS_platformTell(void *opaque);

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "zlib121" /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PHYSFS_SUPPORTS_QPAK=1 /D PHYSFS_SUPPORTS_ZIP=1 /D PHYSFS_SUPPORTS_HOG=1 /D PHYSFS_SUPPORTS_GRP=1 /D PHYSFS_SUPPORTS_WAD=1 /D PHYSFS_SUPPORTS_MVL=1 /D Z_PREFIX=1 /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "zlib123" /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PHYSFS_SUPPORTS_QPAK=1 /D PHYSFS_SUPPORTS_ZIP=1 /D PHYSFS_SUPPORTS_HOG=1 /D PHYSFS_SUPPORTS_GRP=1 /D PHYSFS_SUPPORTS_WAD=1 /D PHYSFS_SUPPORTS_MVL=1 /D Z_PREFIX=1 /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -66,7 +66,7 @@ LIB32=link.exe -lib
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "zlib121" /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PHYSFS_SUPPORTS_QPAK=1 /D PHYSFS_SUPPORTS_ZIP=1 /D PHYSFS_SUPPORTS_HOG=1 /D PHYSFS_SUPPORTS_GRP=1 /D PHYSFS_SUPPORTS_WAD=1 /D PHYSFS_SUPPORTS_MVL=1 /D Z_PREFIX=1 /FR /YX /FD /GZ /c
# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "zlib123" /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PHYSFS_SUPPORTS_QPAK=1 /D PHYSFS_SUPPORTS_ZIP=1 /D PHYSFS_SUPPORTS_HOG=1 /D PHYSFS_SUPPORTS_GRP=1 /D PHYSFS_SUPPORTS_WAD=1 /D PHYSFS_SUPPORTS_MVL=1 /D Z_PREFIX=1 /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@ -90,47 +90,47 @@ LIB32=link.exe -lib
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\zlib121\adler32.c
SOURCE=.\zlib123\adler32.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\compress.c
SOURCE=.\zlib123\compress.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\crc32.c
SOURCE=.\zlib123\crc32.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\deflate.c
SOURCE=.\zlib123\deflate.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\infback.c
SOURCE=.\zlib123\infback.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\inffast.c
SOURCE=.\zlib123\inffast.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\inflate.c
SOURCE=.\zlib123\inflate.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\inftrees.c
SOURCE=.\zlib123\inftrees.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\trees.c
SOURCE=.\zlib123\trees.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\uncompr.c
SOURCE=.\zlib123\uncompr.c
# End Source File
# Begin Source File
SOURCE=.\zlib121\zutil.c
SOURCE=.\zlib123\zutil.c
# End Source File
# End Group
# Begin Source File

View File

@ -1,10 +0,0 @@
Makefile
.deps
.libs
libplatform.la
Makefile.in
unix.lo
posix.lo
beos.lo
win32.lo
os2.lo

View File

@ -14,7 +14,6 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <alloca.h>
/*
* Most of the API calls in here are, according to ADC, available since
@ -138,7 +137,7 @@ static OSErr oserr(OSErr retval)
const char *errstr = get_macos_error_string(retval);
if (strcmp(errstr, ERR_MACOS_GENERIC) == 0)
{
snprintf(buf, sizeof (buf), ERR_MACOS_GENERIC, (int) retval);
sprintf(buf, ERR_MACOS_GENERIC, (int) retval);
errstr = buf;
} /* if */
@ -768,16 +767,10 @@ PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
PHYSFS_uint32 size, PHYSFS_uint32 count)
{
SInt16 ref = *((SInt16 *) opaque);
SInt32 br;
PHYSFS_uint32 i;
SInt32 br = size*count;
for (i = 0; i < count; i++)
{
br = size;
BAIL_IF_MACRO(oserr(FSRead(ref, &br, buffer)) != noErr, NULL, i);
BAIL_IF_MACRO(br != size, NULL, i); /* !!! FIXME: seek back if only read part of an object! */
buffer = ((PHYSFS_uint8 *) buffer) + size;
} /* for */
BAIL_IF_MACRO(oserr(FSRead(ref, &br, buffer)) != noErr, NULL, br/size);
BAIL_IF_MACRO(br != size*count, NULL, br/size); /* !!! FIXME: seek back if only read part of an object! */
return(count);
} /* __PHYSFS_platformRead */
@ -787,16 +780,10 @@ PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
PHYSFS_uint32 size, PHYSFS_uint32 count)
{
SInt16 ref = *((SInt16 *) opaque);
SInt32 bw;
PHYSFS_uint32 i;
SInt32 bw = size*count;
for (i = 0; i < count; i++)
{
bw = size;
BAIL_IF_MACRO(oserr(FSWrite(ref, &bw, buffer)) != noErr, NULL, i);
BAIL_IF_MACRO(bw != size, NULL, i); /* !!! FIXME: seek back if only wrote part of an object! */
buffer = ((PHYSFS_uint8 *) buffer) + size;
} /* for */
BAIL_IF_MACRO(oserr(FSWrite(ref, &bw, buffer)) != noErr, NULL, bw/size);
BAIL_IF_MACRO(bw != size*count, NULL, bw/size); /* !!! FIXME: seek back if only wrote part of an object! */
return(count);
} /* __PHYSFS_platformWrite */

View File

@ -662,13 +662,13 @@ int __PHYSFS_platformEOF(void *opaque)
int __PHYSFS_platformFlush(void *opaque)
{
return(os2err(DosResetBuffer((HFILE) opaque) == NO_ERROR));
return(os2err(DosResetBuffer((HFILE) opaque)) == NO_ERROR);
} /* __PHYSFS_platformFlush */
int __PHYSFS_platformClose(void *opaque)
{
return(os2err(DosClose((HFILE) opaque) == NO_ERROR));
return(os2err(DosClose((HFILE) opaque)) == NO_ERROR);
} /* __PHYSFS_platformClose */
@ -677,7 +677,7 @@ int __PHYSFS_platformDelete(const char *path)
if (__PHYSFS_platformIsDirectory(path))
return(os2err(DosDeleteDir(path)) == NO_ERROR);
return(os2err(DosDelete(path) == NO_ERROR));
return(os2err(DosDelete(path)) == NO_ERROR);
} /* __PHYSFS_platformDelete */

View File

@ -553,7 +553,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
LowPos = SetFilePointer(FileHandle, 0, &HighPos, FILE_CURRENT);
if ((LowPos == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
{
BAIL_MACRO(win32strerror(), 0);
BAIL_MACRO(win32strerror(), -1);
} /* if */
else
{
@ -591,14 +591,18 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
int __PHYSFS_platformEOF(void *opaque)
{
const PHYSFS_sint64 FileLength = __PHYSFS_platformFileLength(opaque);
PHYSFS_sint64 FilePosition;
int retval = 0;
if (FileLength == 0)
return 1; /* we're definitely at EOF. */
/* Get the current position in the file */
if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
if ((FilePosition = __PHYSFS_platformTell(opaque)) != -1)
{
/* Non-zero if EOF is equal to the file length */
retval = FilePosition == __PHYSFS_platformFileLength(opaque);
retval = (FilePosition == FileLength);
} /* if */
return(retval);
@ -675,5 +679,5 @@ PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
} /* __PHYSFS_platformGetLastModTime */
/* end of skeleton.c ... */
/* end of pocketpc.c ... */

View File

@ -344,13 +344,26 @@ int __PHYSFS_platformMkDir(const char *path)
static void *doOpen(const char *filename, int mode)
{
const int appending = (mode & O_APPEND);
int fd;
int *retval;
errno = 0;
/* O_APPEND doesn't actually behave as we'd like. */
mode &= ~O_APPEND;
fd = open(filename, mode, S_IRUSR | S_IWUSR);
BAIL_IF_MACRO(fd < 0, strerror(errno), NULL);
if (appending)
{
if (lseek(fd, 0, SEEK_END) < 0)
{
close(fd);
BAIL_MACRO(strerror(errno), NULL);
} /* if */
} /* if */
retval = (int *) malloc(sizeof (int));
if (retval == NULL)
{
@ -465,7 +478,7 @@ int __PHYSFS_platformEOF(void *opaque)
{
PHYSFS_sint64 pos = __PHYSFS_platformTell(opaque);
PHYSFS_sint64 len = __PHYSFS_platformFileLength(opaque);
return(pos >= len);
return((pos < 0) || (len < 0) || (pos >= len));
} /* __PHYSFS_platformEOF */

View File

@ -25,14 +25,12 @@
#if (defined _MSC_VER)
#define alloca(x) _alloca(x)
#elif (defined MINGW) /* scary...hopefully this is okay. */
#elif (defined __MINGW32__) /* scary...hopefully this is okay. */
#define alloca(x) __builtin_alloca(x)
#endif
#define LOWORDER_UINT64(pos) (PHYSFS_uint32) \
(pos & 0x00000000FFFFFFFF)
#define HIGHORDER_UINT64(pos) (PHYSFS_uint32) \
(((pos & 0xFFFFFFFF00000000) >> 32) & 0x00000000FFFFFFFF)
#define LOWORDER_UINT64(pos) ((PHYSFS_uint32) (pos & 0xFFFFFFFF))
#define HIGHORDER_UINT64(pos) ((PHYSFS_uint32) ((pos >> 32) & 0xFFFFFFFF))
/* GetUserProfileDirectory() is only available on >= NT4 (no 9x/ME systems!) */
typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETUSERPROFILEDIR) (
@ -80,8 +78,7 @@ static const char *win32strerror(void)
{
static TCHAR msgbuf[255];
TCHAR *ptr = msgbuf;
FormatMessage(
DWORD rc = FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
@ -92,12 +89,15 @@ static const char *win32strerror(void)
NULL
);
/* chop off newlines. */
if (rc == 0)
msgbuf[0] = '\0'; /* oh well. Empty string. */
/* chop off newlines... */
for (ptr = msgbuf; *ptr; ptr++)
{
if ((*ptr == '\n') || (*ptr == '\r'))
{
*ptr = ' ';
*ptr = '\0';
break;
} /* if */
} /* for */
@ -185,7 +185,6 @@ static char *getExePath(const char *argv0)
static int determineUserDir(void)
{
DWORD psize = 0;
char dummy[1];
BOOL rc = 0;
HANDLE processHandle; /* Current process handle */
HANDLE accessToken = NULL; /* Security handle to process */
@ -204,7 +203,7 @@ static int determineUserDir(void)
lib = LoadLibrary("userenv.dll");
if (lib)
{
/* !!! FIXME: Handle Unicode? */
/* If you want Unicode, upgrade to PhysicsFS 1.1.1 or later! */
GetUserProfileDirectory = (LPFNGETUSERPROFILEDIR)
GetProcAddress(lib, "GetUserProfileDirectoryA");
if (GetUserProfileDirectory)
@ -217,7 +216,7 @@ static int determineUserDir(void)
* psize. Also note that the second parameter can't be
* NULL or the function fails.
*/
rc = GetUserProfileDirectory(accessToken, dummy, &psize);
rc = GetUserProfileDirectory(accessToken, NULL, &psize);
assert(!rc); /* success?! */
/* Allocate memory for the profile directory */
@ -850,8 +849,8 @@ PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
{
HANDLE FileHandle = ((win32file *) opaque)->handle;
DWORD HighOrderPos;
DWORD *pHighOrderPos;
LONG HighOrderPos;
PLONG pHighOrderPos;
DWORD rc;
/* Get the high order 32-bits of the position */
@ -888,7 +887,7 @@ int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
{
HANDLE FileHandle = ((win32file *) opaque)->handle;
DWORD HighPos = 0;
LONG HighPos = 0;
DWORD LowPos;
PHYSFS_sint64 retval;
@ -897,7 +896,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) &&
(GetLastError() != NO_ERROR) )
{
BAIL_MACRO(win32strerror(), 0);
BAIL_MACRO(win32strerror(), -1);
} /* if */
else
{
@ -936,14 +935,18 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
int __PHYSFS_platformEOF(void *opaque)
{
const PHYSFS_sint64 FileLength = __PHYSFS_platformFileLength(opaque);
PHYSFS_sint64 FilePosition;
int retval = 0;
if (FileLength == 0)
return 1; /* we're definitely at EOF. */
/* Get the current position in the file */
if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0)
if ((FilePosition = __PHYSFS_platformTell(opaque)) != -1
{
/* Non-zero if EOF is equal to the file length */
retval = FilePosition == __PHYSFS_platformFileLength(opaque);
retval = (FilePosition == FileLength);
} /* if */
return(retval);
@ -972,7 +975,7 @@ int __PHYSFS_platformClose(void *opaque)
int __PHYSFS_platformDelete(const char *path)
{
/* If filename is a folder */
if (GetFileAttributes(path) == FILE_ATTRIBUTE_DIRECTORY)
if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY)
{
BAIL_IF_MACRO(!RemoveDirectory(path), win32strerror(), 0);
} /* if */

View File

@ -1,5 +0,0 @@
Makefile
.deps
.libs
Makefile.in
test_physfs

View File

@ -31,7 +31,7 @@
#define TEST_VERSION_MAJOR 1
#define TEST_VERSION_MINOR 0
#define TEST_VERSION_PATCH 0
#define TEST_VERSION_PATCH 2
static FILE *history_file = NULL;
static PHYSFS_uint32 do_buffer_size = 0;
@ -1066,7 +1066,9 @@ static void open_history_file(void)
do
{
fgets(buf, sizeof (buf), f);
if (fgets(buf, sizeof (buf), f) == NULL)
break;
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
add_history(buf);

View File

@ -1,17 +0,0 @@
.deps
.libs
Makefile
Makefile.in
adler32.lo
compress.lo
crc32.lo
deflate.lo
gzio.lo
infback.lo
inffast.lo
inflate.lo
inftrees.lo
libz.la
trees.lo
uncompr.lo
zutil.lo

View File

@ -1,74 +0,0 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2003 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: adler32.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
#define ZLIB_INTERNAL
#include "zlib.h"
#define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
#ifdef NO_DIVIDE
# define MOD(a) \
do { \
if (a >= (BASE << 16)) a -= (BASE << 16); \
if (a >= (BASE << 15)) a -= (BASE << 15); \
if (a >= (BASE << 14)) a -= (BASE << 14); \
if (a >= (BASE << 13)) a -= (BASE << 13); \
if (a >= (BASE << 12)) a -= (BASE << 12); \
if (a >= (BASE << 11)) a -= (BASE << 11); \
if (a >= (BASE << 10)) a -= (BASE << 10); \
if (a >= (BASE << 9)) a -= (BASE << 9); \
if (a >= (BASE << 8)) a -= (BASE << 8); \
if (a >= (BASE << 7)) a -= (BASE << 7); \
if (a >= (BASE << 6)) a -= (BASE << 6); \
if (a >= (BASE << 5)) a -= (BASE << 5); \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
#endif
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = (adler >> 16) & 0xffff;
int k;
if (buf == Z_NULL) return 1L;
while (len > 0) {
k = len < NMAX ? (int)len : NMAX;
len -= k;
while (k >= 16) {
DO16(buf);
buf += 16;
k -= 16;
}
if (k != 0) do {
s1 += *buf++;
s2 += s1;
} while (--k);
MOD(s1);
MOD(s2);
}
return (s2 << 16) | s1;
}

125
zlib123/README Normal file
View File

@ -0,0 +1,125 @@
ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.3 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
and rfc1952.txt (gzip format). These documents are also available in other
formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
All functions of the compression library are documented in the file zlib.h
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
of the library is given in the file example.c which also tests that the library
is working correctly. Another example is given in the file minigzip.c. The
compression library itself is composed of all source files except example.c and
minigzip.c.
To compile all files and run the test program, follow the instructions given at
the top of Makefile. In short "make test; make install" should work for most
machines. For Unix: "./configure; make test; make install". For MSDOS, use one
of the special makefiles such as Makefile.msc. For VMS, use make_vms.com.
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
<info@winimage.com> for the Windows DLL version. The zlib home page is
http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
please check this site to verify that you have the latest version of zlib;
otherwise get the latest version and check whether the problem still exists or
not.
PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
for help.
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available in
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
The changes made in version 1.2.3 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory "contrib".
A Java implementation of zlib is available in the Java Development Kit
http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
See the zlib home page http://www.zlib.org for details.
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
CPAN (Comprehensive Perl Archive Network) sites
http://www.cpan.org/modules/by-module/Compress/
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see
http://www.python.org/doc/lib/module-zlib.html
A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
An experimental package to read and write files in .zip format, written on top
of zlib by Gilles Vollant <info@winimage.com>, is available in the
contrib/minizip directory of zlib.
Notes for some targets:
- For Windows DLL versions, please see win32/DLL_FAQ.txt
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
compiler flag). The compiler bug has been reported to SGI.
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc.
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure.
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
other compilers. Use "make test" to check your compiler.
- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
- For PalmOs, see http://palmzlib.sourceforge.net/
- When building a shared, i.e. dynamic library on Mac OS X, the library must be
installed before testing (do "make install" before "make test"), since the
library location is specified in the library.
Acknowledgments:
The deflate format used by zlib was defined by Phil Katz. The deflate
and zlib specifications were written by L. Peter Deutsch. Thanks to all the
people who reported problems and suggested various improvements in zlib;
they are too numerous to cite here.
Copyright notice:
(C) 1995-2004 Jean-loup Gailly and Mark Adler
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.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
If you use the zlib library in a product, we would appreciate *not*
receiving lengthy legal documents to sign. The sources are provided
for free but without warranty of any kind. The library has been
entirely written by Jean-loup Gailly and Mark Adler; it does not
include third-party code.
If you redistribute modified sources, we would appreciate that you include
in the file ChangeLog history information documenting your changes. Please
read the FAQ for more information on the distribution of modified source
versions.

149
zlib123/adler32.c Normal file
View File

@ -0,0 +1,149 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
#define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* use NO_DIVIDE if your processor does not do division in hardware */
#ifdef NO_DIVIDE
# define MOD(a) \
do { \
if (a >= (BASE << 16)) a -= (BASE << 16); \
if (a >= (BASE << 15)) a -= (BASE << 15); \
if (a >= (BASE << 14)) a -= (BASE << 14); \
if (a >= (BASE << 13)) a -= (BASE << 13); \
if (a >= (BASE << 12)) a -= (BASE << 12); \
if (a >= (BASE << 11)) a -= (BASE << 11); \
if (a >= (BASE << 10)) a -= (BASE << 10); \
if (a >= (BASE << 9)) a -= (BASE << 9); \
if (a >= (BASE << 8)) a -= (BASE << 8); \
if (a >= (BASE << 7)) a -= (BASE << 7); \
if (a >= (BASE << 6)) a -= (BASE << 6); \
if (a >= (BASE << 5)) a -= (BASE << 5); \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
if (a >= BASE) a -= BASE; \
} while (0)
# define MOD4(a) \
do { \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
# define MOD4(a) a %= BASE
#endif
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
unsigned long sum2;
unsigned n;
/* split Adler-32 into component sums */
sum2 = (adler >> 16) & 0xffff;
adler &= 0xffff;
/* in case user likes doing a byte at a time, keep it fast */
if (len == 1) {
adler += buf[0];
if (adler >= BASE)
adler -= BASE;
sum2 += adler;
if (sum2 >= BASE)
sum2 -= BASE;
return adler | (sum2 << 16);
}
/* initial Adler-32 value (deferred check for len == 1 speed) */
if (buf == Z_NULL)
return 1L;
/* in case short lengths are provided, keep it somewhat fast */
if (len < 16) {
while (len--) {
adler += *buf++;
sum2 += adler;
}
if (adler >= BASE)
adler -= BASE;
MOD4(sum2); /* only added so many BASE's */
return adler | (sum2 << 16);
}
/* do length NMAX blocks -- requires just one modulo operation */
while (len >= NMAX) {
len -= NMAX;
n = NMAX / 16; /* NMAX is divisible by 16 */
do {
DO16(buf); /* 16 sums unrolled */
buf += 16;
} while (--n);
MOD(adler);
MOD(sum2);
}
/* do remaining bytes (less than NMAX, still just one modulo) */
if (len) { /* avoid modulos if none remaining */
while (len >= 16) {
len -= 16;
DO16(buf);
buf += 16;
}
while (len--) {
adler += *buf++;
sum2 += adler;
}
MOD(adler);
MOD(sum2);
}
/* return recombined sums */
return adler | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* the derivation of this formula is left as an exercise for the reader */
rem = (unsigned)(len2 % BASE);
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
sum1 += (adler2 & 0xffff) + BASE - 1;
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if (sum1 > BASE) sum1 -= BASE;
if (sum1 > BASE) sum1 -= BASE;
if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
if (sum2 > BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}

View File

@ -1,9 +1,9 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2002 Jean-loup Gailly.
* Copyright (C) 1995-2003 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: compress.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"

View File

@ -1,15 +1,23 @@
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
* tables for updating the shift register in one step with three exclusive-ors
* instead of four steps with four exclusive-ors. This results about a factor
* of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
* instead of four steps with four exclusive-ors. This results in about a
* factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
*/
/* @(#) $Id: crc32.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
/*
Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
protection on the static variables used to control the first-use generation
of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
first call get_crc_table() to initialize the tables before allowing more than
one thread to use crc32().
*/
#ifdef MAKECRCH
# include <stdio.h>
@ -56,15 +64,19 @@
# define TBLS 1
#endif /* BYFOUR */
/* Local functions for crc concatenation */
local unsigned long gf2_matrix_times OF((unsigned long *mat,
unsigned long vec));
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
#ifdef DYNAMIC_CRC_TABLE
local int crc_table_empty = 1;
local volatile int crc_table_empty = 1;
local unsigned long FAR crc_table[TBLS][256];
local void make_crc_table OF((void));
#ifdef MAKECRCH
local void write_table OF((FILE *, const unsigned long FAR *));
#endif /* MAKECRCH */
/*
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
@ -95,38 +107,51 @@ local void make_crc_table()
{
unsigned long c;
int n, k;
unsigned long poly; /* polynomial exclusive-or pattern */
unsigned long poly; /* polynomial exclusive-or pattern */
/* terms of polynomial defining this crc (except x^32): */
static volatile int first = 1; /* flag to limit concurrent making */
static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
/* make exclusive-or pattern from polynomial (0xedb88320UL) */
poly = 0UL;
for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
poly |= 1UL << (31 - p[n]);
/* See if another task is already doing this (not thread-safe, but better
than nothing -- significantly reduces duration of vulnerability in
case the advice about DYNAMIC_CRC_TABLE is ignored) */
if (first) {
first = 0;
/* generate a crc for every 8-bit value */
for (n = 0; n < 256; n++) {
c = (unsigned long)n;
for (k = 0; k < 8; k++)
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
crc_table[0][n] = c;
}
/* make exclusive-or pattern from polynomial (0xedb88320UL) */
poly = 0UL;
for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
poly |= 1UL << (31 - p[n]);
/* generate a crc for every 8-bit value */
for (n = 0; n < 256; n++) {
c = (unsigned long)n;
for (k = 0; k < 8; k++)
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
crc_table[0][n] = c;
}
#ifdef BYFOUR
/* generate crc for each value followed by one, two, and three zeros, and
then the byte reversal of those as well as the first table */
for (n = 0; n < 256; n++) {
c = crc_table[0][n];
crc_table[4][n] = REV(c);
for (k = 1; k < 4; k++) {
c = crc_table[0][c & 0xff] ^ (c >> 8);
crc_table[k][n] = c;
crc_table[k + 4][n] = REV(c);
/* generate crc for each value followed by one, two, and three zeros,
and then the byte reversal of those as well as the first table */
for (n = 0; n < 256; n++) {
c = crc_table[0][n];
crc_table[4][n] = REV(c);
for (k = 1; k < 4; k++) {
c = crc_table[0][c & 0xff] ^ (c >> 8);
crc_table[k][n] = c;
crc_table[k + 4][n] = REV(c);
}
}
}
#endif /* BYFOUR */
crc_table_empty = 0;
crc_table_empty = 0;
}
else { /* not first */
/* wait for the other guy to finish (not efficient, but rare) */
while (crc_table_empty)
;
}
#ifdef MAKECRCH
/* write out CRC tables to crc32.h */
@ -180,9 +205,10 @@ local void write_table(out, table)
const unsigned long FAR * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty) make_crc_table();
if (crc_table_empty)
make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */
return (const unsigned long FAR *)crc_table;
return (const unsigned long FAR *)crc_table;
}
/* ========================================================================= */
@ -248,7 +274,7 @@ local unsigned long crc32_little(crc, buf, len)
len--;
}
buf4 = (const u4 FAR *)buf;
buf4 = (const u4 FAR *)(const void FAR *)buf;
while (len >= 32) {
DOLIT32;
len -= 32;
@ -288,7 +314,7 @@ local unsigned long crc32_big(crc, buf, len)
len--;
}
buf4 = (const u4 FAR *)buf;
buf4 = (const u4 FAR *)(const void FAR *)buf;
buf4--;
while (len >= 32) {
DOBIG32;
@ -309,3 +335,89 @@ local unsigned long crc32_big(crc, buf, len)
}
#endif /* BYFOUR */
#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
/* ========================================================================= */
local unsigned long gf2_matrix_times(mat, vec)
unsigned long *mat;
unsigned long vec;
{
unsigned long sum;
sum = 0;
while (vec) {
if (vec & 1)
sum ^= *mat;
vec >>= 1;
mat++;
}
return sum;
}
/* ========================================================================= */
local void gf2_matrix_square(square, mat)
unsigned long *square;
unsigned long *mat;
{
int n;
for (n = 0; n < GF2_DIM; n++)
square[n] = gf2_matrix_times(mat, mat[n]);
}
/* ========================================================================= */
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
uLong crc1;
uLong crc2;
z_off_t len2;
{
int n;
unsigned long row;
unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
/* degenerate case */
if (len2 == 0)
return crc1;
/* put operator for one zero bit in odd */
odd[0] = 0xedb88320L; /* CRC-32 polynomial */
row = 1;
for (n = 1; n < GF2_DIM; n++) {
odd[n] = row;
row <<= 1;
}
/* put operator for two zero bits in even */
gf2_matrix_square(even, odd);
/* put operator for four zero bits in odd */
gf2_matrix_square(odd, even);
/* apply len2 zeros to crc1 (first square will put the operator for one
zero byte, eight zero bits, in even) */
do {
/* apply zeros operator for this bit of len2 */
gf2_matrix_square(even, odd);
if (len2 & 1)
crc1 = gf2_matrix_times(even, crc1);
len2 >>= 1;
/* if no more bits set, then done */
if (len2 == 0)
break;
/* another iteration of the loop with odd and even swapped */
gf2_matrix_square(odd, even);
if (len2 & 1)
crc1 = gf2_matrix_times(odd, crc1);
len2 >>= 1;
/* if no more bits set, then done */
} while (len2 != 0);
/* return combined crc */
crc1 ^= crc2;
return crc1;
}

View File

@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2003 Jean-loup Gailly.
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -47,12 +47,12 @@
*
*/
/* @(#) $Id: deflate.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#include "deflate.h"
const char deflate_copyright[] =
" deflate 1.2.1 Copyright 1995-2003 Jean-loup Gailly ";
" deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@ -264,7 +264,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
#endif
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_RLE) {
strategy < 0 || strategy > Z_FIXED) {
return Z_STREAM_ERROR;
}
if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
@ -274,6 +274,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
s->strm = strm;
s->wrap = wrap;
s->gzhead = Z_NULL;
s->w_bits = windowBits;
s->w_size = 1 << s->w_bits;
s->w_mask = s->w_size - 1;
@ -333,9 +334,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
if (length < MIN_MATCH) return Z_OK;
if (length > MAX_DIST(s)) {
length = MAX_DIST(s);
#ifndef USE_DICT_HEAD
dictionary += dictLength - length; /* use the tail of the dictionary */
#endif
}
zmemcpy(s->window, dictionary, length);
s->strstart = length;
@ -390,6 +389,17 @@ int ZEXPORT deflateReset (strm)
return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflateSetHeader (strm, head)
z_streamp strm;
gz_headerp head;
{
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
if (strm->state->wrap != 2) return Z_STREAM_ERROR;
strm->state->gzhead = head;
return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflatePrime (strm, bits, value)
z_streamp strm;
@ -420,7 +430,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
#else
if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_RLE) {
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
return Z_STREAM_ERROR;
}
func = configuration_table[s->level].func;
@ -440,6 +450,25 @@ int ZEXPORT deflateParams(strm, level, strategy)
return err;
}
/* ========================================================================= */
int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
z_streamp strm;
int good_length;
int max_lazy;
int nice_length;
int max_chain;
{
deflate_state *s;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
s = strm->state;
s->good_match = good_length;
s->max_lazy_match = max_lazy;
s->nice_match = nice_length;
s->max_chain_length = max_chain;
return Z_OK;
}
/* =========================================================================
* For the default windowBits of 15 and memLevel of 8, this function returns
* a close to exact, as well as small, upper bound on the compressed size.
@ -548,20 +577,47 @@ int ZEXPORT deflate (strm, flush)
if (s->status == INIT_STATE) {
#ifdef GZIP
if (s->wrap == 2) {
strm->adler = crc32(0L, Z_NULL, 0);
put_byte(s, 31);
put_byte(s, 139);
put_byte(s, 8);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, s->level == 9 ? 2 :
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
4 : 0));
put_byte(s, 255);
s->status = BUSY_STATE;
strm->adler = crc32(0L, Z_NULL, 0);
if (s->gzhead == NULL) {
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, s->level == 9 ? 2 :
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
4 : 0));
put_byte(s, OS_CODE);
s->status = BUSY_STATE;
}
else {
put_byte(s, (s->gzhead->text ? 1 : 0) +
(s->gzhead->hcrc ? 2 : 0) +
(s->gzhead->extra == Z_NULL ? 0 : 4) +
(s->gzhead->name == Z_NULL ? 0 : 8) +
(s->gzhead->comment == Z_NULL ? 0 : 16)
);
put_byte(s, (Byte)(s->gzhead->time & 0xff));
put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
put_byte(s, s->level == 9 ? 2 :
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
4 : 0));
put_byte(s, s->gzhead->os & 0xff);
if (s->gzhead->extra != NULL) {
put_byte(s, s->gzhead->extra_len & 0xff);
put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
}
if (s->gzhead->hcrc)
strm->adler = crc32(strm->adler, s->pending_buf,
s->pending);
s->gzindex = 0;
s->status = EXTRA_STATE;
}
}
else
#endif
@ -592,6 +648,110 @@ int ZEXPORT deflate (strm, flush)
strm->adler = adler32(0L, Z_NULL, 0);
}
}
#ifdef GZIP
if (s->status == EXTRA_STATE) {
if (s->gzhead->extra != NULL) {
uInt beg = s->pending; /* start of bytes to update crc */
while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
if (s->pending == s->pending_buf_size) {
if (s->gzhead->hcrc && s->pending > beg)
strm->adler = crc32(strm->adler, s->pending_buf + beg,
s->pending - beg);
flush_pending(strm);
beg = s->pending;
if (s->pending == s->pending_buf_size)
break;
}
put_byte(s, s->gzhead->extra[s->gzindex]);
s->gzindex++;
}
if (s->gzhead->hcrc && s->pending > beg)
strm->adler = crc32(strm->adler, s->pending_buf + beg,
s->pending - beg);
if (s->gzindex == s->gzhead->extra_len) {
s->gzindex = 0;
s->status = NAME_STATE;
}
}
else
s->status = NAME_STATE;
}
if (s->status == NAME_STATE) {
if (s->gzhead->name != NULL) {
uInt beg = s->pending; /* start of bytes to update crc */
int val;
do {
if (s->pending == s->pending_buf_size) {
if (s->gzhead->hcrc && s->pending > beg)
strm->adler = crc32(strm->adler, s->pending_buf + beg,
s->pending - beg);
flush_pending(strm);
beg = s->pending;
if (s->pending == s->pending_buf_size) {
val = 1;
break;
}
}
val = s->gzhead->name[s->gzindex++];
put_byte(s, val);
} while (val != 0);
if (s->gzhead->hcrc && s->pending > beg)
strm->adler = crc32(strm->adler, s->pending_buf + beg,
s->pending - beg);
if (val == 0) {
s->gzindex = 0;
s->status = COMMENT_STATE;
}
}
else
s->status = COMMENT_STATE;
}
if (s->status == COMMENT_STATE) {
if (s->gzhead->comment != NULL) {
uInt beg = s->pending; /* start of bytes to update crc */
int val;
do {
if (s->pending == s->pending_buf_size) {
if (s->gzhead->hcrc && s->pending > beg)
strm->adler = crc32(strm->adler, s->pending_buf + beg,
s->pending - beg);
flush_pending(strm);
beg = s->pending;
if (s->pending == s->pending_buf_size) {
val = 1;
break;
}
}
val = s->gzhead->comment[s->gzindex++];
put_byte(s, val);
} while (val != 0);
if (s->gzhead->hcrc && s->pending > beg)
strm->adler = crc32(strm->adler, s->pending_buf + beg,
s->pending - beg);
if (val == 0)
s->status = HCRC_STATE;
}
else
s->status = HCRC_STATE;
}
if (s->status == HCRC_STATE) {
if (s->gzhead->hcrc) {
if (s->pending + 2 > s->pending_buf_size)
flush_pending(strm);
if (s->pending + 2 <= s->pending_buf_size) {
put_byte(s, (Byte)(strm->adler & 0xff));
put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
strm->adler = crc32(0L, Z_NULL, 0);
s->status = BUSY_STATE;
}
}
else
s->status = BUSY_STATE;
}
#endif
/* Flush as much pending output as possible */
if (s->pending != 0) {
@ -704,7 +864,12 @@ int ZEXPORT deflateEnd (strm)
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
status = strm->state->status;
if (status != INIT_STATE && status != BUSY_STATE &&
if (status != INIT_STATE &&
status != EXTRA_STATE &&
status != NAME_STATE &&
status != COMMENT_STATE &&
status != HCRC_STATE &&
status != BUSY_STATE &&
status != FINISH_STATE) {
return Z_STREAM_ERROR;
}
@ -744,12 +909,12 @@ int ZEXPORT deflateCopy (dest, source)
ss = source->state;
*dest = *source;
zmemcpy(dest, source, sizeof(z_stream));
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
if (ds == Z_NULL) return Z_MEM_ERROR;
dest->state = (struct internal_state FAR *) ds;
*ds = *ss;
zmemcpy(ds, ss, sizeof(deflate_state));
ds->strm = dest;
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
@ -838,9 +1003,11 @@ local void lm_init (s)
s->match_length = s->prev_length = MIN_MATCH-1;
s->match_available = 0;
s->ins_h = 0;
#ifndef FASTEST
#ifdef ASMV
match_init(); /* initialize the asm code */
#endif
#endif
}
#ifndef FASTEST
@ -909,7 +1076,12 @@ local uInt longest_match(s, cur_match)
match = s->window + cur_match;
/* Skip to next match if the match length cannot increase
* or if the match length is less than 2:
* or if the match length is less than 2. Note that the checks below
* for insufficient lookahead only occur occasionally for performance
* reasons. Therefore uninitialized memory will be accessed, and
* conditional jumps will be made that depend on those values.
* However the length of the match is limited to the lookahead, so
* the output of deflate is not affected by the uninitialized values.
*/
#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
/* This code assumes sizeof(unsigned short) == 2. Do not use
@ -1131,6 +1303,7 @@ local void fill_window(s)
later. (Using level 0 permanently is not an optimal usage of
zlib, so we don't care about this pathological case.)
*/
/* %%% avoid this when Z_RLE */
n = s->hash_size;
p = &s->head[n];
do {
@ -1309,12 +1482,12 @@ local block_state deflate_fast(s, flush)
* of the string with itself at the start of the input file).
*/
#ifdef FASTEST
if ((s->strategy < Z_HUFFMAN_ONLY) ||
if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||
(s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
s->match_length = longest_match_fast (s, hash_head);
}
#else
if (s->strategy < Z_HUFFMAN_ONLY) {
if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
s->match_length = longest_match (s, hash_head);
} else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
s->match_length = longest_match_fast (s, hash_head);
@ -1418,7 +1591,7 @@ local block_state deflate_slow(s, flush)
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
if (s->strategy < Z_HUFFMAN_ONLY) {
if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
s->match_length = longest_match (s, hash_head);
} else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
s->match_length = longest_match_fast (s, hash_head);
@ -1500,3 +1673,64 @@ local block_state deflate_slow(s, flush)
return flush == Z_FINISH ? finish_done : block_done;
}
#endif /* FASTEST */
#if 0
/* ===========================================================================
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
* one. Do not maintain a hash table. (It will be regenerated if this run of
* deflate switches away from Z_RLE.)
*/
local block_state deflate_rle(s, flush)
deflate_state *s;
int flush;
{
int bflush; /* set if current block must be flushed */
uInt run; /* length of run */
uInt max; /* maximum length of run */
uInt prev; /* byte at distance one to match */
Bytef *scan; /* scan for end of run */
for (;;) {
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
* for the longest encodable run.
*/
if (s->lookahead < MAX_MATCH) {
fill_window(s);
if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
return need_more;
}
if (s->lookahead == 0) break; /* flush the current block */
}
/* See how many times the previous byte repeats */
run = 0;
if (s->strstart > 0) { /* if there is a previous byte, that is */
max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH;
scan = s->window + s->strstart - 1;
prev = *scan++;
do {
if (*scan++ != prev)
break;
} while (++run < max);
}
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
if (run >= MIN_MATCH) {
check_match(s, s->strstart, s->strstart - 1, run);
_tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
s->lookahead -= run;
s->strstart += run;
} else {
/* No match, output a literal byte */
Tracevv((stderr,"%c", s->window[s->strstart]));
_tr_tally_lit (s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
if (bflush) FLUSH_BLOCK(s, 0);
}
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
#endif

View File

@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
* Copyright (C) 1995-2002 Jean-loup Gailly
* Copyright (C) 1995-2004 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -8,7 +8,7 @@
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id: deflate.h,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#ifndef DEFLATE_H
#define DEFLATE_H
@ -49,6 +49,10 @@
/* All codes must not exceed MAX_BITS bits */
#define INIT_STATE 42
#define EXTRA_STATE 69
#define NAME_STATE 73
#define COMMENT_STATE 91
#define HCRC_STATE 103
#define BUSY_STATE 113
#define FINISH_STATE 666
/* Stream status */
@ -93,9 +97,10 @@ typedef struct internal_state {
Bytef *pending_buf; /* output still pending */
ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */
int pending; /* nb of bytes in the pending buffer */
uInt pending; /* nb of bytes in the pending buffer */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
Byte data_type; /* UNKNOWN, BINARY or ASCII */
gz_headerp gzhead; /* gzip header information to write */
uInt gzindex; /* where in extra, name, or comment */
Byte method; /* STORED (for zip only) or DEFLATED */
int last_flush; /* value of flush param for previous deflate call */

View File

@ -1,17 +1,17 @@
/* gzio.c -- IO on .gz files
* Copyright (C) 1995-2003 Jean-loup Gailly.
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
*/
/* @(#) $Id: gzio.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#include <stdio.h>
#include "zutil.h"
#ifdef NO_DEFLATE /* for compatiblity with old definition */
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
@ -220,7 +220,7 @@ gzFile ZEXPORT gzdopen (fd, mode)
int fd;
const char *mode;
{
char name[20];
char name[46]; /* allow for up to 128-bit integers */
if (fd < 0) return (gzFile)Z_NULL;
sprintf(name, "<fd:%d>", fd); /* for debugging */
@ -264,7 +264,7 @@ local int get_byte(s)
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) {
errno = 0;
s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
if (ferror(s->file)) s->z_err = Z_ERRNO;
@ -300,7 +300,7 @@ local void check_header(s)
if (len < 2) {
if (len) s->inbuf[0] = s->stream.next_in[0];
errno = 0;
len = fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
@ -415,6 +415,7 @@ int ZEXPORT gzread (file, buf, len)
s->stream.avail_out--;
s->back = EOF;
s->out++;
start++;
if (s->last) {
s->z_err = Z_STREAM_END;
return 1;
@ -436,8 +437,8 @@ int ZEXPORT gzread (file, buf, len)
s->stream.avail_in -= n;
}
if (s->stream.avail_out > 0) {
s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
s->file);
s->stream.avail_out -=
(uInt)fread(next_out, 1, s->stream.avail_out, s->file);
}
len -= s->stream.avail_out;
s->in += len;
@ -448,7 +449,7 @@ int ZEXPORT gzread (file, buf, len)
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
if (ferror(s->file)) {
@ -488,6 +489,9 @@ int ZEXPORT gzread (file, buf, len)
}
s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
if (len == s->stream.avail_out &&
(s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
return -1;
return (int)(len - s->stream.avail_out);
}
@ -898,6 +902,18 @@ int ZEXPORT gzeof (file)
return s->z_err == Z_STREAM_END;
}
/* ===========================================================================
Returns 1 if reading and doing so transparently, otherwise zero.
*/
int ZEXPORT gzdirect (file)
gzFile file;
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'r') return 0;
return s->transparent;
}
/* ===========================================================================
Outputs a long in LSB order to the given file
*/
@ -937,7 +953,6 @@ local uLong getLong (s)
int ZEXPORT gzclose (file)
gzFile file;
{
int err;
gz_stream *s = (gz_stream*)file;
if (s == NULL) return Z_STREAM_ERROR;
@ -946,8 +961,8 @@ int ZEXPORT gzclose (file)
#ifdef NO_GZCOMPRESS
return Z_STREAM_ERROR;
#else
err = do_flush (file, Z_FINISH);
if (err != Z_OK) return destroy((gz_stream*)file);
if (do_flush (file, Z_FINISH) != Z_OK)
return destroy((gz_stream*)file);
putLong (s->file, s->crc);
putLong (s->file, (uLong)(s->in & 0xffffffff));
@ -956,10 +971,16 @@ int ZEXPORT gzclose (file)
return destroy((gz_stream*)file);
}
#ifdef STDC
# define zstrerror(errnum) strerror(errnum)
#else
# define zstrerror(errnum) ""
#endif
/* ===========================================================================
Returns the error message for the last error which occured on the
Returns the error message for the last error which occurred on the
given compressed file. errnum is set to zlib error number. If an
error occured in the file system and not in the compression library,
error occurred in the file system and not in the compression library,
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/

View File

@ -1,5 +1,5 @@
/* infback.c -- inflate using a call-back interface
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -26,7 +26,7 @@ local void fixedtables OF((struct inflate_state FAR *state));
window and output buffer that is 2**windowBits bytes.
*/
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
z_stream FAR *strm;
z_streamp strm;
int windowBits;
unsigned char FAR *window;
const char *version;
@ -50,7 +50,8 @@ int stream_size;
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (voidpf)state;
strm->state = (struct internal_state FAR *)state;
state->dmax = 32768U;
state->wbits = windowBits;
state->wsize = 1U << windowBits;
state->window = window;
@ -238,7 +239,7 @@ struct inflate_state FAR *state;
are not correct, i.e. strm is Z_NULL or the state was not initialized.
*/
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
z_stream FAR *strm;
z_streamp strm;
in_func in;
void FAR *in_desc;
out_func out;
@ -434,6 +435,9 @@ void FAR *out_desc;
}
}
/* handle error breaks in while */
if (state->mode == BAD) break;
/* build code tables */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
@ -608,7 +612,7 @@ void FAR *out_desc;
}
int ZEXPORT inflateBackEnd(strm)
z_stream FAR *strm;
z_streamp strm;
{
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
return Z_STREAM_ERROR;

View File

@ -1,5 +1,5 @@
/* inffast.c -- fast decoding
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -19,7 +19,7 @@
- none
No measurable difference:
- Pentium III (Anderson)
- 68060 (Nikl)
- M68060 (Nikl)
*/
#ifdef POSTINC
# define OFF 0
@ -74,6 +74,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
unsigned char FAR *out; /* local strm->next_out */
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
unsigned char FAR *end; /* while out < end, enough space available */
#ifdef INFLATE_STRICT
unsigned dmax; /* maximum distance from zlib header */
#endif
unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */
unsigned write; /* window write index */
@ -98,6 +101,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
out = strm->next_out - OFF;
beg = out - (start - strm->avail_out);
end = out + (strm->avail_out - 257);
#ifdef INFLATE_STRICT
dmax = state->dmax;
#endif
wsize = state->wsize;
whave = state->whave;
write = state->write;
@ -167,6 +173,13 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
}
}
dist += (unsigned)hold & ((1U << op) - 1);
#ifdef INFLATE_STRICT
if (dist > dmax) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#endif
hold >>= op;
bits -= op;
Tracevv((stderr, "inflate: distance %u\n", dist));

View File

@ -1,5 +1,5 @@
/* inflate.c -- zlib decompression
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -109,11 +109,15 @@ z_streamp strm;
state = (struct inflate_state FAR *)strm->state;
strm->total_in = strm->total_out = state->total = 0;
strm->msg = Z_NULL;
strm->adler = 1; /* to support ill-conceived Java test suite */
state->mode = HEAD;
state->last = 0;
state->havedict = 0;
state->dmax = 32768U;
state->head = Z_NULL;
state->wsize = 0;
state->whave = 0;
state->write = 0;
state->hold = 0;
state->bits = 0;
state->lencode = state->distcode = state->next = state->codes;
@ -121,6 +125,22 @@ z_streamp strm;
return Z_OK;
}
int ZEXPORT inflatePrime(strm, bits, value)
z_streamp strm;
int bits;
int value;
{
struct inflate_state FAR *state;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
value &= (1L << bits) - 1;
state->hold += value << state->bits;
state->bits += bits;
return Z_OK;
}
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
z_streamp strm;
int windowBits;
@ -143,7 +163,7 @@ int stream_size;
ZALLOC(strm, 1, sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (voidpf)state;
strm->state = (struct internal_state FAR *)state;
if (windowBits < 0) {
state->wrap = 0;
windowBits = -windowBits;
@ -581,6 +601,8 @@ int flush;
break;
}
state->flags = 0; /* expect zlib header */
if (state->head != Z_NULL)
state->head->done = -1;
if (!(state->wrap & 1) || /* check if zlib header allowed */
#else
if (
@ -596,11 +618,13 @@ int flush;
break;
}
DROPBITS(4);
if (BITS(4) + 8 > state->wbits) {
len = BITS(4) + 8;
if (len > state->wbits) {
strm->msg = (char *)"invalid window size";
state->mode = BAD;
break;
}
state->dmax = 1U << len;
Tracev((stderr, "inflate: zlib header ok\n"));
strm->adler = state->check = adler32(0L, Z_NULL, 0);
state->mode = hold & 0x200 ? DICTID : TYPE;
@ -620,16 +644,24 @@ int flush;
state->mode = BAD;
break;
}
if (state->head != Z_NULL)
state->head->text = (int)((hold >> 8) & 1);
if (state->flags & 0x0200) CRC2(state->check, hold);
INITBITS();
state->mode = TIME;
case TIME:
NEEDBITS(32);
if (state->head != Z_NULL)
state->head->time = hold;
if (state->flags & 0x0200) CRC4(state->check, hold);
INITBITS();
state->mode = OS;
case OS:
NEEDBITS(16);
if (state->head != Z_NULL) {
state->head->xflags = (int)(hold & 0xff);
state->head->os = (int)(hold >> 8);
}
if (state->flags & 0x0200) CRC2(state->check, hold);
INITBITS();
state->mode = EXLEN;
@ -637,15 +669,26 @@ int flush;
if (state->flags & 0x0400) {
NEEDBITS(16);
state->length = (unsigned)(hold);
if (state->head != Z_NULL)
state->head->extra_len = (unsigned)hold;
if (state->flags & 0x0200) CRC2(state->check, hold);
INITBITS();
}
else if (state->head != Z_NULL)
state->head->extra = Z_NULL;
state->mode = EXTRA;
case EXTRA:
if (state->flags & 0x0400) {
copy = state->length;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
state->head->extra != Z_NULL) {
len = state->head->extra_len - state->length;
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);
}
if (state->flags & 0x0200)
state->check = crc32(state->check, next, copy);
have -= copy;
@ -654,6 +697,7 @@ int flush;
}
if (state->length) goto inf_leave;
}
state->length = 0;
state->mode = NAME;
case NAME:
if (state->flags & 0x0800) {
@ -661,13 +705,20 @@ int flush;
copy = 0;
do {
len = (unsigned)(next[copy++]);
if (state->head != Z_NULL &&
state->head->name != Z_NULL &&
state->length < state->head->name_max)
state->head->name[state->length++] = len;
} while (len && copy < have);
if (state->flags & 0x02000)
if (state->flags & 0x0200)
state->check = crc32(state->check, next, copy);
have -= copy;
next += copy;
if (len) goto inf_leave;
}
else if (state->head != Z_NULL)
state->head->name = Z_NULL;
state->length = 0;
state->mode = COMMENT;
case COMMENT:
if (state->flags & 0x1000) {
@ -675,13 +726,19 @@ int flush;
copy = 0;
do {
len = (unsigned)(next[copy++]);
if (state->head != Z_NULL &&
state->head->comment != Z_NULL &&
state->length < state->head->comm_max)
state->head->comment[state->length++] = len;
} while (len && copy < have);
if (state->flags & 0x02000)
if (state->flags & 0x0200)
state->check = crc32(state->check, next, copy);
have -= copy;
next += copy;
if (len) goto inf_leave;
}
else if (state->head != Z_NULL)
state->head->comment = Z_NULL;
state->mode = HCRC;
case HCRC:
if (state->flags & 0x0200) {
@ -693,6 +750,10 @@ int flush;
}
INITBITS();
}
if (state->head != Z_NULL) {
state->head->hcrc = (int)((state->flags >> 9) & 1);
state->head->done = 1;
}
strm->adler = state->check = crc32(0L, Z_NULL, 0);
state->mode = TYPE;
break;
@ -861,6 +922,9 @@ int flush;
}
}
/* handle error breaks in while */
if (state->mode == BAD) break;
/* build code tables */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
@ -965,6 +1029,13 @@ int flush;
state->offset += BITS(state->extra);
DROPBITS(state->extra);
}
#ifdef INFLATE_STRICT
if (state->offset > state->dmax) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#endif
if (state->offset > state->whave + out - left) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
@ -1106,12 +1177,16 @@ uInt dictLength;
/* check state */
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
if (state->mode != DICT) return Z_STREAM_ERROR;
if (state->wrap != 0 && state->mode != DICT)
return Z_STREAM_ERROR;
/* check for correct dictionary id */
id = adler32(0L, Z_NULL, 0);
id = adler32(id, dictionary, dictLength);
if (id != state->check) return Z_DATA_ERROR;
if (state->mode == DICT) {
id = adler32(0L, Z_NULL, 0);
id = adler32(id, dictionary, dictLength);
if (id != state->check)
return Z_DATA_ERROR;
}
/* copy dictionary to window */
if (updatewindow(strm, strm->avail_out)) {
@ -1133,6 +1208,23 @@ uInt dictLength;
return Z_OK;
}
int ZEXPORT inflateGetHeader(strm, head)
z_streamp strm;
gz_headerp head;
{
struct inflate_state FAR *state;
/* check state */
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
/* save header structure */
state->head = head;
head->done = 0;
return Z_OK;
}
/*
Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
or when out of input. When called, *have is the number of pattern bytes
@ -1235,6 +1327,7 @@ z_streamp source;
struct inflate_state FAR *state;
struct inflate_state FAR *copy;
unsigned char FAR *window;
unsigned wsize;
/* check input */
if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
@ -1257,14 +1350,19 @@ z_streamp source;
}
/* copy state */
*dest = *source;
*copy = *state;
copy->lencode = copy->codes + (state->lencode - state->codes);
copy->distcode = copy->codes + (state->distcode - state->codes);
zmemcpy(dest, source, sizeof(z_stream));
zmemcpy(copy, state, sizeof(struct inflate_state));
if (state->lencode >= state->codes &&
state->lencode <= state->codes + ENOUGH - 1) {
copy->lencode = copy->codes + (state->lencode - state->codes);
copy->distcode = copy->codes + (state->distcode - state->codes);
}
copy->next = copy->codes + (state->next - state->codes);
if (window != Z_NULL)
zmemcpy(window, state->window, 1U << state->wbits);
if (window != Z_NULL) {
wsize = 1U << state->wbits;
zmemcpy(window, state->window, wsize);
}
copy->window = window;
dest->state = (voidpf)copy;
dest->state = (struct internal_state FAR *)copy;
return Z_OK;
}

View File

@ -1,5 +1,5 @@
/* inflate.h -- internal inflate state definition
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -19,7 +19,6 @@
/* Possible inflate modes between inflate() calls */
typedef enum {
HEAD, /* i: waiting for magic header */
#ifdef GUNZIP
FLAGS, /* i: waiting for method and flags (gzip) */
TIME, /* i: waiting for modification time (gzip) */
OS, /* i: waiting for extra flags and operating system (gzip) */
@ -28,7 +27,6 @@ typedef enum {
NAME, /* i: waiting for end of file name (gzip) */
COMMENT, /* i: waiting for end of comment (gzip) */
HCRC, /* i: waiting for header crc (gzip) */
#endif
DICTID, /* i: waiting for dictionary check value */
DICT, /* waiting for inflateSetDictionary() call */
TYPE, /* i: waiting for type bits, including last-flag bit */
@ -45,9 +43,7 @@ typedef enum {
MATCH, /* o: waiting for output space to copy string */
LIT, /* o: waiting for output space to write literal */
CHECK, /* i: waiting for 32-bit check value */
#ifdef GUNZIP
LENGTH, /* i: waiting for 32-bit length (gzip) */
#endif
DONE, /* finished check, done -- remain here until reset */
BAD, /* got a data error -- remain here until reset */
MEM, /* got an inflate() memory error -- remain here until reset */
@ -84,8 +80,10 @@ struct inflate_state {
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
int havedict; /* true if dictionary provided */
int flags; /* gzip header method and flags (0 if zlib) */
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
unsigned long check; /* protected copy of check value */
unsigned long total; /* protected copy of output count */
gz_headerp head; /* where to save gzip header information */
/* sliding window */
unsigned wbits; /* log base 2 of requested window size */
unsigned wsize; /* window size or zero if not using window */

View File

@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
" inflate 1.2.1 Copyright 1995-2003 Mark Adler ";
" inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 66};
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@ -114,7 +114,15 @@ unsigned short FAR *work;
for (max = MAXBITS; max >= 1; max--)
if (count[max] != 0) break;
if (root > max) root = max;
if (max == 0) return -1; /* no codes! */
if (max == 0) { /* no symbols to code at all */
this.op = (unsigned char)64; /* invalid code marker */
this.bits = (unsigned char)1;
this.val = (unsigned short)0;
*(*table)++ = this; /* make a table to force an error */
*(*table)++ = this;
*bits = 1;
return 0; /* no symbols, but wait for decoding to report error */
}
for (min = 1; min <= MAXBITS; min++)
if (count[min] != 0) break;
if (root < min) root = min;
@ -126,7 +134,7 @@ unsigned short FAR *work;
left -= count[len];
if (left < 0) return -1; /* over-subscribed */
}
if (left > 0 && (type == CODES || (codes - count[0] != 1)))
if (left > 0 && (type == CODES || max != 1))
return -1; /* incomplete set */
/* generate offsets into symbol table for each length for sorting */
@ -224,6 +232,7 @@ unsigned short FAR *work;
/* replicate for those indices with low len bits equal to huff */
incr = 1U << (len - drop);
fill = 1U << curr;
min = fill; /* save offset to next table */
do {
fill -= incr;
next[(huff >> drop) + fill] = this;
@ -254,7 +263,7 @@ unsigned short FAR *work;
drop = root;
/* increment past last table */
next += 1U << curr;
next += min; /* here min is 1 << curr */
/* determine length of next table */
curr = len - drop;
@ -295,7 +304,6 @@ unsigned short FAR *work;
drop = 0;
len = root;
next = *table;
curr = root;
this.bits = (unsigned char)len;
}

View File

@ -1,5 +1,5 @@
/* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-2003 Mark Adler
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -36,12 +36,12 @@ typedef struct {
*/
/* Maximum size of dynamic tree. The maximum found in a long but non-
exhaustive search was 1004 code structures (850 for length/literals
and 154 for distances, the latter actually the result of an
exhaustive search was 1444 code structures (852 for length/literals
and 592 for distances, the latter actually the result of an
exhaustive search). The true maximum is not known, but the value
below is more than safe. */
#define ENOUGH 1440
#define MAXD 154
#define ENOUGH 2048
#define MAXD 592
/* Type of code to build for inftable() */
typedef enum {

View File

@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-2003 Jean-loup Gailly
* Copyright (C) 1995-2005 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -29,7 +29,7 @@
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/
/* @(#) $Id: trees.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
/* #define GEN_TREES_H */
@ -555,7 +555,7 @@ local void gen_bitlen(s, desc)
while (n != 0) {
m = s->heap[--h];
if (m > max_code) continue;
if (tree[m].Len != (unsigned) bits) {
if ((unsigned) tree[m].Len != (unsigned) bits) {
Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
s->opt_len += ((long)bits - (long)tree[m].Len)
*(long)tree[m].Freq;
@ -930,8 +930,9 @@ void _tr_flush_block(s, buf, stored_len, eof)
/* Build the Huffman trees unless a stored block is forced */
if (s->level > 0) {
/* Check if the file is ascii or binary */
if (s->data_type == Z_UNKNOWN) set_data_type(s);
/* Check if the file is binary or text */
if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN)
set_data_type(s);
/* Construct the literal and distance trees */
build_tree(s, (tree_desc *)(&(s->l_desc)));
@ -982,7 +983,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
#ifdef FORCE_STATIC
} else if (static_lenb >= 0) { /* force static trees */
#else
} else if (static_lenb == opt_lenb) {
} else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
#endif
send_bits(s, (STATIC_TREES<<1)+eof, 3);
compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
@ -1117,21 +1118,24 @@ local void compress_block(s, ltree, dtree)
}
/* ===========================================================================
* Set the data type to ASCII or BINARY, using a crude approximation:
* binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
* IN assertion: the fields freq of dyn_ltree are set and the total of all
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
* Set the data type to BINARY or TEXT, using a crude approximation:
* set it to Z_TEXT if all symbols are either printable characters (33 to 255)
* or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise.
* IN assertion: the fields Freq of dyn_ltree are set.
*/
local void set_data_type(s)
deflate_state *s;
{
int n = 0;
unsigned ascii_freq = 0;
unsigned bin_freq = 0;
while (n < 7) bin_freq += s->dyn_ltree[n++].Freq;
while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
int n;
for (n = 0; n < 9; n++)
if (s->dyn_ltree[n].Freq != 0)
break;
if (n == 9)
for (n = 14; n < 32; n++)
if (s->dyn_ltree[n].Freq != 0)
break;
s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY;
}
/* ===========================================================================

View File

@ -3,7 +3,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: uncompr.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"

View File

@ -1,9 +1,9 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2003 Jean-loup Gailly.
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: zconf.h,v 1.2 2003/12/22 18:19:09 bhook Exp $ */
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
@ -13,65 +13,50 @@
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflatePrime z_deflatePrime
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
# define inflate_table z_inflate_table
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflateBackInit_ z_inflateBackInit_
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define deflate_copyright z_deflate_copyright
# define zlibVersion z_zlibVersion
# define zlibCompileFlags z_zlibCompileFlags
# define zError z_zError
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# define z_errmsg z_z_errmsg
# define _tr_init z_tr_init
# define _tr_stored_block z_tr_stored_block
# define _tr_flush_block z_tr_flush_block
# define _tr_tally z_tr_tally
# define _length_code z_length_code
# define _dist_code z_dist_code
# define _tr_align z_tr_align
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define deflatePrime z_deflatePrime
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define zError z_zError
# define alloc_func z_alloc_func
# define free_func z_free_func
# define in_func z_in_func
# define out_func z_out_func
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
@ -83,8 +68,10 @@
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
@ -303,7 +290,7 @@ typedef uLong FAR uLongf;
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
@ -311,11 +298,11 @@ typedef uLong FAR uLongf;
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
# define z_off_t long
#endif
#if defined(__OS400__)
#define NO_vsnprintf
# define NO_vsnprintf
#endif
#if defined(__MVS__)

View File

@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.1, November 17th, 2003
version 1.2.3, July 18th, 2005
Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -37,8 +37,8 @@
extern "C" {
#endif
#define ZLIB_VERSION "1.2.1"
#define ZLIB_VERNUM 0x1210
#define ZLIB_VERSION "1.2.3"
#define ZLIB_VERNUM 0x1230
/*
The 'zlib' compression library provides in-memory compression and
@ -53,24 +53,22 @@ extern "C" {
application must provide more input and/or consume the output
(providing more output space) before each call.
The compressed data format used by the in-memory functions is the zlib
format, which is a zlib wrapper documented in RFC 1950, wrapped around a
deflate stream, which is itself documented in RFC 1951.
The compressed data format used by default by the in-memory functions is
the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
around a deflate stream, which is itself documented in RFC 1951.
The library also supports reading and writing files in gzip (.gz) format
with an interface similar to that of stdio using the functions that start
with "gz". The gzip format is different from the zlib format. gzip is a
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
This library can optionally read and write gzip streams in memory as well.
The zlib format was designed to be compact and fast for use in memory
and on communications channels. The gzip format was designed for single-
file compression on file systems, has a larger header than zlib to maintain
directory information, and uses a different, slower check method than zlib.
This library does not provide any functions to write gzip files in memory.
However such functions could be easily written using zlib's deflate function,
the documentation in the gzip RFC, and the examples in gzio.c.
The library does not install any signal handler. The decoder checks
the consistency of the compressed data, so the library should never
crash even in case of corrupted input.
@ -97,13 +95,36 @@ typedef struct z_stream_s {
free_func zfree; /* used to free the internal state */
voidpf opaque; /* private data object passed to zalloc and zfree */
int data_type; /* best guess about the data type: ascii or binary */
int data_type; /* best guess about the data type: binary or text */
uLong adler; /* adler32 value of the uncompressed data */
uLong reserved; /* reserved for future use */
} z_stream;
typedef z_stream FAR *z_streamp;
/*
gzip header information passed to and from zlib routines. See RFC 1952
for more details on the meanings of these fields.
*/
typedef struct gz_header_s {
int text; /* true if compressed data believed to be text */
uLong time; /* modification time */
int xflags; /* extra flags (not used when writing a gzip file) */
int os; /* operating system */
Bytef *extra; /* pointer to extra field or Z_NULL if none */
uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
uInt extra_max; /* space at extra (only when reading header) */
Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
uInt name_max; /* space at name (only when reading header) */
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
uInt comm_max; /* space at comment (only when reading header) */
int hcrc; /* true if there was or will be a header crc */
int done; /* true when done reading gzip header (not used
when writing a gzip file) */
} gz_header;
typedef gz_header FAR *gz_headerp;
/*
The application must update next_in and avail_in when avail_in has
dropped to zero. It must update next_out and avail_out when avail_out
@ -168,11 +189,13 @@ typedef z_stream FAR *z_streamp;
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3
#define Z_FIXED 4
#define Z_DEFAULT_STRATEGY 0
/* compression strategy; see deflateInit2() below for details */
#define Z_BINARY 0
#define Z_ASCII 1
#define Z_TEXT 1
#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
#define Z_UNKNOWN 2
/* Possible values of the data_type field (though see inflate()) */
@ -246,6 +269,10 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
and with zero avail_out, it must be called again after making room in the
output buffer because there might be more output pending.
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
decide how much data to accumualte before producing output, in order to
maximize compression.
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far. (In particular
@ -257,7 +284,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
restart from this point if previous compressed data has been damaged or if
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
the compression.
compression.
If deflate returns with avail_out == 0, this function must be called again
with the same value of the flush parameter and more output space (updated
@ -282,8 +309,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
deflate() sets strm->adler to the adler32 checksum of all input read
so far (that is, total_in bytes).
deflate() may update data_type if it can make a good guess about
the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
deflate() may update strm->data_type if it can make a good guess about
the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
binary. This field is only for information purposes and does not affect
the compression algorithm in any manner.
@ -365,11 +392,11 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
output as possible to the output buffer. Z_BLOCK requests that inflate() stop
if and when it get to the next deflate block boundary. When decoding the zlib
or gzip format, this will cause inflate() to return immediately after the
header and before the first block. When doing a raw inflate, inflate() will
go ahead and process the first block, and will return when it gets to the end
of that block, or when it runs out of data.
if and when it gets to the next deflate block boundary. When decoding the
zlib or gzip format, this will cause inflate() to return immediately after
the header and before the first block. When doing a raw inflate, inflate()
will go ahead and process the first block, and will return when it gets to
the end of that block, or when it runs out of data.
The Z_BLOCK option assists in appending to or combining deflate streams.
Also to assist in this, on return inflate() will set strm->data_type to the
@ -401,7 +428,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
because Z_BLOCK is used.
If a preset dictionary is needed after this call (see inflateSetDictionary
below), inflate sets strm-adler to the adler32 checksum of the dictionary
below), inflate sets strm->adler to the adler32 checksum of the dictionary
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
strm->adler to the adler32 checksum of all output produced so far (that is,
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
@ -478,7 +505,8 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
16 to windowBits to write a simple gzip header and trailer around the
compressed data instead of a zlib wrapper. The gzip header will have no
file name, no extra data, no comment, no modification time (set to zero),
no header crc, and the operating system will be set to 255 (unknown).
no header crc, and the operating system will be set to 255 (unknown). If a
gzip stream is being written, strm->adler is a crc32 instead of an adler32.
The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but
@ -497,7 +525,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
parameter only affects the compression ratio but not the correctness of the
compressed output even if it is not set appropriately.
compressed output even if it is not set appropriately. Z_FIXED prevents the
use of dynamic Huffman codes, allowing for a simpler decoder for special
applications.
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
@ -526,7 +556,9 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
deflateInit or deflateInit2, a part of the dictionary may in effect be
discarded, for example if the dictionary is larger than the window size in
deflate or deflate2. Thus the strings most likely to be useful should be
put at the end of the dictionary, not at the front.
put at the end of the dictionary, not at the front. In addition, the
current implementation of deflate will use at most the window size minus
262 bytes of the provided dictionary.
Upon return of this function, strm->adler is set to the adler32 value
of the dictionary; the decompressor may later use this value to determine
@ -592,6 +624,23 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
if strm->avail_out was zero.
*/
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
int good_length,
int max_lazy,
int nice_length,
int max_chain));
/*
Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for
searching for the best matching string, and even then only by the most
fanatic optimizer trying to squeeze out the last compressed bit for their
specific input data. Read the deflate.c source code for the meaning of the
max_lazy, good_length, nice_length, and max_chain parameters.
deflateTune() can be called after deflateInit() or deflateInit2(), and
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
*/
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
uLong sourceLen));
/*
@ -617,6 +666,30 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
stream state was inconsistent.
*/
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
gz_headerp head));
/*
deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called
after deflateInit2() or deflateReset() and before the first call of
deflate(). The text, time, os, extra field, name, and comment information
in the provided gz_header structure are written to the gzip header (xflag is
ignored -- the extra flags are set according to the compression level). The
caller must assure that, if not Z_NULL, name and comment are terminated with
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
available there. If hcrc is true, a gzip header crc is included. Note that
the current versions of the command-line version of gzip (up through version
1.3.x) do not support header crc's, and will report that it is a "multi-part
gzip file" and give up.
If deflateSetHeader is not used, the default gzip header has text false,
the time set to zero, and os set to 255, with no extra, name, or comment
fields. The gzip header is returned to the default state by deflateReset().
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits));
@ -649,14 +722,15 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
windowBits can also be greater than 15 for optional gzip decoding. Add
32 to windowBits to enable zlib and gzip decoding with automatic header
detection, or add 16 to decode only the gzip format (the zlib format will
return a Z_DATA_ERROR).
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
a crc32 instead of an adler32.
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
memLevel). msg is set to null if there is no error message. inflateInit2
does not perform any decompression apart from reading the zlib header if
present: this will be done by inflate(). (So next_in and avail_in may be
modified, but next_out and avail_out are unchanged.)
memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
is set to null if there is no error message. inflateInit2 does not perform
any decompression apart from reading the zlib header if present: this will
be done by inflate(). (So next_in and avail_in may be modified, but next_out
and avail_out are unchanged.)
*/
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
@ -664,11 +738,14 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
uInt dictLength));
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate
if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
can be determined from the adler32 value returned by this call of
inflate. The compressor and decompressor must use exactly the same
dictionary (see deflateSetDictionary).
sequence. This function must be called immediately after a call of inflate,
if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
can be determined from the adler32 value returned by that call of inflate.
The compressor and decompressor must use exactly the same dictionary (see
deflateSetDictionary). For raw inflate, this function can be called
immediately after inflateInit2() or inflateReset() and before any call of
inflate() to set the dictionary. The application must insure that the
dictionary that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is
@ -719,8 +796,64 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
stream state was inconsistent (such as zalloc or state being NULL).
*/
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
int bits,
int value));
/*
ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the
middle of a byte. The provided bits will be used before any bytes are used
from next_in. This function should only be used with raw inflate, and
should be used before the first inflate() call after inflateInit2() or
inflateReset(). bits must be less than or equal to 16, and that many of the
least significant bits of value will be inserted in the input.
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
gz_headerp head));
/*
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
inflateInit2() or inflateReset(), and before the first call of inflate().
As inflate() processes the gzip stream, head->done is zero until the header
is completed, at which time head->done is set to one. If a zlib stream is
being decoded, then head->done is set to -1 to indicate that there will be
no gzip header information forthcoming. Note that Z_BLOCK can be used to
force inflate() to return immediately after header processing is complete
and before any actual data is decompressed.
The text, time, xflags, and os fields are filled in with the gzip header
contents. hcrc is set to true if there is a header CRC. (The header CRC
was valid if done is set to one.) If extra is not Z_NULL, then extra_max
contains the maximum number of bytes to write to extra. Once done is true,
extra_len contains the actual extra field length, and extra contains the
extra field, or that field truncated if extra_max is less than extra_len.
If name is not Z_NULL, then up to name_max characters are written there,
terminated with a zero unless the length is greater than name_max. If
comment is not Z_NULL, then up to comm_max characters are written there,
terminated with a zero unless the length is greater than comm_max. When
any of extra, name, or comment are not Z_NULL and the respective field is
not present in the header, then that field is set to Z_NULL to signal its
absence. This allows the use of deflateSetHeader() with the returned
structure to duplicate the header. However if those fields are set to
allocated memory, then the application will need to save those pointers
elsewhere so that they can be eventually freed.
If inflateGetHeader is not used, then the header information is simply
discarded. The header is always checked for validity, including the header
CRC if present. inflateReset() will reset the process to discard the header
information. The application would need to call inflateGetHeader() again to
retrieve the header from the next gzip stream.
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
unsigned char FAR *window));
Initialize the internal stream state for decompression using inflateBack()
@ -744,7 +877,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc));
/*
@ -813,7 +946,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
that inflateBack() cannot return Z_OK.
*/
ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm));
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
/*
All memory allocated by inflateBackInit() is freed.
@ -1087,6 +1220,12 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
input stream, otherwise zero.
*/
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
/*
Returns 1 if file is being read directly without decompression, otherwise
zero.
*/
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/*
Flushes all pending output if necessary, closes the compressed file
@ -1119,7 +1258,6 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
*/
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. If buf is NULL, this function returns
@ -1135,12 +1273,21 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error();
*/
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
z_off_t len2));
/*
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
*/
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
Update a running crc with the bytes buf[0..len-1] and return the updated
crc. If buf is NULL, this function returns the required initial value
for the crc. Pre- and post-conditioning (one's complement) is performed
within this function so it shouldn't be done by the application.
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is NULL, this function returns the required initial
value for the for the crc. Pre- and post-conditioning (one's complement) is
performed within this function so it shouldn't be done by the application.
Usage example:
uLong crc = crc32(0L, Z_NULL, 0);
@ -1151,6 +1298,16 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
if (crc != original_crc) error();
*/
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
/*
Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
len2.
*/
/* various hacks, don't look :) */
@ -1167,7 +1324,7 @@ ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
unsigned char FAR *window,
const char *version,
int stream_size));
@ -1189,7 +1346,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif
ZEXTERN const char * ZEXPORT zError OF((int err));
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));

View File

@ -1,9 +1,9 @@
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2003 Jean-loup Gailly.
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: zutil.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#include "zutil.h"
@ -11,10 +11,6 @@
struct internal_state {int dummy;}; /* for buggy compilers */
#endif
#ifndef STDC
extern void exit OF((int));
#endif
const char * const z_errmsg[10] = {
"need dictionary", /* Z_NEED_DICT 2 */
"stream end", /* Z_STREAM_END 1 */
@ -78,38 +74,38 @@ uLong ZEXPORT zlibCompileFlags()
flags += 1 << 13;
#endif
#ifdef NO_GZCOMPRESS
flags += 1 << 16;
flags += 1L << 16;
#endif
#ifdef NO_GZIP
flags += 1 << 17;
flags += 1L << 17;
#endif
#ifdef PKZIP_BUG_WORKAROUND
flags += 1 << 20;
flags += 1L << 20;
#endif
#ifdef FASTEST
flags += 1 << 21;
flags += 1L << 21;
#endif
#ifdef STDC
# ifdef NO_vsnprintf
flags += 1 << 25;
flags += 1L << 25;
# ifdef HAS_vsprintf_void
flags += 1 << 26;
flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
flags += 1 << 26;
flags += 1L << 26;
# endif
# endif
#else
flags += 1 << 24;
flags += 1L << 24;
# ifdef NO_snprintf
flags += 1 << 25;
flags += 1L << 25;
# ifdef HAS_sprintf_void
flags += 1 << 26;
flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
flags += 1 << 26;
flags += 1L << 26;
# endif
# endif
#endif
@ -141,7 +137,10 @@ const char * ZEXPORT zError(err)
}
#if defined(_WIN32_WCE)
/* does not exist on WCE */
/* The Microsoft C Run-Time Library for Windows CE doesn't have
* errno. We define it as a global variable to simplify porting.
* Its value is always 0 and should not be used.
*/
int errno = 0;
#endif

View File

@ -1,5 +1,5 @@
/* zutil.h -- internal interface and configuration of the compression library
* Copyright (C) 1995-2003 Jean-loup Gailly.
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -8,7 +8,7 @@
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id: zutil.h,v 1.1 2003/12/07 05:29:20 icculus Exp $ */
/* @(#) $Id$ */
#ifndef ZUTIL_H
#define ZUTIL_H
@ -17,14 +17,26 @@
#include "zlib.h"
#ifdef STDC
# include <stddef.h>
# ifndef _WIN32_WCE
# include <stddef.h>
# endif
# include <string.h>
# include <stdlib.h>
#endif
#ifdef NO_ERRNO_H
# ifdef _WIN32_WCE
/* The Microsoft C Run-Time Library for Windows CE doesn't have
* errno. We define it as a global variable to simplify porting.
* Its value is always 0 and should not be used. We rename it to
* avoid conflict with other libraries that use the same workaround.
*/
# define errno z_errno
# endif
extern int errno;
#else
# include <errno.h>
# ifndef _WIN32_WCE
# include <errno.h>
# endif
#endif
#ifndef local
@ -105,6 +117,9 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#ifdef OS2
# define OS_CODE 0x06
# ifdef M_I86
#include <malloc.h>
# endif
#endif
#if defined(MACOS) || defined(TARGET_OS_MAC)
@ -189,12 +204,8 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define NO_vsnprintf
# endif
#endif
#ifdef HAVE_STRERROR
extern char *strerror OF((int));
# define zstrerror(errnum) strerror(errnum)
#else
# define zstrerror(errnum) ""
#ifdef VMS
# define NO_vsnprintf
#endif
#if defined(pyr)