2008-01-17 16:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/hbzlib/ioapi.c
  * harbour/contrib/hbzlib/zip.c
  * harbour/contrib/hbzlib/unzip.c
  * harbour/contrib/hbzlib/crypt.h
  * harbour/contrib/hbzlib/hbzlib.c
  * harbour/contrib/hbzlib/hbmzip.c
    * casting for C++ compilation
    * changed function declaration for C++ compilation
    * removed #include "errno.h" - some platforms do not have it
    * updated WIN32 API for WinCE and UNICODE builds
    * use localtime_r() only for Linux builds - TODO: create our own
      API for it and remove all #if... from core code so we will have
      it only in one place easy to update for different platforms

  * harbour/contrib/hbzlib/common.mak
    * replaced TABs with SPACEs

  * harbour/harbour-ce-spec
  * harbour/harbour-w32-spec
  * harbour/harbour.spec
  * harbour/bin/hb-func.sh
  * harbour/contrib/Makefile
    + added hbzlib to contrib libraries compiled by default
This commit is contained in:
Przemyslaw Czerpak
2008-01-17 15:51:12 +00:00
parent 9c37ecf0d7
commit eec720e9e9
13 changed files with 309 additions and 302 deletions

View File

@@ -8,6 +8,31 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-01-17 16:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbzlib/ioapi.c
* harbour/contrib/hbzlib/zip.c
* harbour/contrib/hbzlib/unzip.c
* harbour/contrib/hbzlib/crypt.h
* harbour/contrib/hbzlib/hbzlib.c
* harbour/contrib/hbzlib/hbmzip.c
* casting for C++ compilation
* changed function declaration for C++ compilation
* removed #include "errno.h" - some platforms do not have it
* updated WIN32 API for WinCE and UNICODE builds
* use localtime_r() only for Linux builds - TODO: create our own
API for it and remove all #if... from core code so we will have
it only in one place easy to update for different platforms
* harbour/contrib/hbzlib/common.mak
* replaced TABs with SPACEs
* harbour/harbour-ce-spec
* harbour/harbour-w32-spec
* harbour/harbour.spec
* harbour/bin/hb-func.sh
* harbour/contrib/Makefile
+ added hbzlib to contrib libraries compiled by default
2008-01-16 12:03 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/make_b32_all.bat
* contrib/make_vc_all.bat

View File

@@ -88,7 +88,7 @@ mk_hbgetlibsctb()
then
libs="$libs gtwin"
fi
echo -n "$libs hbrddads hbct hbnf hbtip xhb hbgd hbodbc hbpg hbmysql hbrddado hbw32 hbgtwvg"
echo -n "$libs hbrddads hbct hbnf hbzlib hbtip xhb hbgd hbodbc hbpg hbmysql hbrddado hbw32 hbgtwvg"
else
echo -n "$@"
fi
@@ -603,7 +603,7 @@ mk_hblibso()
for l in ${hb_libs}
do
case $l in
debug|profiler|fm|hbodbc|gtalleg|rddads) ;;
debug|profiler|fm|hbodbc|gtalleg|hbrddads) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]

View File

@@ -11,6 +11,7 @@ DIRS=\
hbmisc \
hbnf \
hbclipsm \
hbzlib \
xhb \
# examples \

View File

@@ -10,11 +10,11 @@ PRG_HEADERS = \
hbzlib.ch \
LIB_OBJS = \
$(OBJ_DIR)\ioapi$(OBJEXT) \
$(OBJ_DIR)\zip$(OBJEXT) \
$(OBJ_DIR)\unzip$(OBJEXT) \
$(OBJ_DIR)\hbzlib$(OBJEXT) \
$(OBJ_DIR)\hbmzip$(OBJEXT) \
$(OBJ_DIR)\ioapi$(OBJEXT) \
$(OBJ_DIR)\zip$(OBJEXT) \
$(OBJ_DIR)\unzip$(OBJEXT) \
$(OBJ_DIR)\hbzlib$(OBJEXT) \
$(OBJ_DIR)\hbmzip$(OBJEXT) \
all: \
$(LIB_PATH) \

