Article View: borland.public.cppbuilder.nativeapi
Article #5394Re: Compress/uncompress a Buffer
From: Andrue Cope [TeamB]
Date: Fri, 19 Aug 2005 16:08
Date: Fri, 19 Aug 2005 16:08
26 lines
2142 bytes
2142 bytes
Andrue Cope [TeamB] wrote: > For some bizarre reason as soon as the linker has to include the zlib > functions the application won't run. It just hits some freaky > breakpoint and stops. Looks like something in the zlib library initialisation is getting upset but darned if I can see why. Anyway assuming that the code works for you (here's hoping) the only caveat is: std::vector<BYTE> result( 1024 ); // Should be enough but you need to do something about this The ideal solution would probably be to create a structure to return from compress(). Make it consist of the std::vector and a DWORD indicating the original size. Then pass this structure to decompress and have it create it's std::vector as 2*<originalsize>. The reason I multiply by two is safety. This late on a Friday I'm not going to try and be precise and let's face it multiplying by two will certainly be safe and won't do much harm. -- Andrue Cope [TeamB] [Bicester, Uk] http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<430603f6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<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> <4305f25b@newsgroups.borland.com> <43060098$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 From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address> Subject: Re: Compress/uncompress a Buffer 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> <4305f25b@newsgroups.borland.com> <43060098$1@newsgroups.borland.com> Date: Fri, 19 Aug 2005 17:08:38 +0100 User-Agent: XanaNews/1.17.5.9 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 NNTP-Posting-Host: 217.207.223.34 Message-ID: <430603f6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1124467702 217.207.223.34 (19 Aug 2005 09:08:22 -0700) Lines: 26 X-Authenticated-User: acope Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail