Hi Wei,
Thanks.
> You code looks ok, except that the "9" parameter should be passed to Gzip,
> not FileSink.
Whoops - that's the actual code (not fat fingered during
transcription). What follows corrects the record.
Jeff
try {
CryptoPP::Gzip zipper(
// true = binary
new CryptoPP::FileSink (filename.c_str(), true ),
CryptoPP::Gzip::MAX_DEFLATE_LEVEL ); // Gzip
zipper.Put( (byte*)pCodeStart, dwCodeSize );
zipper.MessageEnd( );
}
catch( CryptoPP::Exception& e )
{
std::cerr << e.what() << std:: endl;
}
...
On 5/27/07, Wei Dai <[EMAIL PROTECTED]> wrote:
> I don't know if WinZip will handle gzip files, but WinRAR certainly does.
> You code looks ok, except that the "9" parameter should be passed to Gzip,
> not FileSink.
>
> ----- Original Message -----
> From: "Jeffrey Walton" <[EMAIL PROTECTED]>
> To: "Crypto++" <[EMAIL PROTECTED]>
> Sent: Sunday, May 27, 2007 3:13 PM
> Subject: Embarassing Question: GZip
>
>
> >
> > Hi All,
> >
> > I hate asking this one, but I'm neck deep in a Memorial Day deadline...
> >
> > I compressed an image (generic term... not a picture) using Gzip as
> > follows below. The archive is created, and image size is showming
> > compression (1.5 MB -> 450 KB). When I attempt to view in WinZip, I
> > receive the message, "Cannot open file: it does not appear to be a
> > valid archive. If you downloaded this file, try downloading the file
> > again."
> >
> > My question[s] is/are:
> > 1) Does WinZip not handle a GZip properly?
> > 2) If [1], what is a recommended external viewer to validate the
> > results of the operation on a Win32 platform
> > 3) Am I doing something wrong (most likely)
> >
> > Jeff
> >
> >
> > try {
> > CryptoPP::Gzip zipper(
> > // Compression Speed: 1 = fast, 9 = slow
> > new CryptoPP::FileSink ( filename.c_str(), 9 )
> > );
> > zipper.Put( (byte*)pCodeStart, dwCodeSize );
> > zipper.MessageEnd( );
> > }
> >
> > catch( CryptoPP::Exception& e )
> > {
> > std::cerr << e.what() << std:: endl;
> > }
> >
> > catch( ... )
> > {
> > std::tcerr << _T("Caught Unknown Exception") << std:: endl;
> > }
> >
> > > >
>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---