View File

@@ -89,13 +89,9 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned lon
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
const char *passwd; /* password string */
unsigned char *buf; /* where to write header */
int bufSize;
unsigned long* pkeys;
const unsigned long* pcrc_32_tab;
unsigned long crcForCrypting;
static int crypthead(const char * passwd, unsigned char * buf, int bufSize,
unsigned long * pkeys, const unsigned long * pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
int t; /* temporary */

View File

@@ -85,7 +85,7 @@ static HB_GARBAGE_FUNC( hb_zipfile_destructor )
static gzFile hb_zipfileParam( int iParam )
{
zipFile* phZip = hb_parptrGC( hb_zipfile_destructor, iParam );
zipFile* phZip = ( zipFile* ) hb_parptrGC( hb_zipfile_destructor, iParam );
if( phZip && * phZip )
return * phZip;
@@ -109,7 +109,7 @@ static HB_GARBAGE_FUNC( hb_unzipfile_destructor )
static gzFile hb_unzipfileParam( int iParam )
{
unzFile* phUnzip = hb_parptrGC( hb_unzipfile_destructor, iParam );
unzFile* phUnzip = ( unzFile* ) hb_parptrGC( hb_unzipfile_destructor, iParam );
if( phUnzip && * phUnzip )
return * phUnzip;
@@ -148,7 +148,7 @@ HB_FUNC( HB_ZIPOPEN )
/* HB_ZipClose( hZip ) --> nError */
HB_FUNC( HB_ZIPCLOSE )
{
zipFile* phZip = hb_parptrGC( hb_zipfile_destructor, 1 );
zipFile* phZip = ( zipFile* ) hb_parptrGC( hb_zipfile_destructor, 1 );
if( phZip && * phZip )
{
@@ -258,7 +258,7 @@ HB_FUNC( HB_UNZIPOPEN )
/* HB_UnzipClose( hUnzip ) --> nError */
HB_FUNC( HB_UNZIPCLOSE )
{
unzFile* phUnzip = hb_parptrGC( hb_unzipfile_destructor, 1 );
unzFile* phUnzip = ( unzFile* ) hb_parptrGC( hb_unzipfile_destructor, 1 );
if( phUnzip && * phUnzip )
{
@@ -470,11 +470,11 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName )
#if defined( HB_OS_WIN_32 )
{
ulExtAttr = GetFileAttributes( szFileName );
ulExtAttr = GetFileAttributesA( szFileName );
if( (LONG) ulExtAttr != -1 )
{
ulExtAttr = GetFileAttributes( szFileName ) &
ulExtAttr = GetFileAttributesA( szFileName ) &
( FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN |
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY |
FILE_ATTRIBUTE_ARCHIVE );
@@ -524,7 +524,11 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName )
ulExtAttr |= ( statbuf.st_mode & S_IRWXG ) << 15;
ulExtAttr |= ( statbuf.st_mode & S_IRWXU ) << 14;
#if defined( HB_OS_LINUX ) && !defined( __WATCOMC__ )
localtime_r( &statbuf.st_mtime, &st );
#else
memcpy( &st, localtime( &statbuf.st_mtime ), sizeof( st ) );
#endif
zfi.tmz_date.tm_sec = st.tm_sec;
zfi.tmz_date.tm_min = st.tm_min;
@@ -564,7 +568,7 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName )
}
else
{
hFile = hb_fsOpen( szFileName, 0 );
hFile = hb_fsOpen( (BYTE*) szFileName, FO_READ );
if( hFile != FS_ERROR )
{
@@ -591,7 +595,7 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName )
if( iResult == 0 )
{
pString = (char*) hb_xgrab( 1024 * 16 );
while ( ( ulLen = hb_fsReadLarge( hFile, pString, 1024 * 16 ) ) > 0 )
while ( ( ulLen = hb_fsReadLarge( hFile, (BYTE*) pString, 1024 * 16 ) ) > 0 )
{
zipWriteInFileInZip( hZip, pString, ulLen );
}
@@ -666,7 +670,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName )
if( ( cSep == '\\' || cSep == '/' ) && ulPos < ulLen - 1 )
{
szName[ ulPos ] = '\0';
hb_fsMkDir( szName );
hb_fsMkDir( (BYTE*) szName );
szName[ ulPos ] = cSep;
}
ulPos++;
@@ -674,12 +678,12 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName )
if( ufi.external_fa & 0x40000000 ) /* DIRECTORY */
{
hb_fsMkDir( szName );
hb_fsMkDir( (BYTE*) szName );
iResult = 0;
}
else
{
hFile = hb_fsCreate( szName, 0 );
hFile = hb_fsCreate( (BYTE*) szName, 0 );
if( hFile != FS_ERROR )
{
@@ -687,7 +691,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName )
while ( ( iResult = unzReadCurrentFile( hUnzip, pString, 16 * 1024 ) ) > 0 )
{
hb_fsWriteLarge( hFile, pString, (ULONG) iResult );
hb_fsWriteLarge( hFile, (BYTE*) pString, (ULONG) iResult );
}
hb_xfree( pString );
@@ -724,7 +728,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName )
#if defined( HB_OS_WIN_32 )
{
SetFileAttributes( szName, ufi.external_fa & 0xFF );
SetFileAttributesA( szName, ufi.external_fa & 0xFF );
}
#elif defined( HB_OS_UNIX )
{

View File

@@ -155,9 +155,9 @@ HB_FUNC( HB_COMPRESS )
if( pDest )
{
if( ISNUM( 4 ) )
iResult = compress2( ( Bytef * ) pDest, &ulDstLen, szData, ulLen, hb_parni( 4 ) );
iResult = compress2( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ulLen, hb_parni( 4 ) );
else
iResult = compress( ( Bytef * ) pDest, &ulDstLen, szData, ulLen );
iResult = compress( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ulLen );
if( !pBuffer )
{
@@ -218,7 +218,7 @@ HB_FUNC( HB_UNCOMPRESS )
if( pDest )
{
iResult = uncompress( ( Bytef * ) pDest, &ulDstLen, szData, ulLen );
iResult = uncompress( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ulLen );
if( !pBuffer )
{
@@ -259,7 +259,7 @@ static HB_GARBAGE_FUNC( hb_gz_Destructor )
static gzFile hb_gzParam( int iParam )
{
gzFile * gzHolder = hb_parptrGC( hb_gz_Destructor, iParam );
gzFile * gzHolder = ( gzFile * ) hb_parptrGC( hb_gz_Destructor, iParam );
if( gzHolder && * gzHolder )
return * gzHolder;
@@ -315,7 +315,7 @@ HB_FUNC( HB_GZDOPEN )
*/
HB_FUNC( HB_GZCLOSE )
{
gzFile * gzHolder = hb_parptrGC( hb_gz_Destructor, 1 );
gzFile * gzHolder = ( gzFile * ) hb_parptrGC( hb_gz_Destructor, 1 );
if( gzHolder )
{

View File

@@ -65,10 +65,10 @@ int ZCALLBACK ferror_file_func OF((
voidpf stream));
voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
voidpf opaque;
const char* filename;
int mode;
voidpf ZCALLBACK fopen_file_func (
voidpf opaque,
const char* filename,
int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@@ -90,11 +90,11 @@ voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
}
uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
voidpf opaque;
voidpf stream;
void* buf;
uLong size;
uLong ZCALLBACK fread_file_func (
voidpf opaque,
voidpf stream,
void* buf,
uLong size)
{
uLong ret;
@@ -105,11 +105,11 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
}
uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
voidpf opaque;
voidpf stream;
const void* buf;
uLong size;
uLong ZCALLBACK fwrite_file_func (
voidpf opaque,
voidpf stream,
const void* buf,
uLong size)
{
uLong ret;
@@ -119,9 +119,9 @@ uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
return ret;
}
long ZCALLBACK ftell_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
long ZCALLBACK ftell_file_func (
voidpf opaque,
voidpf stream)
{
long ret;
@@ -131,11 +131,11 @@ long ZCALLBACK ftell_file_func (opaque, stream)
return ret;
}
long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
voidpf opaque;
voidpf stream;
uLong offset;
int origin;
long ZCALLBACK fseek_file_func (
voidpf opaque,
voidpf stream,
uLong offset,
int origin)
{
int fseek_origin;
long ret;
@@ -160,9 +160,9 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
return ret;
}
int ZCALLBACK fclose_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
int ZCALLBACK fclose_file_func (
voidpf opaque,
voidpf stream)
{
int ret;
@@ -172,9 +172,9 @@ int ZCALLBACK fclose_file_func (opaque, stream)
return ret;
}
int ZCALLBACK ferror_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
int ZCALLBACK ferror_file_func (
voidpf opaque,
voidpf stream)
{
int ret;
@@ -184,8 +184,8 @@ int ZCALLBACK ferror_file_func (opaque, stream)
return ret;
}
void fill_fopen_filefunc (pzlib_filefunc_def)
zlib_filefunc_def* pzlib_filefunc_def;
void fill_fopen_filefunc (
zlib_filefunc_def* pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;

View File

@@ -46,12 +46,13 @@ woven in by Terry Thorsen 1/2003.
# include <string.h>
# include <stdlib.h>
#endif
/*
#ifdef NO_ERRNO_H
extern int errno;
#else
# include <errno.h>
#endif
*/
#ifndef local
# define local static
@@ -173,10 +174,10 @@ local int unzlocal_getByte OF((
voidpf filestream,
int *pi));
local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
local int unzlocal_getByte(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
int *pi)
{
unsigned char c;
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
@@ -203,10 +204,10 @@ local int unzlocal_getShort OF((
voidpf filestream,
uLong *pX));
local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int unzlocal_getShort (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX)
{
uLong x ;
int i;
@@ -231,10 +232,10 @@ local int unzlocal_getLong OF((
voidpf filestream,
uLong *pX));
local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int unzlocal_getLong (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX)
{
uLong x ;
int i;
@@ -264,9 +265,9 @@ local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
/* My own strcmpi / strcasecmp */
local int strcmpcasenosensitive_internal (fileName1,fileName2)
const char* fileName1;
const char* fileName2;
local int strcmpcasenosensitive_internal (
const char* fileName1,
const char* fileName2)
{
for (;;)
{
@@ -307,10 +308,10 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
(like 1 on Unix, 2 on Windows)
*/
extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
const char* fileName1;
const char* fileName2;
int iCaseSensitivity;
extern int ZEXPORT unzStringFileNameCompare (
const char* fileName1,
const char* fileName2,
int iCaseSensitivity)
{
if (iCaseSensitivity==0)
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
@@ -333,9 +334,9 @@ local uLong unzlocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream));
local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
local uLong unzlocal_SearchCentralDir(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream)
{
unsigned char* buf;
uLong uSizeFile;
@@ -399,9 +400,9 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
Else, the return value is a unzFile Handle, usable with other function
of this unzip package.
*/
extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
const char *path;
zlib_filefunc_def* pzlib_filefunc_def;
extern unzFile ZEXPORT unzOpen2 (
const char *path,
zlib_filefunc_def* pzlib_filefunc_def)
{
unz_s us;
unz_s *s;
@@ -502,8 +503,8 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
}
extern unzFile ZEXPORT unzOpen (path)
const char *path;
extern unzFile ZEXPORT unzOpen (
const char *path)
{
return unzOpen2(path, NULL);
}
@@ -513,8 +514,8 @@ extern unzFile ZEXPORT unzOpen (path)
If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzClose (file)
unzFile file;
extern int ZEXPORT unzClose (
unzFile file)
{
unz_s* s;
if (file==NULL)
@@ -534,9 +535,9 @@ extern int ZEXPORT unzClose (file)
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 unzGetGlobalInfo (file,pglobal_info)
unzFile file;
unz_global_info *pglobal_info;
extern int ZEXPORT unzGetGlobalInfo (
unzFile file,
unz_global_info *pglobal_info)
{
unz_s* s;
if (file==NULL)
@@ -550,9 +551,9 @@ extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
/*
Translate date/time from Dos format to tm_unz (readable more easilty)
*/
local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
uLong ulDosDate;
tm_unz* ptm;
local void unzlocal_DosDateToTmuDate (
uLong ulDosDate,
tm_unz* ptm)
{
uLong uDate;
uDate = (uLong)(ulDosDate>>16);
@@ -579,21 +580,16 @@ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
char *szComment,
uLong commentBufferSize));
local int unzlocal_GetCurrentFileInfoInternal (file,
pfile_info,
pfile_info_internal,
szFileName, fileNameBufferSize,
extraField, extraFieldBufferSize,
szComment, commentBufferSize)
unzFile file;
unz_file_info *pfile_info;
unz_file_info_internal *pfile_info_internal;
char *szFileName;
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
local int unzlocal_GetCurrentFileInfoInternal (
unzFile file,
unz_file_info *pfile_info,
unz_file_info_internal *pfile_info_internal,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize)
{
unz_s* s;
unz_file_info file_info;
@@ -744,19 +740,15 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
No preparation of the structure is needed
return UNZ_OK if there is no problem.
*/
extern int ZEXPORT unzGetCurrentFileInfo (file,
pfile_info,
szFileName, fileNameBufferSize,
extraField, extraFieldBufferSize,
szComment, commentBufferSize)
unzFile file;
unz_file_info *pfile_info;
char *szFileName;
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
extern int ZEXPORT unzGetCurrentFileInfo (
unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize)
{
return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
szFileName,fileNameBufferSize,
@@ -768,8 +760,8 @@ extern int ZEXPORT unzGetCurrentFileInfo (file,
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/
extern int ZEXPORT unzGoToFirstFile (file)
unzFile file;
extern int ZEXPORT unzGoToFirstFile (
unzFile file)
{
int err;
unz_s* s;
@@ -790,8 +782,8 @@ extern int ZEXPORT unzGoToFirstFile (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 unzGoToNextFile (file)
unzFile file;
extern int ZEXPORT unzGoToNextFile (
unzFile file)
{
unz_s* s;
int err;
@@ -824,10 +816,10 @@ extern int ZEXPORT unzGoToNextFile (file)
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 unzLocateFile (file, szFileName, iCaseSensitivity)
unzFile file;
const char *szFileName;
int iCaseSensitivity;
extern int ZEXPORT unzLocateFile (
unzFile file,
const char *szFileName,
int iCaseSensitivity)
{
unz_s* s;
int err;
@@ -903,9 +895,9 @@ typedef struct unz_file_pos_s
} unz_file_pos;
*/
extern int ZEXPORT unzGetFilePos(file, file_pos)
unzFile file;
unz_file_pos* file_pos;
extern int ZEXPORT unzGetFilePos(
unzFile file,
unz_file_pos* file_pos)
{
unz_s* s;
@@ -921,9 +913,9 @@ extern int ZEXPORT unzGetFilePos(file, file_pos)
return UNZ_OK;
}
extern int ZEXPORT unzGoToFilePos(file, file_pos)
unzFile file;
unz_file_pos* file_pos;
extern int ZEXPORT unzGoToFilePos(
unzFile file,
unz_file_pos* file_pos)
{
unz_s* s;
int err;
@@ -957,13 +949,11 @@ extern int ZEXPORT unzGoToFilePos(file, file_pos)
store in *piSizeVar the size of extra info in local header
(filename and size of extra field data)
*/
local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
poffset_local_extrafield,
psize_local_extrafield)
unz_s* s;
uInt* piSizeVar;
uLong *poffset_local_extrafield;
uInt *psize_local_extrafield;
local int unzlocal_CheckCurrentFileCoherencyHeader (
unz_s* s,
uInt* piSizeVar,
uLong *poffset_local_extrafield,
uInt *psize_local_extrafield)
{
uLong uMagic,uData,uFlags;
uLong size_filename;
@@ -1048,12 +1038,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
Open for reading data the current file in the zipfile.
If there is no error and the file is opened, the return value is UNZ_OK.
*/
extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
unzFile file;
int* method;
int* level;
int raw;
const char* password;
extern int ZEXPORT unzOpenCurrentFile3 (
unzFile file,
int* method,
int* level,
int raw,
const char* password)
{
int err;
uInt iSizeVar;
@@ -1136,7 +1126,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (Bytef*)0;
pfile_in_zip_read_info->stream.avail_in = 0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
@@ -1195,24 +1185,24 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
return UNZ_OK;
}
extern int ZEXPORT unzOpenCurrentFile (file)
unzFile file;
extern int ZEXPORT unzOpenCurrentFile (
unzFile file)
{
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
}
extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
unzFile file;
const char* password;
extern int ZEXPORT unzOpenCurrentFilePassword (
unzFile file,
const char* password)
{
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
}
extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
unzFile file;
int* method;
int* level;
int raw;
extern int ZEXPORT unzOpenCurrentFile2 (
unzFile file,
int* method,
int* level,
int raw)
{
return unzOpenCurrentFile3(file, method, level, raw, NULL);
}
@@ -1227,10 +1217,10 @@ extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
extern int ZEXPORT unzReadCurrentFile (file, buf, len)
unzFile file;
voidp buf;
unsigned len;
extern int ZEXPORT unzReadCurrentFile (
unzFile file,
voidp buf,
unsigned len)
{
int err=UNZ_OK;
uInt iRead = 0;
@@ -1388,8 +1378,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
/*
Give the current position in uncompressed data
*/
extern z_off_t ZEXPORT unztell (file)
unzFile file;
extern z_off_t ZEXPORT unztell (
unzFile file)
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1408,8 +1398,8 @@ extern z_off_t ZEXPORT unztell (file)
/*
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzeof (file)
unzFile file;
extern int ZEXPORT unzeof (
unzFile file)
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1441,10 +1431,10 @@ extern int ZEXPORT unzeof (file)
the return value is the number of bytes copied in buf, or (if <0)
the error code
*/
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
unzFile file;
voidp buf;
unsigned len;
extern int ZEXPORT unzGetLocalExtrafield (
unzFile file,
voidp buf,
unsigned len)
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1492,8 +1482,8 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
Close the file in zip opened with unzipOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzCloseCurrentFile (file)
unzFile file;
extern int ZEXPORT unzCloseCurrentFile (
unzFile file)
{
int err=UNZ_OK;
@@ -1535,10 +1525,10 @@ extern int ZEXPORT unzCloseCurrentFile (file)
uSizeBuf is the size of the szComment buffer.
return the number of byte copied or an error code <0
*/
extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
unzFile file;
char *szComment;
uLong uSizeBuf;
extern int ZEXPORT unzGetGlobalComment (
unzFile file,
char *szComment,
uLong uSizeBuf)
{
unz_s* s;
uLong uReadThis ;
@@ -1566,13 +1556,13 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
}
/* Additions by RX '2004 */
extern uLong ZEXPORT unzGetOffset (file)
unzFile file;
extern uLong ZEXPORT unzGetOffset (
unzFile file)
{
unz_s* s;
if (file==NULL)
return UNZ_PARAMERROR;
return (uLong) UNZ_PARAMERROR;
s=(unz_s*)file;
if (!s->current_file_ok)
return 0;
@@ -1582,9 +1572,9 @@ extern uLong ZEXPORT unzGetOffset (file)
return s->pos_in_central_dir;
}
extern int ZEXPORT unzSetOffset (file, pos)
unzFile file;
uLong pos;
extern int ZEXPORT unzSetOffset (
unzFile file,
uLong pos)
{
unz_s* s;
int err;

View File

@@ -22,12 +22,13 @@
# include <string.h>
# include <stdlib.h>
#endif
/*
#ifdef NO_ERRNO_H
extern int errno;
#else
# include <errno.h>
#endif
*/
#ifndef local
# define local static
@@ -79,6 +80,7 @@
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
#endif
extern const char zip_copyright[];
const char zip_copyright[] =
" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
@@ -165,7 +167,7 @@ local void init_linkedlist( linkedlist_data* ll );
local int add_data_in_datablock( linkedlist_data* ll, const void* buf, uLong len );
local uLong ziplocal_TmzDateToDosDate( const tm_zip* ptm, uLong dosDate );
local linkedlist_datablock_internal* allocate_new_datablock()
local linkedlist_datablock_internal* allocate_new_datablock( void )
{
linkedlist_datablock_internal* ldi;
ldi = (linkedlist_datablock_internal*)
@@ -179,8 +181,7 @@ local linkedlist_datablock_internal* allocate_new_datablock()
return ldi;
}
local void free_datablock(ldi)
linkedlist_datablock_internal* ldi;
local void free_datablock( linkedlist_datablock_internal* ldi)
{
while (ldi!=NULL)
{
@@ -190,25 +191,23 @@ local void free_datablock(ldi)
}
}
local void init_linkedlist(ll)
linkedlist_data* ll;
local void init_linkedlist(linkedlist_data* ll)
{
ll->first_block = ll->last_block = NULL;
}
#if 0
local void free_linkedlist(ll)
linkedlist_data* ll;
local void free_linkedlist(linkedlist_data* ll)
{
free_datablock(ll->first_block);
ll->first_block = ll->last_block = NULL;
}
#endif
local int add_data_in_datablock(ll,buf,len)
linkedlist_data* ll;
const void* buf;
uLong len;
local int add_data_in_datablock(
linkedlist_data* ll,
const void* buf,
uLong len)
{
linkedlist_datablock_internal* ldi;
const unsigned char* from_copy;
@@ -271,11 +270,11 @@ local int add_data_in_datablock(ll,buf,len)
local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream, uLong x, int nbByte));
local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong x;
int nbByte;
local int ziplocal_putValue (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong x,
int nbByte)
{
unsigned char buf[4];
int n;
@@ -299,10 +298,10 @@ local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
}
local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
local void ziplocal_putValue_inmemory (dest, x, nbByte)
void* dest;
uLong x;
int nbByte;
local void ziplocal_putValue_inmemory (
void* dest,
uLong x,
int nbByte)
{
unsigned char* buf=(unsigned char*)dest;
int n;
@@ -323,9 +322,9 @@ local void ziplocal_putValue_inmemory (dest, x, nbByte)
/****************************************************************************/
local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
const tm_zip* ptm;
uLong dosDate;
local uLong ziplocal_TmzDateToDosDate(
const tm_zip* ptm,
uLong dosDate)
{
uLong year = (uLong)ptm->tm_year;
@@ -348,10 +347,10 @@ local int ziplocal_getByte OF((
voidpf filestream,
int *pi));
local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
local int ziplocal_getByte(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
int *pi)
{
unsigned char c;
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
@@ -378,10 +377,10 @@ local int ziplocal_getShort OF((
voidpf filestream,
uLong *pX));
local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int ziplocal_getShort (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX)
{
uLong x ;
int i;
@@ -406,10 +405,10 @@ local int ziplocal_getLong OF((
voidpf filestream,
uLong *pX));
local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int ziplocal_getLong (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX)
{
uLong x ;
int i;
@@ -448,9 +447,9 @@ local uLong ziplocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream));
local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
local uLong ziplocal_SearchCentralDir(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream)
{
unsigned char* buf;
uLong uSizeFile;
@@ -507,11 +506,11 @@ local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
#endif /* !NO_ADDFILEINEXISTINGZIP*/
/************************************************************/
extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def)
const char *pathname;
int append;
zipcharpc* globalcomment;
zlib_filefunc_def* pzlib_filefunc_def;
extern zipFile ZEXPORT zipOpen2 (
const char *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def)
{
zip_internal ziinit;
zip_internal* zi;
@@ -626,7 +625,7 @@ extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc
if (size_comment>0)
{
ziinit.globalcomment = ALLOC(size_comment+1);
ziinit.globalcomment = (char *) ALLOC(size_comment+1);
if (ziinit.globalcomment)
{
size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
@@ -691,35 +690,30 @@ extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc
}
}
extern zipFile ZEXPORT zipOpen (pathname, append)
const char *pathname;
int append;
extern zipFile ZEXPORT zipOpen (
const char *pathname,
int append)
{
return zipOpen2(pathname,append,NULL,NULL);
}
extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting)
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;
int raw;
int windowBits;
int memLevel;
int strategy;
const char* password;
uLong crcForCrypting;
extern int ZEXPORT zipOpenNewFileInZip3 (
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,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting)
{
zip_internal* zi;
uInt size_filename;
@@ -909,21 +903,18 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
return err;
}
extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw)
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;
int raw;
extern int ZEXPORT zipOpenNewFileInZip2(
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,
int raw)
{
return zipOpenNewFileInZip3 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
@@ -933,20 +924,17 @@ extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
NULL, 0);
}
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;
extern int ZEXPORT zipOpenNewFileInZip (
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)
{
return zipOpenNewFileInZip2 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
@@ -975,10 +963,10 @@ local int zipFlushWriteBuffer(zip_internal* zi)
return err;
}
extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
zipFile file;
const void* buf;
unsigned len;
extern int ZEXPORT zipWriteInFileInZip (
zipFile file,
const void* buf,
unsigned len)
{
zip_internal* zi;
int err=ZIP_OK;
@@ -990,9 +978,9 @@ extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
if (zi->in_opened_file_inzip == 0)
return ZIP_PARAMERROR;
zi->ci.stream.next_in = (void*)buf;
zi->ci.stream.next_in = (Bytef*)buf;
zi->ci.stream.avail_in = len;
zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
zi->ci.crc32 = crc32(zi->ci.crc32,(Bytef*)buf,len);
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
{
@@ -1040,10 +1028,10 @@ extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
return err;
}
extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
zipFile file;
uLong uncompressed_size;
uLong crc32;
extern int ZEXPORT zipCloseFileInZipRaw (
zipFile file,
uLong uncompressed_size,
uLong crc32)
{
zip_internal* zi;
uLong compressed_size;
@@ -1137,15 +1125,15 @@ extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
return err;
}
extern int ZEXPORT zipCloseFileInZip (file)
zipFile file;
extern int ZEXPORT zipCloseFileInZip (
zipFile file)
{
return zipCloseFileInZipRaw (file,0,0);
}
extern int ZEXPORT zipClose (file, global_comment)
zipFile file;
const char* global_comment;
extern int ZEXPORT zipClose (
zipFile file,
const char* global_comment)
{
zip_internal* zi;
int err = 0;

View File

@@ -331,6 +331,7 @@ rm -fR $RPM_BUILD_ROOT
%{_libdir}/%{name}/libhbbtree.a
%{_libdir}/%{name}/libhbmisc.a
%{_libdir}/%{name}/libhbct.a
%{_libdir}/%{name}/libhbzlib.a
%{_libdir}/%{name}/libhbtip.a
%{_libdir}/%{name}/libxhb.a
%{_libdir}/%{name}/libhbrddado.a

View File

@@ -330,6 +330,7 @@ rm -fR $RPM_BUILD_ROOT
%{_libdir}/%{name}/libhbbtree.a
%{_libdir}/%{name}/libhbmisc.a
%{_libdir}/%{name}/libhbct.a
%{_libdir}/%{name}/libhbzlib.a
%{_libdir}/%{name}/libhbtip.a
%{_libdir}/%{name}/libxhb.a
%{_libdir}/%{name}/libhbrddado.a

View File

@@ -516,6 +516,7 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/%{name}/libhbbtree.a
%{_libdir}/%{name}/libhbmisc.a
%{_libdir}/%{name}/libhbct.a
%{_libdir}/%{name}/libhbzlib.a
%{_libdir}/%{name}/libhbtip.a
%{_libdir}/%{name}/libxhb.a
%{_libdir}/%{name}/libhbgt.a