From f22e3a9a0872f01adfcb8776304ad5da0798a005 Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Mon, 29 Dec 2003 03:40:40 +0000 Subject: [PATCH] fseeko api and fixes (.) --- ChangeLog | 7 + bins/Makefile.am | 11 +- bins/Makefile.in | 41 ++-- bins/unzzipcat.c | 6 +- bins/unzzipshow.c | 112 +++++++++ test/Makefile.in | 229 +++++++++++------ zzip/Makefile.am | 31 ++- zzip/Makefile.in | 60 +++-- zzip/fseeko.c | 573 +++++++++++++++++++++++++++++++++++++++++++ zzip/fseeko.h | 78 ++++++ zzip/mmapped.c | 17 +- zziplib.spec | 2 +- zzipwrap/Makefile.in | 227 +++++++++++------ 13 files changed, 1178 insertions(+), 216 deletions(-) create mode 100644 bins/unzzipshow.c create mode 100644 zzip/fseeko.c create mode 100644 zzip/fseeko.h diff --git a/ChangeLog b/ChangeLog index 4dfca24..23bd1a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-29 + * added libzzipfseeko.la with another simplified interface + * rename the other one to libzzipmmapped.la + * fix bugs for decompression on the latter as well + it seems the one has to use inflateInit2 (..., -MAX_WBITS) + * added bins/unzzipshow for an example binary + 2003-12-24 * added libzzipmmap.la with a simplified interface to zip archives * added bins unzzipdir and unzzipcat to show usage of libzzipmmap.la diff --git a/bins/Makefile.am b/bins/Makefile.am index 0d92b90..84059e9 100644 --- a/bins/Makefile.am +++ b/bins/Makefile.am @@ -4,7 +4,7 @@ DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 bin_PROGRAMS = zzcat zzdir zzxorcat zzxordir zzxorcopy \ - unzzip unzzipdir unzzipcat + unzzip unzzipdir unzzipcat unzzipshow noinst_PROGRAMS = zziptest zzobfuscated zzip aclocaldir = $(datadir)/aclocal aclocal_DATA = zziplib.m4 @@ -36,11 +36,14 @@ zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzobfuscated_LDFLAGS = @ZZIPLIB_LDFLAGS@ zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -# these use the simplified mmapped version +# these use the simplified mmapped disk version unzzipdir_LDFLAGS = @ZZIPLIB_LDFLAGS@ -unzzipdir_LDADD = ../zzip/libzzipmmap.la @RESOLVES@ -lz +unzzipdir_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz unzzipcat_LDFLAGS = @ZZIPLIB_LDFLAGS@ -unzzipcat_LDADD = ../zzip/libzzipmmap.la @RESOLVES@ -lz +unzzipcat_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz +# and this uses the simplified fseeko stdio version +unzzipshow_LDFLAGS = @ZZIPLIB_LDFLAGS@ +unzzipshow_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz ../zzip/libzzip.la : @top_srcdir@/zzip/*.c (cd ../zzip && $(MAKE) `basename $@`) diff --git a/bins/Makefile.in b/bins/Makefile.in index 1c83810..96ca0f3 100644 --- a/bins/Makefile.in +++ b/bins/Makefile.in @@ -155,7 +155,7 @@ AUTOTOOL_VERSION = autoconf-2.52 automake-1.5 libtool-1.4.2 DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) bin_PROGRAMS = zzcat zzdir zzxorcat zzxordir zzxorcopy \ - unzzip unzzipdir unzzipcat + unzzip unzzipdir unzzipcat unzzipshow noinst_PROGRAMS = zziptest zzobfuscated zzip aclocal_DATA = zziplib.m4 @@ -183,11 +183,14 @@ zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzobfuscated_LDFLAGS = @ZZIPLIB_LDFLAGS@ zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz -# these use the simplified mmapped version +# these use the simplified mmapped disk version unzzipdir_LDFLAGS = @ZZIPLIB_LDFLAGS@ -unzzipdir_LDADD = ../zzip/libzzipmmap.la @RESOLVES@ -lz +unzzipdir_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz unzzipcat_LDFLAGS = @ZZIPLIB_LDFLAGS@ -unzzipcat_LDADD = ../zzip/libzzipmmap.la @RESOLVES@ -lz +unzzipcat_LDADD = ../zzip/libzzipmmapped.la @RESOLVES@ -lz +# and this uses the simplified fseeko stdio version +unzzipshow_LDFLAGS = @ZZIPLIB_LDFLAGS@ +unzzipshow_LDADD = ../zzip/libzzipfseeko.la @RESOLVES@ -lz subdir = bins ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/uses/mkinstalldirs @@ -195,7 +198,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = bin_PROGRAMS = zzcat$(EXEEXT) zzdir$(EXEEXT) zzxorcat$(EXEEXT) \ zzxordir$(EXEEXT) zzxorcopy$(EXEEXT) unzzip$(EXEEXT) \ - unzzipdir$(EXEEXT) unzzipcat$(EXEEXT) + unzzipdir$(EXEEXT) unzzipcat$(EXEEXT) unzzipshow$(EXEEXT) noinst_PROGRAMS = zziptest$(EXEEXT) zzobfuscated$(EXEEXT) zzip$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) @@ -204,10 +207,13 @@ unzzip_OBJECTS = unzzip.$(OBJEXT) unzzip_DEPENDENCIES = ../zzip/libzzip.la unzzipcat_SOURCES = unzzipcat.c unzzipcat_OBJECTS = unzzipcat.$(OBJEXT) -unzzipcat_DEPENDENCIES = ../zzip/libzzipmmap.la +unzzipcat_DEPENDENCIES = ../zzip/libzzipmmapped.la unzzipdir_SOURCES = unzzipdir.c unzzipdir_OBJECTS = unzzipdir.$(OBJEXT) -unzzipdir_DEPENDENCIES = ../zzip/libzzipmmap.la +unzzipdir_DEPENDENCIES = ../zzip/libzzipmmapped.la +unzzipshow_SOURCES = unzzipshow.c +unzzipshow_OBJECTS = unzzipshow.$(OBJEXT) +unzzipshow_DEPENDENCIES = ../zzip/libzzipfseeko.la zzcat_SOURCES = zzcat.c zzcat_OBJECTS = zzcat.$(OBJEXT) zzcat_DEPENDENCIES = ../zzip/libzzip.la @@ -237,11 +243,11 @@ zzxordir_DEPENDENCIES = ../zzip/libzzip.la depcomp = $(SHELL) $(top_srcdir)/uses/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/unzzip.Po ./$(DEPDIR)/unzzipcat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/unzzipdir.Po ./$(DEPDIR)/zzcat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zzdir.Po ./$(DEPDIR)/zzip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zziptest.Po ./$(DEPDIR)/zzobfuscated.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zzxorcat.Po ./$(DEPDIR)/zzxorcopy.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/zzxordir.Po +@AMDEP_TRUE@ ./$(DEPDIR)/unzzipdir.Po ./$(DEPDIR)/unzzipshow.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/zzcat.Po ./$(DEPDIR)/zzdir.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/zzip.Po ./$(DEPDIR)/zziptest.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/zzobfuscated.Po ./$(DEPDIR)/zzxorcat.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/zzxorcopy.Po ./$(DEPDIR)/zzxordir.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ @@ -249,12 +255,13 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = unzzip.c unzzipcat.c unzzipdir.c zzcat.c zzdir.c zzip.c \ - zziptest.c zzobfuscated.c zzxorcat.c zzxorcopy.c zzxordir.c +DIST_SOURCES = unzzip.c unzzipcat.c unzzipdir.c unzzipshow.c zzcat.c \ + zzdir.c zzip.c zziptest.c zzobfuscated.c zzxorcat.c zzxorcopy.c \ + zzxordir.c DATA = $(aclocal_DATA) DIST_COMMON = Makefile.am Makefile.in -SOURCES = unzzip.c unzzipcat.c unzzipdir.c zzcat.c zzdir.c zzip.c zziptest.c zzobfuscated.c zzxorcat.c zzxorcopy.c zzxordir.c +SOURCES = unzzip.c unzzipcat.c unzzipdir.c unzzipshow.c zzcat.c zzdir.c zzip.c zziptest.c zzobfuscated.c zzxorcat.c zzxorcopy.c zzxordir.c all: all-am @@ -310,6 +317,9 @@ unzzipcat$(EXEEXT): $(unzzipcat_OBJECTS) $(unzzipcat_DEPENDENCIES) unzzipdir$(EXEEXT): $(unzzipdir_OBJECTS) $(unzzipdir_DEPENDENCIES) @rm -f unzzipdir$(EXEEXT) $(LINK) $(unzzipdir_LDFLAGS) $(unzzipdir_OBJECTS) $(unzzipdir_LDADD) $(LIBS) +unzzipshow$(EXEEXT): $(unzzipshow_OBJECTS) $(unzzipshow_DEPENDENCIES) + @rm -f unzzipshow$(EXEEXT) + $(LINK) $(unzzipshow_LDFLAGS) $(unzzipshow_OBJECTS) $(unzzipshow_LDADD) $(LIBS) zzcat$(EXEEXT): $(zzcat_OBJECTS) $(zzcat_DEPENDENCIES) @rm -f zzcat$(EXEEXT) $(LINK) $(zzcat_LDFLAGS) $(zzcat_OBJECTS) $(zzcat_LDADD) $(LIBS) @@ -344,6 +354,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unzzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unzzipcat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unzzipdir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unzzipshow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzcat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzip.Po@am__quote@ diff --git a/bins/unzzipcat.c b/bins/unzzipcat.c index 4c0bd48..71a6b51 100644 --- a/bins/unzzipcat.c +++ b/bins/unzzipcat.c @@ -52,8 +52,10 @@ static void zzip_disk_cat_file(ZZIP_DISK* disk, char* name, FILE* out) if (file) { char buffer[1024]; int len; - while ((len = zzip_disk_fread (buffer, 1024, 1, file))) - fwrite (buffer, len, 1, out); + while ((len = zzip_disk_fread (buffer, 1, 1024, file))) + { + fwrite (buffer, 1, len, out); + } zzip_disk_fclose (file); } diff --git a/bins/unzzipshow.c b/bins/unzzipshow.c new file mode 100644 index 0000000..a098fe5 --- /dev/null +++ b/bins/unzzipshow.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2003 Guido Draheim + * Use freely under the restrictions of the ZLIB license. + * + * This file is used as an example to clarify zzipfseeko api usage. + */ + +#include +#include + +#ifdef ZZIP_HAVE_FNMATCH_H +#include +#else +#define fnmatch(x,y,z) strcmp(x,y) +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +static const char usage[] = +{ + "unzzipshow [names].. \n" + " - unzzip data content of files contained in a zip archive.\n" +}; + +static void zzip_entry_fprint(ZZIP_ENTRY* entry, FILE* out) +{ + ZZIP_ENTRY_FILE* file = zzip_entry_fopen (entry, 0); + if (file) + { + char buffer[1024]; int len; + while ((len = zzip_entry_fread (buffer, 1024, 1, file))) + fwrite (buffer, len, 1, out); + + zzip_entry_fclose (file); + } +} + +static void zzip_cat_file(FILE* disk, char* name, FILE* out) +{ + ZZIP_ENTRY_FILE* file = zzip_entry_ffile (disk, name); + if (file) + { + char buffer[1024]; int len; + while ((len = zzip_entry_fread (buffer, 1024, 1, file))) + fwrite (buffer, len, 1, out); + + zzip_entry_fclose (file); + } +} + +int +main (int argc, char ** argv) +{ + int argn; + FILE* disk; + + if (argc <= 1) + { + printf (usage); + exit(0); + } + + disk = fopen (argv[1], "r"); + if (! disk) { + perror(argv[1]); + return -1; + } + + if (argc == 2) + { /* print directory list */ + ZZIP_ENTRY* entry = zzip_entry_findfirst(disk); + if (! entry) puts("no first entry!\n"); + for (; entry ; entry = zzip_entry_findnext(entry)) + { + char* name = zzip_entry_strdup_name (entry); + printf ("%s\n", name); + free (name); + } + return 0; + } + + if (argc == 3) + { /* list from one spec */ + ZZIP_ENTRY* entry = 0; + while ((entry = zzip_entry_findmatch(disk, argv[2], entry, 0, 0))) + zzip_entry_fprint (entry, stdout); + + return 0; + } + + for (argn=1; argn < argc; argn++) + { /* list only the matching entries - each in order of commandline */ + ZZIP_ENTRY* entry = zzip_entry_findfirst(disk); + for (; entry ; entry = zzip_entry_findnext(entry)) + { + char* name = zzip_entry_strdup_name (entry); + if (! fnmatch (argv[argn], name, + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + zzip_cat_file (disk, name, stdout); + free (name); + } + } + return 0; +} + +/* + * Local variables: + * c-file-style: "stroustrup" + * End: + */ diff --git a/test/Makefile.in b/test/Makefile.in index 42db955..567d9ec 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -13,111 +13,145 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ build_triplet = @build@ -host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ target_triplet = @target@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ CONFIG_FILES = @CONFIG_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LARGEFILE_CFLAGS = @LARGEFILE_CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ -LTREL = @LTREL@ -LTVER = @LTVER@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAJOR = @MAJOR@ -MICRO = @MICRO@ -MINOR = @MINOR@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ MKZIP = @MKZIP@ -OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ -PATCH = @PATCH@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ +RELEASE_INFO = @RELEASE_INFO@ RESOLVES = @RESOLVES@ SDL = @SDL@ -SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ THREAD_SAFE = @THREAD_SAFE@ VERSION = @VERSION@ +VERSION_INFO = @VERSION_INFO@ XMLTO = @XMLTO@ ZIPTESTS = @ZIPTESTS@ ZLIB_INCL = @ZLIB_INCL@ ZLIB_LDIR = @ZLIB_LDIR@ ZLIB_VERSION = @ZLIB_VERSION@ ZZIPLIB_LDFLAGS = @ZZIPLIB_LDFLAGS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +aclocaldir = @aclocaldir@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ +am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ install_sh = @install_sh@ -m4_if = @m4_if@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ pkgconfig_libdir = @pkgconfig_libdir@ pkgconfig_libfile = @pkgconfig_libfile@ +pkgconfigdir = @pkgconfigdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ AUTOMAKE_OPTIONS = 1.4 foreign AUTOTOOL_VERSION = autoconf-2.52 automake-1.5 libtool-1.4.2 DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) -DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 EXTRA_DIST = test.zip test1.zip DISTCLEANFILES = test*.dat test2.zip test3.zip @@ -150,6 +184,7 @@ noinst_PROGRAMS = zzipself zzipsetstub zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@ zzipself_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz subdir = test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/uses/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -164,9 +199,6 @@ zzipsetstub_OBJECTS = zzipsetstub.$(OBJEXT) zzipsetstub_LDADD = $(LDADD) zzipsetstub_DEPENDENCIES = zzipsetstub_LDFLAGS = -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/uses/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/zzipself.Po \ @@ -178,7 +210,6 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ DIST_SOURCES = zzipself.c zzipsetstub.c DIST_COMMON = README Makefile.am Makefile.in SOURCES = zzipself.c zzipsetstub.c @@ -219,23 +250,37 @@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` .c.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< -CCDEPMODE = @CCDEPMODE@ +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< mostlyclean-libtool: -rm -f *.lo @@ -250,6 +295,9 @@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -275,20 +323,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -314,7 +383,6 @@ check: check-am all-am: Makefile $(PROGRAMS) installdirs: - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -377,18 +445,27 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am -.PHONY: GTAGS all all-am check check-am check-local clean clean-generic \ - clean-libtool clean-noinstPROGRAMS distclean distclean-compile \ - distclean-depend distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - tags uninstall uninstall-am uninstall-info-am +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am $(zzcat) $(zzdir) $(zziptest) $(zzxorcat) $(zzxordir) $(xorcopy) : \ diff --git a/zzip/Makefile.am b/zzip/Makefile.am index ec8a96c..c10535f 100644 --- a/zzip/Makefile.am +++ b/zzip/Makefile.am @@ -3,9 +3,11 @@ AUTOTOOL_VERSION=autoconf-2.52 automake-1.5 libtool-1.4.2 DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 -lib_LTLIBRARIES = libzzip.la libzzipmmap.la +lib_LTLIBRARIES = libzzip.la libzzipmmapped.la libzzipfseeko.la zzipdir = ${includedir}/zzip -zzip_HEADERS = $(libzzip_la_headers) $(libzzipmmap_la_headers) +zzip_HEADERS = $(libzzip_la_headers) \ + $(libzzipmmapped_la_headers) \ + $(libzzipfseeko_la_headers) noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h # VERSION_INFO=@VERSION_INFO@ @@ -41,13 +43,17 @@ libzzip_la_LDFLAGS= @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ $(THREAD_SAFE) libzzip_la_LIBADD= -lz @RESOLVES@ -libzzipmmap_la_SOURCES = \ - mmapped.c -libzzipmmap_la_headers = \ - mmapped.h -libzzipmmap_la_LDFLAGS= @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ +libzzipmmapped_la_SOURCES = mmapped.c +libzzipmmapped_la_headers = mmapped.h +libzzipmmapped_la_LDFLAGS= @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ $(THREAD_SAFE) -libzzipmmap_la_LIBADD= -lz @RESOLVES@ +libzzipmmapped_la_LIBADD= -lz @RESOLVES@ + +libzzipfseeko_la_SOURCES = fseeko.c +libzzipfseeko_la_headers = fseeko.h +libzzipfseeko_la_LDFLAGS= @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ + $(THREAD_SAFE) +libzzipfseeko_la_LIBADD= -lz @RESOLVES@ WCC10_DIST = zziplib.wpj WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt @@ -92,7 +98,8 @@ uninstall-local : # ---------------------------------------------------------------------- pkgconfigdir=$(libdir)/pkgconfig -pkgconfig_HEADERS= zzip-zlib-config.pc zziplib.pc zzipmmap.pc +pkgconfig_HEADERS= zzip-zlib-config.pc zziplib.pc \ + zzipmmapped.pc zzipfseeko.pc zziplib.pc : Makefile (cd .. && sh config.status zzip/zziplib.pc) @@ -107,8 +114,10 @@ zzip-zlib-config.pc : Makefile echo 'Libs: $${zlib_libs}' >>$@ echo 'Cflags: $${zlib_cflags}' >>$@ -zzipmmap.pc : zziplib.pc - sed -e 's/-lzzip/-lzzipmem/' -e 's/zziplib/zzipmmap/' $< >$@ +zzipmmapped.pc : zziplib.pc + sed -e 's/-lzzip/-lzzipmmapped/' -e 's/zziplib/zzipmmapped/' $< >$@ +zzipfseeko.pc : zziplib.pc + sed -e 's/-lzzip/-lzzipfseeko/' -e 's/zziplib/zzipfseeko/' $< >$@ __zziplib.pc : Makefile @ echo "prefix=$(prefix)" >$@ diff --git a/zzip/Makefile.in b/zzip/Makefile.in index b50acad..e6dcbba 100644 --- a/zzip/Makefile.in +++ b/zzip/Makefile.in @@ -156,9 +156,12 @@ AUTOMAKE_OPTIONS = 1.4 foreign AUTOTOOL_VERSION = autoconf-2.52 automake-1.5 libtool-1.4.2 DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) -lib_LTLIBRARIES = libzzip.la libzzipmmap.la +lib_LTLIBRARIES = libzzip.la libzzipmmapped.la libzzipfseeko.la zzipdir = ${includedir}/zzip -zzip_HEADERS = $(libzzip_la_headers) $(libzzipmmap_la_headers) +zzip_HEADERS = $(libzzip_la_headers) \ + $(libzzipmmapped_la_headers) \ + $(libzzipfseeko_la_headers) + noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h # @@ -193,16 +196,19 @@ libzzip_la_LDFLAGS = @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ libzzip_la_LIBADD = -lz @RESOLVES@ -libzzipmmap_la_SOURCES = \ - mmapped.c +libzzipmmapped_la_SOURCES = mmapped.c +libzzipmmapped_la_headers = mmapped.h +libzzipmmapped_la_LDFLAGS = @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ + $(THREAD_SAFE) -libzzipmmap_la_headers = \ - mmapped.h +libzzipmmapped_la_LIBADD = -lz @RESOLVES@ -libzzipmmap_la_LDFLAGS = @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ +libzzipfseeko_la_SOURCES = fseeko.c +libzzipfseeko_la_headers = fseeko.h +libzzipfseeko_la_LDFLAGS = @ZZIPLIB_LDFLAGS@ $(RELEASE_INFO) $(VERSION_INFO) \ $(THREAD_SAFE) -libzzipmmap_la_LIBADD = -lz @RESOLVES@ +libzzipfseeko_la_LIBADD = -lz @RESOLVES@ WCC10_DIST = zziplib.wpj WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt @@ -211,7 +217,9 @@ EXTRA_DIST = $(WCC10_DIST) _msvc.sed CONFIG_CLEAN_FILES = _config.h MAINTAINERCLEANFILES = _msvc.h CLEANFILES = $(WCC10_CLEAN) *.pc *.omf -pkgconfig_HEADERS = zzip-zlib-config.pc zziplib.pc zzipmmap.pc +pkgconfig_HEADERS = zzip-zlib-config.pc zziplib.pc \ + zzipmmapped.pc zzipfseeko.pc + subdir = zzip ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/uses/mkinstalldirs @@ -222,16 +230,20 @@ libzzip_la_DEPENDENCIES = am_libzzip_la_OBJECTS = zip.lo file.lo dir.lo stat.lo info.lo err.lo \ plugin.lo write.lo fetch.lo libzzip_la_OBJECTS = $(am_libzzip_la_OBJECTS) -libzzipmmap_la_DEPENDENCIES = -am_libzzipmmap_la_OBJECTS = mmapped.lo -libzzipmmap_la_OBJECTS = $(am_libzzipmmap_la_OBJECTS) +libzzipfseeko_la_DEPENDENCIES = +am_libzzipfseeko_la_OBJECTS = fseeko.lo +libzzipfseeko_la_OBJECTS = $(am_libzzipfseeko_la_OBJECTS) +libzzipmmapped_la_DEPENDENCIES = +am_libzzipmmapped_la_OBJECTS = mmapped.lo +libzzipmmapped_la_OBJECTS = $(am_libzzipmmapped_la_OBJECTS) depcomp = $(SHELL) $(top_srcdir)/uses/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/err.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/fetch.Plo ./$(DEPDIR)/file.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/info.Plo ./$(DEPDIR)/mmapped.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/plugin.Plo ./$(DEPDIR)/stat.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/write.Plo ./$(DEPDIR)/zip.Plo +@AMDEP_TRUE@ ./$(DEPDIR)/fseeko.Plo ./$(DEPDIR)/info.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mmapped.Plo ./$(DEPDIR)/plugin.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/stat.Plo ./$(DEPDIR)/write.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/zip.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ @@ -239,12 +251,13 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libzzip_la_SOURCES) $(libzzipmmap_la_SOURCES) +DIST_SOURCES = $(libzzip_la_SOURCES) $(libzzipfseeko_la_SOURCES) \ + $(libzzipmmapped_la_SOURCES) HEADERS = $(noinst_HEADERS) $(pkgconfig_HEADERS) $(zzip_HEADERS) DIST_COMMON = $(noinst_HEADERS) $(pkgconfig_HEADERS) $(zzip_HEADERS) \ Makefile.am Makefile.in -SOURCES = $(libzzip_la_SOURCES) $(libzzipmmap_la_SOURCES) +SOURCES = $(libzzip_la_SOURCES) $(libzzipfseeko_la_SOURCES) $(libzzipmmapped_la_SOURCES) all: all-am @@ -285,8 +298,10 @@ clean-libLTLIBRARIES: done libzzip.la: $(libzzip_la_OBJECTS) $(libzzip_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libzzip_la_LDFLAGS) $(libzzip_la_OBJECTS) $(libzzip_la_LIBADD) $(LIBS) -libzzipmmap.la: $(libzzipmmap_la_OBJECTS) $(libzzipmmap_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libzzipmmap_la_LDFLAGS) $(libzzipmmap_la_OBJECTS) $(libzzipmmap_la_LIBADD) $(LIBS) +libzzipfseeko.la: $(libzzipfseeko_la_OBJECTS) $(libzzipfseeko_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libzzipfseeko_la_LDFLAGS) $(libzzipfseeko_la_OBJECTS) $(libzzipfseeko_la_LIBADD) $(LIBS) +libzzipmmapped.la: $(libzzipmmapped_la_OBJECTS) $(libzzipmmapped_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libzzipmmapped_la_LDFLAGS) $(libzzipmmapped_la_OBJECTS) $(libzzipmmapped_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core @@ -298,6 +313,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fetch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fseeko.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmapped.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@ @@ -615,8 +631,10 @@ zzip-zlib-config.pc : Makefile echo 'Libs: $${zlib_libs}' >>$@ echo 'Cflags: $${zlib_cflags}' >>$@ -zzipmmap.pc : zziplib.pc - sed -e 's/-lzzip/-lzzipmem/' -e 's/zziplib/zzipmmap/' $< >$@ +zzipmmapped.pc : zziplib.pc + sed -e 's/-lzzip/-lzzipmmapped/' -e 's/zziplib/zzipmmapped/' $< >$@ +zzipfseeko.pc : zziplib.pc + sed -e 's/-lzzip/-lzzipfseeko/' -e 's/zziplib/zzipfseeko/' $< >$@ __zziplib.pc : Makefile @ echo "prefix=$(prefix)" >$@ diff --git a/zzip/fseeko.c b/zzip/fseeko.c new file mode 100644 index 0000000..c370496 --- /dev/null +++ b/zzip/fseeko.c @@ -0,0 +1,573 @@ +/* + * These routines are fully independent from the traditional zzip + * implementation. They assume a readonly seekable stdio handle + * representing a complete zip file. The functions show how to + * parse the structure, find files and return a decoded bytestream. + * + * These routines are a bit simple and really here for documenting + * the way to access a zip file. The complexity of zip access comes + * from staggered reading of bytes and reposition of a filepointer in + * a big archive with lots of files and long compressed datastreams. + * Plus varaints of drop-in stdio replacements, obfuscation routines, + * auto fileextensions, drop-in dirent replacements, and so on... + * + * btw, we can _not_ use fgetpos/fsetpos since an fpos_t has no asserted + * relation to a linear seek value as specified in zip info headers. In + * general it is not a problem if your system has no fseeko/ftello pair + * since we can fallback to fseek/ftell which limits the zip disk size + * to 2MiBs but the zip-storable seek values are 32bit limited anyway. + * + * Author: + * Guido Draheim + * + * Copyright (c) 2003,2004 Guido Draheim + * All rights reserved, + * use under the restrictions of the + * Lesser GNU General Public License + * or alternatively the restrictions + * of the Mozilla Public License 1.1 + */ + +/* we want fseeko/ftello ... */ +#define _LARGEFILE_SOURCE + +#include +#include +#include +#include + +#ifdef ZZIP_HAVE_FNMATCH_H +#include +#endif + +#if defined ZZIP_HAVE_STRING_H +#include +#elif defined ZZIP_HAVE_STRINGS_H +#include +#endif + +#include +#include +#include +#include + +#if __STDC_VERSION__+0 > 199900L +#define ___ +#define ____ +#else +#define ___ { +#define ____ } +#endif + +#ifndef ZZIP_HAVE_FSEEKO +#define fseeko fseek +#define ftello ftello +#endif + +/* note that the struct zzip_entry inherits the zzip_disk_entry values + * and usually carries a copy of its values (in disk format!). To make the + * following code more readable, we use a shorthand notation for the + * upcast needed in C (not needed in C++) as "disk_(entry)". + */ +#ifdef __cplusplus +#define disk_(_entry_) _entry_ +#else +#define disk_(_entry_) (& (_entry_)->head) +#endif + +#ifdef __cplusplus +struct zzip_entry : public struct zzip_disk_entry +{ + char* _zzip_restrict tail; + zzip_off_t tailalloc; /* the allocated size of tail */ + FILE* diskfile; /* a file reference */ + zzip_off_t disksize; /* the size of the file */ + zzip_off_t headseek; /* the offset within the file */ +}; +#else +struct zzip_entry /* : struct zzip_disk_entry */ +{ + struct zzip_disk_entry head; + char* _zzip_restrict tail; + zzip_off_t tailalloc; /* the allocated size of tail */ + FILE* diskfile; /* a file reference */ + zzip_off_t disksize; /* the size of the file */ + zzip_off_t headseek; /* the offset within the file */ +}; +#endif + +/* we try to round all seeks to the pagesize - since we do not use + * the sys/mmap interface we have to guess a good value here: */ +#define PAGESIZE 8192 + +/* ====================================================================== */ +/* helper functions */ + +static zzip_off_t +zzip_entry_fread_file_header (ZZIP_ENTRY* entry, + struct zzip_file_header* file_header) +{ + zzip_off_t offset = zzip_disk_entry_fileoffset (disk_(entry)); + if (0 > offset || offset >= entry->disksize) return 0; + fseeko (entry->diskfile, offset, SEEK_SET); + return (fread (file_header, sizeof(*file_header), 1, entry->diskfile) + ? offset+sizeof(*file_header) : 0 ); +} + +/** helper functions for (fseeko) zip access api + * + * This functions returns the seekval offset of the data portion of the + * file referenced by the given zzip_entry. It requires an intermediate + * check of the file_header structure (i.e. it reads it from disk). After + * this call, the contained diskfile readposition is already set to the + * data_offset returned here. On error -1 is returned. + */ +zzip_off_t +zzip_entry_data_offset(ZZIP_ENTRY* entry) +{ + struct zzip_file_header file_header; + if (! entry) return -1; + ___ zzip_off_t offset = + zzip_entry_fread_file_header (entry, & file_header); + if (! offset) return -1; + offset += zzip_file_header_sizeof_tails (& file_header); + fseeko (entry->diskfile, offset, SEEK_SET); + return offset; ____; +} + +/** => zzip_entry_to_data + * This function is a big helper despite its little name: in a zip file the + * encoded filenames are usually NOT zero-terminated but for common usage + * with libc we need it that way. Secondly, the filename SHOULD be present + * in the zip central directory but if not then we fallback to the filename + * given in the file_header of each compressed data portion. + */ +char* _zzip_restrict +zzip_entry_strdup_name(ZZIP_ENTRY* entry) +{ + if (! entry) return 0; + + ___ zzip_size_t len; + if ((len = zzip_disk_entry_namlen (disk_(entry)))) + { + char* name = malloc (len+1); + if (! name) return 0; + memcpy (name, entry->tail, len); + name[len] = '\0'; + return name; + } + ___ auto struct zzip_file_header header; + if (zzip_entry_fread_file_header (entry, &header) && + (( len = zzip_file_header_namlen(&header) ))) + { + char* name = malloc (len+1); + if (! name) return 0; + fread (name, 1, len, entry->diskfile); + name[len] = '\0'; + return name; + } + return 0; + ____;____; +} + +/* ====================================================================== */ + +/** => zzip_entry_findfile + * + * This function is the first call of all the zip access functions here. + * It contains the code to find the first entry of the zip central directory. + * Here we require the stdio handle to represent a real zip file where the + * disk_trailer is _last_ in the file area, so that its position would be at + * a fixed offset from the end of the file area if not for the comment field + * allowed to be of variable length (which needs us to do a little search + * for the disk_tailer). However, in this simple implementation we disregard + * any disk_trailer info telling about multidisk archives, so we just return + * a pointer to the first entry in the zip central directory of that file. + * + * For an actual means, we are going to search backwards from the end + * of the mmaped block looking for the PK-magic signature of a + * disk_trailer. If we see one then we check the rootseek value to + * find the first disk_entry of the root central directory. If we find + * the correct PK-magic signature of a disk_entry over there then we + * assume we are done and we are going to return a pointer to that label. + * + * The return value is a pointer to the first zzip_disk_entry being checked + * to be within the bounds of the file area specified by the arguments. If + * no disk_trailer was found then null is returned, and likewise we only + * accept a disk_trailer with a seekvalue that points to a disk_entry and + * both parts have valid PK-magic parts. Beyond some sanity check we try to + * catch a common brokeness with zip archives that still allows us to find + * the start of the zip central directory. + */ +ZZIP_ENTRY* _zzip_restrict +zzip_entry_findfirst(FILE* disk) +{ + if (! disk) return 0; + fseeko (disk, 0, SEEK_END); + ___ zzip_off_t disksize = ftello (disk); + if (disksize < (zzip_off_t) sizeof(struct zzip_disk_trailer)) return 0; + /* we read out chunks of 8 KiB in the hope to match disk granularity */ + ___ zzip_off_t pagesize = PAGESIZE; /* getpagesize() */ + ___ ZZIP_ENTRY* entry = malloc (sizeof(*entry)); if (! entry) return 0; + ___ char* buffer = malloc (pagesize); if (! buffer) goto nomem; + + assert (pagesize/2 > (zzip_off_t) sizeof (struct zzip_disk_trailer)); + /* at each step, we will fread a pagesize block which overlaps with the + * previous read by means of pagesize/2 step at the end of the while(1) */ + ___ zzip_off_t mapoffs = disksize &~ (pagesize-1); + ___ zzip_off_t mapsize = disksize - mapoffs; + if (mapoffs && mapsize < pagesize/2) { + mapoffs -= pagesize/2; mapsize += pagesize/2; } + while(1) + { + fseeko (disk, mapoffs, SEEK_SET); + fread (buffer, 1, mapsize, disk); + char* p = buffer + mapsize - sizeof(struct zzip_disk_trailer); + for (; p >= buffer ; p--) + { + if (! zzip_disk_trailer_check_magic(p)) continue; + ___ zzip_off_t root = + zzip_disk_trailer_rootseek ((struct zzip_disk_trailer*)p); + if ((char*) root > p) + { /* the first disk_entry is after the disk_trailer? can't be! */ + zzip_off_t rootsize = + zzip_disk_trailer_rootsize ((struct zzip_disk_trailer*)p); + if (rootsize > mapoffs) continue; + /* a common brokeness that can be fixed: we just assume that + * the central directory was written directly before : */ + root = mapoffs - rootsize; + } + assert (0 <= root && root < mapsize); + fseeko (disk, root, SEEK_SET); + fread (disk_(entry), 1, sizeof(*disk_(entry)), disk); + if (zzip_disk_entry_check_magic(entry)) + { + free (buffer); + entry->headseek = root; + entry->diskfile = disk; + entry->disksize = disksize; + ___ zzip_size_t tailsize = + zzip_disk_entry_sizeof_tails (disk_(entry)); + if (!( entry->tail = malloc (tailsize+1) )) goto nomem; + fread (entry->tail, 1, tailsize, disk); + entry->tailalloc = tailsize+1; + return entry; ____; + } + ____; + } + if (! mapoffs) break; assert (mapsize >= pagesize/2); + mapoffs -= pagesize/2; /* mapsize += pagesize/2; */ + mapsize = pagesize; /* if (mapsize > pagesize) ... */ + if (disksize - mapoffs > 64*1024) break; + } + free (buffer); + nomem: + free (entry); ____;____;____;____;____;____; + return 0; +} + +/** => zzip_entry_findfile + * + * This function takes an existing "entry" in the central root directory + * (e.g. from zzip_entry_findfirst) and moves it to point to the next entry. + * On error it returns 0, otherwise the old entry. If no further match is + * found then null is returned and the entry already free()d. + */ +ZZIP_ENTRY* _zzip_restrict +zzip_entry_findnext(ZZIP_ENTRY* _zzip_restrict entry) +{ + if (! entry) return entry; + ___ zzip_off_t seek = + entry->headseek + zzip_disk_entry_sizeto_end (disk_(entry)); + if (seek + (zzip_off_t) sizeof(*disk_(entry)) > entry->disksize) goto err; + fseeko (entry->diskfile, seek, SEEK_SET); + fread (disk_(entry), 1, sizeof(*disk_(entry)), entry->diskfile); + entry->headseek = seek; + ___ zzip_off_t tailsize = zzip_disk_entry_sizeof_tails (disk_(entry)); + if (tailsize+1 > entry->tailalloc) + { + char* newtail = realloc (entry->tail, tailsize+1); + if (! newtail) goto err; + entry->tail = newtail; + entry->tailalloc = tailsize+1; + } + fread (entry->tail, 1, tailsize, entry->diskfile); + return entry; ____; + err: + zzip_entry_free (entry); + return 0; ____; +} + +/** => zzip_entry_findfile + * this function releases the malloc()ed areas needed for zzip_entry, the + * pointer is invalid afterwards. This function has #define synonyms of + * zzip_entry_findlast(), zzip_entry_findlastfile(), zzip_entry_findlastmatch() + */ +int +zzip_entry_free(ZZIP_ENTRY* entry) +{ + if (! entry) return 0; + free (entry->tail); + free (entry); + return 1; +} + +/** search for files in the (fseeko) zip central directory + * + * This function is given a filename as an additional argument, to find the + * disk_entry matching a given filename. The compare-function is usually + * strcmp or strcasecmp or perhaps strcoll, if null then strcmp is used. + * - use null as argument for "old"-entry when searching the first + * matching entry, otherwise the last returned value if you look for other + * entries with a special "compare" function (if null then a doubled search + * is rather useless with this variant of _findfile). If no further entry is + * found then null is returned and any "old"-entry gets already free()d. + */ +ZZIP_ENTRY* _zzip_restrict +zzip_entry_findfile(FILE* disk, char* filename, + ZZIP_ENTRY* _zzip_restrict entry, + zzip_strcmp_fn_t compare) +{ + if (! filename || ! disk) return 0; + entry = ! entry ? zzip_entry_findfirst (disk) + : zzip_entry_findnext (entry); + + if (! compare) compare = (zzip_strcmp_fn_t)(strcmp); + for (; entry ; entry = zzip_entry_findnext (entry)) + { + /* filenames within zip files are often not null-terminated! */ + char* realname = zzip_entry_strdup_name (entry); + if (realname && ! compare(filename, realname)) + { + free (realname); + return entry; + } + free (realname); + } + return 0; +} + +#ifdef ZZIP_HAVE_FNMATCH_H +#define _zzip_fnmatch fnmatch +# ifdef FNM_CASEFOLD +# define _zzip_fnmatch_CASEFOLD FNM_CASEFOLD +# else +# define _zzip_fnmatch_CASEFOLD 0 +# endif +#else +# define _zzip_fnmatch_CASEFOLD 0 +/* if your system does not have fnmatch, we fall back to strcmp: */ +static int _zzip_fnmatch(char* pattern, char* string, int flags) +{ + puts (""); + return strcmp (pattern, string); +} +#endif + +/** => zzip_entry_findfile + * + * This function uses a compare-function with an additional argument + * and it is called just like fnmatch(3) from POSIX.2 AD:1993), i.e. + * the argument filespec first and the ziplocal filename second with + * the integer-flags put in as third to the indirect call. If the + * platform has fnmatch available then null-compare will use that one + * and otherwise we fall back to mere strcmp, so if you need fnmatch + * searching then please provide an implementation somewhere else. + * - use null as argument for "after"-entry when searching the first + * matching entry, or the last disk_entry return-value to find the + * next entry matching the given filespec. If no further entry is + * found then null is returned and any "old"-entry gets already free()d. + */ +ZZIP_ENTRY* _zzip_restrict +zzip_entry_findmatch(FILE* disk, char* filespec, + ZZIP_ENTRY* _zzip_restrict entry, + zzip_fnmatch_fn_t compare, int flags) +{ + if (! filespec || ! disk) return 0; + entry = ! entry ? zzip_entry_findfirst (disk) + : zzip_entry_findnext (entry); + + if (! compare) compare = (zzip_fnmatch_fn_t) _zzip_fnmatch; + for (; entry ; entry = zzip_entry_findnext (entry)) + { + /* filenames within zip files are often not null-terminated! */ + char* realname = zzip_entry_strdup_name(entry); + if (realname && ! compare(filespec, realname, flags)) + { + free (realname); + return entry; + } + free (realname); + } + return 0; +} + +/* ====================================================================== */ + +/** + * typedef struct zzip_disk_file ZZIP_ENTRY_FILE; + */ +struct zzip_entry_file /* : zzip_file_header */ +{ + struct zzip_file_header header; /* fopen detected header */ + ZZIP_ENTRY* entry; /* fopen entry */ + zzip_off_t data; /* for stored blocks */ + zzip_size_t avail; /* memorized for checks on EOF */ + zzip_size_t compressed; /* compressed flag and datasize */ + zzip_size_t dataoff; /* offset from data start */ + z_stream zlib; /* for inflated blocks */ + char buffer[PAGESIZE]; /* work buffer for inflate algorithm */ +}; + +/** => zzip_disk_fopen + * + * the ZZIP_DISK_FILE* is rather simple in just encapsulating the + * arguments given to this function plus a zlib deflate buffer. + * Note that the ZZIP_DISK pointer does already contain the full + * mmapped file area of a zip disk, so open()ing a file part within + * that area happens to be a lookup of its bounds and encoding. That + * information is memorized on the ZZIP_DISK_FILE so that subsequent + * _read() operations will be able to get the next data portion or + * return an eof condition for that file part wrapped in the zip archive. + */ +ZZIP_ENTRY_FILE* _zzip_restrict +zzip_entry_fopen (ZZIP_ENTRY* entry, int takeover) +{ + if (! entry) return 0; + if (! takeover) + { + ZZIP_ENTRY* found = malloc (sizeof(*entry)); + if (! found) return 0; + memcpy (found, entry, sizeof(*entry)); + found->tail = malloc (found->tailalloc); + if (! found->tail) { free (found); return 0; } + memcpy (found->tail, entry->tail, entry->tailalloc); + entry = found; + } + ZZIP_ENTRY_FILE* file = malloc(sizeof(*file)); + if (! file) goto fail1; + file->entry = entry; + if (! zzip_entry_fread_file_header (entry, &file->header)) + goto fail2; + file->avail = zzip_file_header_usize (&file->header); + file->data = zzip_entry_data_offset (entry); + file->dataoff = 0; + + if (! file->avail || zzip_file_header_data_stored (&file->header)) + { file->compressed = 0; return file; } + + file->compressed = zzip_file_header_csize (&file->header); + file->zlib.opaque = 0; + file->zlib.zalloc = Z_NULL; + file->zlib.zfree = Z_NULL; + + ___ zzip_off_t seek = file->data; + seek += sizeof(file->buffer); seek -= seek & (sizeof(file->buffer)-1); + assert (file->data < seek); /* pre-read to next PAGESIZE boundary... */ + fseeko (file->entry->diskfile, file->data + file->dataoff, SEEK_SET); + file->zlib.next_in = file->buffer; + file->zlib.avail_in = fread (file->buffer, 1, seek - file->data, + file->entry->diskfile); + file->dataoff += file->zlib.avail_in; ____; + + if (! zzip_file_header_data_deflated (&file->header) || + inflateInit2 (& file->zlib, -MAX_WBITS) != Z_OK) goto fail2; + + return file; + fail2: + free (file); + fail1: + zzip_entry_free (entry); + return 0; +} + +/** openening a file part wrapped within a (mmapped) zip archive + * + * This function opens a file found by name, so it does a search into + * the zip central directory with => zzip_disk_findfile and whatever + * is found first is given to => zzip_disk_entry_fopen + */ +ZZIP_ENTRY_FILE* _zzip_restrict +zzip_entry_ffile (FILE* disk, char* filename) +{ + ZZIP_ENTRY* entry = zzip_entry_findfile (disk, filename, 0, 0); + if (! entry) return 0; else return zzip_entry_fopen (entry, 1); +} + + +/** => zzip_disk_fopen + * + * This function reads more bytes into the output buffer specified as + * arguments. The return value is null on eof or error, the stdio-like + * interface can not distinguish between these so you need to check + * with => zzip_disk_feof for the difference. + */ +zzip_size_t +zzip_entry_fread (void* ptr, zzip_size_t sized, zzip_size_t nmemb, + ZZIP_ENTRY_FILE* file) +{ + zzip_size_t size = sized*nmemb; + if (! file->compressed) + { + if (size > file->avail) size = file->avail; + fread (ptr, 1, size, file->entry->diskfile); + file->dataoff += size; + file->avail -= size; + return size; + } + + file->zlib.avail_out = size; + file->zlib.next_out = ptr; + ___ zzip_size_t total_old = file->zlib.total_out; + while (1) + { + if (! file->zlib.avail_in) + { + size = file->compressed - file->dataoff; + if (size > sizeof(file->buffer)) size = sizeof(file->buffer); + /* fseek (file->data + file->dataoff, file->entry->diskfile); */ + file->zlib.avail_in = fread (file->buffer, 1, size, + file->entry->diskfile); + file->zlib.next_in = file->buffer; + file->dataoff += file->zlib.avail_in; + } + if (! file->zlib.avail_in) return 0; + + ___ int err = inflate (& file->zlib, Z_NO_FLUSH); + if (err == Z_STREAM_END) + file->avail = 0; + else if (err == Z_OK) + file->avail -= file->zlib.total_out - total_old; + else + return 0; + ____; + if (file->zlib.avail_out && ! file->zlib.avail_in) continue; + return file->zlib.total_out - total_old; + }____; +} + +/** => zzip_entry_fopen + * This function releases any zlib decoder info needed for decompression + * and dumps the ZZIP_ENTRY_FILE* then. + */ +int +zzip_entry_fclose (ZZIP_ENTRY_FILE* file) +{ + if (file->compressed) + inflateEnd (& file->zlib); + zzip_entry_free (file->entry); + free (file); + return 0; +} + +/** => zzip_entry_fopen + * + * This function allows to distinguish an error from an eof condition. + * Actually, if we found an error but we did already reach eof then we + * just keep on saying that it was an eof, so the app can just continue. + */ +int +zzip_entry_feof (ZZIP_ENTRY_FILE* file) +{ + return ! file || ! file->avail; +} diff --git a/zzip/fseeko.h b/zzip/fseeko.h new file mode 100644 index 0000000..0a6f58e --- /dev/null +++ b/zzip/fseeko.h @@ -0,0 +1,78 @@ +#ifndef _ZZIP_FSEEKO_H_ +#define _ZZIP_FSEEKO_H_ +/* + * simplified zip disk access using fseeko on a stdio FILE handle + * + * Author: + * Guido Draheim + * + * Copyright (c) 2003,2004 Guido Draheim + * All rights reserved, + * use under the restrictions of the + * Lesser GNU General Public License + * or alternatively the restrictions + * of the Mozilla Public License 1.1 + */ + + +#include +#include + +typedef struct zzip_entry ZZIP_ENTRY; +typedef struct zzip_entry_file ZZIP_ENTRY_FILE; + +typedef int (*zzip_strcmp_fn_t)(char*, char*); +typedef int (*zzip_fnmatch_fn_t)(char*, char*, int); + +#define zzip_entry_extern extern + +zzip_off_t +zzip_entry_data_offset(ZZIP_ENTRY* entry); + +char* _zzip_restrict +zzip_entry_strdup_name(ZZIP_ENTRY* entry); + + +zzip_entry_extern ZZIP_ENTRY* _zzip_restrict +zzip_entry_findfirst(FILE* file); + +zzip_entry_extern ZZIP_ENTRY* _zzip_restrict +zzip_entry_findnext(ZZIP_ENTRY* _zzip_restrict entry); + +#define zzip_entry_findlast zzip_entry_free +#define zzip_entry_findlastfile zzip_entry_free +#define zzip_entry_findlastmatch zzip_entry_free + +zzip_entry_extern int +zzip_entry_free(ZZIP_ENTRY* entry); + +char* _zzip_restrict +zzip_entry_strdup_name(ZZIP_ENTRY* entry); +char* +zzip_entry_to_data(ZZIP_ENTRY* entry); + +zzip_entry_extern ZZIP_ENTRY* _zzip_restrict +zzip_entry_findfile(FILE* disk, char* filename, + ZZIP_ENTRY* _zzip_restrict old, + zzip_strcmp_fn_t compare); +zzip_entry_extern ZZIP_ENTRY* _zzip_restrict +zzip_entry_findmatch(FILE* disk, char* filespec, + ZZIP_ENTRY* _zzip_restrict old, + zzip_fnmatch_fn_t compare, int flags); + +zzip_entry_extern ZZIP_ENTRY_FILE* _zzip_restrict +zzip_entry_fopen (ZZIP_ENTRY* entry, int takeover); + +zzip_entry_extern ZZIP_ENTRY_FILE* _zzip_restrict +zzip_entry_ffile (FILE* disk, char* filename); + +zzip_entry_extern _zzip_size_t +zzip_entry_fread (void* ptr, _zzip_size_t size, _zzip_size_t nmemb, + ZZIP_ENTRY_FILE* file); +zzip_entry_extern int +zzip_entry_fclose (ZZIP_ENTRY_FILE* file); +int +zzip_entry_feof (ZZIP_ENTRY_FILE* file); + +#endif + diff --git a/zzip/mmapped.c b/zzip/mmapped.c index 335024d..6a7f4f1 100644 --- a/zzip/mmapped.c +++ b/zzip/mmapped.c @@ -173,13 +173,11 @@ zzip_disk_close(ZZIP_DISK* disk) static char* _zzip_restrict _zzip_strndup(char* p, int maxlen) { if (! p) return 0; - ___ int l = strlen (p); - if (l > maxlen) l = maxlen; - ___ char* r = malloc (l+1); + ___ char* r = malloc (maxlen+1); if (! r) return r; - memcpy (r, p, l); - r[l] = '\0'; - return r; ____;____; + strncpy (r, p, maxlen); + r[maxlen] = '\0'; + return r; ____; } #endif @@ -384,7 +382,7 @@ zzip_disk_findfile(ZZIP_DISK* disk, char* filename, /* if your system does not have fnmatch, we fall back to strcmp: */ static int _zzip_fnmatch(char* pattern, char* string, int flags) { - puts (""); + puts (""); return strcmp (pattern, string); } #endif @@ -467,6 +465,7 @@ zzip_disk_entry_fopen (ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry) if (! file->avail || zzip_file_header_data_stored (file->header)) { file->stored = zzip_file_header_to_data (file->header); return file; } + file->stored = 0; file->zlib.opaque = 0; file->zlib.zalloc = Z_NULL; file->zlib.zfree = Z_NULL; @@ -474,7 +473,7 @@ zzip_disk_entry_fopen (ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry) file->zlib.next_in = zzip_file_header_to_data (file->header); if (! zzip_file_header_data_deflated (file->header) || - inflateInit (& file->zlib) != Z_OK) + inflateInit2 (& file->zlib, -MAX_WBITS) != Z_OK) { free (file); return 0; } return file; @@ -505,7 +504,7 @@ zzip_size_t zzip_disk_fread (void* ptr, zzip_size_t sized, zzip_size_t nmemb, ZZIP_DISK_FILE* file) { - zzip_size_t size = sized*nmemb; + zzip_size_t size = sized*nmemb; if (size > file->avail) size = file->avail; if (file->stored) { diff --git a/zziplib.spec b/zziplib.spec index 59524b0..63e3ef5 100644 --- a/zziplib.spec +++ b/zziplib.spec @@ -1,7 +1,7 @@ %define lib lib010 Summary: ZZipLib - libZ-based ZIP-access Library Name: zziplib -Version: 0.13.30 +Version: 0.13.31 Release: 1mdk Serial: 1 Copyright: LGPL diff --git a/zzipwrap/Makefile.in b/zzipwrap/Makefile.in index e051e45..70c23f2 100644 --- a/zzipwrap/Makefile.in +++ b/zzipwrap/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -13,119 +13,153 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ build_triplet = @build@ -host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ target_triplet = @target@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ CONFIG_FILES = @CONFIG_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LARGEFILE_CFLAGS = @LARGEFILE_CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ -LTREL = @LTREL@ -LTVER = @LTVER@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAJOR = @MAJOR@ -MICRO = @MICRO@ -MINOR = @MINOR@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ MKZIP = @MKZIP@ -OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ -PATCH = @PATCH@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ +RELEASE_INFO = @RELEASE_INFO@ RESOLVES = @RESOLVES@ SDL = @SDL@ -SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ THREAD_SAFE = @THREAD_SAFE@ VERSION = @VERSION@ +# +VERSION_INFO = @VERSION_INFO@ XMLTO = @XMLTO@ ZIPTESTS = @ZIPTESTS@ ZLIB_INCL = @ZLIB_INCL@ ZLIB_LDIR = @ZLIB_LDIR@ ZLIB_VERSION = @ZLIB_VERSION@ ZZIPLIB_LDFLAGS = @ZZIPLIB_LDFLAGS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +aclocaldir = @aclocaldir@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ +am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ install_sh = @install_sh@ -m4_if = @m4_if@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ pkgconfig_libdir = @pkgconfig_libdir@ pkgconfig_libfile = @pkgconfig_libfile@ + +# ---------------------------------------------------------------------- +pkgconfigdir = $(libdir)/pkgconfig +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ AUTOMAKE_OPTIONS = 1.4 foreign AUTOTOOL_VERSION = autoconf-2.52 automake-1.5 libtool-1.4.2 DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) -DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 noinst_PROGRAMS = zzipwrap lib_LTLIBRARIES = libzzipwrap.la zzipdir = ${includedir}/zzip zzip_HEADERS = $(libzzipwrap_la_headers) -# -VERSION_INFO = @VERSION_INFO@ -RELEASE_INFO = @RELEASE_INFO@ # libzzipwrap_la_SOURCES = \ @@ -147,11 +181,9 @@ CLEANFILES = $(WCC10_CLEAN) *.pc *.omf zzipwrap_LDFLAGS = @ZZIPLIB_LDFLAGS@ zzipwrap_LDADD = libzzipwrap.la @RESOLVES@ ../zzip/libzzip.la -lz - -# ---------------------------------------------------------------------- -pkgconfigdir = $(libdir)/pkgconfig pkgconfig_HEADERS = zzipwrap.pc subdir = zzipwrap +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/uses/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -166,9 +198,6 @@ PROGRAMS = $(noinst_PROGRAMS) zzipwrap_SOURCES = zzipwrap.c zzipwrap_OBJECTS = zzipwrap.$(OBJEXT) zzipwrap_DEPENDENCIES = libzzipwrap.la ../zzip/libzzip.la -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/uses/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/wrap.Plo ./$(DEPDIR)/zzipwrap.Po @@ -179,7 +208,6 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ DIST_SOURCES = $(libzzipwrap_la_SOURCES) zzipwrap.c HEADERS = $(pkgconfig_HEADERS) $(zzip_HEADERS) @@ -220,7 +248,7 @@ clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test -z "$dir" && dir=.; \ + test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -250,23 +278,37 @@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` .c.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< -CCDEPMODE = @CCDEPMODE@ +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< mostlyclean-libtool: -rm -f *.lo @@ -317,6 +359,9 @@ uninstall-zzipHEADERS: ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -342,20 +387,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -381,7 +447,6 @@ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(pkgconfigdir) $(DESTDIR)$(zzipdir) - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -444,11 +509,19 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ uninstall-pkgconfigHEADERS uninstall-zzipHEADERS -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-depend distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am info \ info-am install install-am install-data install-data-am \ @@ -457,8 +530,8 @@ uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ install-strip install-zzipHEADERS installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool tags uninstall uninstall-am \ - uninstall-info-am uninstall-libLTLIBRARIES \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am uninstall-libLTLIBRARIES \ uninstall-pkgconfigHEADERS uninstall-zzipHEADERS -- 2.40.0