Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replaced zlib with a hacked up copy of miniz: http://code.google.com/…
  • Loading branch information
icculus committed Mar 10, 2012
1 parent c8fc8cf commit 700d94e
Show file tree
Hide file tree
Showing 27 changed files with 706 additions and 10,952 deletions.
38 changes: 0 additions & 38 deletions CMakeLists.txt
Expand Up @@ -90,21 +90,6 @@ ENDIF(MSVC)

# Basic chunks of source code ...

SET(ZLIB_SRCS
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
src/lzma/C/7zCrc.c
src/lzma/C/Archive/7z/7zBuffer.c
Expand Down Expand Up @@ -238,7 +223,6 @@ ENDIF(HAVE_ASSERT_H)
OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
IF(PHYSFS_ARCHIVE_ZIP)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
SET(PHYSFS_NEED_ZLIB TRUE)
ENDIF(PHYSFS_ARCHIVE_ZIP)

OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
Expand Down Expand Up @@ -279,27 +263,6 @@ IF(PHYSFS_ARCHIVE_ISO9660)
ENDIF(PHYSFS_ARCHIVE_ISO9660)


# See if some archiver required zlib, and see about using system version.

IF(PHYSFS_NEED_ZLIB)
FIND_PACKAGE(ZLIB)

IF(ZLIB_FOUND)
OPTION(PHYSFS_INTERNAL_ZLIB "Link own zlib instead of system library" FALSE)
ELSE(HAVE_SYSTEM_ZLIB)
SET(PHYSFS_INTERNAL_ZLIB TRUE)
ENDIF(ZLIB_FOUND)

IF(PHYSFS_INTERNAL_ZLIB)
INCLUDE_DIRECTORIES(./src/zlib123)
ADD_DEFINITIONS(-DZ_PREFIX=1)
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${ZLIB_SRCS})
ELSE(PHYSFS_INTERNAL_ZLIB)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${ZLIB_LIBRARY})
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF(PHYSFS_INTERNAL_ZLIB)
ENDIF(PHYSFS_NEED_ZLIB)

OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
IF(PHYSFS_BUILD_STATIC)
ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS})
Expand Down Expand Up @@ -602,7 +565,6 @@ MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL)
MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK)
MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB)
MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC)
MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED)
MESSAGE_BOOL_OPTION("Build Perl bindings" PHYSFS_BUILD_PERL)
Expand Down
4 changes: 0 additions & 4 deletions LICENSE.txt
Expand Up @@ -34,10 +34,6 @@ Versions of PhysicsFS prior to 0.1.9 are licensed under the GNU Lesser General
Optional pieces of PhysicsFS may fall under other licenses, please consult
your lawyer for legal advice, which this is not...

zlib: if you enable ZIP archive support, PhysicsFS uses zlib. Its license
requirements are identical to PhysicsFS.
Please see zlib123/README for details.

lzma: if you enable LZMA (7zip) support, PhysicsFS uses the lzma sdk.
It uses the LGPL license, with exceptions for closed-source programs.
Please see lzma/lzma.txt for details.
Expand Down
11 changes: 8 additions & 3 deletions src/archiver_zip.c
Expand Up @@ -12,11 +12,16 @@
#include <errno.h>
#include <time.h>

#include "zlib.h"

#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"

#define USE_MINIZ 1
#if USE_MINIZ
#include "physfs_miniz.h"
#else
#include <zlib.h>
#endif

/*
* A buffer of ZIP_READBUFSIZE is allocated for each compressed file opened,
* and is freed when you close the file; compressed data is read into
Expand Down Expand Up @@ -142,7 +147,7 @@ static const char *zlib_error_string(int rc)
{
case Z_OK: return NULL; /* not an error. */
case Z_STREAM_END: return NULL; /* not an error. */
case Z_ERRNO: return strerror(errno);
case Z_ERRNO: return ERR_IO_ERROR;
case Z_NEED_DICT: return ERR_NEED_DICT;
case Z_DATA_ERROR: return ERR_DATA_ERROR;
case Z_MEM_ERROR: return ERR_MEMORY_ERROR;
Expand Down
698 changes: 698 additions & 0 deletions src/physfs_miniz.h

Large diffs are not rendered by default.

125 changes: 0 additions & 125 deletions src/zlib123/README

This file was deleted.

149 changes: 0 additions & 149 deletions src/zlib123/adler32.c

This file was deleted.

0 comments on commit 700d94e

Please sign in to comment.