diff options
author | Keith Winstein <keithw@mit.edu> | 2012-04-19 01:35:15 -0400 |
---|---|---|
committer | Keith Winstein <keithw@mit.edu> | 2012-04-19 01:35:15 -0400 |
commit | 58589787eae15730b39f5ca91bec0e9ce68e4dbd (patch) | |
tree | 77d1c6cab7e8e7f9c984994d2e84065e3f3a1c48 | |
parent | 24d48f37a4664cca3a8701bf5a8c9f7684387d92 (diff) |
Make compressor take string references (closes #214 github issue)
-rw-r--r-- | src/network/compressor.cc | 4 | ||||
-rw-r--r-- | src/network/compressor.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/network/compressor.cc b/src/network/compressor.cc index 9f9500f..37c95c5 100644 --- a/src/network/compressor.cc +++ b/src/network/compressor.cc @@ -6,7 +6,7 @@ using namespace Network; using namespace std; -string Compressor::compress_str( const string input ) +string Compressor::compress_str( const string &input ) { long unsigned int len = BUFFER_SIZE; dos_assert( Z_OK == compress( buffer, &len, @@ -15,7 +15,7 @@ string Compressor::compress_str( const string input ) return string( reinterpret_cast<char *>( buffer ), len ); } -string Compressor::uncompress_str( const string input ) +string Compressor::uncompress_str( const string &input ) { long unsigned int len = BUFFER_SIZE; dos_assert( Z_OK == uncompress( buffer, &len, diff --git a/src/network/compressor.h b/src/network/compressor.h index 0d66bc7..ffeca99 100644 --- a/src/network/compressor.h +++ b/src/network/compressor.h @@ -14,8 +14,8 @@ namespace Network { 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 ); + std::string compress_str( const std::string &input ); + std::string uncompress_str( const std::string &input ); /* unused */ Compressor( const Compressor & ); |