2008-07-31 14:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/hbmzip/hbmzip.c
  * harbour/contrib/hbmzip/readme.txt
    * changed parameters of HB_UnzipFileInfo()
      Now in 10-th parameter is @lCrypted and 11-th is @cComment

  * harbour/contrib/hbmzip/tests/myunzip.prg
    + show archive and file comment
    + show encrypted files ('*' after file name)
This commit is contained in:
Przemyslaw Czerpak
2008-07-31 12:50:40 +00:00
parent c695e67c5c
commit a244bb3484
4 changed files with 38 additions and 17 deletions

View File

@@ -8,6 +8,16 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-07-31 14:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbmzip/hbmzip.c
* harbour/contrib/hbmzip/readme.txt
* changed parameters of HB_UnzipFileInfo()
Now in 10-th parameter is @lCrypted and 11-th is @cComment
* harbour/contrib/hbmzip/tests/myunzip.prg
+ show archive and file comment
+ show encrypted files ('*' after file name)
2008-07-31 14:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbmzip/zip.c
! set valid ZIP signature in header file (2.0)

View File

@@ -378,7 +378,7 @@ HB_FUNC( HB_UNZIPFILEGOTO )
/* HB_UnzipFileInfo( hUnzip, @cZipName, @dDate, @cTime,
@nInternalAttr, @nExternalAttr,
@nMethod, @nSize, @nCompressedSize,
@cComment ) --> nError */
@lCrypted, @cComment ) --> nError */
HB_FUNC( HB_UNZIPFILEINFO )
{
unzFile hUnzip = hb_unzipfileParam( 1 );
@@ -414,8 +414,9 @@ HB_FUNC( HB_UNZIPFILEINFO )
hb_stornl( ufi.compression_method, 7 );
hb_stornl( ufi.uncompressed_size, 8 );
hb_stornl( ufi.compressed_size, 9 );
hb_storl( ( ufi.flag & 1 ) != 0, 10 );
if( ufi.size_file_comment > 0 && ISBYREF( 10 ) )
if( ufi.size_file_comment > 0 && ISBYREF( 11 ) )
{
char * pszComment = ( char * ) hb_xgrab( ufi.size_file_comment + 1 );
@@ -425,9 +426,9 @@ HB_FUNC( HB_UNZIPFILEINFO )
if( iResult != UNZ_OK )
{
hb_xfree( pszComment );
hb_storc( NULL, 10 );
hb_storc( NULL, 11 );
}
else if( !hb_storclen_buffer( pszComment, ufi.size_file_comment, 10 ) )
else if( !hb_storclen_buffer( pszComment, ufi.size_file_comment, 11 ) )
hb_xfree( pszComment );
}
}
@@ -445,7 +446,8 @@ HB_FUNC( HB_UNZIPFILEINFO )
hb_stornl( 0, 7 );
hb_stornl( 0, 8 );
hb_stornl( 0, 9 );
hb_storc( NULL, 10 );
hb_storl( FALSE, 10 );
hb_storc( NULL, 11 );
}
}
}

View File

@@ -68,7 +68,7 @@ HB_UnzipFileGoto( hUnzip, nPosition ) --> nError
HB_UnzipFileInfo( hUnzip, @cZipName, @dDate, @cTime,
@nInternalAttr, @nExternalAttr,
@nMethod, @nSize, @nCompressedSize,
@cComment ) --> nError
@lCrypted, @cComment ) --> nError
HB_UnzipFileOpen( hUnzip, [ cPassword ] ) --> nError
HB_UnzipFileRead( hUnzip, @cBuf [, nLen ] ) --> nRead
HB_UnzipFileClose( hUnzip ) --> nError

View File

@@ -54,7 +54,8 @@
PROC MyUnzip( ... )
LOCAL hUnzip, aWild, cFileName, cExt, cPath, cFile, ;
dDate, cTime, nSize, nCompSize, nErr, cPassword, tmp
dDate, cTime, nSize, nCompSize, nErr, ;
lCrypted, cPassword, cComment, tmp
aWild := { ... }
IF LEN( aWild ) < 1
@@ -85,22 +86,30 @@ PROC MyUnzip( ... )
IF ! EMPTY( hUnzip )
? "Archive file:", cFileName
HB_UnzipGlobalInfo( hUnzip, @nSize, @cComment )
? "Number of entires:", nSize
IF !EMPTY( cComment )
? "global comment:", cComment
ENDIF
? ""
? "Filename Date Time Size Compressed Action"
? "Filename Date Time Size Compressed Action"
? "---------------------------------------------------------------------------------"
nErr := HB_UNZIPFILEFIRST( hUnzip )
DO WHILE nErr == 0
HB_UnzipFileInfo( hUnzip, @cFile, @dDate, @cTime,,,, @nSize, @nCompSize )
? PADR( cFile, 30 ), dDate, cTime, nSize, nCompSize
HB_UnzipFileInfo( hUnzip, @cFile, @dDate, @cTime,,,, @nSize, @nCompSize, @lCrypted, @cComment )
? PADR( cFile + iif( lCrypted, "*", ""), 30 ), dDate, cTime, nSize, nCompSize
IF !empty( cComment )
? "comment:", cComment
ENDIF
IF ASCAN( aWild, {|cPattern| HB_WILDMATCH( cPattern, cFile, .T. ) } ) > 0
?? " Extracting"
HB_UnzipExtractCurrentFile( hUnzip, NIL, cPassword )
ELSE
?? " Skipping"
ENDIF
IF ASCAN( aWild, {|cPattern| HB_WILDMATCH( cPattern, cFile, .T. ) } ) > 0
?? " Extracting"
HB_UnzipExtractCurrentFile( hUnzip, NIL, cPassword )
ELSE
?? " Skipping"
ENDIF
nErr := HB_UNZIPFILENEXT( hUnzip )
nErr := HB_UNZIPFILENEXT( hUnzip )
ENDDO
HB_UNZIPCLOSE( hUnzip )
ENDIF