* Correct 64-bit zip files

git-svn-id: trunk@33337 -
This commit is contained in:
michael 2016-03-26 23:35:07 +00:00
parent bfff843ec7
commit 37da491e57

View File

@ -1533,12 +1533,13 @@ Begin
LocalHdr.Extra_Field_Length:=SizeOf(LocalZip64ExtHdr)+SizeOf(LocalZip64Fld);
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapLFH{$ENDIF}(LocalHdr),SizeOf(LocalHdr));
// Append extensible field header+zip64 extensible field if needed:
FOutStream.WriteBuffer(ZFileName[1],Length(ZFileName));
if IsZip64 then
begin
LocalZip64ExtHdr.Header_ID:=ZIP64_HEADER_ID;
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapEDFH{$ENDIF}(LocalZip64ExtHdr),SizeOf(LocalZip64ExtHdr));
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapZ64EIF{$ENDIF}(LocalZip64Fld),SizeOf(LocalZip64Fld));
end;
FOutStream.WriteBuffer(ZFileName[1],Length(ZFileName));
End;
@ -1596,8 +1597,7 @@ Begin
// Move past extra fields
FOutStream.Seek(SavePos+LocalHdr.Extra_Field_Length,soFromBeginning);
end;
SavePos := FOutStream.Position;
SavePos := FOutStream.Position;
FillChar(CentralHdr,SizeOf(CentralHdr),0);
With CentralHdr do
begin
@ -1657,7 +1657,7 @@ Begin
Inc(ACount);
// Move past compressed file data to next header:
if LocalHdr.Compressed_Size=$FFFFFFFF then
if Iszip64 then
FOutStream.Seek(SavePos + LocalZip64Fld.Compressed_Size,soBeginning)
else
FOutStream.Seek(SavePos + LocalHdr.Compressed_Size,soBeginning);
@ -1666,7 +1666,8 @@ Begin
{$IFDEF FPC_BIG_ENDIAN}
LocalHdr := SwapLFH(LocalHdr);
{$ENDIF}
Until LocalHdr.Signature = CENTRAL_FILE_HEADER_SIGNATURE;
Until LocalHdr.Signature = CENTRAL_FILE_HEADER_SIGNATURE ;
FOutStream.Seek(0,soEnd);
FillChar(EndHdr,SizeOf(EndHdr),0);
@ -1832,14 +1833,11 @@ Var
I : integer; //could be qword but limited by FEntries.Count
begin
FOutStream := AStream;
If CheckEntries=0 then
Exit;
FZipping:=True;
Try
GetFileInfo; //get info on file entries in zip
for I:=0 to FEntries.Count-1 do
ZipOneFile(FEntries[i]);
if FEntries.Count>0 then
@ -2787,8 +2785,7 @@ begin
end;
procedure TZipFileEntry.SetArchiveFileName(const AValue: String);
var
Separator: char;
begin
if FArchiveFileName=AValue then Exit;
// Zip standard: filenames inside the zip archive have / path separator