anchor.diff:  uses
     Forms, Controls, StdCtrls, Classes, SysUtils, Dialogs, LResources, KromUtils
     {$IFDEF MSWindows}, Windows {$ENDIF}
  +  {$IFDEF Unix}, LCLType {$ENDIF}
     {$IFDEF WDC}, ZLibEx {$ENDIF}
  -  {$IFDEF FPC}, paszlib, fileutil {$ENDIF}
  +  {$IFDEF FPC}, zstream, fileutil {$ENDIF}
     ;
   
   type
  
positive.code:   DeCompressionStream: TZDecompressionStream;
    CompressionStream: TZCompressionStream;
    {$ENDIF}
    c:char;
  begin
    if not RunOpenDialog(OpenDialog1, '', '', 'Any file|*.*') then exit;
    {$IFDEF WDC}
    InputStream := TFileStream.Create(OpenDialog1.FileName, fmOpenRead);
    InputStream.Position := 0;
    InputStream.Read(c, 1);
  
    if c = #120 then begin
      Application.MessageBox('File is already a zLib archive', 'Error');
      InputStream.Free;
      exit;
    end;
    InputStream.Position := 0; //Reset just in case
  
    OutputStream := TFileStream.Create(OpenDialog1.FileName+'.tmp', fmCreate);
    CompressionStream := TZCompressionStream.Create(OutputStream, zcMax);
    CompressionStream.CopyFrom(InputStream, InputStream.Size);
    CompressionStream.Free;
    OutputStream.Free;
    InputStream.Free;
    {$ENDIF}
    {$IFDEF FPC}
      {
      InStream := TMemoryStream.Create;
      InStream.LoadFromFile(FileName);
  
  
negative.code:   DeCompressionStream: TZDecompressionStream;
    CompressionStream: TZCompressionStream;
    {$ENDIF}
    {$IFDEF FPC}
    DeCompressionStream: TDecompressionStream;
    CompressionStream: TCompressionStream;
    {$ENDIF}
    c:char;
  begin
    if not RunOpenDialog(OpenDialog1, '', '', 'Any file|*.*') then exit;
    InputStream := TFileStream.Create(OpenDialog1.FileName, fmOpenRead);
    InputStream.Position := 0;
    InputStream.Read(c, 1);
  
    if c <> #120 then begin
      Application.MessageBox('File is not a zLib archive', 'Error', MB_OK);
      InputStream.Free;
      exit;
    end;
    InputStream.Position := 0; //Reset just in case
  
    OutputStream := TMemoryStream.Create;
    {$IFDEF WDC}
    DecompressionStream := TZDecompressionStream.Create(InputStream);
    {$ENDIF}
    {$IFDEF FPC}
    DecompressionStream := TDecompressionStream.Create(InputStream);
    {$ENDIF}
    OutputStream.CopyFrom(DecompressionStream, 0);
    InputStream.Free; //Free the Stream before we write to same filename
    OutputStream.SaveToFile(OpenDialog1.Filename);
    DecompressionStream.Free;
    OutputStream.Free;
  end;
  
  
  