mirror of https://github.com/madler/zlib.git
parent
02b6cf579f
commit
c34c1fcbb1
39 changed files with 4752 additions and 109 deletions
@ -0,0 +1,66 @@ |
||||
# Amiga powerUP (TM) Makefile
|
||||
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
|
||||
# Copyright (C) 1998 by Andreas R. Kleinert
|
||||
|
||||
CC = scppc
|
||||
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
|
||||
OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8
|
||||
LIBNAME = libzip.a
|
||||
AR = ppc-amigaos-ar
|
||||
AR_FLAGS = cr
|
||||
RANLIB = ppc-amigaos-ranlib
|
||||
LDFLAGS = -r -o
|
||||
LDLIBS = LIB:scppc.a
|
||||
LN = ppc-amigaos-ld
|
||||
RM = delete quiet
|
||||
|
||||
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
|
||||
zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
|
||||
|
||||
TEST_OBJS = example.o minigzip.o
|
||||
|
||||
all: example minigzip |
||||
|
||||
test: all |
||||
example
|
||||
echo hello world | minigzip | minigzip -d
|
||||
|
||||
$(LIBNAME): $(OBJS) |
||||
$(AR) $(AR_FLAGS) $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
example: example.o $(LIBNAME) |
||||
$(LN) $(LDFLAGS) example LIB:c_ppc.o example.o $(LIBNAME) $(LDLIBS) LIB:end.o
|
||||
|
||||
minigzip: minigzip.o $(LIBNAME) |
||||
$(LN) $(LDFLAGS) minigzip LIB:c_ppc.o minigzip.o $(LIBNAME) $(LDLIBS) LIB:end.o
|
||||
|
||||
clean: |
||||
$(RM) *.o example minigzip $(LIBNAME) foo.gz
|
||||
|
||||
zip: |
||||
zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
|
||||
descrip.mms *.[ch]
|
||||
|
||||
tgz: |
||||
cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
|
||||
zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
adler32.o: zutil.h zlib.h zconf.h |
||||
compress.o: zlib.h zconf.h |
||||
crc32.o: zutil.h zlib.h zconf.h |
||||
deflate.o: deflate.h zutil.h zlib.h zconf.h |
||||
example.o: zlib.h zconf.h |
||||
gzio.o: zutil.h zlib.h zconf.h |
||||
infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h |
||||
infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h |
||||
inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h |
||||
inflate.o: zutil.h zlib.h zconf.h infblock.h |
||||
inftrees.o: zutil.h zlib.h zconf.h inftrees.h |
||||
infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h |
||||
minigzip.o: zlib.h zconf.h |
||||
trees.o: deflate.h zutil.h zlib.h zconf.h |
||||
uncompr.o: zlib.h zconf.h |
||||
zutil.o: zutil.h zlib.h zconf.h |
@ -0,0 +1,74 @@ |
||||
LIBRARY "zlib" |
||||
|
||||
DESCRIPTION '"""zlib data compression library"""' |
||||
|
||||
|
||||
VERSION 1.11 |
||||
|
||||
|
||||
HEAPSIZE 1048576,8192 |
||||
|
||||
EXPORTS |
||||
adler32 @1 |
||||
compress @2 |
||||
crc32 @3 |
||||
deflate @4 |
||||
deflateCopy @5 |
||||
deflateEnd @6 |
||||
deflateInit2_ @7 |
||||
deflateInit_ @8 |
||||
deflateParams @9 |
||||
deflateReset @10 |
||||
deflateSetDictionary @11 |
||||
gzclose @12 |
||||
gzdopen @13 |
||||
gzerror @14 |
||||
gzflush @15 |
||||
gzopen @16 |
||||
gzread @17 |
||||
gzwrite @18 |
||||
inflate @19 |
||||
inflateEnd @20 |
||||
inflateInit2_ @21 |
||||
inflateInit_ @22 |
||||
inflateReset @23 |
||||
inflateSetDictionary @24 |
||||
inflateSync @25 |
||||
uncompress @26 |
||||
zlibVersion @27 |
||||
gzprintf @28 |
||||
gzputc @29 |
||||
gzgetc @30 |
||||
gzseek @31 |
||||
gzrewind @32 |
||||
gztell @33 |
||||
gzeof @34 |
||||
gzsetparams @35 |
||||
zError @36 |
||||
inflateSyncPoint @37 |
||||
get_crc_table @38 |
||||
compress2 @39 |
||||
gzputs @40 |
||||
gzgets @41 |
||||
|
||||
unzOpen @61 |
||||
unzClose @62 |
||||
unzGetGlobalInfo @63 |
||||
unzGetCurrentFileInfo @64 |
||||
unzGoToFirstFile @65 |
||||
unzGoToNextFile @66 |
||||
unzOpenCurrentFile @67 |
||||
unzReadCurrentFile @68 |
||||
unztell @70 |
||||
unzeof @71 |
||||
unzCloseCurrentFile @72 |
||||
unzGetGlobalComment @73 |
||||
unzStringFileNameCompare @74 |
||||
unzLocateFile @75 |
||||
unzGetLocalExtrafield @76 |
||||
|
||||
zipOpen @80 |
||||
zipOpenNewFileInZip @81 |
||||
zipWriteInFileInZip @82 |
||||
zipCloseFileInZip @83 |
||||
zipClose @84 |
@ -0,0 +1,38 @@ |
||||
Change in 0.15: (19 Mar 98) |
||||
- fix memory leak in minizip.c |
||||
|
||||
Change in 0.14: (10 Mar 98) |
||||
- fix bugs in minizip.c sample for zipping big file |
||||
- fix problem in month in date handling |
||||
- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for |
||||
comment handling |
||||
|
||||
Change in 0.13: (6 Mar 98) |
||||
- fix bugs in zip.c |
||||
- add real minizip sample |
||||
|
||||
Change in 0.12: (4 Mar 98) |
||||
- add zip.c and zip.h for creates .zip file |
||||
- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly) |
||||
- fix miniunz.c for file without specific record for directory |
||||
|
||||
Change in 0.11: (3 Mar 98) |
||||
- fix bug in unzGetCurrentFileInfo for get extra field and comment |
||||
- enhance miniunz sample, remove the bad unztst.c sample |
||||
|
||||
Change in 0.10: (2 Mar 98) |
||||
- fix bug in unzReadCurrentFile |
||||
- rename unzip* to unz* function and structure |
||||
- remove Windows-like hungary notation variable name |
||||
- modify some structure in unzip.h |
||||
- add somes comment in source |
||||
- remove unzipGetcCurrentFile function |
||||
- replace ZUNZEXPORT by ZEXPORT |
||||
- add unzGetLocalExtrafield for get the local extrafield info |
||||
- add a new sample, miniunz.c |
||||
|
||||
Change in 0.4: (25 Feb 98) |
||||
- suppress the type unzipFileInZip. |
||||
Only on file in the zipfile can be open at the same time |
||||
- fix somes typo in code |
||||
- added tm_unz structure in unzip_file_info (date/time in readable format) |
@ -0,0 +1,25 @@ |
||||
CC=cc
|
||||
CFLAGS=-O -I../..
|
||||
|
||||
UNZ_OBJS = miniunz.o unzip.o ../../libz.a
|
||||
ZIP_OBJS = minizip.o zip.o ../../libz.a
|
||||
|
||||
.c.o: |
||||
$(CC) -c $(CFLAGS) $*.c
|
||||
|
||||
all: miniunz minizip |
||||
|
||||
miniunz: $(UNZ_OBJS) |
||||
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
|
||||
|
||||
minizip: $(ZIP_OBJS) |
||||
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
|
||||
|
||||
test: miniunz minizip |
||||
./minizip test readme.txt
|
||||
./miniunz -l test.zip
|
||||
mv readme.txt readme.old
|
||||
./miniunz test.zip
|
||||
|
||||
clean: |
||||
/bin/rm -f *.o *~ minizip miniunz
|
@ -0,0 +1,508 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include <time.h> |
||||
#include <errno.h> |
||||
#include <fcntl.h> |
||||
|
||||
#ifdef unix |
||||
# include <unistd.h> |
||||
# include <utime.h> |
||||
#else |
||||
# include <direct.h> |
||||
# include <io.h> |
||||
#endif |
||||
|
||||
#include "unzip.h" |
||||
|
||||
#define CASESENSITIVITY (0) |
||||
#define WRITEBUFFERSIZE (8192) |
||||
|
||||
/*
|
||||
mini unzip, demo of unzip package |
||||
|
||||
usage : |
||||
Usage : miniunz [-exvlo] file.zip [file_to_extract] |
||||
|
||||
list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT |
||||
if it exists |
||||
*/ |
||||
|
||||
|
||||
/* change_file_date : change the date/time of a file
|
||||
filename : the filename of the file where date/time must be modified |
||||
dosdate : the new date at the MSDos format (4 bytes) |
||||
tmu_date : the SAME new date at the tm_unz format */ |
||||
void change_file_date(filename,dosdate,tmu_date) |
||||
const char *filename; |
||||
uLong dosdate; |
||||
tm_unz tmu_date; |
||||
{ |
||||
#ifdef WIN32 |
||||
HANDLE hFile; |
||||
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; |
||||
|
||||
hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE, |
||||
0,NULL,OPEN_EXISTING,0,NULL); |
||||
GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite); |
||||
DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal); |
||||
LocalFileTimeToFileTime(&ftLocal,&ftm); |
||||
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); |
||||
CloseHandle(hFile); |
||||
#else |
||||
#ifdef unix |
||||
struct utimbuf ut; |
||||
struct tm newdate; |
||||
newdate.tm_sec = tmu_date.tm_sec; |
||||
newdate.tm_min=tmu_date.tm_min; |
||||
newdate.tm_hour=tmu_date.tm_hour; |
||||
newdate.tm_mday=tmu_date.tm_mday; |
||||
newdate.tm_mon=tmu_date.tm_mon; |
||||
if (tmu_date.tm_year > 1900) |
||||
newdate.tm_year=tmu_date.tm_year - 1900; |
||||
else |
||||
newdate.tm_year=tmu_date.tm_year ; |
||||
newdate.tm_isdst=-1; |
||||
|
||||
ut.actime=ut.modtime=mktime(&newdate); |
||||
utime(filename,&ut); |
||||
#endif |
||||
#endif |
||||
} |
||||
|
||||
|
||||
/* mymkdir and change_file_date are not 100 % portable
|
||||
As I don't know well Unix, I wait feedback for the unix portion */ |
||||
|
||||
int mymkdir(dirname) |
||||
const char* dirname; |
||||
{ |
||||
int ret=0; |
||||
#ifdef WIN32 |
||||
ret = mkdir(dirname); |
||||
#else |
||||
#ifdef unix |
||||
ret = mkdir (dirname,0775); |
||||
#endif |
||||
#endif |
||||
return ret; |
||||
} |
||||
|
||||
int makedir (newdir) |
||||
char *newdir; |
||||
{ |
||||
char *buffer ; |
||||
char *p; |
||||
int len = strlen(newdir);
|
||||
|
||||
if (len <= 0)
|
||||
return 0; |
||||
|
||||
buffer = (char*)malloc(len+1); |
||||
strcpy(buffer,newdir); |
||||
|
||||
if (buffer[len-1] == '/') { |
||||
buffer[len-1] = '\0'; |
||||
} |
||||
if (mymkdir(buffer) == 0) |
||||
{ |
||||
free(buffer); |
||||
return 1; |
||||
} |
||||
|
||||
p = buffer+1; |
||||
while (1) |
||||
{ |
||||
char hold; |
||||
|
||||
while(*p && *p != '\\' && *p != '/') |
||||
p++; |
||||
hold = *p; |
||||
*p = 0; |
||||
if ((mymkdir(buffer) == -1) && (errno == ENOENT)) |
||||
{ |
||||
printf("couldn't create directory %s\n",buffer); |
||||
free(buffer); |
||||
return 0; |
||||
} |
||||
if (hold == 0) |
||||
break; |
||||
*p++ = hold; |
||||
} |
||||
free(buffer); |
||||
return 1; |
||||
} |
||||
|
||||
void do_banner() |
||||
{ |
||||
printf("MiniUnz 0.15, demo of zLib + Unz package written by Gilles Vollant\n"); |
||||
printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n"); |
||||
} |
||||
|
||||
void do_help() |
||||
{
|
||||
printf("Usage : miniunz [-exvlo] file.zip [file_to_extract]\n\n") ; |
||||
} |
||||
|
||||
|
||||
int do_list(uf) |
||||
unzFile uf; |
||||
{ |
||||
uLong i; |
||||
unz_global_info gi; |
||||
int err; |
||||
|
||||
err = unzGetGlobalInfo (uf,&gi); |
||||
if (err!=UNZ_OK) |
||||
printf("error %d with zipfile in unzGetGlobalInfo \n",err); |
||||
printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); |
||||
printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); |
||||
for (i=0;i<gi.number_entry;i++) |
||||
{ |
||||
char filename_inzip[256]; |
||||
unz_file_info file_info; |
||||
uLong ratio=0; |
||||
const char *string_method; |
||||
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); |
||||
if (err!=UNZ_OK) |
||||
{ |
||||
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err); |
||||
break; |
||||
} |
||||
if (file_info.uncompressed_size>0) |
||||
ratio = (file_info.compressed_size*100)/file_info.uncompressed_size; |
||||
|
||||
if (file_info.compression_method==0) |
||||
string_method="Stored"; |
||||
else |
||||
if (file_info.compression_method==Z_DEFLATED) |
||||
{ |
||||
uInt iLevel=(uInt)((file_info.flag & 0x6)/2); |
||||
if (iLevel==0) |
||||
string_method="Defl:N"; |
||||
else if (iLevel==1) |
||||
string_method="Defl:X"; |
||||
else if ((iLevel==2) || (iLevel==3)) |
||||
string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ |
||||
} |
||||
else |
||||
string_method="Unkn. "; |
||||
|
||||
printf("%7lu %6s %7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", |
||||
file_info.uncompressed_size,string_method,file_info.compressed_size, |
||||
ratio, |
||||
(uLong)file_info.tmu_date.tm_mon + 1, |
||||
(uLong)file_info.tmu_date.tm_mday, |
||||
(uLong)file_info.tmu_date.tm_year % 100, |
||||
(uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min, |
||||
(uLong)file_info.crc,filename_inzip); |
||||
if ((i+1)<gi.number_entry) |
||||
{ |
||||
err = unzGoToNextFile(uf); |
||||
if (err!=UNZ_OK) |
||||
{ |
||||
printf("error %d with zipfile in unzGoToNextFile\n",err); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
|
||||
int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite) |
||||
unzFile uf; |
||||
const int* popt_extract_without_path; |
||||
int* popt_overwrite; |
||||
{ |
||||
char filename_inzip[256]; |
||||
char* filename_withoutpath; |
||||
char* p; |
||||
int err=UNZ_OK; |
||||
FILE *fout=NULL; |
||||
void* buf; |
||||
uInt size_buf; |
||||
|
||||
unz_file_info file_info; |
||||
uLong ratio=0; |
||||
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); |
||||
|
||||
if (err!=UNZ_OK) |
||||
{ |
||||
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err); |
||||
return err; |
||||
} |
||||
|
||||
size_buf = WRITEBUFFERSIZE; |
||||
buf = (void*)malloc(size_buf); |
||||
if (buf==NULL) |
||||
{ |
||||
printf("Error allocating memory\n"); |
||||
return UNZ_INTERNALERROR; |
||||
} |
||||
|
||||
p = filename_withoutpath = filename_inzip; |
||||
while ((*p) != '\0') |
||||
{ |
||||
if (((*p)=='/') || ((*p)=='\\')) |
||||
filename_withoutpath = p+1; |
||||
p++; |
||||
} |
||||
|
||||
if ((*filename_withoutpath)=='\0') |
||||
{ |
||||
if ((*popt_extract_without_path)==0) |
||||
{ |
||||
printf("creating directory: %s\n",filename_inzip); |
||||
mymkdir(filename_inzip); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
const char* write_filename; |
||||
int skip=0; |
||||
|
||||
if ((*popt_extract_without_path)==0) |
||||
write_filename = filename_inzip; |
||||
else |
||||
write_filename = filename_withoutpath; |
||||
|
||||
err = unzOpenCurrentFile(uf); |
||||
if (err!=UNZ_OK) |
||||
{ |
||||
printf("error %d with zipfile in unzOpenCurrentFile\n",err); |
||||
} |
||||
|
||||
if (((*popt_overwrite)==0) && (err==UNZ_OK)) |
||||
{ |
||||
char rep; |
||||
FILE* ftestexist; |
||||
ftestexist = fopen(write_filename,"rb"); |
||||
if (ftestexist!=NULL) |
||||
{ |
||||
fclose(ftestexist); |
||||
do |
||||
{ |
||||
char answer[128]; |
||||
printf("The file %s exist. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); |
||||
scanf("%1s",answer); |
||||
rep = answer[0] ; |
||||
if ((rep>='a') && (rep<='z')) |
||||
rep -= 0x20; |
||||
} |
||||
while ((rep!='Y') && (rep!='N') && (rep!='A')); |
||||
} |
||||
|
||||
if (rep == 'N') |
||||
skip = 1; |
||||
|
||||
if (rep == 'A') |
||||
*popt_overwrite=1; |
||||
} |
||||
|
||||
if ((skip==0) && (err==UNZ_OK)) |
||||
{ |
||||
fout=fopen(write_filename,"wb"); |
||||
|
||||
/* some zipfile don't contain directory alone before file */ |
||||
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
||||
(filename_withoutpath!=(char*)filename_inzip)) |
||||
{ |
||||
char c=*(filename_withoutpath-1); |
||||
*(filename_withoutpath-1)='\0'; |
||||
makedir(write_filename); |
||||
*(filename_withoutpath-1)=c; |
||||
fout=fopen(write_filename,"wb"); |
||||
} |
||||
|
||||
if (fout==NULL) |
||||
{ |
||||
printf("error opening %s\n",write_filename); |
||||
} |
||||
} |
||||
|
||||
if (fout!=NULL) |
||||
{ |
||||
printf(" extracting: %s\n",write_filename); |
||||
|
||||
do |
||||
{ |
||||
err = unzReadCurrentFile(uf,buf,size_buf); |
||||
if (err<0)
|
||||
{ |
||||
printf("error %d with zipfile in unzReadCurrentFile\n",err); |
||||
break; |
||||
} |
||||
if (err>0) |
||||
if (fwrite(buf,err,1,fout)!=1) |
||||
{ |
||||
printf("error in writing extracted file\n"); |
||||
err=UNZ_ERRNO; |
||||
break; |
||||
} |
||||
} |
||||
while (err>0); |
||||
fclose(fout); |
||||
if (err==0)
|
||||
change_file_date(write_filename,file_info.dosDate, |
||||
file_info.tmu_date); |
||||
} |
||||
|
||||
if (err==UNZ_OK) |
||||
{ |
||||
err = unzCloseCurrentFile (uf); |
||||
if (err!=UNZ_OK) |
||||
{ |
||||
printf("error %d with zipfile in unzCloseCurrentFile\n",err); |
||||
} |
||||
} |
||||
else |
||||
unzCloseCurrentFile(uf); /* don't lose the error */
|
||||
} |
||||
|
||||
free(buf);
|
||||
return err; |
||||
} |
||||
|
||||
|
||||
int do_extract(uf,opt_extract_without_path,opt_overwrite) |
||||
unzFile uf; |
||||
int opt_extract_without_path; |
||||
int opt_overwrite; |
||||
{ |
||||
uLong i; |
||||
unz_global_info gi; |
||||
int err; |
||||
FILE* fout=NULL;
|
||||
|
||||
err = unzGetGlobalInfo (uf,&gi); |
||||
if (err!=UNZ_OK) |
||||
printf("error %d with zipfile in unzGetGlobalInfo \n",err); |
||||
|
||||
for (i=0;i<gi.number_entry;i++) |
||||
{ |
||||
if (do_extract_currentfile(uf,&opt_extract_without_path, |
||||
&opt_overwrite) != UNZ_OK) |
||||
break; |
||||
|
||||
if ((i+1)<gi.number_entry) |
||||
{ |
||||
err = unzGoToNextFile(uf); |
||||
if (err!=UNZ_OK) |
||||
{ |
||||
printf("error %d with zipfile in unzGoToNextFile\n",err); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite) |
||||
unzFile uf; |
||||
const char* filename; |
||||
int opt_extract_without_path; |
||||
int opt_overwrite; |
||||
{ |
||||
int err = UNZ_OK; |
||||
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) |
||||
{ |
||||
printf("file %s not found in the zipfile\n",filename); |
||||
return 2; |
||||
} |
||||
|
||||
if (do_extract_currentfile(uf,&opt_extract_without_path, |
||||
&opt_overwrite) == UNZ_OK) |
||||
return 0; |
||||
else |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
int main(argc,argv) |
||||
int argc; |
||||
char *argv[]; |
||||
{ |
||||
const char *zipfilename=NULL; |
||||
const char *filename_to_extract=NULL; |
||||
int i; |
||||
int opt_do_list=0; |
||||
int opt_do_extract=1; |
||||
int opt_do_extract_withoutpath=0; |
||||
int opt_overwrite=0; |
||||
char filename_try[512]; |
||||
unzFile uf=NULL; |
||||
|
||||
do_banner(); |
||||
if (argc==1) |
||||
{ |
||||
do_help(); |
||||
exit(0); |
||||
} |
||||
else |
||||
{ |
||||
for (i=1;i<argc;i++) |
||||
{ |
||||
if ((*argv[i])=='-') |
||||
{ |
||||
const char *p=argv[i]+1; |
||||
|
||||
while ((*p)!='\0') |
||||
{
|
||||
char c=*(p++);; |
||||
if ((c=='l') || (c=='L')) |
||||
opt_do_list = 1; |
||||
if ((c=='v') || (c=='V')) |
||||
opt_do_list = 1; |
||||
if ((c=='x') || (c=='X')) |
||||
opt_do_extract = 1; |
||||
if ((c=='e') || (c=='E')) |
||||
opt_do_extract = opt_do_extract_withoutpath = 1; |
||||
if ((c=='o') || (c=='O')) |
||||
opt_overwrite=1; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
if (zipfilename == NULL) |
||||
zipfilename = argv[i]; |
||||
else if (filename_to_extract==NULL) |
||||
filename_to_extract = argv[i] ; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (zipfilename!=NULL) |
||||
{ |
||||
strcpy(filename_try,zipfilename); |
||||
uf = unzOpen(zipfilename); |
||||
if (uf==NULL) |
||||
{ |
||||
strcat(filename_try,".zip"); |
||||
uf = unzOpen(filename_try); |
||||
} |
||||
} |
||||
|
||||
if (uf==NULL) |
||||
{ |
||||
printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename); |
||||
exit (1); |
||||
} |
||||
printf("%s opened\n",filename_try); |
||||
|
||||
if (opt_do_list==1) |
||||
return do_list(uf); |
||||
else if (opt_do_extract==1) |
||||
{ |
||||
if (filename_to_extract == NULL) |
||||
return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite); |
||||
else |
||||
return do_extract_onefile(uf,filename_to_extract, |
||||
opt_do_extract_withoutpath,opt_overwrite); |
||||
} |
||||
unzCloseCurrentFile(uf); |
||||
|
||||
return 0; /* to avoid warning */ |
||||
} |
@ -0,0 +1,302 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include <time.h> |
||||
#include <errno.h> |
||||
#include <fcntl.h> |
||||
|
||||
#ifdef unix |
||||
# include <unistd.h> |
||||
# include <utime.h> |
||||
# include <sys/types.h> |
||||
# include <sys/stat.h> |
||||
#else |
||||
# include <direct.h> |
||||
# include <io.h> |
||||
#endif |
||||
|
||||
#include "zip.h" |
||||
|
||||
|
||||
#define WRITEBUFFERSIZE (16384) |
||||
#define MAXFILENAME (256) |
||||
|
||||
#ifdef WIN32 |
||||
uLong filetime(f, tmzip, dt) |
||||
char *f; /* name of file to get info on */ |
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */ |
||||
uLong *dt; /* dostime */ |
||||
{ |
||||
int ret = 0; |
||||
{ |
||||
FILETIME ftLocal; |
||||
HANDLE hFind; |
||||
WIN32_FIND_DATA ff32; |
||||
|
||||
hFind = FindFirstFile(f,&ff32); |
||||
if (hFind != INVALID_HANDLE_VALUE) |
||||
{ |
||||
FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); |
||||
FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); |
||||
FindClose(hFind); |
||||
ret = 1; |
||||
} |
||||
} |
||||
return ret; |
||||
} |
||||
#else |
||||
#ifdef unix |
||||
uLong filetime(f, tmzip, dt) |
||||
char *f; /* name of file to get info on */ |
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */ |
||||
uLong *dt; /* dostime */ |
||||
{ |
||||
int ret=0; |
||||
struct stat s; /* results of stat() */ |
||||
struct tm* filedate; |
||||
time_t tm_t=0; |
||||
|
||||
if (strcmp(f,"-")!=0) |
||||
{ |
||||
char name[MAXFILENAME]; |
||||
int len = strlen(f); |
||||
strcpy(name, f); |
||||
if (name[len - 1] == '/') |
||||
name[len - 1] = '\0'; |
||||
/* not all systems allow stat'ing a file with / appended */ |
||||
if (stat(name,&s)==0) |
||||
{ |
||||
tm_t = s.st_mtime; |
||||
ret = 1; |
||||
} |
||||
} |
||||
filedate = localtime(&tm_t); |
||||
|
||||
tmzip->tm_sec = filedate->tm_sec; |
||||
tmzip->tm_min = filedate->tm_min; |
||||
tmzip->tm_hour = filedate->tm_hour; |
||||
tmzip->tm_mday = filedate->tm_mday; |
||||
tmzip->tm_mon = filedate->tm_mon ; |
||||
tmzip->tm_year = filedate->tm_year; |
||||
|
||||
return ret; |
||||
} |
||||
#else |
||||
uLong filetime(f, tmzip, dt) |
||||
char *f; /* name of file to get info on */ |
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */ |
||||
uLong *dt; /* dostime */ |
||||
{ |
||||
return 0; |
||||
} |
||||
#endif |
||||
#endif |
||||
|
||||
|
||||
|
||||
|
||||
int check_exist_file(filename) |
||||
const char* filename; |
||||
{ |
||||
FILE* ftestexist; |
||||
int ret = 1; |
||||
ftestexist = fopen(filename,"rb"); |
||||
if (ftestexist==NULL) |
||||
ret = 0; |
||||
else |
||||
fclose(ftestexist); |
||||
return ret; |
||||
} |
||||
|
||||
void do_banner() |
||||
{ |
||||
printf("MiniZip 0.15, demo of zLib + Zip package written by Gilles Vollant\n"); |
||||
printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n"); |
||||
} |
||||
|
||||
void do_help() |
||||
{
|
||||
printf("Usage : minizip [-o] file.zip [files_to_add]\n\n") ; |
||||
} |
||||
|
||||
int main(argc,argv) |
||||
int argc; |
||||
char *argv[]; |
||||
{ |
||||
int i; |
||||
int opt_overwrite=0; |
||||
int opt_compress_level=Z_DEFAULT_COMPRESSION; |
||||
int zipfilenamearg = 0; |
||||
char filename_try[MAXFILENAME]; |
||||
int zipok; |
||||
int err=0; |
||||
int size_buf=0; |
||||
void* buf=NULL, |
||||
|
||||
|
||||
do_banner(); |
||||
if (argc==1) |
||||
{ |
||||
do_help(); |
||||
exit(0); |
||||
return 0; |
||||
} |
||||
else |
||||
{ |
||||
for (i=1;i<argc;i++) |
||||
{ |
||||
if ((*argv[i])=='-') |
||||
{ |
||||
const char *p=argv[i]+1; |
||||
|
||||
while ((*p)!='\0') |
||||
{
|
||||
char c=*(p++);; |
||||
if ((c=='o') || (c=='O')) |
||||
opt_overwrite = 1; |
||||
if ((c>='0') && (c<='9')) |
||||
opt_compress_level = c-'0'; |
||||
} |
||||
} |
||||
else |
||||
if (zipfilenamearg == 0) |
||||
zipfilenamearg = i ; |
||||
} |
||||
} |
||||
|
||||
size_buf = WRITEBUFFERSIZE; |
||||
buf = (void*)malloc(size_buf); |
||||
if (buf==NULL) |
||||
{ |
||||
printf("Error allocating memory\n"); |
||||
return ZIP_INTERNALERROR; |
||||
} |
||||
|
||||
if (zipfilenamearg==0) |
||||
zipok=0; |
||||
else |
||||
{ |
||||
int i,len; |
||||
int dot_found=0; |
||||
|
||||
zipok = 1 ; |
||||
strcpy(filename_try,argv[zipfilenamearg]); |
||||
len=strlen(filename_try); |
||||
for (i=0;i<len;i++) |
||||
if (filename_try[i]=='.') |
||||
dot_found=1; |
||||
|
||||
if (dot_found==0) |
||||
strcat(filename_try,".zip"); |
||||
|
||||
if (opt_overwrite==0) |
||||
if (check_exist_file(filename_try)!=0) |
||||
{ |
||||
char rep; |
||||
do |
||||
{ |
||||
char answer[128]; |
||||
printf("The file %s exist. Overwrite ? [y]es, [n]o : ",filename_try); |
||||
scanf("%1s",answer); |
||||
rep = answer[0] ; |
||||
if ((rep>='a') && (rep<='z')) |
||||
rep -= 0x20; |
||||
} |
||||
while ((rep!='Y') && (rep!='N')); |
||||
if (rep=='N') |
||||
zipok = 0; |
||||
} |
||||
} |
||||
|
||||
if (zipok==1) |
||||
{ |
||||
zipFile zf; |
||||
int errclose; |
||||
zf = zipOpen(filename_try,0); |
||||
if (zf == NULL) |
||||
{ |
||||
printf("error opening %s\n",filename_try); |
||||
err= ZIP_ERRNO; |
||||
} |
||||
else
|
||||
printf("creating %s\n",filename_try); |
||||
|
||||
for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++) |
||||
{ |
||||
if (((*(argv[i]))!='-') && ((*(argv[i]))!='/')) |
||||
{ |
||||
FILE * fin; |
||||
int size_read; |
||||
const char* filenameinzip = argv[i]; |
||||
zip_fileinfo zi; |
||||
|
||||
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
|
||||
zi.tmz_date.tm_mday = zi.tmz_date.tm_min = zi.tmz_date.tm_year = 0; |
||||
zi.dosDate = 0; |
||||
zi.internal_fa = 0; |
||||
zi.external_fa = 0; |
||||
filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); |
||||
|
||||
|
||||
err = zipOpenNewFileInZip(zf,filenameinzip,&zi, |
||||
NULL,0,NULL,0,NULL /* comment*/, |
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0, |
||||
opt_compress_level); |
||||
|
||||
if (err != ZIP_OK) |
||||
printf("error in opening %s in zipfile\n",filenameinzip); |
||||
else |
||||
{ |
||||
fin = fopen(filenameinzip,"rb"); |
||||
if (fin==NULL) |
||||
{ |
||||
err=ZIP_ERRNO; |
||||
printf("error in opening %s for reading\n",filenameinzip); |
||||
} |
||||
} |
||||
|
||||
if (err == ZIP_OK) |
||||
do |
||||
{ |
||||
err = ZIP_OK; |
||||
size_read = fread(buf,1,size_buf,fin); |
||||
if (size_read < size_buf) |
||||
if (feof(fin)==0) |
||||
{ |
||||
printf("error in reading %s\n",filenameinzip); |
||||
err = ZIP_ERRNO; |
||||
} |
||||
|
||||
if (size_read>0) |
||||
{ |
||||
err = zipWriteInFileInZip (zf,buf,size_read); |
||||
if (err<0) |
||||
{ |
||||
printf("error in writing %s in the zipfile\n", |
||||
filenameinzip); |
||||
} |
||||
|
||||
} |
||||
} while ((err == ZIP_OK) && (size_read>0)); |
||||
|
||||
fclose(fin); |
||||
if (err<0) |
||||
err=ZIP_ERRNO; |
||||
else |
||||
{
|
||||
err = zipCloseFileInZip(zf); |
||||
if (err!=ZIP_OK) |
||||
printf("error in closing %s in the zipfile\n", |
||||
filenameinzip); |
||||
} |
||||
} |
||||
} |
||||
errclose = zipClose(zf,NULL); |
||||
if (errclose != ZIP_OK) |
||||
printf("error in closing %s\n",filename_try); |
||||
} |
||||
|
||||
free(buf); |
||||
exit(0); |
||||
return 0; /* to avoid warning */ |
||||
} |
@ -0,0 +1,37 @@ |
||||
|
||||
UnZip 0.15 additionnal library |
||||
|
||||
|
||||
This unzip package allow extract file from .ZIP file, compatible with |
||||
PKZip 2.04g, WinZip, InfoZip tools and compatible. |
||||
|
||||
Multi volume ZipFile (span) are not supported, and old compression used by old |
||||
PKZip 1.x are not supported. |
||||
|
||||
See probdesc.zip from PKWare for specification of .ZIP format. |
||||
|
||||
What is Unzip |
||||
The Zlib library support the deflate compression and the creation of gzip (.gz) |
||||
file. Zlib is free and small. |
||||
The .Zip format, which can contain several compressed files (.gz can containt |
||||
only one file) is a very popular format. This is why I've written a package for reading file compressed in Zipfile. |
||||
|
||||
Using Unzip package |
||||
|
||||
You need source of Zlib (get zlib111.zip and read zlib.h). |
||||
Get unzlb015.zip and read unzip.h (whith documentation of unzip functions) |
||||
|
||||
The Unzip package is only two file : unzip.h and unzip.c. But it use the Zlib |
||||
files. |
||||
unztst.c is a simple sample program, which list file in a zipfile and display |
||||
README.TXT or FILE_ID.DIZ (if these files are found). |
||||
miniunz.c is a mini unzip program. |
||||
|
||||
I'm also currenlyt writing a zipping portion (zip.h, zip.c and test with minizip.c) |
||||
|
||||
Please email me for feedback. |
||||
I hope my source is compatible with Unix system, but I need your help for be sure |
||||
|
||||
Latest revision : Mar 04th, 1998 |
||||
|
||||
Check http://www.winimage.com/zLibDll/unzip.html for up to date info. |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@ |
||||
unzOpen @61 |
||||
unzClose @62 |
||||
unzGetGlobalInfo @63 |
||||
unzGetCurrentFileInfo @64 |
||||
unzGoToFirstFile @65 |
||||
unzGoToNextFile @66 |
||||
unzOpenCurrentFile @67 |
||||
unzReadCurrentFile @68 |
||||
unztell @70 |
||||
unzeof @71 |
||||
unzCloseCurrentFile @72 |
||||
unzGetGlobalComment @73 |
||||
unzStringFileNameCompare @74 |
||||
unzLocateFile @75 |
||||
unzGetLocalExtrafield @76 |
@ -0,0 +1,275 @@ |
||||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 0.15 beta, Mar 19th, 1998, |
||||
|
||||
Copyright (C) 1998 Gilles Vollant |
||||
|
||||
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g |
||||
WinZip, InfoZip tools and compatible. |
||||
Encryption and multi volume ZipFile (span) are not supported. |
||||
Old compressions used by old PKZip 1.x are not supported |
||||
|
||||
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE |
||||
CAN CHANGE IN FUTURE VERSION !! |
||||
I WAIT FEEDBACK at mail info@winimage.com |
||||
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
|
||||
|
||||
Condition of use and distribution are the same than zlib : |
||||
|
||||
This software is provided 'as-is', without any express or implied |
||||
warranty. In no event will the authors be held liable for any damages |
||||
arising from the use of this software. |
||||
|
||||
Permission is granted to anyone to use this software for any purpose, |
||||
including commercial applications, and to alter it and redistribute it |
||||
freely, subject to the following restrictions: |
||||
|
||||
1. The origin of this software must not be misrepresented; you must not |
||||
claim that you wrote the original software. If you use this software |
||||
in a product, an acknowledgment in the product documentation would be |
||||
appreciated but is not required. |
||||
2. Altered source versions must be plainly marked as such, and must not be |
||||
misrepresented as being the original software. |
||||
3. This notice may not be removed or altered from any source distribution. |
||||
|
||||
|
||||
*/ |
||||
/* for more info about .ZIP format, see
|
||||
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
|
||||
PkWare has also a specification at : |
||||
ftp://ftp.pkware.com/probdesc.zip */
|
||||
|
||||
#ifndef _unz_H |
||||
#define _unz_H |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#ifndef _ZLIB_H |
||||
#include "zlib.h" |
||||
#endif |
||||
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) |
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */ |
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef unzFile__ *unzFile; |
||||
#else |
||||
typedef voidp unzFile; |
||||
#endif |
||||
|
||||
|
||||
#define UNZ_OK (0) |
||||
#define UNZ_END_OF_LIST_OF_FILE (-100) |
||||
#define UNZ_ERRNO (Z_ERRNO) |
||||
#define UNZ_EOF (0) |
||||
#define UNZ_PARAMERROR (-102) |
||||
#define UNZ_BADZIPFILE (-103) |
||||
#define UNZ_INTERNALERROR (-104) |
||||
#define UNZ_CRCERROR (-105) |
||||
|
||||
/* tm_unz contain date/time info */ |
||||
typedef struct tm_unz_s
|
||||
{ |
||||
uInt tm_sec; /* seconds after the minute - [0,59] */ |
||||
uInt tm_min; /* minutes after the hour - [0,59] */ |
||||
uInt tm_hour; /* hours since midnight - [0,23] */ |
||||
uInt tm_mday; /* day of the month - [1,31] */ |
||||
uInt tm_mon; /* months since January - [0,11] */ |
||||
uInt tm_year; /* years - [1980..2044] */ |
||||
} tm_unz; |
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */ |
||||
typedef struct unz_global_info_s |
||||
{ |
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */ |
||||
uLong size_comment; /* size of the global comment of the zipfile */ |
||||
} unz_global_info; |
||||
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */ |
||||
typedef struct unz_file_info_s |
||||
{ |
||||
uLong version; /* version made by 2 bytes */ |
||||
uLong version_needed; /* version needed to extract 2 bytes */ |
||||
uLong flag; /* general purpose bit flag 2 bytes */ |
||||
uLong compression_method; /* compression method 2 bytes */ |
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ |
||||
uLong crc; /* crc-32 4 bytes */ |
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */ |
||||
uLong size_file_extra; /* extra field length 2 bytes */ |
||||
uLong size_file_comment; /* file comment length 2 bytes */ |
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */ |
||||
uLong internal_fa; /* internal file attributes 2 bytes */ |
||||
uLong external_fa; /* external file attributes 4 bytes */ |
||||
|
||||
tm_unz tmu_date; |
||||
} unz_file_info; |
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, |
||||
const char* fileName2, |
||||
int iCaseSensitivity)); |
||||
/*
|
||||
Compare two filename (fileName1,fileName2). |
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) |
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi |
||||
or strcasecmp) |
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system |
||||
(like 1 on Unix, 2 on Windows) |
||||
*/ |
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path)); |
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example, |
||||
on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer |
||||
"zlib/zlib111.zip". |
||||
If the zipfile cannot be opened (file don't exist or in not valid), the |
||||
return value is NULL. |
||||
Else, the return value is a unzFile Handle, usable with other function |
||||
of this unzip package. |
||||
*/ |
||||
|
||||
extern int ZEXPORT unzClose OF((unzFile file)); |
||||
/*
|
||||
Close a ZipFile opened with unzipOpen. |
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
||||
these files MUST be closed with unzipCloseCurrentFile before call unzipClose. |
||||
return UNZ_OK if there is no problem. */ |
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, |
||||
unz_global_info *pglobal_info)); |
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure. |
||||
No preparation of the structure is needed |
||||
return UNZ_OK if there is no problem. */ |
||||
|
||||
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file, |
||||
char *szComment, |
||||
uLong uSizeBuf)); |
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer. |
||||
uSizeBuf is the size of the szComment buffer. |
||||
return the number of byte copied or an error code <0 |
||||
*/ |
||||
|
||||
|
||||
/***************************************************************************/ |
||||
/* Unzip package allow you browse the directory of the zipfile */ |
||||
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); |
||||
/*
|
||||
Set the current file of the zipfile to the first file. |
||||
return UNZ_OK if there is no problem |
||||
*/ |
||||
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file)); |
||||
/*
|
||||
Set the current file of the zipfile to the next file. |
||||
return UNZ_OK if there is no problem |
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
||||
*/ |
||||
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName, |
||||
int iCaseSensitivity)); |
||||
/*
|
||||
Try locate the file szFileName in the zipfile. |
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare |
||||
|
||||
return value : |
||||
UNZ_OK if the file is found. It becomes the current file. |
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found |
||||
*/ |
||||
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, |
||||
unz_file_info *pfile_info, |
||||
char *szFileName, |
||||
uLong fileNameBufferSize, |
||||
void *extraField, |
||||
uLong extraFieldBufferSize, |
||||
char *szComment, |
||||
uLong commentBufferSize)); |
||||
/*
|
||||
Get Info about the current file |
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about |
||||
the current file |
||||
if szFileName!=NULL, the filemane string will be copied in szFileName |
||||
(fileNameBufferSize is the size of the buffer) |
||||
if extraField!=NULL, the extra field information will be copied in extraField |
||||
(extraFieldBufferSize is the size of the buffer). |
||||
This is the Central-header version of the extra field |
||||
if szComment!=NULL, the comment string of the file will be copied in szComment |
||||
(commentBufferSize is the size of the buffer) |
||||
*/ |
||||
|
||||
/***************************************************************************/ |
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file) |
||||
*/ |
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); |
||||
/*
|
||||
Open for reading data the current file in the zipfile. |
||||
If there is no error, the return value is UNZ_OK. |
||||
*/ |
||||
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); |
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile |
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good |
||||
*/ |
||||
|
||||
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf, |
||||
unsigned len)); |
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile) |
||||
buf contain buffer where data must be copied |
||||
len the size of buf. |
||||
|
||||
return the number of byte copied if somes bytes are copied |
||||
return 0 if the end of file was reached |
||||
return <0 with error code if there is an error |
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error) |
||||
*/ |
||||
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file)); |
||||
/*
|
||||
Give the current position in uncompressed data |
||||
*/ |
||||
|
||||
extern int ZEXPORT unzeof OF((unzFile file)); |
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/ |
||||
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, |
||||
voidp buf, |
||||
unsigned len)); |
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile) |
||||
This is the local-header version of the extra field (sometimes, there is |
||||
more info in the local-header version than in the central-header) |
||||
|
||||
if buf==NULL, it return the size of the local extra field |
||||
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in |
||||
buf. |
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code |
||||
*/ |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* _unz_H */ |
@ -0,0 +1,716 @@ |
||||
/* zip.c -- IO on .zip files using zlib
|
||||
Version 0.15 beta, Mar 19th, 1998, |
||||
|
||||
Read zip.h for more info |
||||
*/ |
||||
|
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include "zlib.h" |
||||
#include "zip.h" |
||||
|
||||
#ifdef STDC |
||||
# include <stddef.h> |
||||
# include <string.h> |
||||
# include <stdlib.h> |
||||
#endif |
||||
#ifdef NO_ERRNO_H |
||||
extern int errno; |
||||
#else |
||||
# include <errno.h> |
||||
#endif |
||||
|
||||
|
||||
#ifndef local |
||||
# define local static |
||||
#endif |
||||
/* compile with -Dlocal if your debugger can't find static symbols */ |
||||
|
||||
#ifndef VERSIONMADEBY |
||||
# define VERSIONMADEBY (0x0) /* platform depedent */ |
||||
#endif |
||||
|
||||
#ifndef Z_BUFSIZE |
||||
#define Z_BUFSIZE (16384) |
||||
#endif |
||||
|
||||
#ifndef Z_MAXFILENAMEINZIP |
||||
#define Z_MAXFILENAMEINZIP (256) |
||||
#endif |
||||
|
||||
#ifndef ALLOC |
||||
# define ALLOC(size) (malloc(size)) |
||||
#endif |
||||
#ifndef TRYFREE |
||||
# define TRYFREE(p) {if (p) free(p);} |
||||
#endif |
||||
|
||||
/*
|
||||
#define SIZECENTRALDIRITEM (0x2e) |
||||
#define SIZEZIPLOCALHEADER (0x1e) |
||||
*/ |
||||
|
||||
/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ |
||||
|
||||
#ifndef SEEK_CUR |
||||
#define SEEK_CUR 1 |
||||
#endif |
||||
|
||||
#ifndef SEEK_END |
||||
#define SEEK_END 2 |
||||
#endif |
||||
|
||||
#ifndef SEEK_SET |
||||
#define SEEK_SET 0 |
||||
#endif |
||||
|
||||
const char zip_copyright[] = |
||||
" zip 0.15 Copyright 1998 Gilles Vollant "; |
||||
|
||||
|
||||
#define SIZEDATA_INDATABLOCK (4096-(4*4)) |
||||
|
||||
#define LOCALHEADERMAGIC (0x04034b50) |
||||
#define CENTRALHEADERMAGIC (0x02014b50) |
||||
#define ENDHEADERMAGIC (0x06054b50) |
||||
|
||||
#define FLAG_LOCALHEADER_OFFSET (0x06) |
||||
#define CRC_LOCALHEADER_OFFSET (0x0e) |
||||
|
||||
#define SIZECENTRALHEADER (0x2e) /* 46 */ |
||||
|
||||
typedef struct linkedlist_datablock_internal_s |
||||
{ |
||||
struct linkedlist_datablock_internal_s* next_datablock; |
||||
uLong avail_in_this_block; |
||||
uLong filled_in_this_block; |
||||
uLong unused; /* for future use and alignement */ |
||||
unsigned char data[SIZEDATA_INDATABLOCK]; |
||||
} linkedlist_datablock_internal; |
||||
|
||||
typedef struct linkedlist_data_s |
||||
{ |
||||
linkedlist_datablock_internal* first_block; |
||||
linkedlist_datablock_internal* last_block; |
||||
} linkedlist_data; |
||||
|
||||
|
||||
typedef struct |
||||
{ |
||||
z_stream stream; /* zLib stream structure for inflate */ |
||||
int stream_initialised; /* 1 is stream is initialised */ |
||||
uInt pos_in_buffered_data; /* last written byte in buffered_data */ |
||||
|
||||
uLong pos_local_header; /* offset of the local header of the file
|
||||
currenty writing */ |
||||
char* central_header; /* central header data for the current file */ |
||||
uLong size_centralheader; /* size of the central header for cur file */ |
||||
uLong flag; /* flag of the file currently writing */ |
||||
|
||||
int method; /* compression method of file currenty wr.*/ |
||||
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/ |
||||
uLong dosDate; |
||||
uLong crc32; |
||||
} curfile_info; |
||||
|
||||
typedef struct |
||||
{ |
||||
FILE * filezip; |
||||
linkedlist_data central_dir;/* datablock with central dir in construction*/ |
||||
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/ |
||||
curfile_info ci; /* info on the file curretly writing */ |
||||
|
||||
uLong begin_pos; /* position of the beginning of the zipfile */ |
||||
uLong number_entry; |
||||
} zip_internal; |
||||
|
||||
local linkedlist_datablock_internal* allocate_new_datablock() |
||||
{ |
||||
linkedlist_datablock_internal* ldi; |
||||
ldi = (linkedlist_datablock_internal*) |
||||
ALLOC(sizeof(linkedlist_datablock_internal)); |
||||
if (ldi!=NULL) |
||||
{ |
||||
ldi->next_datablock = NULL ; |
||||
ldi->filled_in_this_block = 0 ; |
||||
ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ; |
||||
} |
||||
return ldi; |
||||
} |
||||
|
||||
local void free_datablock(ldi) |
||||
linkedlist_datablock_internal* ldi; |
||||
{ |
||||
while (ldi!=NULL) |
||||
{ |
||||
linkedlist_datablock_internal* ldinext = ldi->next_datablock; |
||||
TRYFREE(ldi); |
||||
ldi = ldinext; |
||||
} |
||||
} |
||||
|
||||
local void init_linkedlist(ll) |
||||
linkedlist_data* ll; |
||||
{ |
||||
ll->first_block = ll->last_block = NULL; |
||||
} |
||||
|
||||
local void free_linkedlist(ll) |
||||
linkedlist_data* ll; |
||||
{ |
||||
free_datablock(ll->first_block); |
||||
ll->first_block = ll->last_block = NULL; |
||||
} |
||||
|
||||
|
||||
local int add_data_in_datablock(ll,buf,len) |
||||
linkedlist_data* ll;
|
||||
const void* buf; |
||||
uLong len; |
||||
{ |
||||
linkedlist_datablock_internal* ldi; |
||||
const unsigned char* from_copy; |
||||
|
||||
if (ll==NULL) |
||||
return ZIP_INTERNALERROR; |
||||
|
||||
if (ll->last_block == NULL) |
||||
{ |
||||
ll->first_block = ll->last_block = allocate_new_datablock(); |
||||
if (ll->first_block == NULL) |
||||
return ZIP_INTERNALERROR; |
||||
} |
||||
|
||||
ldi = ll->last_block; |
||||
from_copy = (unsigned char*)buf; |
||||
|
||||
while (len>0) |
||||
{ |
||||
uInt copy_this; |
||||
uInt i; |
||||
unsigned char* to_copy; |
||||
|
||||
if (ldi->avail_in_this_block==0) |
||||
{ |
||||
ldi->next_datablock = allocate_new_datablock(); |
||||
if (ldi->next_datablock == NULL) |
||||
return ZIP_INTERNALERROR; |
||||
ldi = ldi->next_datablock ; |
||||
ll->last_block = ldi; |
||||
} |
||||
|
||||
if (ldi->avail_in_this_block < len) |
||||
copy_this = (uInt)ldi->avail_in_this_block; |
||||
else |
||||
copy_this = (uInt)len; |
||||
|
||||
to_copy = &(ldi->data[ldi->filled_in_this_block]); |
||||
|
||||
for (i=0;i<copy_this;i++) |
||||
*(to_copy+i)=*(from_copy+i); |
||||
|
||||
ldi->filled_in_this_block += copy_this; |
||||
ldi->avail_in_this_block -= copy_this; |
||||
from_copy += copy_this ; |
||||
len -= copy_this; |
||||
} |
||||
return ZIP_OK; |
||||
} |
||||
|
||||
|
||||
local int write_datablock(fout,ll) |
||||
FILE * fout; |
||||
linkedlist_data* ll;
|
||||
{ |
||||
linkedlist_datablock_internal* ldi; |
||||
ldi = ll->first_block; |
||||
while (ldi!=NULL) |
||||
{ |
||||
if (ldi->filled_in_this_block > 0) |
||||
if (fwrite(ldi->data,(uInt)ldi->filled_in_this_block,1,fout)!=1) |
||||
return ZIP_ERRNO; |
||||
ldi = ldi->next_datablock; |
||||
} |
||||
return ZIP_OK; |
||||
} |
||||
|
||||
/****************************************************************************/ |
||||
|
||||
/* ===========================================================================
|
||||
Outputs a long in LSB order to the given file |
||||
nbByte == 1, 2 or 4 (byte, short or long) |
||||
*/ |
||||
local int ziplocal_putValue (file, x, nbByte) |
||||
FILE *file; |
||||
uLong x; |
||||
int nbByte; |
||||
{ |
||||
unsigned char buf[4]; |
||||
int n; |
||||
for (n = 0; n < nbByte; n++) { |
||||
buf[n] = (unsigned char)(x & 0xff); |
||||
x >>= 8; |
||||
} |
||||
if (fwrite(buf,nbByte,1,file)!=1) |
||||
return ZIP_ERRNO; |
||||
else |
||||
return ZIP_OK; |
||||
} |
||||
|
||||
|
||||
local void ziplocal_putValue_inmemory (dest, x, nbByte) |
||||
void* dest; |
||||
uLong x; |
||||
int nbByte; |
||||
{ |
||||
unsigned char* buf=(unsigned char*)dest; |
||||
int n; |
||||
for (n = 0; n < nbByte; n++) { |
||||
buf[n] = (unsigned char)(x & 0xff); |
||||
x >>= 8; |
||||
} |
||||
} |
||||
/****************************************************************************/ |
||||
|
||||
|
||||
local uLong ziplocal_TmzDateToDosDate(ptm,dosDate) |
||||
tm_zip* ptm; |
||||
uLong dosDate; |
||||
{ |
||||
uLong year = (uLong)ptm->tm_year; |
||||
if (year>1980) |
||||
year-=1980; |
||||
else if (year>80) |
||||
year-=80; |
||||
return |
||||
(uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | |
||||
((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); |
||||
} |
||||
|
||||
|
||||
/****************************************************************************/ |
||||
|
||||
extern zipFile ZEXPORT zipOpen (pathname, append) |
||||
const char *pathname; |
||||
int append; |
||||
{ |
||||
zip_internal ziinit; |
||||
zip_internal* zi; |
||||
|
||||
ziinit.filezip = fopen(pathname,(append == 0) ? "wb" : "ab"); |
||||
if (ziinit.filezip == NULL) |
||||
return NULL; |
||||
ziinit.begin_pos = ftell(ziinit.filezip); |
||||
ziinit.in_opened_file_inzip = 0; |
||||
ziinit.ci.stream_initialised = 0; |
||||
ziinit.number_entry = 0; |
||||
init_linkedlist(&(ziinit.central_dir)); |
||||
|
||||
|
||||
zi = (zip_internal*)ALLOC(sizeof(zip_internal)); |
||||
if (zi==NULL) |
||||
{ |
||||
fclose(ziinit.filezip); |
||||
return NULL; |
||||
} |
||||
|
||||
*zi = ziinit; |
||||
return (zipFile)zi; |
||||
} |
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local, |
||||
extrafield_global, size_extrafield_global, |
||||
comment, method, level) |
||||
zipFile file; |
||||
const char* filename; |
||||
const zip_fileinfo* zipfi; |
||||
const void* extrafield_local; |
||||
uInt size_extrafield_local; |
||||
const void* extrafield_global; |
||||
uInt size_extrafield_global; |
||||
const char* comment; |
||||
int method; |
||||
int level; |
||||
{ |
||||
zip_internal* zi; |
||||
uInt size_filename; |
||||
uInt size_comment; |
||||
uInt i; |
||||
int err = ZIP_OK; |
||||
|
||||
if (file == NULL) |
||||
return ZIP_PARAMERROR; |
||||
if ((method!=0) && (method!=Z_DEFLATED)) |
||||
return ZIP_PARAMERROR; |
||||
|
||||
zi = (zip_internal*)file; |
||||
|
||||
if (zi->in_opened_file_inzip == 1) |
||||
{ |
||||
err = zipCloseFileInZip (file); |
||||
if (err != ZIP_OK) |
||||
return err; |
||||
} |
||||
|
||||
|
||||
if (filename==NULL) |
||||
filename="-"; |
||||
|
||||
if (comment==NULL) |
||||
size_comment = 0; |
||||
else |
||||
size_comment = strlen(comment); |
||||
|
||||
size_filename = strlen(filename); |
||||
|
||||
if (zipfi == NULL) |
||||
zi->ci.dosDate = 0; |
||||
else |
||||
{ |
||||
if (zipfi->dosDate != 0) |
||||
zi->ci.dosDate = zipfi->dosDate; |
||||
else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate); |
||||
} |
||||
|
||||
zi->ci.flag = 0; |
||||
if ((level==8) || (level==9)) |
||||
zi->ci.flag |= 2; |
||||
if ((level==2)) |
||||
zi->ci.flag |= 4; |
||||
if ((level==1)) |
||||
zi->ci.flag |= 6; |
||||
|
||||
zi->ci.crc32 = 0; |
||||
zi->ci.method = method; |
||||
zi->ci.stream_initialised = 0; |
||||
zi->ci.pos_in_buffered_data = 0; |
||||
zi->ci.pos_local_header = ftell(zi->filezip); |
||||
zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename +
|
||||
size_extrafield_global + size_comment; |
||||
zi->ci.central_header = (char*)ALLOC(zi->ci.size_centralheader); |
||||
|
||||
ziplocal_putValue_inmemory(zi->ci.central_header,CENTRALHEADERMAGIC,4); |
||||
/* version info */ |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+4,VERSIONMADEBY,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+6,20,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+8,zi->ci.flag,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+10,zi->ci.method,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+12,zi->ci.dosDate,4); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+16,0,4); /*crc*/ |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+20,0,4); /*compr size*/ |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+24,0,4); /*uncompr size*/ |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+28,size_filename,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+30,size_extrafield_global,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+32,size_comment,2); |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+34,0,2); /*disk nm start*/ |
||||
|
||||
if (zipfi==NULL) |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+36,0,2);
|
||||
else |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+36,zipfi->internal_fa,2);
|
||||
|
||||
if (zipfi==NULL) |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+38,0,4);
|
||||
else |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+38,zipfi->external_fa,4); |
||||
|
||||
ziplocal_putValue_inmemory(zi->ci.central_header+42,zi->ci.pos_local_header,4); |
||||
|
||||
for (i=0;i<size_filename;i++) |
||||
*(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i); |
||||
|
||||
for (i=0;i<size_extrafield_global;i++) |
||||
*(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) = |
||||
*(((const char*)extrafield_global)+i); |
||||
|
||||
for (i=0;i<size_comment;i++) |
||||
*(zi->ci.central_header+SIZECENTRALHEADER+size_filename+ |
||||
size_extrafield_global+i) = *(filename+i); |
||||
if (zi->ci.central_header == NULL) |
||||
return ZIP_INTERNALERROR; |
||||
|
||||
/* write the local header */ |
||||
err = ziplocal_putValue(zi->filezip,LOCALHEADERMAGIC,4); |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,20,2);/* version needed to extract */ |
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,zi->ci.flag,2); |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,zi->ci.method,2); |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,zi->ci.dosDate,4); |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,0,4); /* crc 32, unknown */ |
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,0,4); /* compressed size, unknown */ |
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,0,4); /* uncompressed size, unknown */ |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,(uLong)size_filename,2); |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,(uLong)size_extrafield_local,2); |
||||
|
||||
if ((err==ZIP_OK) && (size_filename>0)) |
||||
if (fwrite(filename,(uInt)size_filename,1,zi->filezip)!=1) |
||||
err = ZIP_ERRNO; |
||||
|
||||
if ((err==ZIP_OK) && (size_extrafield_local>0)) |
||||
if (fwrite(extrafield_local,(uInt)size_extrafield_local,1,zi->filezip) |
||||
!=1) |
||||
err = ZIP_ERRNO; |
||||
|
||||
zi->ci.stream.avail_in = (uInt)0; |
||||
zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; |
||||
zi->ci.stream.next_out = zi->ci.buffered_data; |
||||
zi->ci.stream.total_in = 0; |
||||
zi->ci.stream.total_out = 0; |
||||
|
||||
if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED)) |
||||
{ |
||||
zi->ci.stream.zalloc = (alloc_func)0; |
||||
zi->ci.stream.zfree = (free_func)0; |
||||
zi->ci.stream.opaque = (voidpf)0; |
||||
|
||||
err = deflateInit2(&zi->ci.stream, level, |
||||
Z_DEFLATED, -MAX_WBITS, /*DEF_MEM_LEVEL*/8, 0); |
||||
|
||||
if (err==Z_OK) |
||||
zi->ci.stream_initialised = 1; |
||||
} |
||||
|
||||
|
||||
if (err==Z_OK) |
||||
zi->in_opened_file_inzip = 1; |
||||
return err; |
||||
} |
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip (file, buf, len) |
||||
zipFile file; |
||||
const voidp buf; |
||||
unsigned len; |
||||
{ |
||||
zip_internal* zi; |
||||
int err=ZIP_OK; |
||||
|
||||
if (file == NULL) |
||||
return ZIP_PARAMERROR; |
||||
zi = (zip_internal*)file; |
||||
|
||||
if (zi->in_opened_file_inzip == 0) |
||||
return ZIP_PARAMERROR; |
||||
|
||||
zi->ci.stream.next_in = buf; |
||||
zi->ci.stream.avail_in = len; |
||||
zi->ci.crc32 = crc32(zi->ci.crc32,buf,len); |
||||
|
||||
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) |
||||
{ |
||||
if (zi->ci.stream.avail_out == 0) |
||||
{ |
||||
if (fwrite(zi->ci.buffered_data,(uInt)zi->ci.pos_in_buffered_data,1,zi->filezip) |
||||
!=1) |
||||
err = ZIP_ERRNO; |
||||
zi->ci.pos_in_buffered_data = 0; |
||||
zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; |
||||
zi->ci.stream.next_out = zi->ci.buffered_data; |
||||
} |
||||
|
||||
if (zi->ci.method == Z_DEFLATED) |
||||
{ |
||||
uLong uTotalOutBefore = zi->ci.stream.total_out; |
||||
err=deflate(&zi->ci.stream, Z_NO_FLUSH); |
||||
zi->ci.pos_in_buffered_data += zi->ci.stream.total_out - uTotalOutBefore ; |
||||
|
||||
} |
||||
else |
||||
{ |
||||
uInt copy_this,i; |
||||
if (zi->ci.stream.avail_in < zi->ci.stream.avail_out) |
||||
copy_this = zi->ci.stream.avail_in; |
||||
else |
||||
copy_this = zi->ci.stream.avail_out; |
||||
for (i=0;i<copy_this;i++) |
||||
*(((char*)zi->ci.stream.next_out)+i) = |
||||
*(((const char*)zi->ci.stream.next_in)+i); |
||||
{ |
||||
zi->ci.stream.avail_in -= copy_this; |
||||
zi->ci.stream.avail_out-= copy_this; |
||||
zi->ci.stream.next_in+= copy_this; |
||||
zi->ci.stream.next_out+= copy_this; |
||||
zi->ci.stream.total_in+= copy_this; |
||||
zi->ci.stream.total_out+= copy_this; |
||||
zi->ci.pos_in_buffered_data += copy_this; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
extern int ZEXPORT zipCloseFileInZip (file) |
||||
zipFile file; |
||||
{ |
||||
zip_internal* zi; |
||||
int err=ZIP_OK; |
||||
|
||||
if (file == NULL) |
||||
return ZIP_PARAMERROR; |
||||
zi = (zip_internal*)file; |
||||
|
||||
if (zi->in_opened_file_inzip == 0)
|
||||
return ZIP_PARAMERROR; |
||||
zi->ci.stream.avail_in = 0; |
||||
|
||||
if (zi->ci.method == Z_DEFLATED) |
||||
while (err==ZIP_OK) |
||||
{ |
||||
uLong uTotalOutBefore; |
||||
if (zi->ci.stream.avail_out == 0) |
||||
{ |
||||
if (fwrite(zi->ci.buffered_data,(uInt)zi->ci.pos_in_buffered_data,1,zi->filezip) |
||||
!=1) |
||||
err = ZIP_ERRNO; |
||||
zi->ci.pos_in_buffered_data = 0; |
||||
zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; |
||||
zi->ci.stream.next_out = zi->ci.buffered_data; |
||||
} |
||||
uTotalOutBefore = zi->ci.stream.total_out; |
||||
err=deflate(&zi->ci.stream, Z_FINISH); |
||||
zi->ci.pos_in_buffered_data += zi->ci.stream.total_out - uTotalOutBefore ; |
||||
} |
||||
|
||||
if (err==Z_STREAM_END) |
||||
err=ZIP_OK; /* this is normal */ |
||||
|
||||
if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK)) |
||||
if (fwrite(zi->ci.buffered_data,(uInt)zi->ci.pos_in_buffered_data,1,zi->filezip) |
||||
!=1) |
||||
err = ZIP_ERRNO; |
||||
|
||||
if ((zi->ci.method == Z_DEFLATED) && (err==ZIP_OK)) |
||||
{ |
||||
err=deflateEnd(&zi->ci.stream); |
||||
zi->ci.stream_initialised = 0; |
||||
} |
||||
|
||||
ziplocal_putValue_inmemory(zi->ci.central_header+16,zi->ci.crc32,4); /*crc*/ |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+20, |
||||
zi->ci.stream.total_out,4); /*compr size*/ |
||||
ziplocal_putValue_inmemory(zi->ci.central_header+24, |
||||
zi->ci.stream.total_in,4); /*uncompr size*/ |
||||
|
||||
if (err==ZIP_OK) |
||||
err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header, |
||||
(uLong)zi->ci.size_centralheader); |
||||
free(zi->ci.central_header); |
||||
|
||||
if (err==ZIP_OK) |
||||
{ |
||||
long cur_pos_inzip = ftell(zi->filezip); |
||||
if (fseek(zi->filezip, |
||||
zi->ci.pos_local_header + 14,SEEK_SET)!=0) |
||||
err = ZIP_ERRNO; |
||||
|
||||
if (err==ZIP_OK) |
||||
err = ziplocal_putValue(zi->filezip,zi->ci.crc32,4); /* crc 32, unknown */ |
||||
|
||||
if (err==ZIP_OK) /* compressed size, unknown */ |
||||
err = ziplocal_putValue(zi->filezip,zi->ci.stream.total_out,4);
|
||||
|
||||
if (err==ZIP_OK) /* uncompressed size, unknown */ |
||||
err = ziplocal_putValue(zi->filezip,zi->ci.stream.total_in,4); |
||||
|
||||
if (fseek(zi->filezip, |
||||
cur_pos_inzip,SEEK_SET)!=0) |
||||
err = ZIP_ERRNO; |
||||
} |
||||
|
||||
zi->number_entry ++; |
||||
zi->in_opened_file_inzip = 0; |
||||
|
||||
return err; |
||||
} |
||||
|
||||
extern int ZEXPORT zipClose (file, global_comment) |
||||
zipFile file; |
||||
const char* global_comment; |
||||
{ |
||||
zip_internal* zi; |
||||
int err = 0; |
||||
uLong size_centraldir = 0; |
||||
uLong centraldir_pos_inzip ; |
||||
uInt size_global_comment; |
||||
if (file == NULL) |
||||
return ZIP_PARAMERROR; |
||||
zi = (zip_internal*)file; |
||||
|
||||
if (zi->in_opened_file_inzip == 1) |
||||
{ |
||||
err = zipCloseFileInZip (file); |
||||
} |
||||
|
||||
if (global_comment==NULL) |
||||
size_global_comment = 0; |
||||
else |
||||
size_global_comment = strlen(global_comment); |
||||
|
||||
|
||||
centraldir_pos_inzip = ftell(zi->filezip); |
||||
if (err==ZIP_OK) |
||||
{ |
||||
linkedlist_datablock_internal* ldi = zi->central_dir.first_block ; |
||||
while (ldi!=NULL) |
||||
{ |
||||
if ((err==ZIP_OK) && (ldi->filled_in_this_block>0)) |
||||
if (fwrite(ldi->data,(uInt)ldi->filled_in_this_block, |
||||
1,zi->filezip) !=1 ) |
||||
err = ZIP_ERRNO; |
||||
|
||||
size_centraldir += ldi->filled_in_this_block; |
||||
ldi = ldi->next_datablock; |
||||
} |
||||
} |
||||
free_datablock(zi->central_dir.first_block); |
||||
|
||||
if (err==ZIP_OK) /* Magic End */ |
||||
err = ziplocal_putValue(zi->filezip,ENDHEADERMAGIC,4); |
||||
|
||||
if (err==ZIP_OK) /* number of this disk */ |
||||
err = ziplocal_putValue(zi->filezip,0,2); |
||||
|
||||
if (err==ZIP_OK) /* number of the disk with the start of the central directory */ |
||||
err = ziplocal_putValue(zi->filezip,0,2); |
||||
|
||||
if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ |
||||
err = ziplocal_putValue(zi->filezip,zi->number_entry,2); |
||||
|
||||
if (err==ZIP_OK) /* total number of entries in the central dir */ |
||||
err = ziplocal_putValue(zi->filezip,zi->number_entry,2); |
||||
|
||||
if (err==ZIP_OK) /* size of the central directory */ |
||||
err = ziplocal_putValue(zi->filezip,size_centraldir,4); |
||||
|
||||
if (err==ZIP_OK) /* offset of start of central directory with respect to the
|
||||
starting disk number */ |
||||
err = ziplocal_putValue(zi->filezip,centraldir_pos_inzip ,4); |
||||
|
||||
if (err==ZIP_OK) /* zipfile comment length */ |
||||
err = ziplocal_putValue(zi->filezip,(uLong)size_global_comment,2); |
||||
|
||||
if ((err==ZIP_OK) && (size_global_comment>0)) |
||||
if (fwrite(global_comment,(uInt)size_global_comment,1,zi->filezip) !=1 ) |
||||
err = ZIP_ERRNO; |
||||
fclose(zi->filezip); |
||||
TRYFREE(zi); |
||||
|
||||
return err; |
||||
} |
@ -0,0 +1,5 @@ |
||||
zipOpen @80 |
||||
zipOpenNewFileInZip @81 |
||||
zipWriteInFileInZip @82 |
||||
zipCloseFileInZip @83 |
||||
zipClose @84 |
@ -0,0 +1,150 @@ |
||||
/* zip.h -- IO for compress .zip files using zlib
|
||||
Version 0.15 alpha, Mar 19th, 1998, |
||||
|
||||
Copyright (C) 1998 Gilles Vollant |
||||
|
||||
This unzip package allow creates .ZIP file, compatible with PKZip 2.04g |
||||
WinZip, InfoZip tools and compatible. |
||||
Encryption and multi volume ZipFile (span) are not supported. |
||||
Old compressions used by old PKZip 1.x are not supported |
||||
|
||||
For uncompress .zip file, look at unzip.h |
||||
|
||||
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE |
||||
CAN CHANGE IN FUTURE VERSION !! |
||||
I WAIT FEEDBACK at mail info@winimage.com |
||||
Visit also http://www.winimage.com/zLibDll/zip.htm for evolution
|
||||
|
||||
Condition of use and distribution are the same than zlib : |
||||
|
||||
This software is provided 'as-is', without any express or implied |
||||
warranty. In no event will the authors be held liable for any damages |
||||
arising from the use of this software. |
||||
|
||||
Permission is granted to anyone to use this software for any purpose, |
||||
including commercial applications, and to alter it and redistribute it |
||||
freely, subject to the following restrictions: |
||||
|
||||
1. The origin of this software must not be misrepresented; you must not |
||||
claim that you wrote the original software. If you use this software |
||||
in a product, an acknowledgment in the product documentation would be |
||||
appreciated but is not required. |
||||
2. Altered source versions must be plainly marked as such, and must not be |
||||
misrepresented as being the original software. |
||||
3. This notice may not be removed or altered from any source distribution. |
||||
|
||||
|
||||
*/ |
||||
|
||||
/* for more info about .ZIP format, see
|
||||
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
|
||||
PkWare has also a specification at : |
||||
ftp://ftp.pkware.com/probdesc.zip
|
||||
*/ |
||||
|
||||
#ifndef _zip_H |
||||
#define _zip_H |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#ifndef _ZLIB_H |
||||
#include "zlib.h" |
||||
#endif |
||||
|
||||
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP) |
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */ |
||||
typedef struct TagzipFile__ { int unused; } zipFile__;
|
||||
typedef zipFile__ *zipFile; |
||||
#else |
||||
typedef voidp zipFile; |
||||
#endif |
||||
|
||||
#define ZIP_OK (0) |
||||
#define ZIP_ERRNO (Z_ERRNO) |
||||
#define ZIP_PARAMERROR (-102) |
||||
#define ZIP_INTERNALERROR (-104) |
||||
|
||||
/* tm_zip contain date/time info */ |
||||
typedef struct tm_zip_s
|
||||
{ |
||||
uInt tm_sec; /* seconds after the minute - [0,59] */ |
||||
uInt tm_min; /* minutes after the hour - [0,59] */ |
||||
uInt tm_hour; /* hours since midnight - [0,23] */ |
||||
uInt tm_mday; /* day of the month - [1,31] */ |
||||
uInt tm_mon; /* months since January - [0,11] */ |
||||
uInt tm_year; /* years - [1980..2044] */ |
||||
} tm_zip; |
||||
|
||||
typedef struct |
||||
{ |
||||
tm_zip tmz_date; /* date in understandable format */ |
||||
uLong dosDate; /* if dos_date == 0, tmu_date is used */ |
||||
/* uLong flag; */ /* general purpose bit flag 2 bytes */ |
||||
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */ |
||||
uLong external_fa; /* external file attributes 4 bytes */ |
||||
} zip_fileinfo; |
||||
|
||||
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); |
||||
/*
|
||||
Create a zipfile. |
||||
pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on |
||||
an Unix computer "zlib/zlib111.zip". |
||||
if the file pathname exist and append=1, the zip will be created at the end |
||||
of the file. (useful if the file contain a self extractor code) |
||||
If the zipfile cannot be opened, the return value is NULL. |
||||
Else, the return value is a zipFile Handle, usable with other function |
||||
of this zip package. |
||||
|
||||
|
||||
*/ |
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, |
||||
const char* filename, |
||||
const zip_fileinfo* zipfi, |
||||
const void* extrafield_local, |
||||
uInt size_extrafield_local, |
||||
const void* extrafield_global, |
||||
uInt size_extrafield_global, |
||||
const char* comment, |
||||
int method, |
||||
int level)); |
||||
/*
|
||||
Open a file in the ZIP for writing. |
||||
filename : the filename in zip (if NULL, '-' without quote will be used |
||||
*zipfi contain supplemental information |
||||
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local |
||||
contains the extrafield data the the local header |
||||
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global |
||||
contains the extrafield data the the local header |
||||
if comment != NULL, comment contain the comment string |
||||
method contain the compression method (0 for store, Z_DEFLATED for deflate) |
||||
level contain the level of compression (can be Z_DEFAULT_COMPRESSION) |
||||
*/ |
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, |
||||
const voidp buf, |
||||
unsigned len)); |
||||
/*
|
||||
Write data in the zipfile |
||||
*/ |
||||
|
||||
extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); |
||||
/*
|
||||
Close the current file in the zipfile |
||||
*/ |
||||
|
||||
extern int ZEXPORT zipClose OF((zipFile file, |
||||
const char* global_comment)); |
||||
/*
|
||||
Close the zipfile |
||||
*/ |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* _zip_H */ |
@ -0,0 +1,74 @@ |
||||
LIBRARY "zlib" |
||||
|
||||
DESCRIPTION '"""zlib data compression library"""' |
||||
|
||||
|
||||
VERSION 1.11 |
||||
|
||||
|
||||
HEAPSIZE 1048576,8192 |
||||
|
||||
EXPORTS |
||||
adler32 @1 |
||||
compress @2 |
||||
crc32 @3 |
||||
deflate @4 |
||||
deflateCopy @5 |
||||
deflateEnd @6 |
||||
deflateInit2_ @7 |
||||
deflateInit_ @8 |
||||
deflateParams @9 |
||||
deflateReset @10 |
||||
deflateSetDictionary @11 |
||||
gzclose @12 |
||||
gzdopen @13 |
||||
gzerror @14 |
||||
gzflush @15 |
||||
gzopen @16 |
||||
gzread @17 |
||||
gzwrite @18 |
||||
inflate @19 |
||||
inflateEnd @20 |
||||
inflateInit2_ @21 |
||||
inflateInit_ @22 |
||||
inflateReset @23 |
||||
inflateSetDictionary @24 |
||||
inflateSync @25 |
||||
uncompress @26 |
||||
zlibVersion @27 |
||||
gzprintf @28 |
||||
gzputc @29 |
||||
gzgetc @30 |
||||
gzseek @31 |
||||
gzrewind @32 |
||||
gztell @33 |
||||
gzeof @34 |
||||
gzsetparams @35 |
||||
zError @36 |
||||
inflateSyncPoint @37 |
||||
get_crc_table @38 |
||||
compress2 @39 |
||||
gzputs @40 |
||||
gzgets @41 |
||||
|
||||
unzOpen @61 |
||||
unzClose @62 |
||||
unzGetGlobalInfo @63 |
||||
unzGetCurrentFileInfo @64 |
||||
unzGoToFirstFile @65 |
||||
unzGoToNextFile @66 |
||||
unzOpenCurrentFile @67 |
||||
unzReadCurrentFile @68 |
||||
unztell @70 |
||||
unzeof @71 |
||||
unzCloseCurrentFile @72 |
||||
unzGetGlobalComment @73 |
||||
unzStringFileNameCompare @74 |
||||
unzLocateFile @75 |
||||
unzGetLocalExtrafield @76 |
||||
|
||||
zipOpen @80 |
||||
zipOpenNewFileInZip @81 |
||||
zipWriteInFileInZip @82 |
||||
zipCloseFileInZip @83 |
||||
zipClose @84 |
@ -0,0 +1,651 @@ |
||||
# Microsoft Developer Studio Project File - Name="zlibvc" - Package Owner=<4> |
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00 |
||||
# ** DO NOT EDIT ** |
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 |
||||
# TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 |
||||
|
||||
CFG=zlibvc - Win32 Release |
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
||||
!MESSAGE use the Export Makefile command and run |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "zlibvc.mak". |
||||
!MESSAGE |
||||
!MESSAGE You can specify a configuration when running NMAKE |
||||
!MESSAGE by defining the macro CFG on the command line. For example: |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Release" |
||||
!MESSAGE |
||||
!MESSAGE Possible choices for configuration are: |
||||
!MESSAGE |
||||
!MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") |
||||
!MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") |
||||
!MESSAGE "zlibvc - Win32 ReleaseAxp" (based on\ |
||||
"Win32 (ALPHA) Dynamic-Link Library") |
||||
!MESSAGE "zlibvc - Win32 ReleaseWithoutAsm" (based on\ |
||||
"Win32 (x86) Dynamic-Link Library") |
||||
!MESSAGE "zlibvc - Win32 ReleaseWithoutCrtdll" (based on\ |
||||
"Win32 (x86) Dynamic-Link Library") |
||||
!MESSAGE |
||||
|
||||
# Begin Project |
||||
# PROP Scc_ProjName "" |
||||
# PROP Scc_LocalPath "" |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir ".\Release" |
||||
# PROP BASE Intermediate_Dir ".\Release" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir ".\Release" |
||||
# PROP Intermediate_Dir ".\Release" |
||||
# PROP Ignore_Export_Lib 0 |
||||
# PROP Target_Dir "" |
||||
CPP=cl.exe |
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c |
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c |
||||
# SUBTRACT CPP /YX |
||||
MTL=midl.exe |
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32 |
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
RSC=rc.exe |
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG" |
||||
# ADD RSC /l 0x40c /d "NDEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 |
||||
# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll" |
||||
# SUBTRACT LINK32 /pdb:none |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 1 |
||||
# PROP BASE Output_Dir ".\Debug" |
||||
# PROP BASE Intermediate_Dir ".\Debug" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 1 |
||||
# PROP Output_Dir ".\Debug" |
||||
# PROP Intermediate_Dir ".\Debug" |
||||
# PROP Target_Dir "" |
||||
CPP=cl.exe |
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c |
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /FD /c |
||||
# SUBTRACT CPP /YX |
||||
MTL=midl.exe |
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32 |
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 |
||||
RSC=rc.exe |
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG" |
||||
# ADD RSC /l 0x40c /d "_DEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 |
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\zlib.dll" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir "zlibvc__" |
||||
# PROP BASE Intermediate_Dir "zlibvc__" |
||||
# PROP BASE Ignore_Export_Lib 0 |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir "zlibvc__" |
||||
# PROP Intermediate_Dir "zlibvc__" |
||||
# PROP Ignore_Export_Lib 0 |
||||
# PROP Target_Dir "" |
||||
MTL=midl.exe |
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
CPP=cl.exe |
||||
# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c |
||||
# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c |
||||
# SUBTRACT CPP /YX |
||||
RSC=rc.exe |
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG" |
||||
# ADD RSC /l 0x40c /d "NDEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:".\Release\zlib.dll" |
||||
# SUBTRACT BASE LINK32 /pdb:none |
||||
# ADD LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:"zlibvc__\zlib.dll" |
||||
# SUBTRACT LINK32 /pdb:none |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir "zlibvc_0" |
||||
# PROP BASE Intermediate_Dir "zlibvc_0" |
||||
# PROP BASE Ignore_Export_Lib 0 |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir "zlibvc_0" |
||||
# PROP Intermediate_Dir "zlibvc_0" |
||||
# PROP Ignore_Export_Lib 0 |
||||
# PROP Target_Dir "" |
||||
CPP=cl.exe |
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c |
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c |
||||
# SUBTRACT CPP /YX |
||||
MTL=midl.exe |
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
RSC=rc.exe |
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG" |
||||
# ADD RSC /l 0x40c /d "NDEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll" |
||||
# SUBTRACT BASE LINK32 /pdb:none |
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_0\zlib.dll" |
||||
# SUBTRACT LINK32 /pdb:none |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir "zlibvc_1" |
||||
# PROP BASE Intermediate_Dir "zlibvc_1" |
||||
# PROP BASE Ignore_Export_Lib 0 |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir "zlibvc_1" |
||||
# PROP Intermediate_Dir "zlibvc_1" |
||||
# PROP Ignore_Export_Lib 0 |
||||
# PROP Target_Dir "" |
||||
CPP=cl.exe |
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c |
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c |
||||
# SUBTRACT CPP /YX |
||||
MTL=midl.exe |
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
RSC=rc.exe |
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG" |
||||
# ADD RSC /l 0x40c /d "NDEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll" |
||||
# SUBTRACT BASE LINK32 /pdb:none |
||||
# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_1\zlib.dll" |
||||
# SUBTRACT LINK32 /pdb:none |
||||
|
||||
!ENDIF |
||||
|
||||
# Begin Target |
||||
|
||||
# Name "zlibvc - Win32 Release" |
||||
# Name "zlibvc - Win32 Debug" |
||||
# Name "zlibvc - Win32 ReleaseAxp" |
||||
# Name "zlibvc - Win32 ReleaseWithoutAsm" |
||||
# Name "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
# Begin Group "Source Files" |
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\adler32.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_ADLER=\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\compress.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_COMPR=\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\crc32.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_CRC32=\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\deflate.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_DEFLA=\ |
||||
".\deflate.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\gvmat32c.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\gzio.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_GZIO_=\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\infblock.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_INFBL=\ |
||||
".\infblock.h"\ |
||||
".\infcodes.h"\ |
||||
".\inftrees.h"\ |
||||
".\infutil.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\infcodes.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_INFCO=\ |
||||
".\infblock.h"\ |
||||
".\infcodes.h"\ |
||||
".\inffast.h"\ |
||||
".\inftrees.h"\ |
||||
".\infutil.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\inffast.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_INFFA=\ |
||||
".\infblock.h"\ |
||||
".\infcodes.h"\ |
||||
".\inffast.h"\ |
||||
".\inftrees.h"\ |
||||
".\infutil.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\inflate.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_INFLA=\ |
||||
".\infblock.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\inftrees.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_INFTR=\ |
||||
".\inftrees.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\infutil.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_INFUT=\ |
||||
".\infblock.h"\ |
||||
".\infcodes.h"\ |
||||
".\inftrees.h"\ |
||||
".\infutil.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\trees.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_TREES=\ |
||||
".\deflate.h"\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\uncompr.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_UNCOM=\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\unzip.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zip.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zlib.rc |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zlibvc.def |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zutil.c |
||||
|
||||
!IF "$(CFG)" == "zlibvc - Win32 Release" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp" |
||||
|
||||
DEP_CPP_ZUTIL=\ |
||||
".\zconf.h"\ |
||||
".\zlib.h"\ |
||||
".\zutil.h"\ |
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" |
||||
|
||||
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" |
||||
|
||||
!ENDIF |
||||
|
||||
# End Source File |
||||
# End Group |
||||
# Begin Group "Header Files" |
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\deflate.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\infblock.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\infcodes.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\inffast.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\inftrees.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\infutil.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zconf.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zlib.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\zutil.h |
||||
# End Source File |
||||
# End Group |
||||
# Begin Group "Resource Files" |
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" |
||||
# End Group |
||||
# End Target |
||||
# End Project |
@ -0,0 +1,41 @@ |
||||
Microsoft Developer Studio Workspace File, Format Version 5.00 |
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! |
||||
|
||||
############################################################################### |
||||
|
||||
Project: "zlibstat"=.\zlibstat.dsp - Package Owner=<4> |
||||
|
||||
Package=<5> |
||||
{{{ |
||||
}}} |
||||
|
||||
Package=<4> |
||||
{{{ |
||||
}}} |
||||
|
||||
############################################################################### |
||||
|
||||
Project: "zlibvc"=.\zlibvc.dsp - Package Owner=<4> |
||||
|
||||
Package=<5> |
||||
{{{ |
||||
}}} |
||||
|
||||
Package=<4> |
||||
{{{ |
||||
}}} |
||||
|
||||
############################################################################### |
||||
|
||||
Global: |
||||
|
||||
Package=<5> |
||||
{{{ |
||||
}}} |
||||
|
||||
Package=<3> |
||||
{{{ |
||||
}}} |
||||
|
||||
############################################################################### |
||||
|
@ -0,0 +1,125 @@ |
||||
/* inffixed.h -- table for decoding fixed codes
|
||||
* Generated automatically by the maketree.c program |
||||
*/ |
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is |
||||
subject to change. Applications should only use zlib.h. |
||||
*/ |
||||
|
||||
local uInt fixed_bl = 9; |
||||
local uInt fixed_bd = 5; |
||||
local inflate_huft fixed_tl[] = { |
||||
{{96,7},256}, {{0,8},80}, {{0,8},16}, {{84,8},115}, {{82,7},31}, |
||||
{{0,8},112}, {{0,8},48}, {{0,9},192}, {{80,7},10}, {{0,8},96}, |
||||
{{0,8},32}, {{0,9},160}, {{0,8},0}, {{0,8},128}, {{0,8},64}, |
||||
{{0,9},224}, {{80,7},6}, {{0,8},88}, {{0,8},24}, {{0,9},144}, |
||||
{{83,7},59}, {{0,8},120}, {{0,8},56}, {{0,9},208}, {{81,7},17}, |
||||
{{0,8},104}, {{0,8},40}, {{0,9},176}, {{0,8},8}, {{0,8},136}, |
||||
{{0,8},72}, {{0,9},240}, {{80,7},4}, {{0,8},84}, {{0,8},20}, |
||||
{{85,8},227}, {{83,7},43}, {{0,8},116}, {{0,8},52}, {{0,9},200}, |
||||
{{81,7},13}, {{0,8},100}, {{0,8},36}, {{0,9},168}, {{0,8},4}, |
||||
{{0,8},132}, {{0,8},68}, {{0,9},232}, {{80,7},8}, {{0,8},92}, |
||||
{{0,8},28}, {{0,9},152}, {{84,7},83}, {{0,8},124}, {{0,8},60}, |
||||
{{0,9},216}, {{82,7},23}, {{0,8},108}, {{0,8},44}, {{0,9},184}, |
||||
{{0,8},12}, {{0,8},140}, {{0,8},76}, {{0,9},248}, {{80,7},3}, |
||||
{{0,8},82}, {{0,8},18}, {{85,8},163}, {{83,7},35}, {{0,8},114}, |
||||
{{0,8},50}, {{0,9},196}, {{81,7},11}, {{0,8},98}, {{0,8},34}, |
||||
{{0,9},164}, {{0,8},2}, {{0,8},130}, {{0,8},66}, {{0,9},228}, |
||||
{{80,7},7}, {{0,8},90}, {{0,8},26}, {{0,9},148}, {{84,7},67}, |
||||
{{0,8},122}, {{0,8},58}, {{0,9},212}, {{82,7},19}, {{0,8},106}, |
||||
{{0,8},42}, {{0,9},180}, {{0,8},10}, {{0,8},138}, {{0,8},74}, |
||||
{{0,9},244}, {{80,7},5}, {{0,8},86}, {{0,8},22}, {{192,8},0}, |
||||
{{83,7},51}, {{0,8},118}, {{0,8},54}, {{0,9},204}, {{81,7},15}, |
||||
{{0,8},102}, {{0,8},38}, {{0,9},172}, {{0,8},6}, {{0,8},134}, |
||||
{{0,8},70}, {{0,9},236}, {{80,7},9}, {{0,8},94}, {{0,8},30}, |
||||
{{0,9},156}, {{84,7},99}, {{0,8},126}, {{0,8},62}, {{0,9},220}, |
||||
{{82,7},27}, {{0,8},110}, {{0,8},46}, {{0,9},188}, {{0,8},14}, |
||||
{{0,8},142}, {{0,8},78}, {{0,9},252}, {{96,7},256}, {{0,8},81}, |
||||
{{0,8},17}, {{85,8},131}, {{82,7},31}, {{0,8},113}, {{0,8},49}, |
||||
{{0,9},194}, {{80,7},10}, {{0,8},97}, {{0,8},33}, {{0,9},162}, |
||||
{{0,8},1}, {{0,8},129}, {{0,8},65}, {{0,9},226}, {{80,7},6}, |
||||
{{0,8},89}, {{0,8},25}, {{0,9},146}, {{83,7},59}, {{0,8},121}, |
||||
{{0,8},57}, {{0,9},210}, {{81,7},17}, {{0,8},105}, {{0,8},41}, |
||||
{{0,9},178}, {{0,8},9}, {{0,8},137}, {{0,8},73}, {{0,9},242}, |
||||
{{80,7},4}, {{0,8},85}, {{0,8},21}, {{80,8},258}, {{83,7},43}, |
||||
{{0,8},117}, {{0,8},53}, {{0,9},202}, {{81,7},13}, {{0,8},101}, |
||||
{{0,8},37}, {{0,9},170}, {{0,8},5}, {{0,8},133}, {{0,8},69}, |
||||
{{0,9},234}, {{80,7},8}, {{0,8},93}, {{0,8},29}, {{0,9},154}, |
||||
{{84,7},83}, {{0,8},125}, {{0,8},61}, {{0,9},218}, {{82,7},23}, |
||||
{{0,8},109}, {{0,8},45}, {{0,9},186}, {{0,8},13}, {{0,8},141}, |
||||
{{0,8},77}, {{0,9},250}, {{80,7},3}, {{0,8},83}, {{0,8},19}, |
||||
{{85,8},195}, {{83,7},35}, {{0,8},115}, {{0,8},51}, {{0,9},198}, |
||||
{{81,7},11}, {{0,8},99}, {{0,8},35}, {{0,9},166}, {{0,8},3}, |
||||
{{0,8},131}, {{0,8},67}, {{0,9},230}, {{80,7},7}, {{0,8},91}, |
||||
{{0,8},27}, {{0,9},150}, {{84,7},67}, {{0,8},123}, {{0,8},59}, |
||||
{{0,9},214}, {{82,7},19}, {{0,8},107}, {{0,8},43}, {{0,9},182}, |
||||
{{0,8},11}, {{0,8},139}, {{0,8},75}, {{0,9},246}, {{80,7},5}, |
||||
{{0,8},87}, {{0,8},23}, {{192,8},0}, {{83,7},51}, {{0,8},119}, |
||||
{{0,8},55}, {{0,9},206}, {{81,7},15}, {{0,8},103}, {{0,8},39}, |
||||
{{0,9},174}, {{0,8},7}, {{0,8},135}, {{0,8},71}, {{0,9},238}, |
||||
{{80,7},9}, {{0,8},95}, {{0,8},31}, {{0,9},158}, {{84,7},99}, |
||||
{{0,8},127}, {{0,8},63}, {{0,9},222}, {{82,7},27}, {{0,8},111}, |
||||
{{0,8},47}, {{0,9},190}, {{0,8},15}, {{0,8},143}, {{0,8},79}, |
||||
{{0,9},254}, {{96,7},256}, {{0,8},80}, {{0,8},16}, {{84,8},115}, |
||||
{{82,7},31}, {{0,8},112}, {{0,8},48}, {{0,9},193}, {{80,7},10}, |
||||
{{0,8},96}, {{0,8},32}, {{0,9},161}, {{0,8},0}, {{0,8},128}, |
||||
{{0,8},64}, {{0,9},225}, {{80,7},6}, {{0,8},88}, {{0,8},24}, |
||||
{{0,9},145}, {{83,7},59}, {{0,8},120}, {{0,8},56}, {{0,9},209}, |
||||
{{81,7},17}, {{0,8},104}, {{0,8},40}, {{0,9},177}, {{0,8},8}, |
||||
{{0,8},136}, {{0,8},72}, {{0,9},241}, {{80,7},4}, {{0,8},84}, |
||||
{{0,8},20}, {{85,8},227}, {{83,7},43}, {{0,8},116}, {{0,8},52}, |
||||
{{0,9},201}, {{81,7},13}, {{0,8},100}, {{0,8},36}, {{0,9},169}, |
||||
{{0,8},4}, {{0,8},132}, {{0,8},68}, {{0,9},233}, {{80,7},8}, |
||||
{{0,8},92}, {{0,8},28}, {{0,9},153}, {{84,7},83}, {{0,8},124}, |
||||
{{0,8},60}, {{0,9},217}, {{82,7},23}, {{0,8},108}, {{0,8},44}, |
||||
{{0,9},185}, {{0,8},12}, {{0,8},140}, {{0,8},76}, {{0,9},249}, |
||||
{{80,7},3}, {{0,8},82}, {{0,8},18}, {{85,8},163}, {{83,7},35}, |
||||
{{0,8},114}, {{0,8},50}, {{0,9},197}, {{81,7},11}, {{0,8},98}, |
||||
{{0,8},34}, {{0,9},165}, {{0,8},2}, {{0,8},130}, {{0,8},66}, |
||||
{{0,9},229}, {{80,7},7}, {{0,8},90}, {{0,8},26}, {{0,9},149}, |
||||
{{84,7},67}, {{0,8},122}, {{0,8},58}, {{0,9},213}, {{82,7},19}, |
||||
{{0,8},106}, {{0,8},42}, {{0,9},181}, {{0,8},10}, {{0,8},138}, |
||||
{{0,8},74}, {{0,9},245}, {{80,7},5}, {{0,8},86}, {{0,8},22}, |
||||
{{192,8},0}, {{83,7},51}, {{0,8},118}, {{0,8},54}, {{0,9},205}, |
||||
{{81,7},15}, {{0,8},102}, {{0,8},38}, {{0,9},173}, {{0,8},6}, |
||||
{{0,8},134}, {{0,8},70}, {{0,9},237}, {{80,7},9}, {{0,8},94}, |
||||
{{0,8},30}, {{0,9},157}, {{84,7},99}, {{0,8},126}, {{0,8},62}, |
||||
{{0,9},221}, {{82,7},27}, {{0,8},110}, {{0,8},46}, {{0,9},189}, |
||||
{{0,8},14}, {{0,8},142}, {{0,8},78}, {{0,9},253}, {{96,7},256}, |
||||
{{0,8},81}, {{0,8},17}, {{85,8},131}, {{82,7},31}, {{0,8},113}, |
||||
{{0,8},49}, {{0,9},195}, {{80,7},10}, {{0,8},97}, {{0,8},33}, |
||||
{{0,9},163}, {{0,8},1}, {{0,8},129}, {{0,8},65}, {{0,9},227}, |
||||
{{80,7},6}, {{0,8},89}, {{0,8},25}, {{0,9},147}, {{83,7},59}, |
||||
{{0,8},121}, {{0,8},57}, {{0,9},211}, {{81,7},17}, {{0,8},105}, |
||||
{{0,8},41}, {{0,9},179}, {{0,8},9}, {{0,8},137}, {{0,8},73}, |
||||
{{0,9},243}, {{80,7},4}, {{0,8},85}, {{0,8},21}, {{80,8},258}, |
||||
{{83,7},43}, {{0,8},117}, {{0,8},53}, {{0,9},203}, {{81,7},13}, |
||||
{{0,8},101}, {{0,8},37}, {{0,9},171}, {{0,8},5}, {{0,8},133}, |
||||
{{0,8},69}, {{0,9},235}, {{80,7},8}, {{0,8},93}, {{0,8},29}, |
||||
{{0,9},155}, {{84,7},83}, {{0,8},125}, {{0,8},61}, {{0,9},219}, |
||||
{{82,7},23}, {{0,8},109}, {{0,8},45}, {{0,9},187}, {{0,8},13}, |
||||
{{0,8},141}, {{0,8},77}, {{0,9},251}, {{80,7},3}, {{0,8},83}, |
||||
{{0,8},19}, {{85,8},195}, {{83,7},35}, {{0,8},115}, {{0,8},51}, |
||||
{{0,9},199}, {{81,7},11}, {{0,8},99}, {{0,8},35}, {{0,9},167}, |
||||
{{0,8},3}, {{0,8},131}, {{0,8},67}, {{0,9},231}, {{80,7},7}, |
||||
{{0,8},91}, {{0,8},27}, {{0,9},151}, {{84,7},67}, {{0,8},123}, |
||||
{{0,8},59}, {{0,9},215}, {{82,7},19}, {{0,8},107}, {{0,8},43}, |
||||
{{0,9},183}, {{0,8},11}, {{0,8},139}, {{0,8},75}, {{0,9},247}, |
||||
{{80,7},5}, {{0,8},87}, {{0,8},23}, {{192,8},0}, {{83,7},51}, |
||||
{{0,8},119}, {{0,8},55}, {{0,9},207}, {{81,7},15}, {{0,8},103}, |
||||
{{0,8},39}, {{0,9},175}, {{0,8},7}, {{0,8},135}, {{0,8},71}, |
||||
{{0,9},239}, {{80,7},9}, {{0,8},95}, {{0,8},31}, {{0,9},159}, |
||||
{{84,7},99}, {{0,8},127}, {{0,8},63}, {{0,9},223}, {{82,7},27}, |
||||
{{0,8},111}, {{0,8},47}, {{0,9},191}, {{0,8},15}, {{0,8},143}, |
||||
{{0,8},79}, {{0,9},255} |
||||
}; |
||||
local inflate_huft fixed_td[] = { |
||||
{{80,5},1}, {{87,5},257}, {{83,5},17}, {{91,5},4097}, {{81,5},5}, |
||||
{{89,5},1025}, {{85,5},65}, {{93,5},16385}, {{80,5},3}, {{88,5},513}, |
||||
{{84,5},33}, {{92,5},8193}, {{82,5},9}, {{90,5},2049}, {{86,5},129}, |
||||
{{192,5},24577}, {{80,5},2}, {{87,5},385}, {{83,5},25}, {{91,5},6145}, |
||||
{{81,5},7}, {{89,5},1537}, {{85,5},97}, {{93,5},24577}, {{80,5},4}, |
||||
{{88,5},769}, {{84,5},49}, {{92,5},12289}, {{82,5},13}, {{90,5},3073}, |
||||
{{86,5},193}, {{192,5},24577} |
||||
}; |
@ -0,0 +1,119 @@ |
||||
/* maketree.c -- make inffixed.h table for decoding fixed codes
|
||||
* Copyright (C) 1998 Mark Adler |
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/ |
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is |
||||
subject to change. Applications should only use zlib.h. |
||||
*/ |
||||
|
||||
/* This program is included in the distribution for completeness.
|
||||
You do not need to compile or run this program since inffixed.h |
||||
is already included in the distribution. To use this program |
||||
you need to compile zlib with BUILDFIXED defined and then compile |
||||
and link this program with the zlib library. Then the output of |
||||
this program can be piped to inffixed.h. */ |
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include "zutil.h" |
||||
#include "inftrees.h" |
||||
|
||||
/* simplify the use of the inflate_huft type with some defines */ |
||||
#define exop word.what.Exop |
||||
#define bits word.what.Bits |
||||
|
||||
/* showtree is only used for debugging purposes */ |
||||
void showtree(uInt b, inflate_huft *t, int d) |
||||
{ |
||||
int i, e; |
||||
char p[2*d+1]; |
||||
|
||||
for (i = 0; i < 2*d; i++) |
||||
p[i] = ' '; |
||||
p[i] = 0; |
||||
printf("%s[%d]\n", p, 1<<b); |
||||
for (i = 0; i < (1<<b); i++) |
||||
{ |
||||
e = t[i].exop; |
||||
if (e == 0) /* simple code */ |
||||
printf("%s%d(%d): literal=%d\n", p, i, t[i].bits, t[i].base); |
||||
else if (e & 16) /* length */ |
||||
printf("%s%d(%d): length/distance=%d+(%d)\n", |
||||
p, i, t[i].bits, t[i].base, e & 15); |
||||
else if ((e & 64) == 0) /* next table */ |
||||
{ |
||||
printf("%s%d(%d): *sub table*\n", p, i, t[i].bits); |
||||
showtree(e, t + t[i].base, d + 1); |
||||
} |
||||
else if (e & 32) /* end of block */ |
||||
printf("%s%d(%d): end of block\n", p, i, t[i].bits); |
||||
else /* bad code */ |
||||
printf("%s%d: bad code\n", p, i); |
||||
} |
||||
} |
||||
|
||||
/* generate initialization table for an inflate_huft structure array */ |
||||
void maketree(uInt b, inflate_huft *t) |
||||
{ |
||||
int i, e; |
||||
|
||||
i = 0; |
||||
while (1) |
||||
{ |
||||
e = t[i].exop; |
||||
if (e && (e & (16+64)) == 0) /* table pointer */ |
||||
{ |
||||
fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); |
||||
exit(1); |
||||
} |
||||
if (i % 5 == 0) |
||||
printf("\n "); |
||||
printf(" {{%u,%u},%u}", t[i].exop, t[i].bits, t[i].base); |
||||
if (++i == (1<<b)) |
||||
break; |
||||
putchar(','); |
||||
} |
||||
puts(""); |
||||
} |
||||
|
||||
/* create the fixed tables in C initialization syntax */ |
||||
void main(void) |
||||
{ |
||||
int r; |
||||
uInt bl, bd; |
||||
inflate_huft *tl, *td; |
||||
z_stream z; |
||||
|
||||
z.zalloc = zcalloc; |
||||
z.opaque = (voidpf)0; |
||||
z.zfree = zcfree; |
||||
r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z); |
||||
if (r) |
||||
{ |
||||
fprintf(stderr, "inflate_trees_fixed error %d\n", r); |
||||
return; |
||||
} |
||||
/* puts("Literal/Length Tree:");
|
||||
showtree(bl, tl, 1); |
||||
puts("Distance Tree:"); |
||||
showtree(bd, td, 1); */ |
||||
puts("/* inffixed.h -- table for decoding fixed codes"); |
||||
puts(" * Generated automatically by the maketree.c program"); |
||||
puts(" */"); |
||||
puts(""); |
||||
puts("/* WARNING: this file should *not* be used by applications. It is"); |
||||
puts(" part of the implementation of the compression library and is"); |
||||
puts(" subject to change. Applications should only use zlib.h."); |
||||
puts(" */"); |
||||
puts(""); |
||||
printf("local uInt fixed_bl = %d;\n", bl); |
||||
printf("local uInt fixed_bd = %d;\n", bd); |
||||
printf("local inflate_huft fixed_tl[] = {"); |
||||
maketree(bl, tl); |
||||
puts(" };"); |
||||
printf("local inflate_huft fixed_td[] = {"); |
||||
maketree(bd, td); |
||||
puts(" };"); |
||||
} |
Loading…
Reference in new issue