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

* harbour/contrib/hbzlib/zip.c
  * harbour/contrib/hbzlib/unzip.c
    ! fixed possible access to uninitialized memory - thanks to Lorenzo

  * harbour/contrib/hbzlib/hbzlib.c
    * fixed casting - thanks to Andi

  * harbour/contrib/hbzlib/hbmzip.c
    * use hb_fsGetOsHandle() instead of LongToHandle() - code which
      uses hb_fsGetOsHandle() will work also with our own virtual
      handles if we add such extensions in the future

  * harbour/source/vm/harbinit.prg
    ! call __SetHelpK() only when HELP() function/procedure exist
      Clipper compatible behavior
This commit is contained in:
Przemyslaw Czerpak
2008-01-18 00:17:35 +00:00
parent 8128564f46
commit 8bae6cb2b9
6 changed files with 31 additions and 11 deletions

View File

@@ -8,6 +8,23 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-01-18 01:17 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbzlib/zip.c
* harbour/contrib/hbzlib/unzip.c
! fixed possible access to uninitialized memory - thanks to Lorenzo
* harbour/contrib/hbzlib/hbzlib.c
* fixed casting - thanks to Andi
* harbour/contrib/hbzlib/hbmzip.c
* use hb_fsGetOsHandle() instead of LongToHandle() - code which
uses hb_fsGetOsHandle() will work also with our own virtual
handles if we add such extensions in the future
* harbour/source/vm/harbinit.prg
! call __SetHelpK() only when HELP() function/procedure exist
Clipper compatible behavior
2008-01-17 17:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/harbour.spec
! removed dummy %endif which left after recent modification

View File

@@ -577,7 +577,7 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName )
FILETIME ftutc, ft;
SYSTEMTIME st;
if( GetFileTime( LongToHandle( hFile ), NULL, NULL, &ftutc ) &&
if( GetFileTime( hb_fsGetOsHandle( hFile ), NULL, NULL, &ftutc ) &&
FileTimeToLocalFileTime( &ftutc, &ft ) &
FileTimeToSystemTime( &ft, &st ) )
{
@@ -711,7 +711,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName )
if( SystemTimeToFileTime( &st, &ft ) &&
LocalFileTimeToFileTime( &ft, &ftutc ) )
{
SetFileTime( LongToHandle( hFile ), &ftutc, &ftutc, &ftutc );
SetFileTime( hb_fsGetOsHandle( hFile ), &ftutc, &ftutc, &ftutc );
}
}
#endif

View File

@@ -107,7 +107,7 @@ HB_FUNC( HB_COMPRESSBOUND )
if( ISCHAR( 1 ) )
hb_retnint( compressBound( hb_parclen( 1 ) ) );
else if( ISNUM( 1 ) )
hb_retnint( compressBound( hb_parnint( 1 ) ) );
hb_retnint( compressBound( ( uLong ) hb_parnint( 1 ) ) );
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS );
}
@@ -148,7 +148,8 @@ HB_FUNC( HB_COMPRESS )
}
else
{
ulDstLen = ISNUM( 2 ) ? hb_parnint( 2 ) : compressBound( ulLen );
ulDstLen = ISNUM( 2 ) ? ( uLong ) hb_parnint( 2 ) :
compressBound( ulLen );
pDest = ( char * ) hb_xalloc( ulDstLen + 1 );
}
@@ -211,7 +212,7 @@ HB_FUNC( HB_UNCOMPRESS )
}
else
{
ulDstLen = ISNUM( 2 ) ? hb_parnint( 2 ) :
ulDstLen = ISNUM( 2 ) ? ( uLong ) hb_parnint( 2 ) :
hb_zlibUncompressedSize( szData, ulLen );
pDest = ( char * ) hb_xalloc( ulDstLen + 1 );
}
@@ -466,7 +467,7 @@ HB_FUNC( HB_GZSEEK )
{
gzFile gz = hb_gzParam( 1 );
if( gz )
hb_retnint( gzseek( gz, hb_parnint( 2 ), ISNUM( 3 ) ?
hb_retnint( gzseek( gz, ( z_off_t ) hb_parnint( 2 ), ISNUM( 3 ) ?
hb_parni( 3 ) : SEEK_SET ) );
}
else

View File

@@ -210,7 +210,7 @@ local int unzlocal_getShort (
uLong *pX)
{
uLong x ;
int i;
int i = 0;
int err;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
@@ -238,7 +238,7 @@ local int unzlocal_getLong (
uLong *pX)
{
uLong x ;
int i;
int i = 0;
int err;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);

View File

@@ -383,7 +383,7 @@ local int ziplocal_getShort (
uLong *pX)
{
uLong x ;
int i;
int i = 0;
int err;
err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
@@ -411,7 +411,7 @@ local int ziplocal_getLong (
uLong *pX)
{
uLong x ;
int i;
int i = 0;
int err;
err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);

View File

@@ -82,7 +82,9 @@ PROCEDURE ClipInit
/* TOFIX: In Clipper this function is not called from here CLIPINIT(). */
/* NOTE: In Clipper __SETHELPK() is called *after* ERRORSYS(). */
__SetHelpK()
IF Type( "HELP()" ) == "UI"
__SetHelpK()
ENDIF
RETURN