[fpc-devel] [PATCH] patch for zipper.pp

Andrew Haines AndrewD207 at aol.com
Wed Jul 29 03:17:56 CEST 2009


Hi,

This patch updates TUnZipper so that files can be unzipped to a custom
user stream.

To use a custom stream here is an example:

UnZip := TUnZipper.Create;

// both of the following have to be set or
// the builtin method will be used (TFileStream)

UnZip.UseCustomOutputStream := True;
UnZip.OnCustomOutput := @UnZipCustomOutput;

....

procedure TForm1. at UnZipCustomOutput(Sender: TObject; var AStream:
            TStream; AItem: TFullZipFileEntry; AClosing: Boolean);
begin
  if AClosing = False then
  begin
    AStream := TMemoryStream.Create;
  end
  else
  begin
    DoSomethingCreativeWith(AStream);
    AStream.Free;
  end;
end;

Also fixed a bug where if a date was not set on a zipfile entry a crash
would occur.

Regards,

Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zipper.diff
Type: text/x-patch
Size: 7931 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090728/9ae9d284/attachment.bin>


More information about the fpc-devel mailing list