Use protobuf’s Gzip{Input,Output}Stream wrapper around zlib

This removes our direct zlib dependency (although of course protobuf
still uses it internally), removes a fixed 4 MiB buffer and its
corresponding limit on the terminal size, reduces some string copying,
and deletes some code.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

(Closes #230.)
This commit is contained in:
Anders Kaseorg
2012-04-17 02:50:29 -04:00
committed by Keith Winstein
parent 76f5b593d9
commit b6736eb0a5
7 changed files with 30 additions and 71 deletions
-28
View File
@@ -1,28 +0,0 @@
#ifndef COMPRESSOR_H
#define COMPRESSOR_H
#include <string>
namespace Network {
class Compressor {
private:
static const int BUFFER_SIZE = 2048 * 2048; /* effective limit on terminal size */
unsigned char *buffer;
public:
Compressor() : buffer( NULL ) { buffer = new unsigned char[ BUFFER_SIZE ]; }
~Compressor() { if ( buffer ) { delete[] buffer; } }
std::string compress_str( const std::string &input );
std::string uncompress_str( const std::string &input );
/* unused */
Compressor( const Compressor & );
Compressor & operator=( const Compressor & );
};
Compressor & get_compressor( void );
}
#endif