(trunk libT) if we compile with TR_EMBEDDED, use Z_DEFAULT_COMPRESSION. otherwise, use Z_BEST_COMPRESSION

This commit is contained in:
Charles Kerr 2010-08-15 23:45:58 +00:00
parent 7e52a2e8bb
commit 4e0f5f5d35
1 changed files with 8 additions and 1 deletions

View File

@ -330,6 +330,8 @@ add_response( struct evhttp_request * req,
if( !server->isStreamInitialized )
{
int compressionLevel;
server->isStreamInitialized = TRUE;
server->stream.zalloc = (alloc_func) Z_NULL;
server->stream.zfree = (free_func) Z_NULL;
@ -337,7 +339,12 @@ add_response( struct evhttp_request * req,
/* zlib's manual says: "Add 16 to windowBits to write a simple gzip header
* and trailer around the compressed data instead of a zlib wrapper." */
deflateInit2( &server->stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15+16, 8, Z_DEFAULT_STRATEGY );
#ifdef TR_EMBEDDED
compressionLevel = Z_DEFAULT_COMPRESSION;
#else
compressionLevel = Z_BEST_COMPRESSION;
#endif
deflateInit2( &server->stream, compressionLevel, Z_DEFLATED, 15+16, 8, Z_DEFAULT_STRATEGY );
}
server->stream.next_in = (Bytef*) content;