Revert use of protobuf's Gzip streams.

Unfortunately some Red Hat-based distributions lack the required header.
See https://bugzilla.redhat.com/show_bug.cgi?id=815587

This reverts commit 261a389a76.
This reverts commit b6736eb0a5.
This commit is contained in:
Keith Winstein
2012-04-23 22:49:32 -04:00
parent 905176c2b9
commit 63459ed1c7
5 changed files with 69 additions and 29 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <zlib.h>
#include "compressor.h"
#include "dos_assert.h"
using namespace Network;
using namespace std;
string Compressor::compress_str( const string &input )
{
long unsigned int len = BUFFER_SIZE;
dos_assert( Z_OK == compress( buffer, &len,
reinterpret_cast<const unsigned char *>( input.data() ),
input.size() ) );
return string( reinterpret_cast<char *>( buffer ), len );
}
string Compressor::uncompress_str( const string &input )
{
long unsigned int len = BUFFER_SIZE;
dos_assert( Z_OK == uncompress( buffer, &len,
reinterpret_cast<const unsigned char *>( input.data() ),
input.size() ) );
return string( reinterpret_cast<char *>( buffer ), len );
}
/* construct on first use */
Compressor & Network::get_compressor( void )
{
static Compressor the_compressor;
return the_compressor;
}