Moved directory structure around.
--- a/CHANGELOG.txt Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-The changelog is no longer maintained by hand. It made sense to have a single
- timeline when we were using CVS, but modern revision control tools make this
- redundant, at best.
-
-If you want a list of changes, updated in real time, just point your web
- browser here:
-
- http://hg.icculus.org/icculus/physfs/
-
-
--- a/CMakeLists.txt Mon Mar 23 16:50:44 2009 -0400
+++ b/CMakeLists.txt Fri Mar 27 15:10:42 2009 -0400
@@ -73,38 +73,38 @@
# Basic chunks of source code ...
SET(ZLIB_SRCS
- zlib123/adler32.c
- zlib123/compress.c
- zlib123/crc32.c
- zlib123/deflate.c
- zlib123/gzio.c
- zlib123/infback.c
- zlib123/inffast.c
- zlib123/inflate.c
- zlib123/inftrees.c
- zlib123/trees.c
- zlib123/uncompr.c
- zlib123/zutil.c
+ src/zlib123/adler32.c
+ src/zlib123/compress.c
+ src/zlib123/crc32.c
+ src/zlib123/deflate.c
+ src/zlib123/gzio.c
+ src/zlib123/infback.c
+ src/zlib123/inffast.c
+ src/zlib123/inflate.c
+ src/zlib123/inftrees.c
+ src/zlib123/trees.c
+ src/zlib123/uncompr.c
+ src/zlib123/zutil.c
)
SET(LZMA_SRCS
- lzma/C/7zCrc.c
- lzma/C/Archive/7z/7zBuffer.c
- lzma/C/Archive/7z/7zDecode.c
- lzma/C/Archive/7z/7zExtract.c
- lzma/C/Archive/7z/7zHeader.c
- lzma/C/Archive/7z/7zIn.c
- lzma/C/Archive/7z/7zItem.c
- lzma/C/Archive/7z/7zMethodID.c
- lzma/C/Compress/Branch/BranchX86.c
- lzma/C/Compress/Branch/BranchX86_2.c
- lzma/C/Compress/Lzma/LzmaDecode.c
+ src/lzma/C/7zCrc.c
+ src/lzma/C/Archive/7z/7zBuffer.c
+ src/lzma/C/Archive/7z/7zDecode.c
+ src/lzma/C/Archive/7z/7zExtract.c
+ src/lzma/C/Archive/7z/7zHeader.c
+ src/lzma/C/Archive/7z/7zIn.c
+ src/lzma/C/Archive/7z/7zItem.c
+ src/lzma/C/Archive/7z/7zMethodID.c
+ src/lzma/C/Compress/Branch/BranchX86.c
+ src/lzma/C/Compress/Branch/BranchX86_2.c
+ src/lzma/C/Compress/Lzma/LzmaDecode.c
)
IF(BEOS)
# We add this explicitly, since we don't want CMake to think this
# is a C++ project unless we're on BeOS.
- SET(PHYSFS_BEOS_SRCS platform/beos.cpp)
+ SET(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} be root)
ENDIF(BEOS)
@@ -113,23 +113,23 @@
# another project or bring up a new build system: just compile all the source
# code and #define the things you want.
SET(PHYSFS_SRCS
- physfs.c
- physfs_byteorder.c
- physfs_unicode.c
- platform/os2.c
- platform/pocketpc.c
- platform/posix.c
- platform/unix.c
- platform/macosx.c
- platform/windows.c
- archivers/dir.c
- archivers/grp.c
- archivers/hog.c
- archivers/lzma.c
- archivers/mvl.c
- archivers/qpak.c
- archivers/wad.c
- archivers/zip.c
+ src/physfs.c
+ src/physfs_byteorder.c
+ src/physfs_unicode.c
+ src/platform_os2.c
+ src/platform_pocketpc.c
+ src/platform_posix.c
+ src/platform_unix.c
+ src/platform_macosx.c
+ src/platform_windows.c
+ src/archiver_dir.c
+ src/archiver_grp.c
+ src/archiver_hog.c
+ src/archiver_lzma.c
+ src/archiver_mvl.c
+ src/archiver_qpak.c
+ src/archiver_wad.c
+ src/archiver_zip.c
${PHYSFS_BEOS_SRCS}
)
--- a/CREDITS.txt Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-Maintainer and general codemonkey:
- Ryan C. Gordon
-
-Tons of win32 help:
- Adam Gates
-
-More win32 hacking:
- Gregory S. Read
-
-Fixes for missing current working directories,
-PHYSFS_setSaneConfig() improvements,
-other bugfixes:
- David Hedbor
-
-Darwin support:
- Patrick Stein
-
-configure fixes,
-RPM specfile:
- Edward Rudd
-
-GetLastModTime API,
-other stuff:
- John R. Hall
-
-Various support, fixes and suggestions:
- Alexander Pipelka
-
-Russian translation,
-Ruby bindings,
-QPAK archiver:
- Ed Sinjiashvili
-
-French translation:
- Stéphane Peter
-
-Debian package support:
- Colin Bayer
-
-"abs-file.h" in "extras" dir:
- Adam D. Moss
-
-WinCE port and other Win32 patches:
- Corona688
-
-German translation:
- Michael Renner
-
-Apple Project Builder support,
-Mac OS X improvements:
- Eric Wing
-
-iPhone support:
- Christian Gmeiner
-
-HOG archiver,
-MVL archiver:
- Bradley Bell
-
-MIX archiver:
- Sebastian Steinhauer
-
-Bug fixes:
- Tolga Dalman
-
-Initial PHYSFS_mount() work:
- Philip D. Bober
-
-Brazillian Portuguese translation:
- Danny Angelo Carminati Grein
-
-Spanish translation:
- Pedro J. Pérez
-
-MacOS Classic fixes,
-MPW support,
-bug fixes:
- Chris Taylor
-
-Mingw support,
-General bug fixes:
- Matze Braun
-
-Haiku support:
- scott mc
-
-Bug fixes:
- Jörg Walter
-
-Bug fixes:
- Olivier Boudeville
-
-Windows .rc file,
-7zip/lzma archiver:
- Dennis Schridde
-
-OS/2 updates:
- Dave Yeo
-
-Other stuff:
- Your name here! Patches go to icculus@icculus.org ...
-
-/* end of CREDITS.txt ... */
-
--- a/Doxyfile Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1079 +0,0 @@
-# Doxyfile 1.3.4
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = physfs
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 2.0.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = docs
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
-# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
-# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese,
-# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. It is allowed to use relative paths in the argument list.
-
-STRIP_FROM_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explict @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# reimplements.
-
-INHERIT_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = physfs.h
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-
-INPUT_FILTER =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output dir.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimised for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = YES
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \
- __EXPORT__=
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse the
-# parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = NO
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = NO
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similiar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes that
-# lay further from the root node will be omitted. Note that setting this option to
-# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that a graph may be further truncated if the graph's image dimensions are
-# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
-# If 0 is used for the depth value (the default), the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
--- a/INSTALL.txt Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-
-The latest PhysicsFS information and releases can be found at:
- http://icculus.org/physfs/
-
-Building is (ahem) very easy.
-
-
-ALL PLATFORMS:
-
-Please understand your rights and mine: read the text file LICENSE.txt in the
- root of the source tree. If you can't abide by it, delete this source tree
- now. The license is extremely liberal, even to closed-source, commercial
- applications.
-
-If you've got Doxygen (http://www.doxygen.org/) installed, you can run it
- without any command line arguments in the root of the source tree to generate
- the API reference (or build the "docs" target from your build system). This
- is optional. You can browse the API docs online here:
-
- http://icculus.org/physfs/docs/
-
-
-
-
-UNIX:
-
-You will need CMake (http://www.cmake.org/) 2.4 or later installed.
-
-Make a directory, wherever you like. This will be your build directory.
-
-Chdir to your build directory. Run "cmake /where/i/unpacked/physfs" to
- generate Makefiles. You can then run "ccmake ." and customize the build,
- but the defaults are probably okay. You can have CMake generate KDevelop
- project files if you prefer these.
-
-Run "make". PhysicsFS will now build.
-
-As root, run "make install".
- If you get sick of the library, run "xargs rm < install_manifest.txt" as root
- and it will remove all traces of the library from the system paths.
-
-Once you are satisfied, you can delete the build directory.
-
-Primary Unix development is done with GNU/Linux, but PhysicsFS is known to
- work out of the box with several flavors of Unix. It it doesn't work, patches
- to get it running can be sent to icculus@icculus.org.
-
-
-
-BeOS, Zeta, and Haiku:
-
-Use the "Unix" instructions, above. The CMake port to BeOS is fairly new at
- the time of this writing, but it works. You can get a build of CMake from
- bebits.com or build it yourself from source from cmake.org.
-
-
-
-Windows:
-
-If building with Cygwin, mingw32, MSYS, or something else that uses the GNU
- toolchain, follow the Unix instructions, above.
-
-If you want to use Visual Studio, nmake, or the Platform SDK, you will need
- CMake (http://www.cmake.org/) 2.4 or later installed. Point CMake at the
- CMakeLists.txt file in the root of the source directory and hit the
- "Configure" button. After telling it what type of compiler you are targeting
- (Borland, Visual Studio, etc), CMake will process for while and then give you
- a list of options you can change (what archivers you want to support, etc).
- If you aren't sure, the defaults are probably fine. Hit the "Configure"
- button again, then "OK" once configuration has completed with options that
- match your liking. Now project files for your favorite programming
- environment will be generated for you in the directory you specified.
- Go there and use them to build PhysicsFS.
-
-PhysicsFS will only link directly against system libraries that have existed
- since Windows 95 and Windows NT 3.51. If there's a newer API we want to use,
- we try to dynamically load it at runtime and fallback to a reasonable
- behaviour when we can't find it...this is used for Unicode support and
- locating user-specific directories, etc.
-
-PhysicsFS has not been tested on 64-bit Windows, but probably works. There is
- no 16-bit Windows support at all. Reports of success and problems can go to
- Ryan at icculus@icculus.org ...
-
-If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear
-from you; send an email to icculus@icculus.org ...
-
-
-
-PocketPC/WindowsCE:
-
-Code exists for PocketPC support, and there are shipping titles that used
- PhysicsFS 1.0 on PocketPC...but it isn't tested in 2.0, and is probably
- broken with the new build system. Please send patches.
-
-
-
-MAC OS 8/9:
-
-Classic Mac OS support has been dropped in PhysicsFS 2.0. Apple hasn't updated
- pre-OSX versions in more than a decade at this point, none of the hardware
- they've shipped will boot it for almost as many years, and finding
- developer tools for it is becoming almost impossible. As the switch to Intel
- hardware has removed the "Classic" emulation environment, it was time to
- remove support from PhysicsFS. That being said, the PhysicsFS 1.0 branch can
- still target back to Mac OS 8.5, so you can use that if you need support for
- this legacy OS. We still very much support Mac OS X, though: see below.
-
-
-
-MAC OS X:
-
-You will need CMake (http://www.cmake.org/) 2.4 or later installed.
-
-You can either generate a Unix makefile with CMake, or generate an Xcode
- project, whichever makes you more comfortable.
-
-PowerPC and Intel Macs should both be supported.
-
-If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for
- Mac OS X, I'd like to hear from you; send an email to icculus@icculus.org.
-
-
-
-OS/2:
-
-You need Innotek GCC and libc installed (or kLIBC). I tried this on a stock
- Warp 4 install, no fixpaks. You need to install link386.exe (Selective
- Install, "link object modules" option). Once klibc and GCC are installed
- correctly, unpack the source to PhysicsFS and run the script
- file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build
- without users having to hunt down a "make" program.
-
-Someone please port CMake to OS/2. Ideally I'd like to be able to target
- Innotek GCC and OpenWatcom with CMake.
-
-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@icculus.org.
-
-
-
-OTHER PLATFORMS:
-
-Many Unix-like platforms might "just work" with CMake. Some of these platforms
- are known to have worked at one time, but have not been heavily tested, if
- tested at all. PhysicsFS is, as far as we know, 64-bit and byteorder clean,
- and is known to compile on several compilers across many platforms. To
- implement a new platform or archiver, please read the heavily-commented
- physfs_internal.h and look in the platform/ and archiver/ directories for
- examples.
-
---ryan. (icculus@icculus.org)
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt Fri Mar 27 15:10:42 2009 -0400
@@ -0,0 +1,7 @@
+
+PhysicsFS; a portable, flexible file i/o abstraction.
+
+ http://icculus.org/physfs/
+
+Please see the docs directory for documentation, licensing, and information.
+
--- a/TODO.txt Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-Stuff that needs to be done and wishlist:
-
-These are in no particular order.
-Some might be dupes, some might be done already.
-
-UNICODE:
-- OS/2: Codepages. No full Unicode in the filesystem, but we can probably make
- a conversion effort.
-
-
-Stuff:
-- Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less
- important, since streaming archives aren't of much value to games (which
- is why zipfiles are king: random access), but it could have uses for, say,
- an installer/updater.
-- Reduce malloc() pressure all over the place. We fragment memory like mad.
-- profile string list interpolation.
-- We have two different ways to find dir entries in zip.c.
-- Do symlinks in zip archiver work when they point to dirs?
-- Enable more warnings?
-- Use __cdecl in physfs.h?
-- Look for FIXMEs (many marked with "!!!" in comments).
-- Find some way to relax or remove the security model for external tools.
-- OSX shouldn't use ~/.app for userdir.
-- fscanf and fprintf support in extras dir.
-- Why do we call it openArchive and dirClose?
-- Sanity check byte order at runtime.
-- Memory locking?
-- Find a better name than dvoid and fvoid.
-- Can windows.c and pocketpc.c get merged?
-- There's so much cut-and-paste between archivers...can this be reduced?
-- General code audit.
-- Multiple write dirs with mount points?
-- Deprecate PHYSFS_setSaneConfig and move it to extras?
-- Why is physfsrwops.c cut-and-pasted into the ruby bindings?
-- Replace code from SDL...
-- Should file enumeration return an error or set error state?
-- Need "getmountpoint" command in test_physfs.c ...
-- Look for calloc() calls that aren't going through the allocation hooks.
-- Write up a simple HOWTO on embedding physicsfs in another project.
-- Archivers need abstracted i/o to read from memory or files (archives in archives?)
-- Probably other stuff. Requests and recommendations are welcome.
-- Dump OS/2?
-
-// end of TODO.txt ...
-
--- a/archivers/dir.c Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +0,0 @@
-/*
- * Standard directory I/O support routines for PhysicsFS.
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Ryan C. Gordon.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "physfs.h"
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-static PHYSFS_sint64 DIR_read(fvoid *opaque, void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- PHYSFS_sint64 retval;
- retval = __PHYSFS_platformRead(opaque, buffer, objSize, objCount);
- return(retval);
-} /* DIR_read */
-
-
-static PHYSFS_sint64 DIR_write(fvoid *opaque, const void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- PHYSFS_sint64 retval;
- retval = __PHYSFS_platformWrite(opaque, buffer, objSize, objCount);
- return(retval);
-} /* DIR_write */
-
-
-static int DIR_eof(fvoid *opaque)
-{
- return(__PHYSFS_platformEOF(opaque));
-} /* DIR_eof */
-
-
-static PHYSFS_sint64 DIR_tell(fvoid *opaque)
-{
- return(__PHYSFS_platformTell(opaque));
-} /* DIR_tell */
-
-
-static int DIR_seek(fvoid *opaque, PHYSFS_uint64 offset)
-{
- return(__PHYSFS_platformSeek(opaque, offset));
-} /* DIR_seek */
-
-
-static PHYSFS_sint64 DIR_fileLength(fvoid *opaque)
-{
- return(__PHYSFS_platformFileLength(opaque));
-} /* DIR_fileLength */
-
-
-static int DIR_fileClose(fvoid *opaque)
-{
- /*
- * we manually flush the buffer, since that's the place a close will
- * most likely fail, but that will leave the file handle in an undefined
- * state if it fails. Flush failures we can recover from.
- */
- BAIL_IF_MACRO(!__PHYSFS_platformFlush(opaque), NULL, 0);
- BAIL_IF_MACRO(!__PHYSFS_platformClose(opaque), NULL, 0);
- return(1);
-} /* DIR_fileClose */
-
-
-static int DIR_isArchive(const char *filename, int forWriting)
-{
- /* directories ARE archives in this driver... */
- return(__PHYSFS_platformIsDirectory(filename));
-} /* DIR_isArchive */
-
-
-static void *DIR_openArchive(const char *name, int forWriting)
-{
- const char *dirsep = PHYSFS_getDirSeparator();
- char *retval = NULL;
- size_t namelen = strlen(name);
- size_t seplen = strlen(dirsep);
-
- /* !!! FIXME: when is this not called right before openArchive? */
- BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
- ERR_UNSUPPORTED_ARCHIVE, 0);
-
- retval = allocator.Malloc(namelen + seplen + 1);
- BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
-
- /* make sure there's a dir separator at the end of the string */
- strcpy(retval, name);
- if (strcmp((name + namelen) - seplen, dirsep) != 0)
- strcat(retval, dirsep);
-
- return(retval);
-} /* DIR_openArchive */
-
-
-static void DIR_enumerateFiles(dvoid *opaque, const char *dname,
- int omitSymLinks, PHYSFS_EnumFilesCallback cb,
- const char *origdir, void *callbackdata)
-{
- char *d = __PHYSFS_platformCvtToDependent((char *)opaque, dname, NULL);
- if (d != NULL)
- {
- __PHYSFS_platformEnumerateFiles(d, omitSymLinks, cb,
- origdir, callbackdata);
- allocator.Free(d);
- } /* if */
-} /* DIR_enumerateFiles */
-
-
-static int DIR_exists(dvoid *opaque, const char *name)
-{
- char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- int retval;
-
- BAIL_IF_MACRO(f == NULL, NULL, 0);
- retval = __PHYSFS_platformExists(f);
- allocator.Free(f);
- return(retval);
-} /* DIR_exists */
-
-
-static int DIR_isDirectory(dvoid *opaque, const char *name, int *fileExists)
-{
- char *d = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- int retval = 0;
-
- BAIL_IF_MACRO(d == NULL, NULL, 0);
- *fileExists = __PHYSFS_platformExists(d);
- if (*fileExists)
- retval = __PHYSFS_platformIsDirectory(d);
- allocator.Free(d);
- return(retval);
-} /* DIR_isDirectory */
-
-
-static int DIR_isSymLink(dvoid *opaque, const char *name, int *fileExists)
-{
- char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- int retval = 0;
-
- BAIL_IF_MACRO(f == NULL, NULL, 0);
- *fileExists = __PHYSFS_platformExists(f);
- if (*fileExists)
- retval = __PHYSFS_platformIsSymLink(f);
- allocator.Free(f);
- return(retval);
-} /* DIR_isSymLink */
-
-
-static PHYSFS_sint64 DIR_getLastModTime(dvoid *opaque,
- const char *name,
- int *fileExists)
-{
- char *d = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- PHYSFS_sint64 retval = -1;
-
- BAIL_IF_MACRO(d == NULL, NULL, 0);
- *fileExists = __PHYSFS_platformExists(d);
- if (*fileExists)
- retval = __PHYSFS_platformGetLastModTime(d);
- allocator.Free(d);
- return(retval);
-} /* DIR_getLastModTime */
-
-
-static fvoid *doOpen(dvoid *opaque, const char *name,
- void *(*openFunc)(const char *filename),
- int *fileExists)
-{
- char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- void *rc = NULL;
-
- BAIL_IF_MACRO(f == NULL, NULL, NULL);
-
- if (fileExists != NULL)
- {
- *fileExists = __PHYSFS_platformExists(f);
- if (!(*fileExists))
- {
- allocator.Free(f);
- return(NULL);
- } /* if */
- } /* if */
-
- rc = openFunc(f);
- allocator.Free(f);
-
- return((fvoid *) rc);
-} /* doOpen */
-
-
-static fvoid *DIR_openRead(dvoid *opaque, const char *fnm, int *exist)
-{
- return(doOpen(opaque, fnm, __PHYSFS_platformOpenRead, exist));
-} /* DIR_openRead */
-
-
-static fvoid *DIR_openWrite(dvoid *opaque, const char *filename)
-{
- return(doOpen(opaque, filename, __PHYSFS_platformOpenWrite, NULL));
-} /* DIR_openWrite */
-
-
-static fvoid *DIR_openAppend(dvoid *opaque, const char *filename)
-{
- return(doOpen(opaque, filename, __PHYSFS_platformOpenAppend, NULL));
-} /* DIR_openAppend */
-
-
-static int DIR_remove(dvoid *opaque, const char *name)
-{
- char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- int retval;
-
- BAIL_IF_MACRO(f == NULL, NULL, 0);
- retval = __PHYSFS_platformDelete(f);
- allocator.Free(f);
- return(retval);
-} /* DIR_remove */
-
-
-static int DIR_mkdir(dvoid *opaque, const char *name)
-{
- char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
- int retval;
-
- BAIL_IF_MACRO(f == NULL, NULL, 0);
- retval = __PHYSFS_platformMkDir(f);
- allocator.Free(f);
- return(retval);
-} /* DIR_mkdir */
-
-
-static void DIR_dirClose(dvoid *opaque)
-{
- allocator.Free(opaque);
-} /* DIR_dirClose */
-
-
-
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
-{
- "",
- DIR_ARCHIVE_DESCRIPTION,
- "Ryan C. Gordon <icculus@icculus.org>",
- "http://icculus.org/physfs/",
-};
-
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_DIR =
-{
- &__PHYSFS_ArchiveInfo_DIR,
- DIR_isArchive, /* isArchive() method */
- DIR_openArchive, /* openArchive() method */
- DIR_enumerateFiles, /* enumerateFiles() method */
- DIR_exists, /* exists() method */
- DIR_isDirectory, /* isDirectory() method */
- DIR_isSymLink, /* isSymLink() method */
- DIR_getLastModTime, /* getLastModTime() method */
- DIR_openRead, /* openRead() method */
- DIR_openWrite, /* openWrite() method */
- DIR_openAppend, /* openAppend() method */
- DIR_remove, /* remove() method */
- DIR_mkdir, /* mkdir() method */
- DIR_dirClose, /* dirClose() method */
- DIR_read, /* read() method */
- DIR_write, /* write() method */
- DIR_eof, /* eof() method */
- DIR_tell, /* tell() method */
- DIR_seek, /* seek() method */
- DIR_fileLength, /* fileLength() method */
- DIR_fileClose /* fileClose() method */
-};
-
-/* end of dir.c ... */
-
--- a/archivers/grp.c Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/*
- * GRP support routines for PhysicsFS.
- *
- * This driver handles BUILD engine archives ("groupfiles"). This format
- * (but not this driver) was put together by Ken Silverman.
- *
- * The format is simple enough. In Ken's words:
- *
- * What's the .GRP file format?
- *
- * The ".grp" file format is just a collection of a lot of files stored
- * into 1 big one. I tried to make the format as simple as possible: The
- * first 12 bytes contains my name, "KenSilverman". The next 4 bytes is
- * the number of files that were compacted into the group file. Then for
- * each file, there is a 16 byte structure, where the first 12 bytes are
- * the filename, and the last 4 bytes are the file's size. The rest of
- * the group file is just the raw data packed one after the other in the
- * same order as the list of files.
- *
- * (That info is from http://www.advsys.net/ken/build.htm ...)
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Ryan C. Gordon.
- */
-
-#if (defined PHYSFS_SUPPORTS_GRP)
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "physfs.h"
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-typedef struct
-{
- char name[13];
- PHYSFS_uint32 startPos;
- PHYSFS_uint32 size;
-} GRPentry;
-
-typedef struct
-{
- char *filename;
- PHYSFS_sint64 last_mod_time;
- PHYSFS_uint32 entryCount;
- GRPentry *entries;
-} GRPinfo;
-
-typedef struct
-{
- void *handle;
- GRPentry *entry;
- PHYSFS_uint32 curPos;
-} GRPfileinfo;
-
-
-static void GRP_dirClose(dvoid *opaque)
-{
- GRPinfo *info = ((GRPinfo *) opaque);
- allocator.Free(info->filename);
- allocator.Free(info->entries);
- allocator.Free(info);
-} /* GRP_dirClose */
-
-
-static PHYSFS_sint64 GRP_read(fvoid *opaque, void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- GRPfileinfo *finfo = (GRPfileinfo *) opaque;
- GRPentry *entry = finfo->entry;
- PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
- PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
- PHYSFS_sint64 rc;
-
- if (objsLeft < objCount)
- objCount = objsLeft;
-
- rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
- if (rc > 0)
- finfo->curPos += (PHYSFS_uint32) (rc * objSize);
-
- return(rc);
-} /* GRP_read */
-
-
-static PHYSFS_sint64 GRP_write(fvoid *opaque, const void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* GRP_write */
-
-
-static int GRP_eof(fvoid *opaque)
-{
- GRPfileinfo *finfo = (GRPfileinfo *) opaque;
- GRPentry *entry = finfo->entry;
- return(finfo->curPos >= entry->size);
-} /* GRP_eof */
-
-
-static PHYSFS_sint64 GRP_tell(fvoid *opaque)
-{
- return(((GRPfileinfo *) opaque)->curPos);
-} /* GRP_tell */
-
-
-static int GRP_seek(fvoid *opaque, PHYSFS_uint64 offset)
-{
- GRPfileinfo *finfo = (GRPfileinfo *) opaque;
- GRPentry *entry = finfo->entry;
- int rc;
-
- BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
- BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
- rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
- if (rc)
- finfo->curPos = (PHYSFS_uint32) offset;
-
- return(rc);
-} /* GRP_seek */
-
-
-static PHYSFS_sint64 GRP_fileLength(fvoid *opaque)
-{
- GRPfileinfo *finfo = (GRPfileinfo *) opaque;
- return((PHYSFS_sint64) finfo->entry->size);
-} /* GRP_fileLength */
-
-
-static int GRP_fileClose(fvoid *opaque)
-{
- GRPfileinfo *finfo = (GRPfileinfo *) opaque;
- BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
- allocator.Free(finfo);
- return(1);
-} /* GRP_fileClose */
-
-
-static int grp_open(const char *filename, int forWriting,
- void **fh, PHYSFS_uint32 *count)
-{
- PHYSFS_uint8 buf[12];
-
- *fh = NULL;
- BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
-
- *fh = __PHYSFS_platformOpenRead(filename);
- BAIL_IF_MACRO(*fh == NULL, NULL, 0);
-
- if (__PHYSFS_platformRead(*fh, buf, 12, 1) != 1)
- goto openGrp_failed;
-
- if (memcmp(buf, "KenSilverman", 12) != 0)
- {
- __PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
- goto openGrp_failed;
- } /* if */
-
- if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
- goto openGrp_failed;
-
- *count = PHYSFS_swapULE32(*count);
-
- return(1);
-
-openGrp_failed:
- if (*fh != NULL)
- __PHYSFS_platformClose(*fh);
-
- *count = -1;
- *fh = NULL;
- return(0);
-} /* grp_open */
-
-
-static int GRP_isArchive(const char *filename, int forWriting)
-{
- void *fh;
- PHYSFS_uint32 fileCount;
- int retval = grp_open(filename, forWriting, &fh, &fileCount);
-
- if (fh != NULL)
- __PHYSFS_platformClose(fh);
-
- return(retval);
-} /* GRP_isArchive */
-
-
-static int grp_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
-{
- 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)
-{
- 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 */
-
-
-static int grp_load_entries(const char *name, int forWriting, GRPinfo *info)
-{
- void *fh = NULL;
- PHYSFS_uint32 fileCount;
- PHYSFS_uint32 location = 16; /* sizeof sig. */
- GRPentry *entry;
- char *ptr;
-
- BAIL_IF_MACRO(!grp_open(name, forWriting, &fh, &fileCount), NULL, 0);
- info->entryCount = fileCount;
- info->entries = (GRPentry *) allocator.Malloc(sizeof(GRPentry)*fileCount);
- if (info->entries == NULL)
- {
- __PHYSFS_platformClose(fh);
- BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
- } /* if */
-
- location += (16 * fileCount);
-
- for (entry = info->entries; fileCount > 0; fileCount--, entry++)
- {
- if (__PHYSFS_platformRead(fh, &entry->name, 12, 1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- entry->name[12] = '\0'; /* name isn't null-terminated in file. */
- if ((ptr = strchr(entry->name, ' ')) != NULL)
- *ptr = '\0'; /* trim extra spaces. */
-
- if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- entry->size = PHYSFS_swapULE32(entry->size);
- entry->startPos = location;
- location += entry->size;
- } /* for */
-
- __PHYSFS_platformClose(fh);
-
- __PHYSFS_sort(info->entries, info->entryCount,
- grp_entry_cmp, grp_entry_swap);
- return(1);
-} /* grp_load_entries */
-
-
-static void *GRP_openArchive(const char *name, int forWriting)
-{
- PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
- GRPinfo *info = (GRPinfo *) allocator.Malloc(sizeof (GRPinfo));
-
- BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
-
- memset(info, '\0', sizeof (GRPinfo));
- info->filename = (char *) allocator.Malloc(strlen(name) + 1);
- GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, GRP_openArchive_failed);
-
- if (!grp_load_entries(name, forWriting, info))
- goto GRP_openArchive_failed;
-
- strcpy(info->filename, name);
- info->last_mod_time = modtime;
-
- return(info);
-
-GRP_openArchive_failed:
- if (info != NULL)
- {
- if (info->filename != NULL)
- allocator.Free(info->filename);
- if (info->entries != NULL)
- allocator.Free(info->entries);
- allocator.Free(info);
- } /* if */
-
- return(NULL);
-} /* GRP_openArchive */
-
-
-static void GRP_enumerateFiles(dvoid *opaque, const char *dname,
- int omitSymLinks, PHYSFS_EnumFilesCallback cb,
- const char *origdir, void *callbackdata)
-{
- /* no directories in GRP files. */
- if (*dname == '\0')
- {
- GRPinfo *info = (GRPinfo *) opaque;
- GRPentry *entry = info->entries;
- PHYSFS_uint32 max = info->entryCount;
- PHYSFS_uint32 i;
-
- for (i = 0; i < max; i++, entry++)
- cb(callbackdata, origdir, entry->name);
- } /* if */
-} /* GRP_enumerateFiles */
-
-
-static GRPentry *grp_find_entry(GRPinfo *info, const char *name)
-{
- char *ptr = strchr(name, '.');
- GRPentry *a = info->entries;
- PHYSFS_sint32 lo = 0;
- PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
- PHYSFS_sint32 middle;
- int rc;
-
- /*
- * Rule out filenames to avoid unneeded processing...no dirs,
- * big filenames, or extensions > 3 chars.
- */
- BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
-
- while (lo <= hi)
- {
- middle = lo + ((hi - lo) / 2);
- rc = strcmp(name, a[middle].name);
- if (rc == 0) /* found it! */
- return(&a[middle]);
- else if (rc > 0)
- lo = middle + 1;
- else
- hi = middle - 1;
- } /* while */
-
- BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
-} /* grp_find_entry */
-
-
-static int GRP_exists(dvoid *opaque, const char *name)
-{
- return(grp_find_entry((GRPinfo *) opaque, name) != NULL);
-} /* GRP_exists */
-
-
-static int GRP_isDirectory(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = GRP_exists(opaque, name);
- return(0); /* never directories in a groupfile. */
-} /* GRP_isDirectory */
-
-
-static int GRP_isSymLink(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = GRP_exists(opaque, name);
- return(0); /* never symlinks in a groupfile. */
-} /* GRP_isSymLink */
-
-
-static PHYSFS_sint64 GRP_getLastModTime(dvoid *opaque,
- const char *name,
- int *fileExists)
-{
- GRPinfo *info = (GRPinfo *) opaque;
- PHYSFS_sint64 retval = -1;
-
- *fileExists = (grp_find_entry(info, name) != NULL);
- if (*fileExists) /* use time of GRP itself in the physical filesystem. */
- retval = info->last_mod_time;
-
- return(retval);
-} /* GRP_getLastModTime */
-
-
-static fvoid *GRP_openRead(dvoid *opaque, const char *fnm, int *fileExists)
-{
- GRPinfo *info = (GRPinfo *) opaque;
- GRPfileinfo *finfo;
- GRPentry *entry;
-
- entry = grp_find_entry(info, fnm);
- *fileExists = (entry != NULL);
- BAIL_IF_MACRO(entry == NULL, NULL, NULL);
-
- finfo = (GRPfileinfo *) allocator.Malloc(sizeof (GRPfileinfo));
- BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
-
- finfo->handle = __PHYSFS_platformOpenRead(info->filename);
- if ( (finfo->handle == NULL) ||
- (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
- {
- allocator.Free(finfo);
- return(NULL);
- } /* if */
-
- finfo->curPos = 0;
- finfo->entry = entry;
- return(finfo);
-} /* GRP_openRead */
-
-
-static fvoid *GRP_openWrite(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* GRP_openWrite */
-
-
-static fvoid *GRP_openAppend(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* GRP_openAppend */
-
-
-static int GRP_remove(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* GRP_remove */
-
-
-static int GRP_mkdir(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* GRP_mkdir */
-
-
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP =
-{
- "GRP",
- GRP_ARCHIVE_DESCRIPTION,
- "Ryan C. Gordon <icculus@icculus.org>",
- "http://icculus.org/physfs/",
-};
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_GRP =
-{
- &__PHYSFS_ArchiveInfo_GRP,
- GRP_isArchive, /* isArchive() method */
- GRP_openArchive, /* openArchive() method */
- GRP_enumerateFiles, /* enumerateFiles() method */
- GRP_exists, /* exists() method */
- GRP_isDirectory, /* isDirectory() method */
- GRP_isSymLink, /* isSymLink() method */
- GRP_getLastModTime, /* getLastModTime() method */
- GRP_openRead, /* openRead() method */
- GRP_openWrite, /* openWrite() method */
- GRP_openAppend, /* openAppend() method */
- GRP_remove, /* remove() method */
- GRP_mkdir, /* mkdir() method */
- GRP_dirClose, /* dirClose() method */
- GRP_read, /* read() method */
- GRP_write, /* write() method */
- GRP_eof, /* eof() method */
- GRP_tell, /* tell() method */
- GRP_seek, /* seek() method */
- GRP_fileLength, /* fileLength() method */
- GRP_fileClose /* fileClose() method */
-};
-
-#endif /* defined PHYSFS_SUPPORTS_GRP */
-
-/* end of grp.c ... */
-
--- a/archivers/hog.c Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,514 +0,0 @@
-/*
- * HOG support routines for PhysicsFS.
- *
- * This driver handles Descent I/II HOG archives.
- *
- * The format is very simple:
- *
- * The file always starts with the 3-byte signature "DHF" (Descent
- * HOG file). After that the files of a HOG are just attached after
- * another, divided by a 17 bytes header, which specifies the name
- * and length (in bytes) of the forthcoming file! So you just read
- * the header with its information of how big the following file is,
- * and then skip exact that number of bytes to get to the next file
- * in that HOG.
- *
- * char sig[3] = {'D', 'H', 'F'}; // "DHF"=Descent HOG File
- *
- * struct {
- * char file_name[13]; // Filename, padded to 13 bytes with 0s
- * int file_size; // filesize in bytes
- * char data[file_size]; // The file data
- * } FILE_STRUCT; // Repeated until the end of the file.
- *
- * (That info is from http://www.descent2.com/ddn/specs/hog/)
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Bradley Bell.
- * Based on grp.c by Ryan C. Gordon.
- */
-
-#if (defined PHYSFS_SUPPORTS_HOG)
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "physfs.h"
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-/*
- * One HOGentry is kept for each file in an open HOG archive.
- */
-typedef struct
-{
- char name[13];
- PHYSFS_uint32 startPos;
- PHYSFS_uint32 size;
-} HOGentry;
-
-/*
- * One HOGinfo is kept for each open HOG archive.
- */
-typedef struct
-{
- char *filename;
- PHYSFS_sint64 last_mod_time;
- PHYSFS_uint32 entryCount;
- HOGentry *entries;
-} HOGinfo;
-
-/*
- * One HOGfileinfo is kept for each open file in a HOG archive.
- */
-typedef struct
-{
- void *handle;
- HOGentry *entry;
- PHYSFS_uint32 curPos;
-} HOGfileinfo;
-
-
-static void HOG_dirClose(dvoid *opaque)
-{
- HOGinfo *info = ((HOGinfo *) opaque);
- allocator.Free(info->filename);
- allocator.Free(info->entries);
- allocator.Free(info);
-} /* HOG_dirClose */
-
-
-static PHYSFS_sint64 HOG_read(fvoid *opaque, void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- HOGfileinfo *finfo = (HOGfileinfo *) opaque;
- HOGentry *entry = finfo->entry;
- PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
- PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
- PHYSFS_sint64 rc;
-
- if (objsLeft < objCount)
- objCount = objsLeft;
-
- rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
- if (rc > 0)
- finfo->curPos += (PHYSFS_uint32) (rc * objSize);
-
- return(rc);
-} /* HOG_read */
-
-
-static PHYSFS_sint64 HOG_write(fvoid *opaque, const void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* HOG_write */
-
-
-static int HOG_eof(fvoid *opaque)
-{
- HOGfileinfo *finfo = (HOGfileinfo *) opaque;
- HOGentry *entry = finfo->entry;
- return(finfo->curPos >= entry->size);
-} /* HOG_eof */
-
-
-static PHYSFS_sint64 HOG_tell(fvoid *opaque)
-{
- return(((HOGfileinfo *) opaque)->curPos);
-} /* HOG_tell */
-
-
-static int HOG_seek(fvoid *opaque, PHYSFS_uint64 offset)
-{
- HOGfileinfo *finfo = (HOGfileinfo *) opaque;
- HOGentry *entry = finfo->entry;
- int rc;
-
- BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
- BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
- rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
- if (rc)
- finfo->curPos = (PHYSFS_uint32) offset;
-
- return(rc);
-} /* HOG_seek */
-
-
-static PHYSFS_sint64 HOG_fileLength(fvoid *opaque)
-{
- HOGfileinfo *finfo = (HOGfileinfo *) opaque;
- return((PHYSFS_sint64) finfo->entry->size);
-} /* HOG_fileLength */
-
-
-static int HOG_fileClose(fvoid *opaque)
-{
- HOGfileinfo *finfo = (HOGfileinfo *) opaque;
- BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
- allocator.Free(finfo);
- return(1);
-} /* HOG_fileClose */
-
-
-static int hog_open(const char *filename, int forWriting,
- void **fh, PHYSFS_uint32 *count)
-{
- PHYSFS_uint8 buf[13];
- PHYSFS_uint32 size;
- PHYSFS_sint64 pos;
-
- *count = 0;
-
- *fh = NULL;
- BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
-
- *fh = __PHYSFS_platformOpenRead(filename);
- BAIL_IF_MACRO(*fh == NULL, NULL, 0);
-
- if (__PHYSFS_platformRead(*fh, buf, 3, 1) != 1)
- goto openHog_failed;
-
- if (memcmp(buf, "DHF", 3) != 0)
- {
- __PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
- goto openHog_failed;
- } /* if */
-
- while (1)
- {
- if (__PHYSFS_platformRead(*fh, buf, 13, 1) != 1)
- break; /* eof here is ok */
-
- if (__PHYSFS_platformRead(*fh, &size, 4, 1) != 1)
- goto openHog_failed;
-
- size = PHYSFS_swapULE32(size);
-
- (*count)++;
-
- /* Skip over entry... */
- pos = __PHYSFS_platformTell(*fh);
- if (pos == -1)
- goto openHog_failed;
- if (!__PHYSFS_platformSeek(*fh, pos + size))
- goto openHog_failed;
- } /* while */
-
- /* Rewind to start of entries... */
- if (!__PHYSFS_platformSeek(*fh, 3))
- goto openHog_failed;
-
- return(1);
-
-openHog_failed:
- if (*fh != NULL)
- __PHYSFS_platformClose(*fh);
-
- *count = -1;
- *fh = NULL;
- return(0);
-} /* hog_open */
-
-
-static int HOG_isArchive(const char *filename, int forWriting)
-{
- void *fh;
- PHYSFS_uint32 fileCount;
- int retval = hog_open(filename, forWriting, &fh, &fileCount);
-
- if (fh != NULL)
- __PHYSFS_platformClose(fh);
-
- return(retval);
-} /* HOG_isArchive */
-
-
-static int hog_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
-{
- if (one != two)
- {
- const HOGentry *a = (const HOGentry *) _a;
- return(__PHYSFS_stricmpASCII(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)
-{
- 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 */
-
-
-static int hog_load_entries(const char *name, int forWriting, HOGinfo *info)
-{
- void *fh = NULL;
- PHYSFS_uint32 fileCount;
- HOGentry *entry;
-
- BAIL_IF_MACRO(!hog_open(name, forWriting, &fh, &fileCount), NULL, 0);
- info->entryCount = fileCount;
- info->entries = (HOGentry *) allocator.Malloc(sizeof(HOGentry)*fileCount);
- if (info->entries == NULL)
- {
- __PHYSFS_platformClose(fh);
- BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
- } /* if */
-
- for (entry = info->entries; fileCount > 0; fileCount--, entry++)
- {
- if (__PHYSFS_platformRead(fh, &entry->name, 13, 1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- entry->size = PHYSFS_swapULE32(entry->size);
- entry->startPos = (unsigned int) __PHYSFS_platformTell(fh);
- if (entry->startPos == -1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- }
-
- /* Skip over entry */
- if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size))
- {
- __PHYSFS_platformClose(fh);
- return(0);
- }
- } /* for */
-
- __PHYSFS_platformClose(fh);
-
- __PHYSFS_sort(info->entries, info->entryCount,
- hog_entry_cmp, hog_entry_swap);
- return(1);
-} /* hog_load_entries */
-
-
-static void *HOG_openArchive(const char *name, int forWriting)
-{
- PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
- HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
-
- BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
- memset(info, '\0', sizeof (HOGinfo));
- info->filename = (char *) allocator.Malloc(strlen(name) + 1);
- GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, HOG_openArchive_failed);
-
- if (!hog_load_entries(name, forWriting, info))
- goto HOG_openArchive_failed;
-
- strcpy(info->filename, name);
- info->last_mod_time = modtime;
-
- return(info);
-
-HOG_openArchive_failed:
- if (info != NULL)
- {
- if (info->filename != NULL)
- allocator.Free(info->filename);
- if (info->entries != NULL)
- allocator.Free(info->entries);
- allocator.Free(info);
- } /* if */
-
- return(NULL);
-} /* HOG_openArchive */
-
-
-static void HOG_enumerateFiles(dvoid *opaque, const char *dname,
- int omitSymLinks, PHYSFS_EnumFilesCallback cb,
- const char *origdir, void *callbackdata)
-{
- /* no directories in HOG files. */
- if (*dname == '\0')
- {
- HOGinfo *info = (HOGinfo *) opaque;
- HOGentry *entry = info->entries;
- PHYSFS_uint32 max = info->entryCount;
- PHYSFS_uint32 i;
-
- for (i = 0; i < max; i++, entry++)
- cb(callbackdata, origdir, entry->name);
- } /* if */
-} /* HOG_enumerateFiles */
-
-
-static HOGentry *hog_find_entry(HOGinfo *info, const char *name)
-{
- char *ptr = strchr(name, '.');
- HOGentry *a = info->entries;
- PHYSFS_sint32 lo = 0;
- PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
- PHYSFS_sint32 middle;
- int rc;
-
- /*
- * Rule out filenames to avoid unneeded processing...no dirs,
- * big filenames, or extensions > 3 chars.
- */
- BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
-
- while (lo <= hi)
- {
- middle = lo + ((hi - lo) / 2);
- rc = __PHYSFS_stricmpASCII(name, a[middle].name);
- if (rc == 0) /* found it! */
- return(&a[middle]);
- else if (rc > 0)
- lo = middle + 1;
- else
- hi = middle - 1;
- } /* while */
-
- BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
-} /* hog_find_entry */
-
-
-static int HOG_exists(dvoid *opaque, const char *name)
-{
- return(hog_find_entry(((HOGinfo *) opaque), name) != NULL);
-} /* HOG_exists */
-
-
-static int HOG_isDirectory(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = HOG_exists(opaque, name);
- return(0); /* never directories in a groupfile. */
-} /* HOG_isDirectory */
-
-
-static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = HOG_exists(opaque, name);
- return(0); /* never symlinks in a groupfile. */
-} /* HOG_isSymLink */
-
-
-static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque,
- const char *name,
- int *fileExists)
-{
- HOGinfo *info = ((HOGinfo *) opaque);
- PHYSFS_sint64 retval = -1;
-
- *fileExists = (hog_find_entry(info, name) != NULL);
- if (*fileExists) /* use time of HOG itself in the physical filesystem. */
- retval = info->last_mod_time;
-
- return(retval);
-} /* HOG_getLastModTime */
-
-
-static fvoid *HOG_openRead(dvoid *opaque, const char *fnm, int *fileExists)
-{
- HOGinfo *info = ((HOGinfo *) opaque);
- HOGfileinfo *finfo;
- HOGentry *entry;
-
- entry = hog_find_entry(info, fnm);
- *fileExists = (entry != NULL);
- BAIL_IF_MACRO(entry == NULL, NULL, NULL);
-
- finfo = (HOGfileinfo *) allocator.Malloc(sizeof (HOGfileinfo));
- BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
-
- finfo->handle = __PHYSFS_platformOpenRead(info->filename);
- if ( (finfo->handle == NULL) ||
- (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
- {
- allocator.Free(finfo);
- return(NULL);
- } /* if */
-
- finfo->curPos = 0;
- finfo->entry = entry;
- return(finfo);
-} /* HOG_openRead */
-
-
-static fvoid *HOG_openWrite(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* HOG_openWrite */
-
-
-static fvoid *HOG_openAppend(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* HOG_openAppend */
-
-
-static int HOG_remove(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* HOG_remove */
-
-
-static int HOG_mkdir(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* HOG_mkdir */
-
-
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG =
-{
- "HOG",
- HOG_ARCHIVE_DESCRIPTION,
- "Bradley Bell <btb@icculus.org>",
- "http://icculus.org/physfs/",
-};
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_HOG =
-{
- &__PHYSFS_ArchiveInfo_HOG,
- HOG_isArchive, /* isArchive() method */
- HOG_openArchive, /* openArchive() method */
- HOG_enumerateFiles, /* enumerateFiles() method */
- HOG_exists, /* exists() method */
- HOG_isDirectory, /* isDirectory() method */
- HOG_isSymLink, /* isSymLink() method */
- HOG_getLastModTime, /* getLastModTime() method */
- HOG_openRead, /* openRead() method */
- HOG_openWrite, /* openWrite() method */
- HOG_openAppend, /* openAppend() method */
- HOG_remove, /* remove() method */
- HOG_mkdir, /* mkdir() method */
- HOG_dirClose, /* dirClose() method */
- HOG_read, /* read() method */
- HOG_write, /* write() method */
- HOG_eof, /* eof() method */
- HOG_tell, /* tell() method */
- HOG_seek, /* seek() method */
- HOG_fileLength, /* fileLength() method */
- HOG_fileClose /* fileClose() method */
-};
-
-#endif /* defined PHYSFS_SUPPORTS_HOG */
-
-/* end of hog.c ... */
-
--- a/archivers/lzma.c Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,735 +0,0 @@
-/*
- * LZMA support routines for PhysicsFS.
- *
- * Please see the file lzma.txt in the lzma/ directory.
- *
- * This file was written by Dennis Schridde, with some peeking at "7zMain.c"
- * by Igor Pavlov.
- */
-
-#if (defined PHYSFS_SUPPORTS_7Z)
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "physfs.h"
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#include "lzma/C/7zCrc.h"
-#include "lzma/C/Archive/7z/7zIn.h"
-#include "lzma/C/Archive/7z/7zExtract.h"
-
-
-/* 7z internal from 7zIn.c */
-extern int TestSignatureCandidate(Byte *testBytes);
-
-
-#ifdef _LZMA_IN_CB
-# define BUFFER_SIZE (1 << 12)
-#endif /* _LZMA_IN_CB */
-
-
-/*
- * Carries filestream metadata through 7z
- */
-typedef struct _FileInputStream
-{
- ISzAlloc allocImp; /* Allocation implementation, used by 7z */
- ISzAlloc allocTempImp; /* Temporary allocation implementation, used by 7z */
- ISzInStream inStream; /* Input stream with read callbacks, used by 7z */
- void *file; /* Filehandle, used by read implementation */
-#ifdef _LZMA_IN_CB
- Byte buffer[BUFFER_SIZE]; /* Buffer, used by read implementation */
-#endif /* _LZMA_IN_CB */
-} FileInputStream;
-
-/*
- * In the 7z format archives are splited into blocks, those are called folders
- * Set by LZMA_read()
-*/
-typedef struct _LZMAfolder
-{
- PHYSFS_uint32 index; /* Index of folder in archive */
- PHYSFS_uint32 references; /* Number of files using this block */
- PHYSFS_uint8 *cache; /* Cached folder */
- size_t size; /* Size of folder */
-} LZMAfolder;
-
-/*
- * Set by LZMA_openArchive(), except folder which gets it's values
- * in LZMA_read()
- */
-typedef struct _LZMAarchive
-{
- struct _LZMAfile *files; /* Array of files, size == archive->db.Database.NumFiles */
- LZMAfolder *folders; /* Array of folders, size == archive->db.Database.NumFolders */
- CArchiveDatabaseEx db; /* For 7z: Database */
- FileInputStream stream; /* For 7z: Input file incl. read and seek callbacks */
-} LZMAarchive;
-
-/* Set by LZMA_openArchive(), except offset which is set by LZMA_read() */
-typedef struct _LZMAfile
-{
- PHYSFS_uint32 index; /* Index of file in archive */
- LZMAarchive *archive; /* Link to corresponding archive */
- LZMAfolder *folder; /* Link to corresponding folder */
- CFileItem *item; /* For 7z: File info, eg. name, size */
- size_t offset; /* Offset in folder */
- size_t position; /* Current "virtual" position in file */
-} LZMAfile;
-
-
-/* Memory management implementations to be passed to 7z */
-
-static void *SzAllocPhysicsFS(size_t size)
-{
- return ((size == 0) ? NULL : allocator.Malloc(size));
-} /* SzAllocPhysicsFS */
-
-
-static void SzFreePhysicsFS(void *address)
-{
- if (address != NULL)
- allocator.Free(address);
-} /* SzFreePhysicsFS */
-
-
-/* Filesystem implementations to be passed to 7z */
-
-#ifdef _LZMA_IN_CB
-
-/*
- * Read implementation, to be passed to 7z
- * WARNING: If the ISzInStream in 'object' is not contained in a valid FileInputStream this _will_ break horribly!
- */
-SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
- size_t *processedSize)
-{
- FileInputStream *s = (FileInputStream *)(object - offsetof(FileInputStream, inStream)); // HACK!
- PHYSFS_sint64 processedSizeLoc = 0;
-
- if (maxReqSize > BUFFER_SIZE)
- maxReqSize = BUFFER_SIZE;
- processedSizeLoc = __PHYSFS_platformRead(s->file, s->buffer, 1, maxReqSize);
- *buffer = s->buffer;
- if (processedSize != NULL)
- *processedSize = (size_t) processedSizeLoc;
-
- return SZ_OK;
-} /* SzFileReadImp */
-
-#else
-
-/*
- * Read implementation, to be passed to 7z
- * WARNING: If the ISzInStream in 'object' is not contained in a valid FileInputStream this _will_ break horribly!
- */
-SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
- size_t *processedSize)
-{
- FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); // HACK!
- size_t processedSizeLoc = __PHYSFS_platformRead(s->file, buffer, 1, size);
- if (processedSize != 0)
- *processedSize = processedSizeLoc;
- return SZ_OK;
-} /* SzFileReadImp */
-
-#endif
-
-/*
- * Seek implementation, to be passed to 7z
- * WARNING: If the ISzInStream in 'object' is not contained in a valid FileInputStream this _will_ break horribly!
- */
-SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
-{
- FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); // HACK!
- if (__PHYSFS_platformSeek(s->file, (PHYSFS_uint64) pos))
- return SZ_OK;
- return SZE_FAIL;
-} /* SzFileSeekImp */
-
-
-/*
- * Translate Microsoft FILETIME (used by 7zip) into UNIX timestamp
- */
-static PHYSFS_sint64 lzma_filetime_to_unix_timestamp(CArchiveFileTime *ft)
-{
- /* MS counts in nanoseconds ... */
- const PHYSFS_uint64 FILETIME_NANOTICKS_PER_SECOND = __PHYSFS_UI64(10000000);
- /* MS likes to count seconds since 01.01.1601 ... */
- const PHYSFS_uint64 FILETIME_UNIX_DIFF = __PHYSFS_UI64(11644473600);
-
- PHYSFS_uint64 filetime = ft->Low | ((PHYSFS_uint64)ft->High << 32);
- return filetime/FILETIME_NANOTICKS_PER_SECOND - FILETIME_UNIX_DIFF;
-} /* lzma_filetime_to_unix_timestamp */
-
-
-/*
- * Compare a file with a given name, C89 stdlib variant
- * Used for sorting
- */
-static int lzma_file_cmp_stdlib(const void *key, const void *object)
-{
- const char *name = (const char *) key;
- LZMAfile *file = (LZMAfile *) object;
- return(strcmp(name, file->item->Name));
-} /* lzma_file_cmp_posix */
-
-
-/*
- * Compare two files with each other based on the name
- * Used for sorting
- */
-static int lzma_file_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
-{
- LZMAfile *files = (LZMAfile *) _a;
- return(strcmp(files[one].item->Name, files[two].item->Name));
-} /* lzma_file_cmp */
-
-
-/*
- * Swap two entries in the file array
- */
-static void lzma_file_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
-{
- LZMAfile tmp;
- LZMAfile *first = &(((LZMAfile *) _a)[one]);
- LZMAfile *second = &(((LZMAfile *) _a)[two]);
- memcpy(&tmp, first, sizeof (LZMAfile));
- memcpy(first, second, sizeof (LZMAfile));
- memcpy(second, &tmp, sizeof (LZMAfile));
-} /* lzma_file_swap */
-
-
-/*
- * Find entry 'name' in 'archive'
- */
-static LZMAfile * lzma_find_file(LZMAarchive *archive, const char *name)
-{
- LZMAfile *file = bsearch(name, archive->files, archive->db.Database.NumFiles, sizeof(*archive->files), lzma_file_cmp_stdlib); // FIXME: Should become __PHYSFS_search!!!
-
- BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, NULL);
-
- return(file);
-} /* lzma_find_file */
-
-
-/*
- * Load metadata for the file at given index
- */
-static int lzma_file_init(LZMAarchive *archive, PHYSFS_uint32 fileIndex)
-{
- LZMAfile *file = &archive->files[fileIndex];
- PHYSFS_uint32 folderIndex = archive->db.FileIndexToFolderIndexMap[fileIndex];
-
- file->index = fileIndex; // Store index into 7z array, since we sort our own.
- file->archive = archive;
- file->folder = (folderIndex != (PHYSFS_uint32)-1 ? &archive->folders[folderIndex] : NULL); // Directories don't have a folder (they contain no own data...)
- file->item = &archive->db.Database.Files[fileIndex]; // Holds crucial data and is often referenced -> Store link
- file->position = 0;
- file->offset = 0; /* Offset will be set by LZMA_read() */
-
- return(1);
-} /* lzma_load_file */
-
-
-/*
- * Load metadata for all files
- */
-static int lzma_files_init(LZMAarchive *archive)
-{
- PHYSFS_uint32 fileIndex = 0, numFiles = archive->db.Database.NumFiles;
-
- for (fileIndex = 0; fileIndex < numFiles; fileIndex++ )
- {
- if (!lzma_file_init(archive, fileIndex))
- {
- return(0); // FALSE on failure
- }
- } /* for */
-
- __PHYSFS_sort(archive->files, numFiles, lzma_file_cmp, lzma_file_swap);
-
- return(1);
-} /* lzma_load_files */
-
-
-/*
- * Initialise specified archive
- */
-static void lzma_archive_init(LZMAarchive *archive)
-{
- memset(archive, 0, sizeof(*archive));
-
- /* Prepare callbacks for 7z */
- archive->stream.inStream.Read = SzFileReadImp;
- archive->stream.inStream.Seek = SzFileSeekImp;
-
- archive->stream.allocImp.Alloc = SzAllocPhysicsFS;
- archive->stream.allocImp.Free = SzFreePhysicsFS;
-
- archive->stream.allocTempImp.Alloc = SzAllocPhysicsFS;
- archive->stream.allocTempImp.Free = SzFreePhysicsFS;
-}
-
-
-/*
- * Deinitialise archive
- */
-static void lzma_archive_exit(LZMAarchive *archive)
-{
- /* Free arrays */
- allocator.Free(archive->folders);
- allocator.Free(archive->files);
- allocator.Free(archive);
-}
-
-/*
- * Wrap all 7z calls in this, so the physfs error state is set appropriately.
- */
-static int lzma_err(SZ_RESULT rc)
-{
- switch (rc)
- {
- case SZ_OK: /* Same as LZMA_RESULT_OK */
- break;
- case SZE_DATA_ERROR: /* Same as LZMA_RESULT_DATA_ERROR */
- __PHYSFS_setError(ERR_DATA_ERROR);
- break;
- case SZE_OUTOFMEMORY:
- __PHYSFS_setError(ERR_OUT_OF_MEMORY);
- break;
- case SZE_CRC_ERROR:
- __PHYSFS_setError(ERR_CORRUPTED);
- break;
- case SZE_NOTIMPL:
- __PHYSFS_setError(ERR_NOT_IMPLEMENTED);
- break;
- case SZE_FAIL:
- __PHYSFS_setError(ERR_UNKNOWN_ERROR); /* !!! FIXME: right? */
- break;
- case SZE_ARCHIVE_ERROR:
- __PHYSFS_setError(ERR_CORRUPTED); /* !!! FIXME: right? */
- break;
- default:
- __PHYSFS_setError(ERR_UNKNOWN_ERROR);
- } /* switch */
-
- return(rc);
-} /* lzma_err */
-
-
-static PHYSFS_sint64 LZMA_read(fvoid *opaque, void *outBuffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- LZMAfile *file = (LZMAfile *) opaque;
-
- size_t wantedSize = objSize*objCount;
- size_t remainingSize = file->item->Size - file->position;
- size_t fileSize = 0;
-
- BAIL_IF_MACRO(wantedSize == 0, NULL, 0); /* quick rejection. */
- BAIL_IF_MACRO(remainingSize == 0, ERR_PAST_EOF, 0);
-
- if (remainingSize < wantedSize)
- {
- wantedSize = remainingSize - (remainingSize % objSize);
- objCount = (PHYSFS_uint32) (remainingSize / objSize);
- BAIL_IF_MACRO(objCount == 0, ERR_PAST_EOF, 0); /* quick rejection. */
- __PHYSFS_setError(ERR_PAST_EOF); /* this is always true here. */
- } /* if */
-
- /* Only decompress the folder if it is not allready cached */
- if (file->folder->cache == NULL)
- {
- int rc = lzma_err(SzExtract(
- &file->archive->stream.inStream, /* compressed data */
- &file->archive->db, /* 7z's database, containing everything */
- file->index, /* Index into database arrays */
- /* Index of cached folder, will be changed by SzExtract */
- &file->folder->index,
- /* Cache for decompressed folder, allocated/freed by SzExtract */
- &file->folder->cache,
- /* Size of cache, will be changed by SzExtract */
- &file->folder->size,
- /* Offset of this file inside the cache, set by SzExtract */
- &file->offset,
- &fileSize, /* Size of this file */
- &file->archive->stream.allocImp,
- &file->archive->stream.allocTempImp));
-
- if (rc != SZ_OK)
- return -1;
- } /* if */
-
- /* Copy wanted bytes over from cache to outBuffer */
- memcpy(outBuffer,
- (file->folder->cache +
- file->offset + file->position),
- wantedSize);
- file->position += wantedSize; /* Increase virtual position */
-
- return objCount;
-} /* LZMA_read */
-
-
-static PHYSFS_sint64 LZMA_write(fvoid *opaque, const void *buf,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* LZMA_write */
-
-
-static int LZMA_eof(fvoid *opaque)
-{
- LZMAfile *file = (LZMAfile *) opaque;
- return (file->position >= file->item->Size);
-} /* LZMA_eof */
-
-
-static PHYSFS_sint64 LZMA_tell(fvoid *opaque)
-{
- LZMAfile *file = (LZMAfile *) opaque;
- return (file->position);
-} /* LZMA_tell */
-
-
-static int LZMA_seek(fvoid *opaque, PHYSFS_uint64 offset)
-{
- LZMAfile *file = (LZMAfile *) opaque;
-
- BAIL_IF_MACRO(offset < 0, ERR_SEEK_OUT_OF_RANGE, 0);
- BAIL_IF_MACRO(offset > file->item->Size, ERR_PAST_EOF, 0);
-
- file->position = offset; /* We only use a virtual position... */
-
- return 1;
-} /* LZMA_seek */
-
-
-static PHYSFS_sint64 LZMA_fileLength(fvoid *opaque)
-{
- LZMAfile *file = (LZMAfile *) opaque;
- return (file->item->Size);
-} /* LZMA_fileLength */
-
-
-static int LZMA_fileClose(fvoid *opaque)
-{
- LZMAfile *file = (LZMAfile *) opaque;
-
- BAIL_IF_MACRO(file->folder == NULL, ERR_NOT_A_FILE, 0);
-
- /* Only decrease refcount if someone actually requested this file... Prevents from overflows and close-on-open... */
- if (file->folder->references > 0)
- file->folder->references--;
- if (file->folder->references == 0)
- {
- /* Free the cache which might have been allocated by LZMA_read() */
- allocator.Free(file->folder->cache);
- file->folder->cache = NULL;
- }
-
- return(1);
-} /* LZMA_fileClose */
-
-
-static int LZMA_isArchive(const char *filename, int forWriting)
-{
- PHYSFS_uint8 sig[k7zSignatureSize];
- void *in;
-
- BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
-
- in = __PHYSFS_platformOpenRead(filename);
- BAIL_IF_MACRO(in == NULL, NULL, 0);
-
- /* Read signature bytes */
- if (__PHYSFS_platformRead(in, sig, k7zSignatureSize, 1) != 1)
- {
- __PHYSFS_platformClose(in); // Don't forget to close the file before returning...
- BAIL_MACRO(NULL, 0);
- }
-
- __PHYSFS_platformClose(in);
-
- /* Test whether sig is the 7z signature */
- return(TestSignatureCandidate(sig));
-} /* LZMA_isArchive */
-
-
-static void *LZMA_openArchive(const char *name, int forWriting)
-{
- size_t len = 0;
- LZMAarchive *archive = NULL;
-
- BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, NULL);
- BAIL_IF_MACRO(!LZMA_isArchive(name,forWriting), ERR_UNSUPPORTED_ARCHIVE, 0);
-
- archive = (LZMAarchive *) allocator.Malloc(sizeof (LZMAarchive));
- BAIL_IF_MACRO(archive == NULL, ERR_OUT_OF_MEMORY, NULL);
-
- lzma_archive_init(archive);
-
- if ( (archive->stream.file = __PHYSFS_platformOpenRead(name)) == NULL )
- {
- __PHYSFS_platformClose(archive->stream.file);
- lzma_archive_exit(archive);
- return(NULL); // Error is set by platformOpenRead!
- }
-
- CrcGenerateTable();
- SzArDbExInit(&archive->db);
- if (lzma_err(SzArchiveOpen(&archive->stream.inStream,
- &archive->db,
- &archive->stream.allocImp,
- &archive->stream.allocTempImp)) != SZ_OK)
- {
- SzArDbExFree(&archive->db, SzFreePhysicsFS);
- __PHYSFS_platformClose(archive->stream.file);
- lzma_archive_exit(archive);
- return NULL; // Error is set by lzma_err!
- } /* if */
-
- len = archive->db.Database.NumFiles * sizeof (LZMAfile);
- archive->files = (LZMAfile *) allocator.Malloc(len);
- if (archive->files == NULL)
- {
- SzArDbExFree(&archive->db, SzFreePhysicsFS);
- __PHYSFS_platformClose(archive->stream.file);
- lzma_archive_exit(archive);
- BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
- }
-
- /*
- * Init with 0 so we know when a folder is already cached
- * Values will be set by LZMA_openRead()
- */
- memset(archive->files, 0, len);
-
- len = archive->db.Database.NumFolders * sizeof (LZMAfolder);
- archive->folders = (LZMAfolder *) allocator.Malloc(len);
- if (archive->folders == NULL)
- {
- SzArDbExFree(&archive->db, SzFreePhysicsFS);
- __PHYSFS_platformClose(archive->stream.file);
- lzma_archive_exit(archive);
- BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
- }
-
- /*
- * Init with 0 so we know when a folder is already cached
- * Values will be set by LZMA_read()
- */
- memset(archive->folders, 0, len);
-
- if(!lzma_files_init(archive))
- {
- SzArDbExFree(&archive->db, SzFreePhysicsFS);
- __PHYSFS_platformClose(archive->stream.file);
- lzma_archive_exit(archive);
- BAIL_MACRO(ERR_UNKNOWN_ERROR, NULL);
- }
-
- return(archive);
-} /* LZMA_openArchive */
-
-
-/*
- * Moved to seperate function so we can use alloca then immediately throw
- * away the allocated stack space...
- */
-static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
- const char *odir, const char *str, size_t flen)
-{
- char *newstr = __PHYSFS_smallAlloc(flen + 1);
- if (newstr == NULL)
- return;
-
- memcpy(newstr, str, flen);
- newstr[flen] = '\0';
- cb(callbackdata, odir, newstr);
- __PHYSFS_smallFree(newstr);
-} /* doEnumCallback */
-
-
-static void LZMA_enumerateFiles(dvoid *opaque, const char *dname,
- int omitSymLinks, PHYSFS_EnumFilesCallback cb,
- const char *origdir, void *callbackdata)
-{
- size_t dlen = strlen(dname),
- dlen_inc = dlen + ((dlen > 0) ? 1 : 0);
- LZMAarchive *archive = (LZMAarchive *) opaque;
- LZMAfile *file = NULL,
- *lastFile = &archive->files[archive->db.Database.NumFiles];
- if (dlen)
- {
- file = lzma_find_file(archive, dname);
- if (file != NULL) // if 'file' is NULL it should stay so, otherwise errors will not be handled
- file += 1;
- }
- else
- {
- file = archive->files;
- }
-
- BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, );
-
- while (file < lastFile)
- {
- const char * fname = file->item->Name;
- const char * dirNameEnd = fname + dlen_inc;
-
- if (strncmp(dname, fname, dlen) != 0) /* Stop after mismatch, archive->files is sorted */
- break;
-
- if (strchr(dirNameEnd, '/')) /* Skip subdirs */
- {
- file++;
- continue;
- }
-
- /* Do the actual callback... */
- doEnumCallback(cb, callbackdata, origdir, dirNameEnd, strlen(dirNameEnd));
-
- file++;
- }
-} /* LZMA_enumerateFiles */
-
-
-static int LZMA_exists(dvoid *opaque, const char *name)
-{
- LZMAarchive *archive = (LZMAarchive *) opaque;
- return(lzma_find_file(archive, name) != NULL);
-} /* LZMA_exists */
-
-
-static PHYSFS_sint64 LZMA_getLastModTime(dvoid *opaque,
- const char *name,
- int *fileExists)
-{
- LZMAarchive *archive = (LZMAarchive *) opaque;
- LZMAfile *file = lzma_find_file(archive, name);
-
- *fileExists = (file != NULL);
-
- BAIL_IF_MACRO(file == NULL, NULL, -1);
- BAIL_IF_MACRO(!file->item->IsLastWriteTimeDefined, NULL, -1); // write-time may not be defined for every file
-
- return(lzma_filetime_to_unix_timestamp(&file->item->LastWriteTime));
-} /* LZMA_getLastModTime */
-
-
-static int LZMA_isDirectory(dvoid *opaque, const char *name, int *fileExists)
-{
- LZMAarchive *archive = (LZMAarchive *) opaque;
- LZMAfile *file = lzma_find_file(archive, name);
-
- *fileExists = (file != NULL);
-
- return(file == NULL ? 0 : file->item->IsDirectory);
-} /* LZMA_isDirectory */
-
-
-static int LZMA_isSymLink(dvoid *opaque, const char *name, int *fileExists)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* LZMA_isSymLink */
-
-
-static fvoid *LZMA_openRead(dvoid *opaque, const char *name, int *fileExists)
-{
- LZMAarchive *archive = (LZMAarchive *) opaque;
- LZMAfile *file = lzma_find_file(archive, name);
-
- *fileExists = (file != NULL);
- BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(file->folder == NULL, ERR_NOT_A_FILE, NULL);
-
- file->folder->references++; // Increase refcount for automatic cleanup...
-
- return(file);
-} /* LZMA_openRead */
-
-
-static fvoid *LZMA_openWrite(dvoid *opaque, const char *filename)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* LZMA_openWrite */
-
-
-static fvoid *LZMA_openAppend(dvoid *opaque, const char *filename)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* LZMA_openAppend */
-
-
-static void LZMA_dirClose(dvoid *opaque)
-{
- LZMAarchive *archive = (LZMAarchive *) opaque;
- PHYSFS_uint32 fileIndex = 0, numFiles = archive->db.Database.NumFiles;
-
- for (fileIndex = 0; fileIndex < numFiles; fileIndex++)
- {
- LZMA_fileClose(&archive->files[fileIndex]);
- } /* for */
-
- SzArDbExFree(&archive->db, SzFreePhysicsFS);
- __PHYSFS_platformClose(archive->stream.file);
- lzma_archive_exit(archive);
-} /* LZMA_dirClose */
-
-
-static int LZMA_remove(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* LZMA_remove */
-
-
-static int LZMA_mkdir(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* LZMA_mkdir */
-
-
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_LZMA =
-{
- "7Z",
- LZMA_ARCHIVE_DESCRIPTION,
- "Dennis Schridde <devurandom@gmx.net>",
- "http://icculus.org/physfs/",
-};
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
-{
- &__PHYSFS_ArchiveInfo_LZMA,
- LZMA_isArchive, /* isArchive() method */
- LZMA_openArchive, /* openArchive() method */
- LZMA_enumerateFiles, /* enumerateFiles() method */
- LZMA_exists, /* exists() method */
- LZMA_isDirectory, /* isDirectory() method */
- LZMA_isSymLink, /* isSymLink() method */
- LZMA_getLastModTime, /* getLastModTime() method */
- LZMA_openRead, /* openRead() method */
- LZMA_openWrite, /* openWrite() method */
- LZMA_openAppend, /* openAppend() method */
- LZMA_remove, /* remove() method */
- LZMA_mkdir, /* mkdir() method */
- LZMA_dirClose, /* dirClose() method */
- LZMA_read, /* read() method */
- LZMA_write, /* write() method */
- LZMA_eof, /* eof() method */
- LZMA_tell, /* tell() method */
- LZMA_seek, /* seek() method */
- LZMA_fileLength, /* fileLength() method */
- LZMA_fileClose /* fileClose() method */
-};
-
-#endif /* defined PHYSFS_SUPPORTS_7Z */
-
-/* end of lzma.c ... */
-
--- a/archivers/mvl.c Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * MVL support routines for PhysicsFS.
- *
- * This driver handles Descent II Movielib archives.
- *
- * The file format of MVL is quite easy...
- *
- * //MVL File format - Written by Heiko Herrmann
- * char sig[4] = {'D','M', 'V', 'L'}; // "DMVL"=Descent MoVie Library
- *
- * int num_files; // the number of files in this MVL
- *
- * struct {
- * char file_name[13]; // Filename, padded to 13 bytes with 0s
- * int file_size; // filesize in bytes
- * }DIR_STRUCT[num_files];
- *
- * struct {
- * char data[file_size]; // The file data
- * }FILE_STRUCT[num_files];
- *
- * (That info is from http://www.descent2.com/ddn/specs/mvl/)
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Bradley Bell.
- * Based on grp.c by Ryan C. Gordon.
- */
-
-#if (defined PHYSFS_SUPPORTS_MVL)
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "physfs.h"
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-typedef struct
-{
- char name[13];
- PHYSFS_uint32 startPos;
- PHYSFS_uint32 size;
-} MVLentry;
-
-typedef struct
-{
- char *filename;
- PHYSFS_sint64 last_mod_time;
- PHYSFS_uint32 entryCount;
- MVLentry *entries;
-} MVLinfo;
-
-typedef struct
-{
- void *handle;
- MVLentry *entry;
- PHYSFS_uint32 curPos;
-} MVLfileinfo;
-
-
-static void MVL_dirClose(dvoid *opaque)
-{
- MVLinfo *info = ((MVLinfo *) opaque);
- allocator.Free(info->filename);
- allocator.Free(info->entries);
- allocator.Free(info);
-} /* MVL_dirClose */
-
-
-static PHYSFS_sint64 MVL_read(fvoid *opaque, void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- MVLfileinfo *finfo = (MVLfileinfo *) opaque;
- MVLentry *entry = finfo->entry;
- PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
- PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
- PHYSFS_sint64 rc;
-
- if (objsLeft < objCount)
- objCount = objsLeft;
-
- rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
- if (rc > 0)
- finfo->curPos += (PHYSFS_uint32) (rc * objSize);
-
- return(rc);
-} /* MVL_read */
-
-
-static PHYSFS_sint64 MVL_write(fvoid *opaque, const void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* MVL_write */
-
-
-static int MVL_eof(fvoid *opaque)
-{
- MVLfileinfo *finfo = (MVLfileinfo *) opaque;
- MVLentry *entry = finfo->entry;
- return(finfo->curPos >= entry->size);
-} /* MVL_eof */
-
-
-static PHYSFS_sint64 MVL_tell(fvoid *opaque)
-{
- return(((MVLfileinfo *) opaque)->curPos);
-} /* MVL_tell */
-
-
-static int MVL_seek(fvoid *opaque, PHYSFS_uint64 offset)
-{
- MVLfileinfo *finfo = (MVLfileinfo *) opaque;
- MVLentry *entry = finfo->entry;
- int rc;
-
- BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
- BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
- rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
- if (rc)
- finfo->curPos = (PHYSFS_uint32) offset;
-
- return(rc);
-} /* MVL_seek */
-
-
-static PHYSFS_sint64 MVL_fileLength(fvoid *opaque)
-{
- MVLfileinfo *finfo = (MVLfileinfo *) opaque;
- return((PHYSFS_sint64) finfo->entry->size);
-} /* MVL_fileLength */
-
-
-static int MVL_fileClose(fvoid *opaque)
-{
- MVLfileinfo *finfo = (MVLfileinfo *) opaque;
- BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
- allocator.Free(finfo);
- return(1);
-} /* MVL_fileClose */
-
-
-static int mvl_open(const char *filename, int forWriting,
- void **fh, PHYSFS_uint32 *count)
-{
- PHYSFS_uint8 buf[4];
-
- *fh = NULL;
- BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
-
- *fh = __PHYSFS_platformOpenRead(filename);
- BAIL_IF_MACRO(*fh == NULL, NULL, 0);
-
- if (__PHYSFS_platformRead(*fh, buf, 4, 1) != 1)
- goto openMvl_failed;
-
- if (memcmp(buf, "DMVL", 4) != 0)
- {
- __PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
- goto openMvl_failed;
- } /* if */
-
- if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
- goto openMvl_failed;
-
- *count = PHYSFS_swapULE32(*count);
-
- return(1);
-
-openMvl_failed:
- if (*fh != NULL)
- __PHYSFS_platformClose(*fh);
-
- *count = -1;
- *fh = NULL;
- return(0);
-} /* mvl_open */
-
-
-static int MVL_isArchive(const char *filename, int forWriting)
-{
- void *fh;
- PHYSFS_uint32 fileCount;
- int retval = mvl_open(filename, forWriting, &fh, &fileCount);
-
- if (fh != NULL)
- __PHYSFS_platformClose(fh);
-
- return(retval);
-} /* MVL_isArchive */
-
-
-static int mvl_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
-{
- 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)
-{
- 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 */
-
-
-static int mvl_load_entries(const char *name, int forWriting, MVLinfo *info)
-{
- void *fh = NULL;
- PHYSFS_uint32 fileCount;
- PHYSFS_uint32 location = 8; /* sizeof sig. */
- MVLentry *entry;
-
- BAIL_IF_MACRO(!mvl_open(name, forWriting, &fh, &fileCount), NULL, 0);
- info->entryCount = fileCount;
- info->entries = (MVLentry *) allocator.Malloc(sizeof(MVLentry)*fileCount);
- if (info->entries == NULL)
- {
- __PHYSFS_platformClose(fh);
- BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
- } /* if */
-
- location += (17 * fileCount);
-
- for (entry = info->entries; fileCount > 0; fileCount--, entry++)
- {
- if (__PHYSFS_platformRead(fh, &entry->name, 13, 1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- entry->size = PHYSFS_swapULE32(entry->size);
- entry->startPos = location;
- location += entry->size;
- } /* for */
-
- __PHYSFS_platformClose(fh);
-
- __PHYSFS_sort(info->entries, info->entryCount,
- mvl_entry_cmp, mvl_entry_swap);
- return(1);
-} /* mvl_load_entries */
-
-
-static void *MVL_openArchive(const char *name, int forWriting)
-{
- PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
- MVLinfo *info = (MVLinfo *) allocator.Malloc(sizeof (MVLinfo));
-
- BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
- memset(info, '\0', sizeof (MVLinfo));
-
- info->filename = (char *) allocator.Malloc(strlen(name) + 1);
- GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, MVL_openArchive_failed);
- if (!mvl_load_entries(name, forWriting, info))
- goto MVL_openArchive_failed;
-
- strcpy(info->filename, name);
- info->last_mod_time = modtime;
- return(info);
-
-MVL_openArchive_failed:
- if (info != NULL)
- {
- if (info->filename != NULL)
- allocator.Free(info->filename);
- if (info->entries != NULL)
- allocator.Free(info->entries);
- allocator.Free(info);
- } /* if */
-
- return(NULL);
-} /* MVL_openArchive */
-
-
-static void MVL_enumerateFiles(dvoid *opaque, const char *dname,
- int omitSymLinks, PHYSFS_EnumFilesCallback cb,
- const char *origdir, void *callbackdata)
-{
- /* no directories in MVL files. */
- if (*dname == '\0')
- {
- MVLinfo *info = ((MVLinfo *) opaque);
- MVLentry *entry = info->entries;
- PHYSFS_uint32 max = info->entryCount;
- PHYSFS_uint32 i;
-
- for (i = 0; i < max; i++, entry++)
- cb(callbackdata, origdir, entry->name);
- } /* if */
-} /* MVL_enumerateFiles */
-
-
-static MVLentry *mvl_find_entry(MVLinfo *info, const char *name)
-{
- char *ptr = strchr(name, '.');
- MVLentry *a = info->entries;
- PHYSFS_sint32 lo = 0;
- PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
- PHYSFS_sint32 middle;
- int rc;
-
- /*
- * Rule out filenames to avoid unneeded processing...no dirs,
- * big filenames, or extensions > 3 chars.
- */
- BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
- BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
-
- while (lo <= hi)
- {
- middle = lo + ((hi - lo) / 2);
- rc = __PHYSFS_stricmpASCII(name, a[middle].name);
- if (rc == 0) /* found it! */
- return(&a[middle]);
- else if (rc > 0)
- lo = middle + 1;
- else
- hi = middle - 1;
- } /* while */
-
- BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
-} /* mvl_find_entry */
-
-
-static int MVL_exists(dvoid *opaque, const char *name)
-{
- return(mvl_find_entry(((MVLinfo *) opaque), name) != NULL);
-} /* MVL_exists */
-
-
-static int MVL_isDirectory(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = MVL_exists(opaque, name);
- return(0); /* never directories in a groupfile. */
-} /* MVL_isDirectory */
-
-
-static int MVL_isSymLink(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = MVL_exists(opaque, name);
- return(0); /* never symlinks in a groupfile. */
-} /* MVL_isSymLink */
-
-
-static PHYSFS_sint64 MVL_getLastModTime(dvoid *opaque,
- const char *name,
- int *fileExists)
-{
- MVLinfo *info = ((MVLinfo *) opaque);
- PHYSFS_sint64 retval = -1;
-
- *fileExists = (mvl_find_entry(info, name) != NULL);
- if (*fileExists) /* use time of MVL itself in the physical filesystem. */
- retval = info->last_mod_time;
-
- return(retval);
-} /* MVL_getLastModTime */
-
-
-static fvoid *MVL_openRead(dvoid *opaque, const char *fnm, int *fileExists)
-{
- MVLinfo *info = ((MVLinfo *) opaque);
- MVLfileinfo *finfo;
- MVLentry *entry;
-
- entry = mvl_find_entry(info, fnm);
- *fileExists = (entry != NULL);
- BAIL_IF_MACRO(entry == NULL, NULL, NULL);
-
- finfo = (MVLfileinfo *) allocator.Malloc(sizeof (MVLfileinfo));
- BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
-
- finfo->handle = __PHYSFS_platformOpenRead(info->filename);
- if ( (finfo->handle == NULL) ||
- (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
- {
- allocator.Free(finfo);
- return(NULL);
- } /* if */
-
- finfo->curPos = 0;
- finfo->entry = entry;
- return(finfo);
-} /* MVL_openRead */
-
-
-static fvoid *MVL_openWrite(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* MVL_openWrite */
-
-
-static fvoid *MVL_openAppend(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* MVL_openAppend */
-
-
-static int MVL_remove(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* MVL_remove */
-
-
-static int MVL_mkdir(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* MVL_mkdir */
-
-
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL =
-{
- "MVL",
- MVL_ARCHIVE_DESCRIPTION,
- "Bradley Bell <btb@icculus.org>",
- "http://icculus.org/physfs/",
-};
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_MVL =
-{
- &__PHYSFS_ArchiveInfo_MVL,
- MVL_isArchive, /* isArchive() method */
- MVL_openArchive, /* openArchive() method */
- MVL_enumerateFiles, /* enumerateFiles() method */
- MVL_exists, /* exists() method */
- MVL_isDirectory, /* isDirectory() method */
- MVL_isSymLink, /* isSymLink() method */
- MVL_getLastModTime, /* getLastModTime() method */
- MVL_openRead, /* openRead() method */
- MVL_openWrite, /* openWrite() method */
- MVL_openAppend, /* openAppend() method */
- MVL_remove, /* remove() method */
- MVL_mkdir, /* mkdir() method */
- MVL_dirClose, /* dirClose() method */
- MVL_read, /* read() method */
- MVL_write, /* write() method */
- MVL_eof, /* eof() method */
- MVL_tell, /* tell() method */
- MVL_seek, /* seek() method */
- MVL_fileLength, /* fileLength() method */
- MVL_fileClose /* fileClose() method */
-};
-
-#endif /* defined PHYSFS_SUPPORTS_MVL */
-
-/* end of mvl.c ... */
-
--- a/archivers/qpak.c Mon Mar 23 16:50:44 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,630 +0,0 @@
-/*
- * QPAK support routines for PhysicsFS.
- *
- * This archiver handles the archive format utilized by Quake 1 and 2.
- * Quake3-based games use the PkZip/Info-Zip format (which our zip.c
- * archiver handles).
- *
- * ========================================================================
- *
- * This format info (in more detail) comes from:
- * http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt
- *
- * Quake PAK Format
- *
- * Header
- * (4 bytes) signature = 'PACK'
- * (4 bytes) directory offset
- * (4 bytes) directory length
- *
- * Directory
- * (56 bytes) file name
- * (4 bytes) file position
- * (4 bytes) file length
- *
- * ========================================================================
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Ryan C. Gordon.
- */
-
-#if (defined PHYSFS_SUPPORTS_QPAK)
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "physfs.h"
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if 1 /* Make this case insensitive? */
-#define QPAK_strcmp(x, y) __PHYSFS_stricmpASCII(x, y)
-#define QPAK_strncmp(x, y, z) __PHYSFS_strnicmpASCII(x, y, z)
-#else
-#define QPAK_strcmp(x, y) strcmp(x, y)
-#define QPAK_strncmp(x, y, z) strncmp(x, y, z)
-#endif
-
-
-typedef struct
-{
- char name[56];
- PHYSFS_uint32 startPos;
- PHYSFS_uint32 size;
-} QPAKentry;
-
-typedef struct
-{
- char *filename;
- PHYSFS_sint64 last_mod_time;
- PHYSFS_uint32 entryCount;
- QPAKentry *entries;
-} QPAKinfo;
-
-typedef struct
-{
- void *handle;
- QPAKentry *entry;
- PHYSFS_uint32 curPos;
-} QPAKfileinfo;
-
-/* Magic numbers... */
-#define QPAK_SIG 0x4b434150 /* "PACK" in ASCII. */
-
-
-static void QPAK_dirClose(dvoid *opaque)
-{
- QPAKinfo *info = ((QPAKinfo *) opaque);
- allocator.Free(info->filename);
- allocator.Free(info->entries);
- allocator.Free(info);
-} /* QPAK_dirClose */
-
-
-static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
- QPAKentry *entry = finfo->entry;
- PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
- PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
- PHYSFS_sint64 rc;
-
- if (objsLeft < objCount)
- objCount = objsLeft;
-
- rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
- if (rc > 0)
- finfo->curPos += (PHYSFS_uint32) (rc * objSize);
-
- return(rc);
-} /* QPAK_read */
-
-
-static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer,
- PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* QPAK_write */
-
-
-static int QPAK_eof(fvoid *opaque)
-{
- QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
- QPAKentry *entry = finfo->entry;
- return(finfo->curPos >= entry->size);
-} /* QPAK_eof */
-
-
-static PHYSFS_sint64 QPAK_tell(fvoid *opaque)
-{
- return(((QPAKfileinfo *) opaque)->curPos);
-} /* QPAK_tell */
-
-
-static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset)
-{
- QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
- QPAKentry *entry = finfo->entry;
- int rc;
-
- BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
- BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
- rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
- if (rc)
- finfo->curPos = (PHYSFS_uint32) offset;
-
- return(rc);
-} /* QPAK_seek */
-
-
-static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque)
-{
- QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
- return((PHYSFS_sint64) finfo->entry->size);
-} /* QPAK_fileLength */
-
-
-static int QPAK_fileClose(fvoid *opaque)
-{
- QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
- BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
- allocator.Free(finfo);
- return(1);
-} /* QPAK_fileClose */
-
-
-static int qpak_open(const char *filename, int forWriting,
- void **fh, PHYSFS_uint32 *count)
-{
- PHYSFS_uint32 buf;
-
- *fh = NULL;
- BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
-
- *fh = __PHYSFS_platformOpenRead(filename);
- BAIL_IF_MACRO(*fh == NULL, NULL, 0);
-
- if (__PHYSFS_platformRead(*fh, &buf, sizeof (PHYSFS_uint32), 1) != 1)
- goto openQpak_failed;
-
- buf = PHYSFS_swapULE32(buf);
- GOTO_IF_MACRO(buf != QPAK_SIG, ERR_UNSUPPORTED_ARCHIVE, openQpak_failed);
-
- if (__PHYSFS_platformRead(*fh, &buf, sizeof (PHYSFS_uint32), 1) != 1)
- goto openQpak_failed;
-
- buf = PHYSFS_swapULE32(buf); /* directory table offset. */
-
- if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
- goto openQpak_failed;
-
- *count = PHYSFS_swapULE32(*count);
-
- /* corrupted archive? */
- GOTO_IF_MACRO((*count % 64) != 0, ERR_CORRUPTED, openQpak_failed);
-
- if (!__PHYSFS_platformSeek(*fh, buf))
- goto openQpak_failed;
-
- *count /= 64;
- return(1);
-
-openQpak_failed:
- if (*fh != NULL)
- __PHYSFS_platformClose(*fh);
-
- *count = -1;
- *fh = NULL;
- return(0);
-} /* qpak_open */
-
-
-static int QPAK_isArchive(const char *filename, int forWriting)
-{
- void *fh;
- PHYSFS_uint32 fileCount;
- int retval = qpak_open(filename, forWriting, &fh, &fileCount);
-
- if (fh != NULL)
- __PHYSFS_platformClose(fh);
-
- return(retval);
-} /* QPAK_isArchive */
-
-
-static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
-{
- 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)
-{
- 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 */
-
-
-static int qpak_load_entries(const char *name, int forWriting, QPAKinfo *info)
-{
- void *fh = NULL;
- PHYSFS_uint32 fileCount;
- QPAKentry *entry;
-
- BAIL_IF_MACRO(!qpak_open(name, forWriting, &fh, &fileCount), NULL, 0);
- info->entryCount = fileCount;
- info->entries = (QPAKentry*) allocator.Malloc(sizeof(QPAKentry)*fileCount);
- if (info->entries == NULL)
- {
- __PHYSFS_platformClose(fh);
- BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
- } /* if */
-
- for (entry = info->entries; fileCount > 0; fileCount--, entry++)
- {
- PHYSFS_uint32 loc;
-
- if (__PHYSFS_platformRead(fh,&entry->name,sizeof(entry->name),1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- if (__PHYSFS_platformRead(fh,&loc,sizeof(loc),1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- if (__PHYSFS_platformRead(fh,&entry->size,sizeof(entry->size),1) != 1)
- {
- __PHYSFS_platformClose(fh);
- return(0);
- } /* if */
-
- entry->size = PHYSFS_swapULE32(entry->size);
- entry->startPos = PHYSFS_swapULE32(loc);
- } /* for */
-
- __PHYSFS_platformClose(fh);
-
- __PHYSFS_sort(info->entries, info->entryCount,
- qpak_entry_cmp, qpak_entry_swap);
- return(1);
-} /* qpak_load_entries */
-
-
-static void *QPAK_openArchive(const char *name, int forWriting)
-{
- QPAKinfo *info = (QPAKinfo *) allocator.Malloc(sizeof (QPAKinfo));
- PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
-
- BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
- memset(info, '\0', sizeof (QPAKinfo));
-
- info->filename = (char *) allocator.Malloc(strlen(name) + 1);
- if (info->filename == NULL)
- {
- __PHYSFS_setError(ERR_OUT_OF_MEMORY);
- goto QPAK_openArchive_failed;
- } /* if */
-
- if (!qpak_load_entries(name, forWriting, info))
- goto QPAK_openArchive_failed;
-
- strcpy(info->filename, name);
- info->last_mod_time = modtime;
- return(info);
-
-QPAK_openArchive_failed:
- if (info != NULL)
- {
- if (info->filename != NULL)
- allocator.Free(info->filename);
- if (info->entries != NULL)
- allocator.Free(info->entries);
- allocator.Free(info);
- } /* if */
-
- return(NULL);
-} /* QPAK_openArchive */
-
-
-static PHYSFS_sint32 qpak_find_start_of_dir(QPAKinfo *info, const char *path,
- int stop_on_first_find)
-{
- PHYSFS_sint32 lo = 0;
- PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
- PHYSFS_sint32 middle;
- PHYSFS_uint32 dlen = strlen(path);
- PHYSFS_sint32 retval = -1;
- const char *name;
- int rc;
-
- if (*path == '\0') /* root dir? */
- return(0);
-
- if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
- dlen--;
-
- while (lo <= hi)
- {
- middle = lo + ((hi - lo) / 2);
- name = info->entries[middle].name;
- rc = QPAK_strncmp(path, name, dlen);
- if (rc == 0)
- {
- char ch = name[dlen];
- if (ch < '/') /* make sure this isn't just a substr match. */
- rc = -1;
- else if (ch > '/')
- rc = 1;
- else
- {
- if (stop_on_first_find) /* Just checking dir's existance? */
- return(middle);
-
- if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
- return(middle + 1);
-
- /* there might be more entries earlier in the list. */
- retval = middle;
- hi = middle - 1;
- } /* else */
- } /* if */
-
- if (rc > 0)
- lo = middle + 1;
- else
- hi = middle - 1;
- } /* while */
-
- return(retval);
-} /* qpak_find_start_of_dir */
-
-
-/*
- * Moved to seperate function so we can use alloca then immediately throw
- * away the allocated stack space...
- */
-static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
- const char *odir, const char *str, PHYSFS_sint32 ln)
-{
- char *newstr = __PHYSFS_smallAlloc(ln + 1);
- if (newstr == NULL)
- return;
-
- memcpy(newstr, str, ln);
- newstr[ln] = '\0';
- cb(callbackdata, odir, newstr);
- __PHYSFS_smallFree(newstr);
-} /* doEnumCallback */
-
-
-static void QPAK_enumerateFiles(dvoid *opaque, const char *dname,
- int omitSymLinks, PHYSFS_EnumFilesCallback cb,
- const char *origdir, void *callbackdata)
-{
- QPAKinfo *info = ((QPAKinfo *) opaque);
- PHYSFS_sint32 dlen, dlen_inc, max, i;
-
- i = qpak_find_start_of_dir(info, dname, 0);
- if (i == -1) /* no such directory. */
- return;
-
- dlen = strlen(dname);
- if ((dlen > 0) && (dname[dlen - 1] == '/')) /* ignore trailing slash. */
- dlen--;
-
- dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
- max = (PHYSFS_sint32) info->entryCount;
- while (i < max)
- {
- char *add;
- char *ptr;
- PHYSFS_sint32 ln;
- char *e = info->entries[i].name;
- if ((dlen) && ((QPAK_strncmp(e, dname, dlen)) || (e[dlen] != '/')))
- break; /* past end of this dir; we're done. */
-
- add = e + dlen_inc;
- ptr = strchr(add, '/');
- ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
- doEnumCallback(cb, callbackdata, origdir, add, ln);
- ln += dlen_inc; /* point past entry to children... */
-
- /* increment counter and skip children of subdirs... */
- while ((++i < max) && (ptr != NULL))
- {
- char *e_new = info->entries[i].name;
- if ((QPAK_strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
- break;
- } /* while */
- } /* while */
-} /* QPAK_enumerateFiles */
-
-
-/*
- * This will find the QPAKentry associated with a path in platform-independent
- * notation. Directories don't have QPAKentries associated with them, but
- * (*isDir) will be set to non-zero if a dir was hit.
- */
-static QPAKentry *qpak_find_entry(QPAKinfo *info, const char *path, int *isDir)
-{
- QPAKentry *a = info->entries;
- PHYSFS_sint32 pathlen = strlen(path);
- PHYSFS_sint32 lo = 0;
- PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
- PHYSFS_sint32 middle;
- const char *thispath = NULL;
- int rc;
-
- while (lo <= hi)
- {
- middle = lo + ((hi - lo) / 2);
- thispath = a[middle].name;
- rc = QPAK_strncmp(path, thispath, pathlen);
-
- if (rc > 0)
- lo = middle + 1;
-
- else if (rc < 0)
- hi = middle - 1;
-
- else /* substring match...might be dir or entry or nothing. */
- {
- if (isDir != NULL)
- {
- *isDir = (thispath[pathlen] == '/');
- if (*isDir)
- return(NULL);
- } /* if */
-
- if (thispath[pathlen] == '\0') /* found entry? */
- return(&a[middle]);
- else
- hi = middle - 1; /* adjust search params, try again. */
- } /* if */
- } /* while */
-
- if (isDir != NULL)
- *isDir = 0;
-
- BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
-} /* qpak_find_entry */
-
-
-static int QPAK_exists(dvoid *opaque, const char *name)
-{
- int isDir;
- QPAKinfo *info = (QPAKinfo *) opaque;
- QPAKentry *entry = qpak_find_entry(info, name, &isDir);
- return((entry != NULL) || (isDir));
-} /* QPAK_exists */
-
-
-static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists)
-{
- QPAKinfo *info = (QPAKinfo *) opaque;
- int isDir;
- QPAKentry *entry = qpak_find_entry(info, name, &isDir);
-
- *fileExists = ((isDir) || (entry != NULL));
- if (isDir)
- return(1); /* definitely a dir. */
-
- BAIL_MACRO(ERR_NO_SUCH_FILE, 0);
-} /* QPAK_isDirectory */
-
-
-static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists)
-{
- *fileExists = QPAK_exists(opaque, name);
- return(0); /* never symlinks in a quake pak. */
-} /* QPAK_isSymLink */
-
-
-static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque,
- const char *name,
- int *fileExists)
-{
- int isDir;
- QPAKinfo *info = ((QPAKinfo *) opaque);
- PHYSFS_sint64 retval = -1;
- QPAKentry *entry = qpak_find_entry(info, name, &isDir);
-
- *fileExists = ((isDir) || (entry != NULL));
- if (*fileExists) /* use time of QPAK itself in the physical filesystem. */
- retval = info->last_mod_time;
-
- return(retval);
-} /* QPAK_getLastModTime */
-
-
-static fvoid *QPAK_openRead(dvoid *opaque, const char *fnm, int *fileExists)
-{
- QPAKinfo *info = ((QPAKinfo *) opaque);
- QPAKfileinfo *finfo;
- QPAKentry *entry;
- int isDir;
-
- entry = qpak_find_entry(info, fnm, &isDir);
- *fileExists = ((entry != NULL) || (isDir));
- BAIL_IF_MACRO(isDir, ERR_NOT_A_FILE, NULL);
- BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL);
-
- finfo = (QPAKfileinfo *) allocator.Malloc(sizeof (QPAKfileinfo));
- BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
-
- finfo->handle = __PHYSFS_platformOpenRead(info->filename);
- if ( (finfo->handle == NULL) ||
- (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
- {
- allocator.Free(finfo);
- return(NULL);
- } /* if */
-
- finfo->curPos = 0;
- finfo->entry = entry;
- return(finfo);
-} /* QPAK_openRead */
-
-
-static fvoid *QPAK_openWrite(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* QPAK_openWrite */
-
-
-static fvoid *QPAK_openAppend(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
-} /* QPAK_openAppend */
-
-
-static int QPAK_remove(dvoid *opaque, const char *name)
-{
- BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
-} /* QPAK_remove */
-
-
-static int QPAK_mkdir(dvoid *opaque, const char *name)
-{