Zlib at Delphi 2009

I am updating the application to Delphi 2009. The application uses soap, and we compress the request flows and soap flows using Zlib. This works fine in Delphi 2006, but not in Delphi 2009.

So, I returned to Delphi 2006 and switched to using FastZlib. All this worked fine in Delphi2006, but it doesn’t work in Delphi 2009, and I get Decompress errors.

Has anyone else had this problem?

How can I fix this?

Sandeep

+3
source share
5 answers

I just looked at the built-in Zlib.pas and seems to have been updated correctly for D2009. What gives you problems?

0
source

delphi 2006 Zlib ( Delphi 2006)

procedure CompressStream(inpStream, outStream: TStream);
var
  InpBuf, OutBuf: Pointer;
  InpBytes, OutBytes: Integer;
begin
  InpBuf := nil;
  OutBuf := nil;
  try
    GetMem(InpBuf, inpStream.Size);
    inpStream.Position := 0;
    InpBytes := inpStream.Read(InpBuf^, inpStream.Size);
    CompressBuf(InpBuf, InpBytes, OutBuf, OutBytes);
    outStream.Write(OutBuf^, OutBytes);
  finally
    if InpBuf <> nil then FreeMem(InpBuf);
    if OutBuf <> nil then FreeMem(OutBuf);
  end;
end;


{ Decompress a stream }
procedure DecompressStream(inpStream, outStream: TStream);
var
  InpBuf, OutBuf: Pointer;
  OutBytes, sz: Integer;
begin
  InpBuf := nil;
  OutBuf := nil;
  sz     := inpStream.Size - inpStream.Position;
  if sz > 0 then 
    try
      GetMem(InpBuf, sz);
      inpStream.Read(InpBuf^, sz);
      DecompressBuf(InpBuf, sz, 0, OutBuf, OutBytes);
      outStream.Write(OutBuf^, OutBytes);
    finally
      if InpBuf <> nil then FreeMem(InpBuf);
      if OutBuf <> nil then FreeMem(OutBuf);
    end;
  outStream.Position := 0;
end;

, Delphi 2009?

0

-, - , UUENCODE, , . , - .

, , .

0

: CompressBuf DecompressBuf GONE.

, D7, D2010, "CompressBuf" "DecompressBuf".

find D7 c:\Program Files\Borland\Delphi7\Source\Rtl\Common\ZLib.pas

But a search with D2010 (inconvenient split) the Find in Files command cannot find CompressBuf or DecompressBuf anywhere.

It is very worrying that updating the IDE causes the routines used and necessary in projects to disappear!

0
source

in D2009 you can use ZCompress / ZDecompress instead of CompressBuf / DecompressBuf
I am testing it and there are no problems.

0
source

Source: https://habr.com/ru/post/1709653/


All Articles