From e775f6d3dcf0edd51d5dd66e34ee076ccedd5bed Mon Sep 17 00:00:00 2001 From: Luiz Rafael Culik Date: Thu, 29 Jun 2000 02:18:07 +0000 Subject: [PATCH] See changelog 20000628-23:20 GMT -3 --- harbour/contrib/hbzlib/hbzip.h | 7 ++--- harbour/contrib/hbzlib/makefile.bc | 10 +++---- harbour/contrib/hbzlib/zipfile2.c | 48 +++++++++++++++--------------- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/harbour/contrib/hbzlib/hbzip.h b/harbour/contrib/hbzlib/hbzip.h index 5bf267b272..4af01c8c1e 100644 --- a/harbour/contrib/hbzlib/hbzip.h +++ b/harbour/contrib/hbzlib/hbzip.h @@ -36,7 +36,7 @@ #ifndef HB_APIZLIB_H_ #define HB_APIZLIB_H_ - +#include "hbsetup.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbapifs.h" @@ -53,10 +53,9 @@ extern uLong hb___filetime(char *f, tm_zip *tmzip, uLong *dt); extern char *hb___CheckFile( char * szFile); extern int hb___CompressOneFile(char *szFile,char *szFiletoCompress,int iCompLevel,PHB_ITEM pBlock,BOOL iOverWrite); extern int hb___CompressMultipleFile(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL iOverWrite); -extern int hb___unZipFiles(char *szFile,PHB_ITEM pBlock); +extern int hb___unZipFiles(char *szFile,PHB_ITEM pBlock,BOOL iExtractPath); extern int hb___ExtractCurrentFile(unzFile uf,const int* popt_extract_without_path,int* popt_overwrite,PHB_ITEM pBlock); -extern void hb____ChangeFileDate(const char *filename,uLong dosdate,tm_unz tmu_date); -extern int hb___MyMkdir(const char *DirectoryName); +extern void hb____ChangeFileDate(char *filename,uLong dosdate,tm_unz tmu_date); extern int hb___MakeDir(char *NewDirectory); #if defined(HB_EXTERN_C) } diff --git a/harbour/contrib/hbzlib/makefile.bc b/harbour/contrib/hbzlib/makefile.bc index 275ff7e4c6..d180bb51ab 100644 --- a/harbour/contrib/hbzlib/makefile.bc +++ b/harbour/contrib/hbzlib/makefile.bc @@ -37,9 +37,9 @@ HB_GT_LIB = $(GTWIN_LIB) ARFLAGS = /P32 -!if !$d(BCC_NOOPTIM) -CFLAGS = -O2 $(CFLAGS) -!endif +#!if !$d(BCC_NOOPTIM) +#CFLAGS = -O2- $(CFLAGS) +#!endif # # Directory macros. These should never have to change. @@ -48,7 +48,7 @@ CFLAGS = -O2 $(CFLAGS) INCLUDE_DIR = ..\..\include ZLIB_DIR = . WINSYS_DIR = \WINDOWS\SYSTEM -CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS) -v -y +CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS) -y CLIBFLAGS =$(CFLAGS) HARBOUR_EXE = $(BIN_DIR)\harbour.exe HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) @@ -102,7 +102,7 @@ $(OBJ_DIR)\zlibapi.obj : $(ZLIB_DIR)\zlibapi.c tlib $(ZLIB_LIB) $(ARFLAGS) -+$@,, $(ZLIB_BOR_DEF) : $(ZLIB_DEF_OBJ) - $(ID) $(LIB_DIR)\zlib.def $(ZLIB_DIR)\zlib.dll + $(ID) -a $(LIB_DIR)\zlib.def $(ZLIB_DIR)\zlib.dll $(ZLIB_BOR_LIB) : $(ZLIB_BOR_LIB_OBJ) $(IL) $(LIB_DIR)\zlib_bor.lib $(LIB_DIR)\zlib.def diff --git a/harbour/contrib/hbzlib/zipfile2.c b/harbour/contrib/hbzlib/zipfile2.c index 3ad4f99879..4397b866a7 100644 --- a/harbour/contrib/hbzlib/zipfile2.c +++ b/harbour/contrib/hbzlib/zipfile2.c @@ -54,9 +54,9 @@ #define WRITEBUFFERSIZE (8192) extern int err; -void hb____ChangeFileDate(const char *filename,uLong dosdate,tm_unz tmu_date) +void hb____ChangeFileDate(char *filename,uLong dosdate,tm_unz tmu_date) { -#ifdef defined(HB_OS_WIN_32) +#if defined(HB_OS_WIN_32) HANDLE hFile; FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; HB_SYMBOL_UNUSED(tmu_date); @@ -90,14 +90,6 @@ void hb____ChangeFileDate(const char *filename,uLong dosdate,tm_unz tmu_date) /* mymkdir and change_file_date are not 100 % portable As I don't know well Unix, I wait feedback for the unix portion */ - -int hb___MyMkdir(const char *DirectoryName) -{ - int uiReturn; - uiReturn = mkdir(DirectoryName); - return uiReturn; -} - int hb___MakeDir(char *NewDirectory) { char *szBuffer ; @@ -113,7 +105,7 @@ int hb___MakeDir(char *NewDirectory) if (szBuffer[uiLen-1] == '/') { szBuffer[uiLen-1] = '\0'; } - if (hb___MyMkdir(szBuffer) == 0) + if (hb_fsMkDir(szBuffer)) { hb_xfree((void*) szBuffer); return 1; @@ -123,12 +115,13 @@ int hb___MakeDir(char *NewDirectory) while (1) { char hold; - + int iResult; while(*p && *p != '\\' && *p != '/') p++; hold = *p; *p = 0; - if ((hb___MyMkdir(szBuffer) == -1) && (errno == ENOENT)) + iResult=hb_fsMkDir(szBuffer); + if (( iResult== -1) && (errno == ENOENT)) { hb_xfree((void*) szBuffer); return 0; @@ -188,14 +181,15 @@ int hb___Extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,PHB_I -int hb___unZipFiles(char *szFile,PHB_ITEM pBlock) +int hb___unZipFiles(char *szFile,PHB_ITEM pBlock,BOOL iExtractPath) { const char *szZipFileName=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_do_extract_withoutpath=iExtractPath; + int opt_overwrite=0; char filename_try[512]; unzFile uf=NULL; @@ -240,7 +234,7 @@ int hb___ExtractCurrentFile(unzFile uf,const int* popt_extract_without_path,int* char filename_inzip[256]; char* filename_withoutpath; char* p; - + char NewFileToWrite[256]; FHANDLE fout; BYTE * buf; uInt size_buf; @@ -261,7 +255,7 @@ int hb___ExtractCurrentFile(unzFile uf,const int* popt_extract_without_path,int* { return UNZ_INTERNALERROR; } - + strcpy(NewFileToWrite,filename_inzip); p = filename_withoutpath = filename_inzip; while ((*p) != '\0') { @@ -274,19 +268,25 @@ int hb___ExtractCurrentFile(unzFile uf,const int* popt_extract_without_path,int* { if ((*popt_extract_without_path)==0) { - hb___MyMkdir(filename_inzip); + hb_fsMkDir(filename_inzip); } } else { - const char* write_filename; + + char* write_filename; int skip=0; - if ((*popt_extract_without_path)==0) - write_filename = filename_inzip; - else - write_filename = filename_withoutpath; + if ((*popt_extract_without_path)==0) { + write_filename = filename_inzip; + + } + else { + + write_filename = filename_withoutpath; + + } if(pBlock !=NULL){ PHB_ITEM pFileName=hb_itemPutC(NULL, (char *)write_filename); hb_vmEvalBlockV( pBlock, 1, pFileName ); @@ -306,7 +306,7 @@ int hb___ExtractCurrentFile(unzFile uf,const int* popt_extract_without_path,int* /* some zipfile don't contain directory alone before file */ - if ((fout==NULL) && ((*popt_extract_without_path)==0) && + if ((fout==-1) && ((*popt_extract_without_path)==0) && (filename_withoutpath!=(char*)filename_inzip)) { char c=*(filename_withoutpath-1);