Make compressor take string references (closes #214 github issue)
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
using namespace Network;
|
using namespace Network;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
string Compressor::compress_str( const string input )
|
string Compressor::compress_str( const string &input )
|
||||||
{
|
{
|
||||||
long unsigned int len = BUFFER_SIZE;
|
long unsigned int len = BUFFER_SIZE;
|
||||||
dos_assert( Z_OK == compress( buffer, &len,
|
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 );
|
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;
|
long unsigned int len = BUFFER_SIZE;
|
||||||
dos_assert( Z_OK == uncompress( buffer, &len,
|
dos_assert( Z_OK == uncompress( buffer, &len,
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace Network {
|
|||||||
Compressor() : buffer( NULL ) { buffer = new unsigned char[ BUFFER_SIZE ]; }
|
Compressor() : buffer( NULL ) { buffer = new unsigned char[ BUFFER_SIZE ]; }
|
||||||
~Compressor() { if ( buffer ) { delete[] buffer; } }
|
~Compressor() { if ( buffer ) { delete[] buffer; } }
|
||||||
|
|
||||||
std::string compress_str( const std::string input );
|
std::string compress_str( const std::string &input );
|
||||||
std::string uncompress_str( const std::string input );
|
std::string uncompress_str( const std::string &input );
|
||||||
|
|
||||||
/* unused */
|
/* unused */
|
||||||
Compressor( const Compressor & );
|
Compressor( const Compressor & );
|
||||||
|
|||||||
Reference in New Issue
Block a user