2016-03-08 16:01 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbmzip/mzip.c
! fixed memory leak
! typo in comment
* contrib/hbziparc/ziparc.prg
! strip leading dir separators from filenames stored in ZIP file when
<lWithDrive> parameter of hb_ZipFile() is not set.
This commit is contained in:
@@ -10,6 +10,15 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2016-03-08 16:01 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbmzip/mzip.c
|
||||
! fixed memory leak
|
||||
! typo in comment
|
||||
|
||||
* contrib/hbziparc/ziparc.prg
|
||||
! strip leading dir separators from filenames stored in ZIP file when
|
||||
<lWithDrive> parameter of hb_ZipFile() is not set.
|
||||
|
||||
2016-03-08 14:52 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* src/lang/Makefile
|
||||
+ src/lang/l_de_at.c
|
||||
|
||||
@@ -740,7 +740,7 @@ static HB_BOOL hb_zipGetFileInfo( const char * pszFileName, HB_U32 * pulCRC, HB_
|
||||
}
|
||||
|
||||
|
||||
/* hb_zipFileCRC32( cFileName ) --> nError */
|
||||
/* hb_zipFileCRC32( cFileName ) --> nCRC */
|
||||
HB_FUNC( HB_ZIPFILECRC32 )
|
||||
{
|
||||
const char * szFileName = hb_parc( 1 );
|
||||
@@ -759,8 +759,6 @@ HB_FUNC( HB_ZIPFILECRC32 )
|
||||
static int hb_zipStoreFile( zipFile hZip, int iParamFileName, int iParamZipName, const char * szPassword, int iParamComment, HB_BOOL fUnicode )
|
||||
{
|
||||
const char * szFileName = hb_parc( iParamFileName );
|
||||
const char * szName = hb_parc( iParamZipName );
|
||||
char * pString;
|
||||
PHB_FILE pFile;
|
||||
HB_SIZE nLen;
|
||||
HB_FATTR ulExtAttr;
|
||||
@@ -956,30 +954,23 @@ static int hb_zipStoreFile( zipFile hZip, int iParamFileName, int iParamZipName,
|
||||
szComment = hb_parc( iParamComment );
|
||||
}
|
||||
|
||||
if( szName )
|
||||
nLen = strlen( szZipName );
|
||||
if( iParamZipName != iParamFileName )
|
||||
{
|
||||
/* change path separators to '/' */
|
||||
nLen = strlen( szZipName );
|
||||
pString = szZipName;
|
||||
while( nLen-- )
|
||||
{
|
||||
if( pString[ nLen ] == '\\' )
|
||||
pString[ nLen ] = '/';
|
||||
if( szZipName[ nLen ] == '\\' )
|
||||
szZipName[ nLen ] = '/';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get file name */
|
||||
szZipName = hb_strdup( szFileName );
|
||||
|
||||
nLen = strlen( szZipName );
|
||||
pString = szZipName;
|
||||
|
||||
while( nLen-- )
|
||||
{
|
||||
if( pString[ nLen ] == '/' || pString[ nLen ] == '\\' )
|
||||
if( szZipName[ nLen ] == '/' || szZipName[ nLen ] == '\\' )
|
||||
{
|
||||
memmove( szZipName, &pString[ nLen + 1 ], strlen( szZipName ) - nLen );
|
||||
memmove( szZipName, &szZipName[ nLen + 1 ], strlen( szZipName ) - nLen );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1031,8 @@ static int hb_zipStoreFile( zipFile hZip, int iParamFileName, int iParamZipName,
|
||||
szPassword, ulCRC, _version_made_by( fUnicode ), flags );
|
||||
if( iResult == 0 )
|
||||
{
|
||||
pString = ( char * ) hb_xgrab( HB_Z_IOBUF_SIZE );
|
||||
char * pString = ( char * ) hb_xgrab( HB_Z_IOBUF_SIZE );
|
||||
|
||||
while( ( nLen = hb_fileRead( pFile, pString, HB_Z_IOBUF_SIZE, -1 ) ) > 0 &&
|
||||
nLen != ( HB_SIZE ) FS_ERROR )
|
||||
zipWriteInFileInZip( hZip, pString, ( unsigned ) nLen );
|
||||
|
||||
@@ -298,9 +298,9 @@ FUNCTION hb_ZipFile( ;
|
||||
aProcFile := {}
|
||||
FOR EACH cFN IN hb_defaultValue( acFiles, {} )
|
||||
hb_FNameSplit( cFN, @cPath, NIL, NIL, @cDrive )
|
||||
IF hb_LeftEq( cPath, "." + hb_ps() ) /* strip current dir if any */
|
||||
DO WHILE hb_LeftEq( cPath, "." + hb_ps() ) /* strip current dir if any */
|
||||
cPath := SubStr( cPath, Len( "." + hb_ps() ) + 1 )
|
||||
ENDIF
|
||||
ENDDO
|
||||
IF "?" $ cFN .OR. "*" $ cFN
|
||||
IF lFullPath
|
||||
cPath := hb_PathJoin( hb_cwd(), cPath )
|
||||
@@ -342,10 +342,19 @@ FUNCTION hb_ZipFile( ;
|
||||
hb_FGetDateTime( cFileToZip, @tTime )
|
||||
|
||||
hb_FNameSplit( cFileToZip, @cPath, @cName, @cExt, @cDrive )
|
||||
IF ! lWithDrive .AND. ! Empty( cDrive ) .AND. hb_LeftEq( cPath, cDrive + hb_osDriveSeparator() )
|
||||
cPath := SubStr( cPath, Len( cDrive + hb_osDriveSeparator() ) + 1 )
|
||||
IF lWithPath
|
||||
IF ! lWithDrive
|
||||
IF ! Empty( cDrive ) .AND. hb_LeftEq( cPath, cDrive += hb_osDriveSeparator() )
|
||||
cPath := SubStr( cPath, Len( cDrive ) + 1 )
|
||||
ENDIF
|
||||
DO WHILE Left( cPath, 1 ) $ "\/"
|
||||
cPath := SubStr( cPath, 2 )
|
||||
ENDDO
|
||||
ENDIF
|
||||
ELSE
|
||||
cPath := NIL
|
||||
ENDIF
|
||||
hb_zipFileCreate( hZip, StrTran( hb_FNameMerge( iif( lWithPath, cPath, NIL ), cName, cExt ), "\", "/" ), ;
|
||||
hb_zipFileCreate( hZip, hb_FNameMerge( cPath, cName, cExt ), ;
|
||||
tTime,,,,, nLevel, cPassword, iif( Empty( cPassword ), NIL, hb_zipFileCRC32( cFileToZip ) ), NIL )
|
||||
|
||||
DO WHILE ( nLen := FRead( hHandle, @cBuffer, hb_BLen( cBuffer ) ) ) > 0
|
||||
|
||||
Reference in New Issue
Block a user