diff --git a/PasZip.pas b/PasZip.pas index 10eaaa41c..d80fc9a6a 100644 --- a/PasZip.pas +++ b/PasZip.pas @@ -80,6 +80,8 @@ function CompressString(const data: RawByteZip; failIfGrow: boolean = false): Ra /// uncompress memory using the ZLib INFLATE algorithm, checking crc32 checksum function UncompressString(const data: RawByteZip): RawByteZip; +/// create a void .zip file +procedure CreateVoidZip(const aFileName: TFileName); {$ifdef MSWINDOWS} { use Windows MapFile } @@ -108,9 +110,6 @@ function IsCompressedFileEqual(const uncomprFile, comprFile: TFileName): boolean function Zip(const zip: TFileName; const files, zipAs: array of TFileName; NoSubDirectories: boolean = false): boolean; -/// create a void .zip file -procedure CreateVoidZip(const aFileName: TFileName); - {$endif MSWINDOWS} /// create a compatible .gz file (returns file size) @@ -3796,6 +3795,21 @@ function UncompressString(const data: RawByteZip): RawByteZip; result := ''; end; +procedure CreateVoidZip(const aFileName: TFileName); +var + H: THandle; + lhr: TLastHeader; +begin + fillchar(lhr, sizeof(lhr), 0); + lhr.signature := $06054b50 + 1; + dec(lhr.signature); // +1 to avoid finding it in the exe + H := FileCreate(aFileName); + if H < 0 then + exit; + FileWrite(H, lhr, sizeof(lhr)); + FileClose(H); +end; + {$ifdef MSWINDOWS} @@ -3806,8 +3820,8 @@ function UncompressString(const data: RawByteZip): RawByteZip; function CompressFile(const srcFile, dstFile: TFileName; failIfGrow: boolean): boolean; var - sf, df: dword; - sm, dm: dword; + sf, df: THandle; + sm, dm: THandle; sb, db: pointer; sl, dl: int64; err: dword; @@ -3881,8 +3895,8 @@ function CompressFile(const srcFile, dstFile: TFileName; failIfGrow: boolean): b function UncompressFile(const srcFile, dstFile: TFileName; lastWriteTime: int64; attr: dword): boolean; var - sf, df: dword; - sm, dm: dword; + sf, df: THandle; + sm, dm: THandle; sb, db: pointer; sl, dl: int64; err: dword; @@ -3962,14 +3976,15 @@ function IsCompressedFileEqual(const uncomprFile, comprFile: TFileName): boolean crc1, crc2: dword; begin result := GetCompressedFileInfo(comprFile, size1, crc1) and - GetUncompressedFileInfo(uncomprFile, size2, crc2) and (size1 = size2) and - (crc1 = crc2); + GetUncompressedFileInfo(uncomprFile, size2, crc2) and + (size1 = size2) and + (crc1 = crc2); end; function GetCompressedFileInfo(const comprFile: TFileName; var size: int64; var crc32: dword): boolean; var - file_: dword; + file_: THandle; c1: dword; begin result := false; @@ -3986,7 +4001,7 @@ function GetCompressedFileInfo(const comprFile: TFileName; var size: int64; function GetUncompressedFileInfo(const uncomprFile: TFileName; var size: int64; var crc32: dword): boolean; var - file_, map: dword; + file_, map: THandle; buf: pointer; begin result := false; @@ -4049,12 +4064,13 @@ function GzCompress(src: pointer; srcLen: integer; const fName: TFileName): card {$ifdef MSWINDOWS} + function Zip(const zip: TFileName; const files, zipAs: array of TFileName; NoSubDirectories: boolean = false): boolean; var i1, i2, i3: integer; - dstFh: dword; - srcFh: dword; + dstFh: THandle; + srcFh: THandle; ft: TFileTime; c1: dword; lfhr: TLocalFileHeader; @@ -4170,21 +4186,6 @@ function Zip(const zip: TFileName; const files, zipAs: array of TFileName; end; end; -procedure CreateVoidZip(const aFileName: TFileName); -var - H: THandle; - lhr: TLastHeader; -begin - fillchar(lhr, sizeof(lhr), 0); - lhr.signature := $06054b50 + 1; - dec(lhr.signature); // +1 to avoid finding it in the exe - H := FileCreate(aFileName); - if H < 0 then - exit; - FileWrite(H, lhr, sizeof(lhr)); - FileClose(H); -end; - {$endif MSWINDOWS} {$ifdef DYNAMIC_CRC_TABLE} diff --git a/SynopseCommit.inc b/SynopseCommit.inc index a998393c6..ec9055f7d 100644 --- a/SynopseCommit.inc +++ b/SynopseCommit.inc @@ -1 +1 @@ -'1.18.7656' +'1.18.7657'