You are not logged in.
Pages: 1
Hello,
I am using TZipRead under Delphi 7 Pro and open a .zip archive file directly from memory with the constructor
constructor Create(BufZip: PByteArray; Size: cardinal);
.
I was surprised that PByteArray was a reference to SysUtils and not SynCommons ("array[0..32767] of Byte" vs "array[0..MaxInt-1] of Byte").
Is there a reason for this?
Thank you
Offline
It is on purpose: SynCommons.pas is NOT used at all in SynZip.pas.
So that you could use SynZip with no dependency - e.g. for a small "Setup" program, or as a faster and cross-platform replacement to the ZLib unit.
Offline
Thank you ab for your response.
I tried to open .zip archives from memory with size > 32768 bytes and it did not failed. Unzip was correct.
however, is this secure?
Offline
Sorry, I meant sure...
Because if PByteArray is an array of 32768 bytes (as declared in SysUtils), I am not supposed to use more than 32768 bytes, no ?
For example, this code worked with a zip of 27,4 Mo :
var
vContent : RawByteString;
vZip :TZipRead;
begin
vContent := StringFromFile('TeamViewerPortable-14.zip');
vZip := TZipRead.Create(@vContent[1], Length(vContent));
vZip.UnZipAll('c:\temp\');
vZip.Free;
end;
I thought Delphi would give me an error.
There is a subtlety that I do not understand ...
Offline
Offline
Pages: 1