/example64
/examplesh
/libz.so*
+/libz-ng.so*
/minigzip
/minigzip64
/minigzipsh
/zlib.pc
+/zlib-ng.pc
/CVE-2003-0107
.DS_Store
zconf.h
zconf.h.cmakein
zconf.h.included
+zconf-ng.h
+zconf-ng.h.cmakein
ztest*
configure.log
else(ZLIB_COMPAT)
set (LIBNAME1 libz-ng)
set (LIBNAME2 zlib-ng)
- set (SUFFIX -ng)
+ set (SUFFIX "-ng")
endif (ZLIB_COMPAT)
option (WITH_GZFILEOP "Compile with support for gzFile related functions" OFF)
if(NOT MINGW AND NOT MSYS)
set(ZLIB_DLL_SRCS
- win32/zlib1.rc # If present will override custom build rule below.
+ win32/zlib${SUFFIX}1.rc # If present will override custom build rule below.
)
endif()
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h _zlib_h_contents)
-string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
- "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
-
+if (ZLIB_COMPAT)
+ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
+ "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
+else()
+ string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
+ "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
+endif()
if(MINGW OR MSYS)
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
-I ${CMAKE_CURRENT_SOURCE_DIR}
-I ${CMAKE_CURRENT_BINARY_DIR}
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
- -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
+ -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib${SUFFIX}1.rc)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW OR MSYS)
test: all
$(MAKE) -C test
-infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib.h zconf.h
+infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c
infcover$(EXE): infcover.o $(STATICLIB)
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-example.o: $(SRCDIR)/test/example.c $(SRCDIR)/zlib.h zconf.h
+example.o: $(SRCDIR)/test/example.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
-minigzip.o: $(SRCDIR)/test/minigzip.c $(SRCDIR)/zlib.h zconf.h
+minigzip.o: $(SRCDIR)/test/minigzip.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
-example64.o: $(SRCDIR)/test/example.c $(SRCDIR)/zlib.h zconf.h
+example64.o: $(SRCDIR)/test/example.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
-minigzip64.o: $(SRCDIR)/test/minigzip.c $(SRCDIR)/zlib.h zconf.h
+minigzip64.o: $(SRCDIR)/test/minigzip.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
-zlibrc.o: win32/zlib1.rc
- $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
+zlibrc.o: win32/zlib$(SUFFIX)1.rc
+ $(RC) $(RCFLAGS) -o $@ win32/zlib$(SUFFIX)1.rc
.SUFFIXES: .lo
# DO NOT DELETE THIS LINE -- make depend depends on it.
-adler32.o: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
+adler32.o: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
functable.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
-gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/gzguts.h
-compress.o example.o minigzip.o uncompr.o: $(SRCDIR)/zlib.h zconf.h
-crc32.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/crc32.h
-deflate.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-deflate_fast.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-deflate_medium.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-deflate_slow.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-infback.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h
-inffast.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/memcopy.h
-inflate.o: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h $(SRCDIR)/memcopy.h
-inftrees.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h
-trees.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/trees.h
-zutil.o: $(SRCDIR)/zutil.h $(SRCDIR)/gzguts.h $(SRCDIR)/zlib.h zconf.h
+gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/gzguts.h
+compress.o example.o minigzip.o uncompr.o: $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+crc32.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/crc32.h
+deflate.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+deflate_fast.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+deflate_medium.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+deflate_slow.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+infback.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h
+inffast.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/memcopy.h
+inflate.o: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h $(SRCDIR)/memcopy.h
+inftrees.o: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h
+trees.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/trees.h
+zutil.o: $(SRCDIR)/zutil.h $(SRCDIR)/gzguts.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
arch/aarch64/adler32_neon.o: $(SRCDIR)/arch/aarch64/adler32_neon.h
arch/aarch64/crc32_acle.o: zconf.h
-arch/aarch64/fill_window_arm.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/aarch64/insert_string_acle.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
+arch/aarch64/fill_window_arm.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/aarch64/insert_string_acle.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
arch/arm/adler32_neon.o: $(SRCDIR)/arch/arm/adler32_neon.h
arch/arm/crc32_acle.o: zconf.h
-arch/arm/fill_window_arm.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/arm/insert_string_acle.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/crc_folding.o: $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/crc_pclmulqdq.o: $(SRCDIR)/arch/x86/x86.h $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/deflate_quick.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/fill_window_sse.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
+arch/arm/fill_window_arm.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/arm/insert_string_acle.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/crc_folding.o: $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/crc_pclmulqdq.o: $(SRCDIR)/arch/x86/x86.h $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/deflate_quick.o: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/fill_window_sse.o: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
arch/x86/x86.o: $(SRCDIR)/arch/x86/x86.h
-adler32.lo: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
+adler32.lo: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
functable.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
-gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/gzguts.h
-compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)/zlib.h zconf.h
-crc32.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/crc32.h
-deflate.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-deflate_fast.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-deflate_medium.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-deflate_slow.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-infback.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h
-inffast.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/memcopy.h
-inflate.lo: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h $(SRCDIR)/memcopy.h
-inftrees.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/inftrees.h
-trees.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h $(SRCDIR)/trees.h
-zutil.lo: $(SRCDIR)/zutil.h $(SRCDIR)/gzguts.h $(SRCDIR)/zlib.h zconf.h
+gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/gzguts.h
+compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+crc32.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/crc32.h
+deflate.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+deflate_fast.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+deflate_medium.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+deflate_slow.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/match.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+infback.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h
+inffast.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/memcopy.h
+inflate.lo: $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/inffixed.h $(SRCDIR)/memcopy.h
+inftrees.lo: $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/inftrees.h
+trees.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h $(SRCDIR)/trees.h
+zutil.lo: $(SRCDIR)/zutil.h $(SRCDIR)/gzguts.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
arch/aarch64/adler32_neon.lo: $(SRCDIR)/arch/aarch64/adler32_neon.h
arch/aarch64/crc32_acle.lo: zconf.h
-arch/aarch64/fill_window_arm.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/aarch64/insert_string_acle.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
+arch/aarch64/fill_window_arm.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/aarch64/insert_string_acle.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
arch/arm/adler32_neon.lo: $(SRCDIR)/arch/arm/adler32_neon.h
arch/arm/crc32_acle.lo: zconf.h
-arch/arm/fill_window_arm.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/arm/insert_string_acle.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/crc_folding.lo: $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/crc_pclmulqdq.lo: $(SRCDIR)/arch/x86/x86.h $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/deflate_quick.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
-arch/x86/fill_window_sse.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib.h zconf.h
+arch/arm/fill_window_arm.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/arm/insert_string_acle.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/crc_folding.lo: $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/crc_pclmulqdq.lo: $(SRCDIR)/arch/x86/x86.h $(SRCDIR)/arch/x86/crc_folding.h $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/deflate_quick.lo: $(SRCDIR)/deflate.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+arch/x86/fill_window_sse.lo: $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/zutil.h $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
arch/x86/x86.lo: $(SRCDIR)/arch/x86/x86.h
CFLAGS=
SFLAGS=
INCLUDES=
+SUFFIX=
SRCDIR=.
SRCTOP=../..
# DO NOT DELETE THIS LINE -- make depend depends on it.
adler32_neon.o: $(SRCDIR)/adler32_neon.h
-crc32_acle.o: $(TOPDIR)/zconf.h
-fill_window_arm.o: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-insert_string_acle.o: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
+crc32_acle.o: $(TOPDIR)/zconf$(SUFFIX).h
+fill_window_arm.o: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+insert_string_acle.o: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
adler32_neon.lo: $(SRCDIR)/adler32_neon.h
-crc32_acle.lo: $(TOPDIR)/zconf.h
-fill_window_arm.lo: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-insert_string_acle.lo: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
+crc32_acle.lo: $(TOPDIR)/zconf$(SUFFIX).h
+fill_window_arm.lo: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+insert_string_acle.lo: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
#include "deflate_p.h"
#include "functable.h"
-extern ZLIB_INTERNAL int read_buf(z_stream *strm, unsigned char *buf, unsigned size);
+extern ZLIB_INTERNAL int read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
#if __ARM_NEON
#include <arm_neon.h>
CFLAGS=
SFLAGS=
INCLUDES=
+SUFFIX=
SRCDIR=.
SRCTOP=../..
# DO NOT DELETE THIS LINE -- make depend depends on it.
adler32_neon.o: $(SRCDIR)/adler32_neon.h
-crc32_acle.o: $(TOPDIR)/zconf.h
-fill_window_arm.o: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-insert_string_acle.o: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
+crc32_acle.o: $(TOPDIR)/zconf$(SUFFIX).h
+fill_window_arm.o: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+insert_string_acle.o: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
adler32_neon.lo: $(SRCDIR)/adler32_neon.h
-crc32_acle.lo: $(TOPDIR)/zconf.h
-fill_window_arm.lo: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-insert_string_acle.lo: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
+crc32_acle.lo: $(TOPDIR)/zconf$(SUFFIX).h
+fill_window_arm.lo: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+insert_string_acle.lo: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
#include "deflate_p.h"
#include "functable.h"
-extern ZLIB_INTERNAL int read_buf(z_stream *strm, unsigned char *buf, unsigned size);
+extern ZLIB_INTERNAL int read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
#if __ARM_NEON__
#include <arm_neon.h>
CFLAGS=
SFLAGS=
INCLUDES=
+SUFFIX=
SSE2FLAG=-msse2
SSE4FLAG=-msse4
# DO NOT DELETE THIS LINE -- make depend depends on it.
-crc_folding.o: $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-crc_pclmulqdq.o: $(SRCDIR)/x86.h $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-deflate_quick.o: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-fill_window_sse.o: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
+crc_folding.o: $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+crc_pclmulqdq.o: $(SRCDIR)/x86.h $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+deflate_quick.o: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+fill_window_sse.o: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
x86.o: $(SRCDIR)/x86.h
-crc_folding.lo: $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-crc_pclmulqdq.lo: $(SRCDIR)/x86.h $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-deflate_quick.lo: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
-fill_window_sse.lo: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib.h $(TOPDIR)/zconf.h
+crc_folding.lo: $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+crc_pclmulqdq.lo: $(SRCDIR)/x86.h $(SRCDIR)/crc_folding.h $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+deflate_quick.lo: $(SRCTOP)/deflate.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
+fill_window_sse.lo: $(SRCTOP)/deflate.h $(SRCTOP)/deflate_p.h $(SRCTOP)/functable.h $(SRCTOP)/zutil.h $(SRCTOP)/zlib$(SUFFIX).h $(TOPDIR)/zconf$(SUFFIX).h
x86.lo: $(SRCDIR)/x86.h
crc_fold_init(s);
return;
}
- s->strm->adler = crc32(0L, NULL, 0);
+ s->strm->adler = PREFIX(crc32)(0L, NULL, 0);
}
ZLIB_INTERNAL void crc_finalize(deflate_state *const s) {
s->strm->adler = crc_fold_512to32(s);
}
-ZLIB_INTERNAL void copy_with_crc(z_stream *strm, unsigned char *dst, unsigned long size) {
+ZLIB_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) {
if (x86_cpu_has_pclmulqdq) {
crc_fold_copy(strm->state, dst, strm->next_in, size);
return;
}
memcpy(dst, strm->next_in, size);
- strm->adler = crc32(strm->adler, dst, size);
+ strm->adler = PREFIX(crc32)(strm->adler, dst, size);
}
#endif
#endif
extern void fill_window_sse(deflate_state *s);
-extern void flush_pending(z_stream *strm);
+extern void flush_pending(PREFIX3(stream) *strm);
static inline long compare258(const unsigned char *const src0, const unsigned char *const src1) {
#ifdef _MSC_VER
#include "deflate_p.h"
#include "functable.h"
-extern int read_buf(z_stream *strm, unsigned char *buf, unsigned size);
+extern int read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
const __m128i xmm_wsize = _mm_set1_epi16(s->w_size);
*/
int ZEXPORT PREFIX(compress2)(unsigned char *dest, size_t *destLen, const unsigned char *source,
size_t sourceLen, int level) {
- z_stream stream;
+ PREFIX3(stream) stream;
int err;
const unsigned int max = (unsigned int)-1;
size_t left;
stream.zfree = NULL;
stream.opaque = NULL;
- err = deflateInit(&stream, level);
+ err = PREFIX(deflateInit)(&stream, level);
if (err != Z_OK)
return err;
stream.avail_in = sourceLen > (unsigned long)max ? max : (unsigned int)sourceLen;
sourceLen -= stream.avail_in;
}
- err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
+ err = PREFIX(deflate)(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);
*destLen = stream.total_out;
- deflateEnd(&stream);
+ PREFIX(deflateEnd)(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}
fi
STATICLIB=${LIBNAME}.a
-MAPNAME=$LIBNAME2.map
+MAPNAME=${LIBNAME2}.map
# extract zlib version numbers from zlib.h
if test $compat -eq 0; then
LDSHARED=${LDSHARED-"$cc"}
LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB},--version-script,${SRCDIR}/${MAPNAME}"
LDSHAREDLIBC=""
- DEFFILE='win32/zlib.def'
+ DEFFILE='win32/${LIBNAME2}.def'
RC="${CROSS_PREFIX}windres"
RCFLAGS='--define GCC_WINDRES'
RCOBJS='zlibrc.o'
LDSHARED=${LDSHARED-"$cc"}
LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB}"
LDSHAREDLIBC=""
- DEFFILE='win32/zlib.def'
+ DEFFILE='win32/${LIBNAME2}.def'
RC="${CROSS_PREFIX}windres"
RCFLAGS='--define GCC_WINDRES'
RCOBJS='zlibrc.o'
LDSHARED=${LDSHARED-"$cc"}
LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB} -Wl,--version-script=${SRCDIR}/${MAPNAME}"
LDSHAREDLIBC=""
- DEFFILE='win32/zlib.def'
+ DEFFILE='win32/${LIBNAME2}.def'
RC="${CROSS_PREFIX}windres"
RCFLAGS='--define GCC_WINDRES'
if [ "$CC" == "mingw32-gcc" ]; then
cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
-#include "zconf.h"
+#include "zconf${SUFFIX}.h"
int main() {
#ifdef STDC
return 0;
/^SFLAGS *=/s#=.*#=$SFLAGS#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
/^INCLUDES *=/s#=.*#=$ARCHINCLUDES#
+/^SUFFIX *=/s#=.*#=$SUFFIX#
/^SRCDIR *=/s#=.*#=$SRCDIR/$ARCHDIR#
/^SRCTOP *=/s#=.*#=$SRCDIR#
/^TOPDIR *=/s#=.*#=$BUILDDIR#
#ifndef X86_PCLMULQDQ_CRC
ZLIB_INTERNAL void crc_reset(deflate_state *const s) {
- s->strm->adler = crc32(0L, NULL, 0);
+ s->strm->adler = PREFIX(crc32)(0L, NULL, 0);
}
-ZLIB_INTERNAL void copy_with_crc(z_stream *strm, unsigned char *dst, unsigned long size) {
+ZLIB_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) {
memcpy(dst, strm->next_in, size);
- strm->adler = crc32(strm->adler, dst, size);
+ strm->adler = PREFIX(crc32)(strm->adler, dst, size);
}
#endif
typedef block_state (*compress_func) (deflate_state *s, int flush);
/* Compression function. Returns the block state after the call. */
-static int deflateStateCheck (z_stream *strm);
+static int deflateStateCheck (PREFIX3(stream) *strm);
static void slide_hash (deflate_state *s);
static block_state deflate_stored (deflate_state *s, int flush);
ZLIB_INTERNAL block_state deflate_fast (deflate_state *s, int flush);
static block_state deflate_huff (deflate_state *s, int flush);
static void lm_init (deflate_state *s);
static void putShortMSB (deflate_state *s, uint16_t b);
-ZLIB_INTERNAL void flush_pending (z_stream *strm);
-ZLIB_INTERNAL unsigned read_buf (z_stream *strm, unsigned char *buf, unsigned size);
+ZLIB_INTERNAL void flush_pending (PREFIX3(stream) *strm);
+ZLIB_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
extern void crc_reset(deflate_state *const s);
#ifdef X86_PCLMULQDQ_CRC
extern void crc_finalize(deflate_state *const s);
#endif
-extern void copy_with_crc(z_stream *strm, unsigned char *dst, unsigned long size);
+extern void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size);
/* ===========================================================================
* Local data
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateInit_)(z_stream *strm, int level, const char *version, int stream_size) {
+int ZEXPORT PREFIX(deflateInit_)(PREFIX3(stream) *strm, int level, const char *version, int stream_size) {
return PREFIX(deflateInit2_)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size);
/* Todo: ignore strm->next_in if we use it as window */
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateInit2_)(z_stream *strm, int level, int method, int windowBits,
+int ZEXPORT PREFIX(deflateInit2_)(PREFIX3(stream) *strm, int level, int method, int windowBits,
int memLevel, int strategy, const char *version, int stream_size) {
unsigned window_padding = 0;
deflate_state *s;
int wrap = 1;
- static const char my_version[] = ZLIB_VERSION;
+ static const char my_version[] = PREFIX2(VERSION);
uint16_t *overlay;
/* We overlay pending_buf and d_buf+l_buf. This works since the average
x86_check_features();
#endif
- if (version == NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) {
+ if (version == NULL || version[0] != my_version[0] || stream_size != sizeof(PREFIX3(stream))) {
return Z_VERSION_ERROR;
}
if (strm == NULL)
s->pending_buf == NULL) {
s->status = FINISH_STATE;
strm->msg = ERR_MSG(Z_MEM_ERROR);
- deflateEnd(strm);
+ PREFIX(deflateEnd)(strm);
return Z_MEM_ERROR;
}
s->d_buf = overlay + s->lit_bufsize/sizeof(uint16_t);
s->method = (unsigned char)method;
s->block_open = 0;
- return deflateReset(strm);
+ return PREFIX(deflateReset)(strm);
}
/* =========================================================================
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
*/
-static int deflateStateCheck (z_stream *strm) {
+static int deflateStateCheck (PREFIX3(stream) *strm) {
deflate_state *s;
if (strm == NULL ||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateSetDictionary)(z_stream *strm, const unsigned char *dictionary, unsigned int dictLength) {
+int ZEXPORT PREFIX(deflateSetDictionary)(PREFIX3(stream) *strm, const unsigned char *dictionary, unsigned int dictLength) {
deflate_state *s;
unsigned int str, n;
int wrap;
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateGetDictionary)(z_stream *strm, unsigned char *dictionary, unsigned int *dictLength) {
+int ZEXPORT PREFIX(deflateGetDictionary)(PREFIX3(stream) *strm, unsigned char *dictionary, unsigned int *dictLength) {
deflate_state *s;
unsigned int len;
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateResetKeep)(z_stream *strm) {
+int ZEXPORT PREFIX(deflateResetKeep)(PREFIX3(stream) *strm) {
deflate_state *s;
if (deflateStateCheck(strm)) {
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateReset)(z_stream *strm) {
+int ZEXPORT PREFIX(deflateReset)(PREFIX3(stream) *strm) {
int ret;
- ret = deflateResetKeep(strm);
+ ret = PREFIX(deflateResetKeep)(strm);
if (ret == Z_OK)
lm_init(strm->state);
return ret;
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateSetHeader)(z_stream *strm, gz_headerp head) {
+int ZEXPORT PREFIX(deflateSetHeader)(PREFIX3(stream) *strm, PREFIX(gz_headerp) head) {
if (deflateStateCheck(strm) || strm->state->wrap != 2)
return Z_STREAM_ERROR;
strm->state->gzhead = head;
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflatePending)(z_stream *strm, uint32_t *pending, int *bits) {
+int ZEXPORT PREFIX(deflatePending)(PREFIX3(stream) *strm, uint32_t *pending, int *bits) {
if (deflateStateCheck(strm))
return Z_STREAM_ERROR;
if (pending != NULL)
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflatePrime)(z_stream *strm, int bits, int value) {
+int ZEXPORT PREFIX(deflatePrime)(PREFIX3(stream) *strm, int bits, int value) {
deflate_state *s;
int put;
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateParams)(z_stream *strm, int level, int strategy) {
+int ZEXPORT PREFIX(deflateParams)(PREFIX3(stream) *strm, int level, int strategy) {
deflate_state *s;
compress_func func;
if ((strategy != s->strategy || func != configuration_table[level].func) && s->high_water) {
/* Flush the last buffer: */
- int err = deflate(strm, Z_BLOCK);
+ int err = PREFIX(deflate)(strm, Z_BLOCK);
if (err == Z_STREAM_ERROR)
return err;
if (strm->avail_out == 0)
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateTune)(z_stream *strm, int good_length, int max_lazy, int nice_length, int max_chain) {
+int ZEXPORT PREFIX(deflateTune)(PREFIX3(stream) *strm, int good_length, int max_lazy, int nice_length, int max_chain) {
deflate_state *s;
if (deflateStateCheck(strm))
* upper bound of about 14% expansion does not seem onerous for output buffer
* allocation.
*/
-unsigned long ZEXPORT PREFIX(deflateBound)(z_stream *strm, unsigned long sourceLen) {
+unsigned long ZEXPORT PREFIX(deflateBound)(PREFIX3(stream) *strm, unsigned long sourceLen) {
deflate_state *s;
unsigned long complen, wraplen;
* applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()).
*/
-ZLIB_INTERNAL void flush_pending(z_stream *strm) {
+ZLIB_INTERNAL void flush_pending(PREFIX3(stream) *strm) {
uint32_t len;
deflate_state *s = strm->state;
#define HCRC_UPDATE(beg) \
do { \
if (s->gzhead->hcrc && s->pending > (beg)) \
- strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
+ strm->adler = PREFIX(crc32)(strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
} while (0)
/* ========================================================================= */
-int ZEXPORT PREFIX(deflate)(z_stream *strm, int flush) {
+int ZEXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int flush) {
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
}
if (s->gzhead->hcrc)
- strm->adler = crc32(strm->adler, s->pending_buf, s->pending);
+ strm->adler = PREFIX(crc32)(strm->adler, s->pending_buf, s->pending);
s->gzindex = 0;
s->status = EXTRA_STATE;
}
}
/* ========================================================================= */
-int ZEXPORT PREFIX(deflateEnd)(z_stream *strm) {
+int ZEXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) {
int status;
if (deflateStateCheck(strm))
/* =========================================================================
* Copy the source state to the destination state.
*/
-int ZEXPORT PREFIX(deflateCopy)(z_stream *dest, z_stream *source) {
+int ZEXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *source) {
deflate_state *ds;
deflate_state *ss;
uint16_t *overlay;
ss = source->state;
- memcpy((void *)dest, (void *)source, sizeof(z_stream));
+ memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream)));
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
if (ds == NULL)
ds->pending_buf = (unsigned char *) overlay;
if (ds->window == NULL || ds->prev == NULL || ds->head == NULL || ds->pending_buf == NULL) {
- deflateEnd(dest);
+ PREFIX(deflateEnd)(dest);
return Z_MEM_ERROR;
}
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
-ZLIB_INTERNAL unsigned read_buf(z_stream *strm, unsigned char *buf, unsigned size) {
+ZLIB_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
uint32_t len = strm->avail_in;
if (len > size)
*/
typedef struct internal_state {
- z_stream *strm; /* pointer back to this zlib stream */
- int status; /* as the name implies */
- unsigned char *pending_buf; /* output still pending */
- unsigned long pending_buf_size; /* size of pending_buf */
- unsigned char *pending_out; /* next pending byte to output to the stream */
- uint32_t pending; /* nb of bytes in the pending buffer */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- gz_headerp gzhead; /* gzip header information to write */
- uint32_t gzindex; /* where in extra, name, or comment */
- unsigned char method; /* can only be DEFLATED */
- int last_flush; /* value of flush param for previous deflate call */
+ PREFIX3(stream) *strm; /* pointer back to this zlib stream */
+ int status; /* as the name implies */
+ unsigned char *pending_buf; /* output still pending */
+ unsigned long pending_buf_size; /* size of pending_buf */
+ unsigned char *pending_out; /* next pending byte to output to the stream */
+ uint32_t pending; /* nb of bytes in the pending buffer */
+ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
+ PREFIX(gz_headerp) gzhead; /* gzip header information to write */
+ uint32_t gzindex; /* where in extra, name, or comment */
+ unsigned char method; /* can only be DEFLATED */
+ int last_flush; /* value of flush param for previous deflate call */
#ifdef X86_PCLMULQDQ_CRC
unsigned ALIGNED_(16) crc0[4 * 5];
#else
#define check_match(s, start, match, length)
#endif
-void flush_pending(z_stream *strm);
+void flush_pending(PREFIX3(stream) *strm);
/* ===========================================================================
* Insert string str in the dictionary and set match_head to the previous head
return Z_STREAM_ERROR;
state = (gz_state *)file;
- return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
+ return state->mode == GZ_READ ? PREFIX(gzclose_r)(file) : PREFIX(gzclose_w)(file);
#else
- return gzclose_r(file);
+ return PREFIX(gzclose_r)(file);
#endif
}
offset += state->x.pos;
if (offset < 0) /* before start of file! */
return -1;
- if (gzrewind(file) == -1) /* rewind, then skip to offset */
+ if (PREFIX(gzrewind)(file) == -1) /* rewind, then skip to offset */
return -1;
}
z_off_t ZEXPORT PREFIX(gzseek)(gzFile file, z_off_t offset, int whence) {
z_off64_t ret;
- ret = gzseek64(file, (z_off64_t)offset, whence);
+ ret = PREFIX(gzseek64)(file, (z_off64_t)offset, whence);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
z_off_t ZEXPORT PREFIX(gztell)(gzFile file) {
z_off64_t ret;
- ret = gztell64(file);
+ ret = PREFIX(gztell64)(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
z_off_t ZEXPORT PREFIX(gzoffset)(gzFile file) {
z_off64_t ret;
- ret = gzoffset64(file);
+ ret = PREFIX(gzoffset64)(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
state->strm.opaque = NULL;
state->strm.avail_in = 0;
state->strm.next_in = NULL;
- if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
+ if (PREFIX(inflateInit2)(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
free(state->out);
free(state->in);
state->size = 0;
single byte is sufficient indication that it is not a gzip file) */
if (strm->avail_in > 1 &&
strm->next_in[0] == 31 && strm->next_in[1] == 139) {
- inflateReset(strm);
+ PREFIX(inflateReset)(strm);
state->how = GZIP;
state->direct = 0;
return 0;
}
/* decompress and handle errors */
- ret = inflate(strm, Z_NO_FLUSH);
+ ret = PREFIX(inflate)(strm, Z_NO_FLUSH);
if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
gz_error(state, Z_STREAM_ERROR, "internal error: inflate stream corrupt");
return -1;
}
int ZEXPORT PREFIX(gzgetc_)(gzFile file) {
- return gzgetc(file);
+ return PREFIX(gzgetc)(file);
}
/* -- see zlib.h -- */
/* free memory and close file */
if (state->size) {
- inflateEnd(&(state->strm));
+ PREFIX(inflateEnd)(&(state->strm));
free(state->out);
free(state->in);
}
strm->zalloc = NULL;
strm->zfree = NULL;
strm->opaque = NULL;
- ret = deflateInit2(strm, state->level, Z_DEFLATED, MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
+ ret = PREFIX(deflateInit2)(strm, state->level, Z_DEFLATED, MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
if (ret != Z_OK) {
free(state->out);
free(state->in);
/* compress */
have = strm->avail_out;
- ret = deflate(strm, flush);
+ ret = PREFIX(deflate)(strm, flush);
if (ret == Z_STREAM_ERROR) {
gz_error(state, Z_STREAM_ERROR, "internal error: deflate stream corrupt");
return -1;
/* if that completed a deflate stream, allow another to start */
if (flush == Z_FINISH)
- deflateReset(strm);
+ PREFIX(deflateReset)(strm);
/* all done, no errors */
return 0;
int ret;
va_start(va, format);
- ret = gzvprintf(file, format, va);
+ ret = PREFIX(gzvprintf)(file, format, va);
va_end(va);
return ret;
}
/* flush previous input with previous parameters before changing */
if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1)
return state->err;
- deflateParams(strm, level, strategy);
+ PREFIX(deflateParams)(strm, level, strategy);
}
state->level = level;
state->strategy = strategy;
ret = state->err;
if (state->size) {
if (!state->direct) {
- (void)deflateEnd(&(state->strm));
+ (void)PREFIX(deflateEnd)(&(state->strm));
free(state->out);
}
free(state->in);
windowBits is in the range 8..15, and window is a user-supplied
window and output buffer that is 2**windowBits bytes.
*/
-int ZEXPORT PREFIX(inflateBackInit_)(z_stream *strm, int windowBits, unsigned char *window,
+int ZEXPORT PREFIX(inflateBackInit_)(PREFIX3(stream) *strm, int windowBits, unsigned char *window,
const char *version, int stream_size) {
struct inflate_state *state;
- if (version == NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream)))
+ if (version == NULL || version[0] != PREFIX2(VERSION)[0] || stream_size != (int)(sizeof(PREFIX3(stream))))
return Z_VERSION_ERROR;
if (strm == NULL || window == NULL || windowBits < 8 || windowBits > 15)
return Z_STREAM_ERROR;
inflateBack() can also return Z_STREAM_ERROR if the input parameters
are not correct, i.e. strm is NULL or the state was not initialized.
*/
-int ZEXPORT PREFIX(inflateBack)(z_stream *strm, in_func in, void *in_desc, out_func out, void *out_desc) {
+int ZEXPORT PREFIX(inflateBack)(PREFIX3(stream) *strm, in_func in, void *in_desc, out_func out, void *out_desc) {
struct inflate_state *state;
const unsigned char *next; /* next input */
unsigned char *put; /* next output */
return ret;
}
-int ZEXPORT PREFIX(inflateBackEnd)(z_stream *strm) {
+int ZEXPORT PREFIX(inflateBackEnd)(PREFIX3(stream) *strm) {
if (strm == NULL || strm->state == NULL || strm->zfree == NULL)
return Z_STREAM_ERROR;
ZFREE(strm, strm->state);
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
-void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned long start) {
+void ZLIB_INTERNAL inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
/* start: inflate()'s starting value for strm->avail_out */
struct inflate_state *state;
const unsigned char *in; /* local strm->next_in */
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned long start);
+void ZLIB_INTERNAL inflate_fast(PREFIX3(stream) *strm, unsigned long start);
#if (defined(__GNUC__) || defined(__clang__)) && defined(__ARM_NEON__)
#endif
/* function prototypes */
-static int inflateStateCheck(z_stream *strm);
+static int inflateStateCheck(PREFIX3(stream) *strm);
static void fixedtables(struct inflate_state *state);
-static int updatewindow(z_stream *strm, const unsigned char *end, uint32_t copy);
+static int updatewindow(PREFIX3(stream) *strm, const unsigned char *end, uint32_t copy);
#ifdef BUILDFIXED
void makefixed(void);
#endif
static uint32_t syncsearch(uint32_t *have, const unsigned char *buf, uint32_t len);
-static int inflateStateCheck(z_stream *strm) {
+static int inflateStateCheck(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL)
return 1;
return 0;
}
-int ZEXPORT PREFIX(inflateResetKeep)(z_stream *strm) {
+int ZEXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (inflateStateCheck(strm))
return Z_OK;
}
-int ZEXPORT PREFIX(inflateReset)(z_stream *strm) {
+int ZEXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (inflateStateCheck(strm))
state->wsize = 0;
state->whave = 0;
state->wnext = 0;
- return inflateResetKeep(strm);
+ return PREFIX(inflateResetKeep)(strm);
}
-int ZEXPORT PREFIX(inflateReset2)(z_stream *strm, int windowBits) {
+int ZEXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int windowBits) {
int wrap;
struct inflate_state *state;
/* update state and reset the rest of it */
state->wrap = wrap;
state->wbits = (unsigned)windowBits;
- return inflateReset(strm);
+ return PREFIX(inflateReset)(strm);
}
-int ZEXPORT PREFIX(inflateInit2_)(z_stream *strm, int windowBits, const char *version, int stream_size) {
+int ZEXPORT PREFIX(inflateInit2_)(PREFIX3(stream) *strm, int windowBits, const char *version, int stream_size) {
int ret;
struct inflate_state *state;
- if (version == NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream)))
+ if (version == NULL || version[0] != PREFIX2(VERSION)[0] || stream_size != (int)(sizeof(PREFIX3(stream))))
return Z_VERSION_ERROR;
if (strm == NULL)
return Z_STREAM_ERROR;
state->strm = strm;
state->window = NULL;
state->mode = HEAD; /* to pass state test in inflateReset2() */
- ret = inflateReset2(strm, windowBits);
+ ret = PREFIX(inflateReset2)(strm, windowBits);
if (ret != Z_OK) {
ZFREE(strm, state);
strm->state = NULL;
return ret;
}
-int ZEXPORT PREFIX(inflateInit_)(z_stream *strm, const char *version, int stream_size) {
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
+int ZEXPORT PREFIX(inflateInit_)(PREFIX3(stream) *strm, const char *version, int stream_size) {
+ return PREFIX(inflateInit2_)(strm, DEF_WBITS, version, stream_size);
}
-int ZEXPORT PREFIX(inflatePrime)(z_stream *strm, int bits, int value) {
+int ZEXPORT PREFIX(inflatePrime)(PREFIX3(stream) *strm, int bits, int value) {
struct inflate_state *state;
if (inflateStateCheck(strm))
output will fall in the output data, making match copies simpler and faster.
The advantage may be dependent on the size of the processor's data caches.
*/
-static int updatewindow(z_stream *strm, const unsigned char *end, uint32_t copy) {
+static int updatewindow(PREFIX3(stream) *strm, const unsigned char *end, uint32_t copy) {
struct inflate_state *state;
uint32_t dist;
/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
# define UPDATE(check, buf, len) \
- (state->flags ? crc32(check, buf, len) : functable.adler32(check, buf, len))
+ (state->flags ? PREFIX(crc32)(check, buf, len) : functable.adler32(check, buf, len))
#else
# define UPDATE(check, buf, len) functable.adler32(check, buf, len)
#endif
do { \
hbuf[0] = (unsigned char)(word); \
hbuf[1] = (unsigned char)((word) >> 8); \
- check = crc32(check, hbuf, 2); \
+ check = PREFIX(crc32)(check, hbuf, 2); \
} while (0)
# define CRC4(check, word) \
hbuf[1] = (unsigned char)((word) >> 8); \
hbuf[2] = (unsigned char)((word) >> 16); \
hbuf[3] = (unsigned char)((word) >> 24); \
- check = crc32(check, hbuf, 4); \
+ check = PREFIX(crc32)(check, hbuf, 4); \
} while (0)
#endif
will return Z_BUF_ERROR if it has not reached the end of the stream.
*/
-int ZEXPORT PREFIX(inflate)(z_stream *strm, int flush) {
+int ZEXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int flush) {
struct inflate_state *state;
const unsigned char *next; /* next input */
unsigned char *put; /* next output */
if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
if (state->wbits == 0)
state->wbits = 15;
- state->check = crc32(0L, NULL, 0);
+ state->check = PREFIX(crc32)(0L, NULL, 0);
CRC2(state->check, hold);
INITBITS();
state->mode = FLAGS;
state->head->extra_max - len : copy);
}
if ((state->flags & 0x0200) && (state->wrap & 4))
- state->check = crc32(state->check, next, copy);
+ state->check = PREFIX(crc32)(state->check, next, copy);
have -= copy;
next += copy;
state->length -= copy;
state->head->name[state->length++] = (unsigned char)len;
} while (len && copy < have);
if ((state->flags & 0x0200) && (state->wrap & 4))
- state->check = crc32(state->check, next, copy);
+ state->check = PREFIX(crc32)(state->check, next, copy);
have -= copy;
next += copy;
if (len)
state->head->comment[state->length++] = (unsigned char)len;
} while (len && copy < have);
if ((state->flags & 0x0200) && (state->wrap & 4))
- state->check = crc32(state->check, next, copy);
+ state->check = PREFIX(crc32)(state->check, next, copy);
have -= copy;
next += copy;
if (len)
state->head->hcrc = (int)((state->flags >> 9) & 1);
state->head->done = 1;
}
- strm->adler = state->check = crc32(0L, NULL, 0);
+ strm->adler = state->check = PREFIX(crc32)(0L, NULL, 0);
state->mode = TYPE;
break;
#endif
return ret;
}
-int ZEXPORT PREFIX(inflateEnd)(z_stream *strm) {
+int ZEXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (inflateStateCheck(strm))
return Z_STREAM_ERROR;
return Z_OK;
}
-int ZEXPORT PREFIX(inflateGetDictionary)(z_stream *strm, unsigned char *dictionary, unsigned int *dictLength) {
+int ZEXPORT PREFIX(inflateGetDictionary)(PREFIX3(stream) *strm, unsigned char *dictionary, unsigned int *dictLength) {
struct inflate_state *state;
/* check state */
return Z_OK;
}
-int ZEXPORT PREFIX(inflateSetDictionary)(z_stream *strm, const unsigned char *dictionary, unsigned int dictLength) {
+int ZEXPORT PREFIX(inflateSetDictionary)(PREFIX3(stream) *strm, const unsigned char *dictionary, unsigned int dictLength) {
struct inflate_state *state;
unsigned long dictid;
int ret;
return Z_OK;
}
-int ZEXPORT PREFIX(inflateGetHeader)(z_stream *strm, gz_headerp head) {
+int ZEXPORT PREFIX(inflateGetHeader)(PREFIX3(stream) *strm, PREFIX(gz_headerp) head) {
struct inflate_state *state;
/* check state */
return next;
}
-int ZEXPORT PREFIX(inflateSync)(z_stream *strm) {
+int ZEXPORT PREFIX(inflateSync)(PREFIX3(stream) *strm) {
unsigned len; /* number of bytes to look at or looked at */
size_t in, out; /* temporary to save total_in and total_out */
unsigned char buf[4]; /* to restore bit buffer to byte string */
return Z_DATA_ERROR;
in = strm->total_in;
out = strm->total_out;
- inflateReset(strm);
+ PREFIX(inflateReset)(strm);
strm->total_in = in;
strm->total_out = out;
state->mode = TYPE;
block. When decompressing, PPP checks that at the end of input packet,
inflate is waiting for these length bytes.
*/
-int ZEXPORT PREFIX(inflateSyncPoint)(z_stream *strm) {
+int ZEXPORT PREFIX(inflateSyncPoint)(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (inflateStateCheck(strm))
return state->mode == STORED && state->bits == 0;
}
-int ZEXPORT PREFIX(inflateCopy)(z_stream *dest, z_stream *source) {
+int ZEXPORT PREFIX(inflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *source) {
struct inflate_state *state;
struct inflate_state *copy;
unsigned char *window;
}
/* copy state */
- memcpy((void *)dest, (void *)source, sizeof(z_stream));
+ memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream)));
memcpy((void *)copy, (void *)state, sizeof(struct inflate_state));
copy->strm = dest;
if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) {
return Z_OK;
}
-int ZEXPORT PREFIX(inflateUndermine)(z_stream *strm, int subvert) {
+int ZEXPORT PREFIX(inflateUndermine)(PREFIX3(stream) *strm, int subvert) {
struct inflate_state *state;
if (inflateStateCheck(strm))
#endif
}
-int ZEXPORT PREFIX(inflateValidate)(z_stream *strm, int check) {
+int ZEXPORT PREFIX(inflateValidate)(PREFIX3(stream) *strm, int check) {
struct inflate_state *state;
if (inflateStateCheck(strm))
return Z_OK;
}
-long ZEXPORT PREFIX(inflateMark)(z_stream *strm) {
+long ZEXPORT PREFIX(inflateMark)(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (inflateStateCheck(strm))
(state->mode == MATCH ? state->was - state->length : 0));
}
-unsigned long ZEXPORT PREFIX(inflateCodesUsed)(z_stream *strm) {
+unsigned long ZEXPORT PREFIX(inflateCodesUsed)(PREFIX3(stream) *strm) {
struct inflate_state *state;
if (strm == NULL || strm->state == NULL)
return (unsigned long)-1;
/* State maintained between inflate() calls -- approximately 7K bytes, not
including the allocated sliding window, which is up to 32K bytes. */
struct inflate_state {
- z_stream *strm; /* pointer back to this zlib stream */
+ PREFIX3(stream) *strm; /* pointer back to this zlib stream */
inflate_mode mode; /* current inflate mode */
int last; /* true if processing last block */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
unsigned long check; /* protected copy of check value */
unsigned long total; /* protected copy of output count */
- gz_headerp head; /* where to save gzip header information */
+ PREFIX(gz_headerp) head; /* where to save gzip header information */
/* sliding window */
unsigned wbits; /* log base 2 of requested window size */
uint32_t wsize; /* window size or zero if not using window */
/* @(#) $Id$ */
-#include "zlib.h"
+#ifdef ZLIB_COMPAT
+# include "zlib.h"
+#else
+# include "zlib-ng.h"
+#endif
+
#include <stdio.h>
#include <string.h>
int err;
size_t len = strlen(hello)+1;
- err = compress(compr, &comprLen, (const unsigned char*)hello, len);
+ err = PREFIX(compress)(compr, &comprLen, (const unsigned char*)hello, len);
CHECK_ERR(err, "compress");
strcpy((char*)uncompr, "garbage");
- err = uncompress(uncompr, &uncomprLen, compr, comprLen);
+ err = PREFIX(uncompress)(uncompr, &uncomprLen, compr, comprLen);
CHECK_ERR(err, "uncompress");
if (strcmp((char*)uncompr, hello)) {
gzFile file;
z_off_t pos;
- file = gzopen(fname, "wb");
+ file = PREFIX(gzopen)(fname, "wb");
if (file == NULL) {
fprintf(stderr, "gzopen error\n");
exit(1);
}
- gzputc(file, 'h');
- if (gzputs(file, "ello") != 4) {
- fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
+ PREFIX(gzputc)(file, 'h');
+ if (PREFIX(gzputs)(file, "ello") != 4) {
+ fprintf(stderr, "gzputs err: %s\n", PREFIX(gzerror)(file, &err));
exit(1);
}
- if (gzprintf(file, ", %s!", "hello") != 8) {
- fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
+ if (PREFIX(gzprintf)(file, ", %s!", "hello") != 8) {
+ fprintf(stderr, "gzprintf err: %s\n", PREFIX(gzerror)(file, &err));
exit(1);
}
- gzseek(file, 1L, SEEK_CUR); /* add one zero byte */
- gzclose(file);
+ PREFIX(gzseek)(file, 1L, SEEK_CUR); /* add one zero byte */
+ PREFIX(gzclose)(file);
- file = gzopen(fname, "rb");
+ file = PREFIX(gzopen)(fname, "rb");
if (file == NULL) {
fprintf(stderr, "gzopen error\n");
exit(1);
}
strcpy((char*)uncompr, "garbage");
- if (gzread(file, uncompr, (unsigned)uncomprLen) != len) {
- fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));
+ if (PREFIX(gzread)(file, uncompr, (unsigned)uncomprLen) != len) {
+ fprintf(stderr, "gzread err: %s\n", PREFIX(gzerror)(file, &err));
exit(1);
}
if (strcmp((char*)uncompr, hello)) {
printf("gzread(): %s\n", (char*)uncompr);
}
- pos = gzseek(file, -8L, SEEK_CUR);
- if (pos != 6 || gztell(file) != pos) {
+ pos = PREFIX(gzseek)(file, -8L, SEEK_CUR);
+ if (pos != 6 || PREFIX(gztell)(file) != pos) {
fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",
- (long)pos, (long)gztell(file));
+ (long)pos, (long)PREFIX(gztell)(file));
exit(1);
}
- if (gzgetc(file) != ' ') {
+ if (PREFIX(gzgetc)(file) != ' ') {
fprintf(stderr, "gzgetc error\n");
exit(1);
}
- if (gzungetc(' ', file) != ' ') {
+ if (PREFIX(gzungetc)(' ', file) != ' ') {
fprintf(stderr, "gzungetc error\n");
exit(1);
}
- gzgets(file, (char*)uncompr, (int)uncomprLen);
+ PREFIX(gzgets)(file, (char*)uncompr, (int)uncomprLen);
if (strlen((char*)uncompr) != 7) { /* " hello!" */
- fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
+ fprintf(stderr, "gzgets err after gzseek: %s\n", PREFIX(gzerror)(file, &err));
exit(1);
}
if (strcmp((char*)uncompr, hello + 6)) {
printf("gzgets() after gzseek: %s\n", (char*)uncompr);
}
- gzclose(file);
+ PREFIX(gzclose)(file);
#endif
}
*/
void test_deflate(unsigned char *compr, size_t comprLen)
{
- z_stream c_stream; /* compression stream */
+ PREFIX3(stream) c_stream; /* compression stream */
int err;
unsigned long len = (unsigned long)strlen(hello)+1;
c_stream.zfree = zfree;
c_stream.opaque = (void *)0;
- err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
+ err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION);
CHECK_ERR(err, "deflateInit");
c_stream.next_in = (const unsigned char *)hello;
while (c_stream.total_in != len && c_stream.total_out < comprLen) {
c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
- err = deflate(&c_stream, Z_NO_FLUSH);
+ err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
}
/* Finish the stream, still forcing small buffers: */
for (;;) {
c_stream.avail_out = 1;
- err = deflate(&c_stream, Z_FINISH);
+ err = PREFIX(deflate)(&c_stream, Z_FINISH);
if (err == Z_STREAM_END) break;
CHECK_ERR(err, "deflate");
}
- err = deflateEnd(&c_stream);
+ err = PREFIX(deflateEnd)(&c_stream);
CHECK_ERR(err, "deflateEnd");
}
void test_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen)
{
int err;
- z_stream d_stream; /* decompression stream */
+ PREFIX3(stream) d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.avail_in = 0;
d_stream.next_out = uncompr;
- err = inflateInit(&d_stream);
+ err = PREFIX(inflateInit)(&d_stream);
CHECK_ERR(err, "inflateInit");
while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
- err = inflate(&d_stream, Z_NO_FLUSH);
+ err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END) break;
CHECK_ERR(err, "inflate");
}
- err = inflateEnd(&d_stream);
+ err = PREFIX(inflateEnd)(&d_stream);
CHECK_ERR(err, "inflateEnd");
if (strcmp((char*)uncompr, hello)) {
*/
void test_large_deflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen)
{
- z_stream c_stream; /* compression stream */
+ PREFIX3(stream) c_stream; /* compression stream */
int err;
c_stream.zalloc = zalloc;
c_stream.zfree = zfree;
c_stream.opaque = (void *)0;
- err = deflateInit(&c_stream, Z_BEST_SPEED);
+ err = PREFIX(deflateInit)(&c_stream, Z_BEST_SPEED);
CHECK_ERR(err, "deflateInit");
c_stream.next_out = compr;
*/
c_stream.next_in = uncompr;
c_stream.avail_in = (unsigned int)uncomprLen;
- err = deflate(&c_stream, Z_NO_FLUSH);
+ err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
if (c_stream.avail_in != 0) {
fprintf(stderr, "deflate not greedy\n");
}
/* Feed in already compressed data and switch to no compression: */
- deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
+ PREFIX(deflateParams)(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
c_stream.next_in = compr;
c_stream.avail_in = (unsigned int)comprLen/2;
- err = deflate(&c_stream, Z_NO_FLUSH);
+ err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
/* Switch back to compressing mode: */
- deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
+ PREFIX(deflateParams)(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
c_stream.next_in = uncompr;
c_stream.avail_in = (unsigned int)uncomprLen;
- err = deflate(&c_stream, Z_NO_FLUSH);
+ err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
- err = deflate(&c_stream, Z_FINISH);
+ err = PREFIX(deflate)(&c_stream, Z_FINISH);
if (err != Z_STREAM_END) {
fprintf(stderr, "deflate should report Z_STREAM_END\n");
exit(1);
}
- err = deflateEnd(&c_stream);
+ err = PREFIX(deflateEnd)(&c_stream);
CHECK_ERR(err, "deflateEnd");
}
void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen)
{
int err;
- z_stream d_stream; /* decompression stream */
+ PREFIX3(stream) d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.next_in = compr;
d_stream.avail_in = (unsigned int)comprLen;
- err = inflateInit(&d_stream);
+ err = PREFIX(inflateInit)(&d_stream);
CHECK_ERR(err, "inflateInit");
for (;;) {
d_stream.next_out = uncompr; /* discard the output */
d_stream.avail_out = (unsigned int)uncomprLen;
- err = inflate(&d_stream, Z_NO_FLUSH);
+ err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END) break;
CHECK_ERR(err, "large inflate");
}
- err = inflateEnd(&d_stream);
+ err = PREFIX(inflateEnd)(&d_stream);
CHECK_ERR(err, "inflateEnd");
if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
*/
void test_flush(unsigned char *compr, size_t *comprLen)
{
- z_stream c_stream; /* compression stream */
+ PREFIX3(stream) c_stream; /* compression stream */
int err;
unsigned int len = (unsigned int)strlen(hello)+1;
c_stream.zfree = zfree;
c_stream.opaque = (void *)0;
- err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
+ err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION);
CHECK_ERR(err, "deflateInit");
c_stream.next_in = (const unsigned char *)hello;
c_stream.next_out = compr;
c_stream.avail_in = 3;
c_stream.avail_out = (unsigned int)*comprLen;
- err = deflate(&c_stream, Z_FULL_FLUSH);
+ err = PREFIX(deflate)(&c_stream, Z_FULL_FLUSH);
CHECK_ERR(err, "deflate");
compr[3]++; /* force an error in first compressed block */
c_stream.avail_in = len - 3;
- err = deflate(&c_stream, Z_FINISH);
+ err = PREFIX(deflate)(&c_stream, Z_FINISH);
if (err != Z_STREAM_END) {
CHECK_ERR(err, "deflate");
}
- err = deflateEnd(&c_stream);
+ err = PREFIX(deflateEnd)(&c_stream);
CHECK_ERR(err, "deflateEnd");
*comprLen = c_stream.total_out;
void test_sync(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen)
{
int err;
- z_stream d_stream; /* decompression stream */
+ PREFIX3(stream) d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.next_in = compr;
d_stream.avail_in = 2; /* just read the zlib header */
- err = inflateInit(&d_stream);
+ err = PREFIX(inflateInit)(&d_stream);
CHECK_ERR(err, "inflateInit");
d_stream.next_out = uncompr;
d_stream.avail_out = (unsigned int)uncomprLen;
- err = inflate(&d_stream, Z_NO_FLUSH);
+ err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
CHECK_ERR(err, "inflate");
d_stream.avail_in = (unsigned int)comprLen-2; /* read all compressed data */
- err = inflateSync(&d_stream); /* but skip the damaged part */
+ err = PREFIX(inflateSync)(&d_stream); /* but skip the damaged part */
CHECK_ERR(err, "inflateSync");
- err = inflate(&d_stream, Z_FINISH);
+ err = PREFIX(inflate)(&d_stream, Z_FINISH);
if (err != Z_DATA_ERROR) {
fprintf(stderr, "inflate should report DATA_ERROR\n");
/* Because of incorrect adler32 */
exit(1);
}
- err = inflateEnd(&d_stream);
+ err = PREFIX(inflateEnd)(&d_stream);
CHECK_ERR(err, "inflateEnd");
printf("after inflateSync(): hel%s\n", (char *)uncompr);
*/
void test_dict_deflate(unsigned char *compr, size_t comprLen)
{
- z_stream c_stream; /* compression stream */
+ PREFIX3(stream) c_stream; /* compression stream */
int err;
c_stream.zalloc = zalloc;
c_stream.zfree = zfree;
c_stream.opaque = (void *)0;
- err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
+ err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION);
CHECK_ERR(err, "deflateInit");
- err = deflateSetDictionary(&c_stream,
+ err = PREFIX(deflateSetDictionary)(&c_stream,
(const unsigned char*)dictionary, (int)sizeof(dictionary));
CHECK_ERR(err, "deflateSetDictionary");
c_stream.next_in = (const unsigned char *)hello;
c_stream.avail_in = (unsigned int)strlen(hello)+1;
- err = deflate(&c_stream, Z_FINISH);
+ err = PREFIX(deflate)(&c_stream, Z_FINISH);
if (err != Z_STREAM_END) {
fprintf(stderr, "deflate should report Z_STREAM_END\n");
exit(1);
}
- err = deflateEnd(&c_stream);
+ err = PREFIX(deflateEnd)(&c_stream);
CHECK_ERR(err, "deflateEnd");
}
void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen)
{
int err;
- z_stream d_stream; /* decompression stream */
+ PREFIX3(stream) d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.next_in = compr;
d_stream.avail_in = (unsigned int)comprLen;
- err = inflateInit(&d_stream);
+ err = PREFIX(inflateInit)(&d_stream);
CHECK_ERR(err, "inflateInit");
d_stream.next_out = uncompr;
d_stream.avail_out = (unsigned int)uncomprLen;
for (;;) {
- err = inflate(&d_stream, Z_NO_FLUSH);
+ err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END) break;
if (err == Z_NEED_DICT) {
if (d_stream.adler != dictId) {
fprintf(stderr, "unexpected dictionary");
exit(1);
}
- err = inflateSetDictionary(&d_stream, (const unsigned char*)dictionary,
+ err = PREFIX(inflateSetDictionary)(&d_stream, (const unsigned char*)dictionary,
(int)sizeof(dictionary));
}
CHECK_ERR(err, "inflate with dict");
}
- err = inflateEnd(&d_stream);
+ err = PREFIX(inflateEnd)(&d_stream);
CHECK_ERR(err, "inflateEnd");
if (strcmp((char*)uncompr, hello)) {
unsigned char *compr, *uncompr;
size_t comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
size_t uncomprLen = comprLen;
- static const char* myVersion = ZLIB_VERSION;
+ static const char* myVersion = PREFIX2(VERSION);
- if (zlibVersion()[0] != myVersion[0]) {
+ if (zVersion()[0] != myVersion[0]) {
fprintf(stderr, "incompatible zlib version\n");
exit(1);
- } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
+ } else if (strcmp(zVersion(), PREFIX2(VERSION)) != 0) {
fprintf(stderr, "warning: different zlib version\n");
}
printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
- ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());
+ PREFIX2(VERSION), PREFIX2(VERNUM), PREFIX(zlibCompileFlags)());
compr = (unsigned char*)calloc((unsigned int)comprLen, 1);
uncompr = (unsigned char*)calloc((unsigned int)uncomprLen, 1);
/* @(#) $Id$ */
-#include "zlib.h"
+#ifdef ZLIB_COMPAT
+# include "zlib.h"
+#else
+# include "zlib-ng.h"
+#endif
#include <stdio.h>
#include <string.h>
int write;
int err;
const char *msg;
- z_stream strm;
+ PREFIX3(stream) strm;
unsigned char *buf;
} *gzFile;
-gzFile gzopen (const char *, const char *);
-gzFile gzdopen (int, const char *);
+gzFile PREFIX(gzopen)(const char *, const char *);
+gzFile PREFIX(gzdopen)(int, const char *);
gzFile gz_open (const char *, int, const char *);
-gzFile gzopen(const char *path, const char *mode)
+gzFile PREFIX(gzopen)(const char *path, const char *mode)
{
return gz_open(path, -1, mode);
}
-gzFile gzdopen(int fd, const char *mode)
+gzFile PREFIX(gzdopen)(int fd, const char *mode)
{
return gz_open(NULL, fd, mode);
}
plevel++;
}
if (gz->write)
- ret = deflateInit2(&(gz->strm), level, 8, 15 + 16, 8, 0);
+ ret = PREFIX(deflateInit2)(&(gz->strm), level, 8, 15 + 16, 8, 0);
else {
gz->strm.next_in = NULL;
gz->strm.avail_in = 0;
- ret = inflateInit2(&(gz->strm), 15 + 16);
+ ret = PREFIX(inflateInit2)(&(gz->strm), 15 + 16);
}
if (ret != Z_OK) {
free(gz);
gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") :
fopen(path, gz->write ? "wb" : "rb");
if (gz->file == NULL) {
- gz->write ? deflateEnd(&(gz->strm)) : inflateEnd(&(gz->strm));
+ gz->write ? PREFIX(deflateEnd)(&(gz->strm)) : PREFIX(inflateEnd)(&(gz->strm));
free(gz);
return NULL;
}
return gz;
}
-int gzwrite (gzFile, const void *, unsigned);
+int PREFIX(gzwrite)(gzFile, const void *, unsigned);
-int gzwrite(gzFile gz, const void *buf, unsigned len)
+int PREFIX(gzwrite)(gzFile gz, const void *buf, unsigned len)
{
- z_stream *strm;
+ PREFIX3(stream) *strm;
if (gz == NULL || !gz->write)
return 0;
do {
strm->next_out = gz->buf;
strm->avail_out = BUFLENW;
- (void)deflate(strm, Z_NO_FLUSH);
+ (void)PREFIX(deflate)(strm, Z_NO_FLUSH);
fwrite(gz->buf, 1, BUFLENW - strm->avail_out, gz->file);
} while (strm->avail_out == 0);
return len;
}
-int gzread (gzFile, void *, unsigned);
+int PREFIX(gzread)(gzFile, void *, unsigned);
-int gzread(gzFile gz, void *buf, unsigned len)
+int PREFIX(gzread)(gzFile gz, void *buf, unsigned len)
{
- z_stream *strm;
+ PREFIX3(stream) *strm;
if (gz == NULL || gz->write || gz->err)
return 0;
}
if (strm->avail_in > 0)
{
- int ret = inflate(strm, Z_NO_FLUSH);
+ int ret = PREFIX(inflate)(strm, Z_NO_FLUSH);
if (ret == Z_DATA_ERROR) {
gz->err = ret;
gz->msg = strm->msg;
return 0;
}
else if (ret == Z_STREAM_END)
- inflateReset(strm);
+ PREFIX(inflateReset)(strm);
}
else
break;
return len - strm->avail_out;
}
-int gzclose (gzFile);
+int PREFIX(gzclose)(gzFile);
-int gzclose(gzFile gz)
+int PREFIX(gzclose)(gzFile gz)
{
- z_stream *strm;
+ PREFIX3(stream) *strm;
if (gz == NULL)
return Z_STREAM_ERROR;
do {
strm->next_out = gz->buf;
strm->avail_out = BUFLENW;
- (void)deflate(strm, Z_FINISH);
+ (void)PREFIX(deflate)(strm, Z_FINISH);
fwrite(gz->buf, 1, BUFLENW - strm->avail_out, gz->file);
} while (strm->avail_out == 0);
- deflateEnd(strm);
+ PREFIX(deflateEnd)(strm);
}
else
- inflateEnd(strm);
+ PREFIX(inflateEnd)(strm);
free(gz->buf);
fclose(gz->file);
free(gz);
return Z_OK;
}
-const char *gzerror (gzFile, int *);
+const char *PREFIX(gzerror)(gzFile, int *);
-const char *gzerror(gzFile gz, int *err)
+const char *PREFIX(gzerror)(gzFile gz, int *err)
{
*err = gz->err;
return gz->msg;
}
if (len == 0) break;
- if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
+ if (PREFIX(gzwrite)(out, buf, (unsigned)len) != len) error(PREFIX(gzerror)(out, &err));
}
fclose(in);
- if (gzclose(out) != Z_OK) error("failed gzclose");
+ if (PREFIX(gzclose)(out) != Z_OK) error("failed gzclose");
}
#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
if (buf == (caddr_t)(-1)) return Z_ERRNO;
/* Compress the whole file at once: */
- len = gzwrite(out, (char *)buf, (unsigned)buf_len);
+ len = PREFIX(gzwrite)(out, (char *)buf, (unsigned)buf_len);
- if (len != (int)buf_len) error(gzerror(out, &err));
+ if (len != (int)buf_len) error(PREFIX(gzerror)(out, &err));
munmap(buf, buf_len);
fclose(in);
- if (gzclose(out) != Z_OK) error("failed gzclose");
+ if (PREFIX(gzclose)(out) != Z_OK) error("failed gzclose");
return Z_OK;
}
#endif /* USE_MMAP */
int err;
for (;;) {
- len = gzread(in, buf, sizeof(buf));
- if (len < 0) error (gzerror(in, &err));
+ len = PREFIX(gzread)(in, buf, sizeof(buf));
+ if (len < 0) error (PREFIX(gzerror)(in, &err));
if (len == 0) break;
if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
}
if (fclose(out)) error("failed fclose");
- if (gzclose(in) != Z_OK) error("failed gzclose");
+ if (PREFIX(gzclose)(in) != Z_OK) error("failed gzclose");
}
perror(file);
exit(1);
}
- out = gzopen(outfile, mode);
+ out = PREFIX(gzopen)(outfile, mode);
if (out == NULL) {
fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
exit(1);
infile = buf;
snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX);
}
- in = gzopen(infile, "rb");
+ in = PREFIX(gzopen)(infile, "rb");
if (in == NULL) {
fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
exit(1);
SET_BINARY_MODE(stdin);
SET_BINARY_MODE(stdout);
if (uncompr) {
- file = gzdopen(fileno(stdin), "rb");
+ file = PREFIX(gzdopen)(fileno(stdin), "rb");
if (file == NULL) error("can't gzdopen stdin");
gz_uncompress(file, stdout);
} else {
- file = gzdopen(fileno(stdout), outmode);
+ file = PREFIX(gzdopen)(fileno(stdout), outmode);
if (file == NULL) error("can't gzdopen stdout");
gz_compress(stdin, file);
}
do {
if (uncompr) {
if (copyout) {
- file = gzopen(*argv, "rb");
+ file = PREFIX(gzopen)(*argv, "rb");
if (file == NULL)
fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv);
else
if (in == NULL) {
perror(*argv);
} else {
- file = gzdopen(fileno(stdout), outmode);
+ file = PREFIX(gzdopen)(fileno(stdout), outmode);
if (file == NULL) error("can't gzdopen stdout");
gz_compress(in, file);
/* @(#) $Id$ */
#define ZLIB_INTERNAL
-#include "zlib.h"
+#ifdef ZLIB_COMPAT
+# include "zlib.h"
+#else
+# include "zlib-ng.h"
+#endif
/* ===========================================================================
Decompresses the source buffer into the destination buffer. *sourceLen is
an incomplete zlib stream.
*/
int ZEXPORT PREFIX(uncompress2)(unsigned char *dest, size_t *destLen, const unsigned char *source, size_t *sourceLen) {
- z_stream stream;
+ PREFIX3(stream) stream;
int err;
const unsigned int max = (unsigned int)-1;
size_t len, left;
stream.zfree = NULL;
stream.opaque = NULL;
- err = inflateInit(&stream);
+ err = PREFIX(inflateInit)(&stream);
if (err != Z_OK) return err;
stream.next_out = dest;
stream.avail_in = len > (unsigned long)max ? max : (unsigned int)len;
len -= stream.avail_in;
}
- err = inflate(&stream, Z_NO_FLUSH);
+ err = PREFIX(inflate)(&stream, Z_NO_FLUSH);
} while (err == Z_OK);
*sourceLen -= len + stream.avail_in;
else if (stream.total_out && err == Z_BUF_ERROR)
left = 1;
- inflateEnd(&stream);
+ PREFIX(inflateEnd)(&stream);
return err == Z_STREAM_END ? Z_OK :
err == Z_NEED_DICT ? Z_DATA_ERROR :
err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
int ZEXPORT PREFIX(uncompress)(unsigned char *dest, size_t *destLen, const unsigned char *source, size_t sourceLen)
{
- return uncompress2(dest, destLen, source, &sourceLen);
+ return PREFIX(uncompress2)(dest, destLen, source, &sourceLen);
}
ARFLAGS = -nologo
RCFLAGS = /dARM /r
DEFFILE = zlib.def
+RCFILE = zlib1.rc
+RESFILE = zlib1.res
WITH_GZFILEOP =
WITH_ACLE =
WITH_NEON =
WITH_VFPV3 =
NEON_ARCH = /arch:VFPv4
+SUFFIX =
OBJS = adler32.obj compress.obj crc32.obj deflate.obj deflate_fast.obj deflate_slow.obj \
- infback.obj inflate.obj inftrees.obj inffast.obj match.obj trees.obj uncompr.obj zutil.obj fill_window_arm.obj
+ functable.obj infback.obj inflate.obj inftrees.obj inffast.obj match.obj trees.obj uncompr.obj zutil.obj fill_window_arm.obj
!if "$(WITH_GZFILEOP)" != ""
WFLAGS = $(WFLAGS) -DWITH_GZFILEOP
OBJS = $(OBJS) gzclose.obj gzlib.obj gzread.obj gzwrite.obj
DEFFILE = zlibcompat.def
+!else
+STATICLIB = zlib-ng.lib
+SHAREDLIB = zlib-ng1.dll
+IMPLIB = zngdll.lib
+DEFFILE = zlib-ng.def
+RCFILE = zlib-ng1.rc
+RESFILE = zlib-ng1.res
+SUFFIX = -ng
!endif
!if "$(WITH_ACLE)" != ""
WFLAGS = $(WFLAGS) -DARM_ACLE_CRC_HASH
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
example.exe minigzip.exe example_d.exe minigzip_d.exe
-zconf: $(TOP)/zconf.h.in
- $(CP) $(TOP)\zconf.h.in $(TOP)\zconf.h
+zconf: $(TOP)/zconf$(SUFFIX).h.in
+ $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
$(STATICLIB): zconf $(OBJS)
$(AR) $(ARFLAGS) -out:$@ $(OBJS)
$(IMPLIB): $(SHAREDLIB)
-$(SHAREDLIB): zconf $(TOP)/win32/zlib.def $(OBJS) zlib1.res
+$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE)
$(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \
- -out:$@ -base:0x5A4C0000 $(OBJS) zlib1.res
+ -out:$@ -base:0x5A4C0000 $(OBJS) $(RESFILE)
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;2
{$(TOP)/test}.c.obj:
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
-$(TOP)/zconf.h: zconf
+$(TOP)/zconf$(SUFFIX).h: zconf
-adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h
+adler32.obj: $(TOP)/adler32.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h
+compress.obj: $(TOP)/compress.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h
+crc32.obj: $(TOP)/crc32.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/crc32.h
-deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
+deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzread.obj: $(TOP)/gzread.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
+infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h $(TOP)/inffixed.h
-inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
+inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h
-inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
+inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h $(TOP)/inffixed.h
-inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h
+inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h
match.obj: $(TOP)/match.c $(TOP)/deflate.h
-trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h
+trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/deflate.h $(TOP)/trees.h
-uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h
+uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
+zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h
+example.obj: $(TOP)/test/example.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h
+minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-zlib1.res: $(TOP)/win32/zlib1.rc
- $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc
+$(RESFILE): $(TOP)/win32/$(RCFILE)
+ $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE)
# testing
test: example.exe minigzip.exe
-del *.exe
-del *.pdb
-del *.manifest
- -del foo.gz
distclean: clean
- -del zconf.h
+ -del zconf$(SUFFIX).h
ARFLAGS = -nologo
RCFLAGS = /dWIN32 /r
DEFFILE = zlib.def
+RCFILE = zlib1.rc
+RESFILE = zlib1.res
WITH_GZFILEOP =
+SUFFIX =
OBJS = adler32.obj compress.obj crc32.obj deflate.obj deflate_fast.obj deflate_quick.obj deflate_slow.obj \
functable.obj infback.obj inflate.obj inftrees.obj inffast.obj match.obj trees.obj uncompr.obj zutil.obj \
WFLAGS = $(WFLAGS) -DWITH_GZFILEOP
OBJS = $(OBJS) gzclose.obj gzlib.obj gzread.obj gzwrite.obj
DEFFILE = zlibcompat.def
+!else
+STATICLIB = zlib-ng.lib
+SHAREDLIB = zlib-ng1.dll
+IMPLIB = zngdll.lib
+DEFFILE = zlib-ng.def
+RCFILE = zlib-ng1.rc
+RESFILE = zlib-ng1.res
+SUFFIX = -ng
!endif
# targets
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
example.exe minigzip.exe example_d.exe minigzip_d.exe
-$(STATICLIB): $(OBJS)
+zconf: $(TOP)/zconf$(SUFFIX).h.in
+ $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+
+$(STATICLIB): zconf $(OBJS)
$(AR) $(ARFLAGS) -out:$@ $(OBJS)
$(IMPLIB): $(SHAREDLIB)
-$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) zlib1.res
+$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE)
$(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \
- -out:$@ -base:0x5A4C0000 $(OBJS) zlib1.res
+ -out:$@ -base:0x5A4C0000 $(OBJS) $(RESFILE)
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;2
{$(TOP)/test}.c.obj:
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
-$(TOP)/zconf.h: $(TOP)/zconf.h.in
- $(CP) $(TOP)\zconf.h.in $(TOP)\zconf.h
+$(TOP)/zconf$(SUFFIX).h: zconf
-adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h
+adler32.obj: $(TOP)/adler32.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h
+compress.obj: $(TOP)/compress.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h
+crc32.obj: $(TOP)/crc32.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/crc32.h
-deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
+deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzread.obj: $(TOP)/gzread.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
+gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/gzguts.h
-infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
+infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h $(TOP)/inffixed.h
-inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
+inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h
-inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
+inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h $(TOP)/inffixed.h
-inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h
+inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/inftrees.h
match.obj: $(TOP)/match.c $(TOP)/deflate.h
-trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h
+trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h $(TOP)/deflate.h $(TOP)/trees.h
-uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h
+uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
+zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h
+example.obj: $(TOP)/test/example.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h
+minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib$(SUFFIX).h $(TOP)/zconf$(SUFFIX).h
-zlib1.res: $(TOP)/win32/zlib1.rc
- $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc
+$(RESFILE): $(TOP)/win32/$(RCFILE)
+ $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE)
# testing
test: example.exe minigzip.exe
-del *.exe
-del *.pdb
-del *.manifest
- -del foo.gz
distclean: clean
- -del zconf.h
+ -del zconf$(SUFFIX).h
--- /dev/null
+; zlib-ng data compression library
+EXPORTS
+; basic functions
+ zlibng_version
+ zng_deflate
+ zng_deflateEnd
+ zng_inflate
+ zng_inflateEnd
+; advanced functions
+ zng_deflateSetDictionary
+ zng_deflateGetDictionary
+ zng_deflateCopy
+ zng_deflateReset
+ zng_deflateParams
+ zng_deflateTune
+ zng_deflateBound
+ zng_deflatePending
+ zng_deflatePrime
+ zng_deflateSetHeader
+ zng_inflateSetDictionary
+ zng_inflateGetDictionary
+ zng_inflateSync
+ zng_inflateCopy
+ zng_inflateReset
+ zng_inflateReset2
+ zng_inflatePrime
+ zng_inflateMark
+ zng_inflateGetHeader
+ zng_inflateBack
+ zng_inflateBackEnd
+ zng_zlibCompileFlags
+; utility functions
+ zng_compress
+ zng_compress2
+ zng_compressBound
+ zng_uncompress
+ zng_uncompress2
+; large file functions
+ zng_adler32_combine64
+ zng_crc32_combine64
+; checksum functions
+ zng_adler32
+ zng_adler32_z
+ zng_crc32
+ zng_crc32_z
+ zng_adler32_combine
+ zng_crc32_combine
+; various hacks, don't look :)
+ zng_deflateInit_
+ zng_deflateInit2_
+ zng_inflateInit_
+ zng_inflateInit2_
+ zng_inflateBackInit_
+ zng_zError
+ zng_inflateSyncPoint
+ zng_get_crc_table
+ zng_inflateUndermine
+ zng_inflateValidate
+ zng_inflateCodesUsed
+ zng_inflateResetKeep
+ zng_deflateResetKeep
--- /dev/null
+#include <winver.h>
+#include "../zlib-ng.h"
+
+#ifdef GCC_WINDRES
+VS_VERSION_INFO VERSIONINFO
+#else
+VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
+#endif
+ FILEVERSION ZLIBNG_VER_MAJOR,ZLIBNG_VER_MINOR,ZLIBNG_VER_REVISION,0
+ PRODUCTVERSION ZLIBNG_VER_MAJOR,ZLIBNG_VER_MINOR,ZLIBNG_VER_REVISION,0
+ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+ FILEFLAGS 1
+#else
+ FILEFLAGS 0
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE 0 // not used
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ //language ID = U.S. English, char set = Windows, Multilingual
+ BEGIN
+ VALUE "FileDescription", "zlib data compression library\0"
+ VALUE "FileVersion", ZLIBNG_VERSION "\0"
+ VALUE "InternalName", "zlib-ng1.dll\0"
+ VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0"
+ VALUE "OriginalFilename", "zlib-ng1.dll\0"
+ VALUE "ProductName", "zlib\0"
+ VALUE "ProductVersion", ZLIBNG_VERSION "\0"
+ VALUE "Comments", "For more information visit http://www.zlib.net/\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 1252
+ END
+END
-/* zconf.h -- configuration of the zlib compression library
+/* zconf-ng.h -- configuration of the zlib-ng compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
-#ifndef ZCONF_H
-#define ZCONF_H
+#ifndef ZCONFNG_H
+#define ZCONFNG_H
#define PREFIX(x) zng_ ## x
+#define PREFIX2(x) ZLIBNG_ ## x
+#define PREFIX3(x) zng_ ## x
+#define zVersion zlibng_version
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
# endif
#endif
-#endif /* ZCONF_H */
+#endif /* ZCONFNG_H */
#ifndef ZCONF_H
#define ZCONF_H
-#define PREFIX(x) zng_ ## x
+#define PREFIX(x) x
+#define PREFIX2(x) ZLIB_ ## x
+#define PREFIX3(x) z_ ## x
+#define zVersion zlibVersion
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#ifndef ZNGLIB_H_
#define ZNGLIB_H_
-/* zlib.h -- interface of the 'zlib-ng' compression library
+/* zlib-ng.h -- interface of the 'zlib-ng' compression library
Forked from and compatible with zlib 1.2.11
Copyright (C) 1995-2016 Jean-loup Gailly and Mark Adler
unsigned long reserved; /* reserved for future use */
} zng_stream;
-typedef zng_stream *zng_streamp; // Obsolete type, retained for compatability only
+typedef zng_stream *zng_streamp; /* Obsolete type, retained for compatibility only */
/*
gzip header information passed to and from zlib routines. See RFC 1952
/* basic functions */
-ZEXTERN const char * ZEXPORT zng_version(void);
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+ZEXTERN const char * ZEXPORT zlibng_version(void);
+/* The application can compare zlibng_version and ZLIBNG_VERSION for consistency.
If the first character differs, the library code actually used is not
- compatible with the zlib.h header file used by the application. This check
+ compatible with the zlib-ng.h header file used by the application. This check
is automatically made by deflateInit and inflateInit.
*/
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if level is not a valid compression level, or
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION). msg is set to null
+ Z_VERSION_ERROR if the zlib library version (zng_version) is incompatible
+ with the version assumed by the caller (ZLIBNG_VERSION). msg is set to null
if there is no error message. deflateInit does not perform any compression:
this will be done by deflate().
*/
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
- method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
- incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
+ method), or Z_VERSION_ERROR if the zlib library version (zng_version) is
+ incompatible with the version assumed by the caller (ZLIBNG_VERSION). msg is
set to null if there is no error message. deflateInit2 does not perform any
compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT zng_inflateInit2_(zng_stream *strm, int windowBits, const char *version, int stream_size);
ZEXTERN int ZEXPORT zng_inflateBackInit_(zng_stream *strm, int windowBits, unsigned char *window,
const char *version, int stream_size);
-#define zng_deflateInit(strm, level) zng_deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(zng_stream))
-#define zng_inflateInit(strm) zng_inflateInit_((strm), ZLIB_VERSION, (int)sizeof(zng_stream))
+#define zng_deflateInit(strm, level) zng_deflateInit_((strm), (level), ZLIBNG_VERSION, (int)sizeof(zng_stream))
+#define zng_inflateInit(strm) zng_inflateInit_((strm), ZLIBNG_VERSION, (int)sizeof(zng_stream))
#define zng_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
zng_deflateInit2_((strm), (level), (method), (windowBits), (memLevel), \
- (strategy), ZLIB_VERSION, (int)sizeof(zng_stream))
-#define zng_inflateInit2(strm, windowBits) inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(zng_stream))
+ (strategy), ZLIBNG_VERSION, (int)sizeof(zng_stream))
+#define zng_inflateInit2(strm, windowBits) zng_inflateInit2_((strm), (windowBits), ZLIBNG_VERSION, (int)sizeof(zng_stream))
#define zng_inflateBackInit(strm, windowBits, window) \
- zng_inflateBackInit_((strm), (windowBits), (window), ZLIB_VERSION, (int)sizeof(zng_stream))
+ zng_inflateBackInit_((strm), (windowBits), (window), ZLIBNG_VERSION, (int)sizeof(zng_stream))
#ifdef WITH_GZFILEOP
const char zlibng_string[] =
" zlib-ng 1.9.9 forked from zlib 1.2.11 ";
+#ifdef ZLIB_COMPAT
const char * ZEXPORT zlibVersion(void)
{
return ZLIB_VERSION;
}
+#endif
const char * ZEXPORT zlibng_version(void)
{
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
-#include "zlib.h"
+#ifdef ZLIB_COMPAT
+# include "zlib.h"
+#else
+# include "zlib-ng.h"
+#endif
typedef unsigned char uch; /* Included for compatibility with external code only */
typedef uint16_t ush; /* Included for compatibility with external code only */