🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5389

Re: Compress/uncompress a Buffer

#5389
From: sam
Date: Fri, 19 Aug 2005 14:11
35 lines
2267 bytes
Andrue I have changed the uncompres fonction, like this:
char *  UNCOMPRESSSTRING(char * szString, char *szBuff)
{
    ULONG ulBuffLen;

    int iErrorCode = Z_BUF_ERROR;
    ulBuffLen = lstrlen(szString) + BUFFER_SIZE;
    do{
        ulBuffLen = ulBuffLen *2;
        szBuff = new char[ulBuffLen];
        ZeroMemory(szBuff,ulBuffLen);
        iErrorCode = uncompress(szBuff, &ulBuffLen,  szString, 
lstrlen(szString));
    }while (iErrorCode == Z_BUF_ERROR);

    if (iErrorCode != Z_OK){

       switch (iErrorCode)
          {
              case Z_MEM_ERROR : throw Exception ("UnCompress: Not enough 
memory");
              case Z_DATA_ERROR: throw Exception ("UnCompress: Input data is 
corrupted");
              default          : throw Exception ("UnCompress: Unknown 
error");
          }
       }
But it loops in the while with no stop, whereas by debug I have found that 
the content of  szBuff is fine and match exactly the compress string for the 
*first pass* in the while ??
I don't understood what is wrong ?

Sam

}
Technical Details
Message-ID: <4305e88a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4304a1d6@newsgroups.borland.com> <4304a3dd@newsgroups.borland.com> <4304c079@newsgroups.borland.com> <4305934f$1@newsgroups.borland.com> <4305ccc9@newsgroups.borland.com> <4305d471$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,68b90959c01bbcf3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "sam" <s33@hotmail.com>
From: "sam" <s33@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4304a1d6@newsgroups.borland.com> <4304a3dd@newsgroups.borland.com> <4304c079@newsgroups.borland.com> <4305934f$1@newsgroups.borland.com> <4305ccc9@newsgroups.borland.com> <4305d471$1@newsgroups.borland.com>
Subject: Re: Compress/uncompress a Buffer
Date: Fri, 19 Aug 2005 16:11:27 +0200
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 83.195.12.122
Message-ID: <4305e88a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1124460682 83.195.12.122 (19 Aug 2005 07:11:22 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail