mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 08:06:07 +02:00
* Correct 64-bit zip files
git-svn-id: trunk@33337 -
This commit is contained in:
parent
bfff843ec7
commit
37da491e57
@ -1533,12 +1533,13 @@ Begin
|
|||||||
LocalHdr.Extra_Field_Length:=SizeOf(LocalZip64ExtHdr)+SizeOf(LocalZip64Fld);
|
LocalHdr.Extra_Field_Length:=SizeOf(LocalZip64ExtHdr)+SizeOf(LocalZip64Fld);
|
||||||
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapLFH{$ENDIF}(LocalHdr),SizeOf(LocalHdr));
|
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapLFH{$ENDIF}(LocalHdr),SizeOf(LocalHdr));
|
||||||
// Append extensible field header+zip64 extensible field if needed:
|
// Append extensible field header+zip64 extensible field if needed:
|
||||||
|
FOutStream.WriteBuffer(ZFileName[1],Length(ZFileName));
|
||||||
if IsZip64 then
|
if IsZip64 then
|
||||||
begin
|
begin
|
||||||
|
LocalZip64ExtHdr.Header_ID:=ZIP64_HEADER_ID;
|
||||||
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapEDFH{$ENDIF}(LocalZip64ExtHdr),SizeOf(LocalZip64ExtHdr));
|
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapEDFH{$ENDIF}(LocalZip64ExtHdr),SizeOf(LocalZip64ExtHdr));
|
||||||
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapZ64EIF{$ENDIF}(LocalZip64Fld),SizeOf(LocalZip64Fld));
|
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapZ64EIF{$ENDIF}(LocalZip64Fld),SizeOf(LocalZip64Fld));
|
||||||
end;
|
end;
|
||||||
FOutStream.WriteBuffer(ZFileName[1],Length(ZFileName));
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -1596,8 +1597,7 @@ Begin
|
|||||||
// Move past extra fields
|
// Move past extra fields
|
||||||
FOutStream.Seek(SavePos+LocalHdr.Extra_Field_Length,soFromBeginning);
|
FOutStream.Seek(SavePos+LocalHdr.Extra_Field_Length,soFromBeginning);
|
||||||
end;
|
end;
|
||||||
SavePos := FOutStream.Position;
|
SavePos := FOutStream.Position;
|
||||||
|
|
||||||
FillChar(CentralHdr,SizeOf(CentralHdr),0);
|
FillChar(CentralHdr,SizeOf(CentralHdr),0);
|
||||||
With CentralHdr do
|
With CentralHdr do
|
||||||
begin
|
begin
|
||||||
@ -1657,7 +1657,7 @@ Begin
|
|||||||
|
|
||||||
Inc(ACount);
|
Inc(ACount);
|
||||||
// Move past compressed file data to next header:
|
// Move past compressed file data to next header:
|
||||||
if LocalHdr.Compressed_Size=$FFFFFFFF then
|
if Iszip64 then
|
||||||
FOutStream.Seek(SavePos + LocalZip64Fld.Compressed_Size,soBeginning)
|
FOutStream.Seek(SavePos + LocalZip64Fld.Compressed_Size,soBeginning)
|
||||||
else
|
else
|
||||||
FOutStream.Seek(SavePos + LocalHdr.Compressed_Size,soBeginning);
|
FOutStream.Seek(SavePos + LocalHdr.Compressed_Size,soBeginning);
|
||||||
@ -1666,7 +1666,8 @@ Begin
|
|||||||
{$IFDEF FPC_BIG_ENDIAN}
|
{$IFDEF FPC_BIG_ENDIAN}
|
||||||
LocalHdr := SwapLFH(LocalHdr);
|
LocalHdr := SwapLFH(LocalHdr);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Until LocalHdr.Signature = CENTRAL_FILE_HEADER_SIGNATURE;
|
Until LocalHdr.Signature = CENTRAL_FILE_HEADER_SIGNATURE ;
|
||||||
|
|
||||||
FOutStream.Seek(0,soEnd);
|
FOutStream.Seek(0,soEnd);
|
||||||
FillChar(EndHdr,SizeOf(EndHdr),0);
|
FillChar(EndHdr,SizeOf(EndHdr),0);
|
||||||
|
|
||||||
@ -1832,14 +1833,11 @@ Var
|
|||||||
I : integer; //could be qword but limited by FEntries.Count
|
I : integer; //could be qword but limited by FEntries.Count
|
||||||
begin
|
begin
|
||||||
FOutStream := AStream;
|
FOutStream := AStream;
|
||||||
|
|
||||||
If CheckEntries=0 then
|
If CheckEntries=0 then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
FZipping:=True;
|
FZipping:=True;
|
||||||
Try
|
Try
|
||||||
GetFileInfo; //get info on file entries in zip
|
GetFileInfo; //get info on file entries in zip
|
||||||
|
|
||||||
for I:=0 to FEntries.Count-1 do
|
for I:=0 to FEntries.Count-1 do
|
||||||
ZipOneFile(FEntries[i]);
|
ZipOneFile(FEntries[i]);
|
||||||
if FEntries.Count>0 then
|
if FEntries.Count>0 then
|
||||||
@ -2787,8 +2785,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TZipFileEntry.SetArchiveFileName(const AValue: String);
|
procedure TZipFileEntry.SetArchiveFileName(const AValue: String);
|
||||||
var
|
|
||||||
Separator: char;
|
|
||||||
begin
|
begin
|
||||||
if FArchiveFileName=AValue then Exit;
|
if FArchiveFileName=AValue then Exit;
|
||||||
// Zip standard: filenames inside the zip archive have / path separator
|
// Zip standard: filenames inside the zip archive have / path separator
|
||||||
|
Loading…
Reference in New Issue
Block a user