UPD: Zip - speed up .zip creation

This commit is contained in:
Alexander Koblov 2024-04-09 20:56:13 +03:00
commit 0bed1bda2d

View file

@ -48,12 +48,6 @@ uses
implementation
uses
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF}
{$IFDEF LibcAPI}
Libc,
{$ENDIF}
SysUtils,
AbArcTyp,
AbExcept,
@ -63,6 +57,7 @@ uses
AbDfBase,
AbZlibPrc,
AbZipxPrc,
DCcrc32,
DCClassesUtf8;
@ -127,19 +122,19 @@ end;
{ ========================================================================== }
procedure DoStore(Archive : TAbZipArchive; Item : TAbZipItem; OutStream, InStream : TStream);
var
CRC32 : LongInt;
CRC32 : UInt32;
Percent : LongInt;
LastPercent : LongInt;
InSize : Int64;
DataRead : Int64;
Total : Int64;
Abort : Boolean;
Buffer : array [0..8191] of byte;
Buffer : array [0..16383] of byte;
begin
{ setup }
Item.CompressionMethod := cmStored;
Abort := False;
CRC32 := -1;
CRC32 := 0;
Total := 0;
Percent := 0;
LastPercent := 0;
@ -159,7 +154,7 @@ begin
end;
{ update CRC}
AbUpdateCRCBuffer(CRC32, Buffer, DataRead);
CRC32 := crc32_16bytes(Buffer, DataRead, CRC32);
{ write data (encrypting if needed) }
OutStream.WriteBuffer(Buffer, DataRead);
@ -169,7 +164,7 @@ begin
end;
{ finish CRC calculation }
Item.CRC32 := not CRC32;
Item.CRC32 := LongInt(CRC32);
{ show final progress increment }
if (Percent < 100) and Assigned(Archive.OnProgress) then