diff options
author | Pixel <pixel@nobis-crew.org> | 2010-06-20 20:51:57 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2010-06-20 20:51:57 -0700 |
commit | 8abf31744c41eacee7ea835aca7866735a30a4f0 (patch) | |
tree | b70a65cf27c388c685ceadd00b3272e6123f4c9d /lib/Handle.cc | |
parent | ecb115ec57dcf948262731ff929101647a5f0741 (diff) |
Adding levels and ability to raw-compress in zlib_deflate.
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r-- | lib/Handle.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index 457f2c9..e88663a 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -887,8 +887,8 @@ int Handle::zlib_inflate(Handle * in, Handle * out) throw (GeneralException) { have = total_out = 0; ret = inflateInit(&s); - if (ret != Z_OK ) { - throw GeneralException("zlib: deflateInit() failed: " + String(ret)); + if (ret != Z_OK) { + throw GeneralException("zlib: inflateInit() failed: " + String(ret)); } do { @@ -927,7 +927,7 @@ int Handle::zlib_inflate(Handle * in, Handle * out) throw (GeneralException) { return total_out; } -int Handle::zlib_deflate(Handle * in, Handle * out) throw (GeneralException) { +int Handle::zlib_deflate(Handle * in, Handle * out, int level, bool raw) throw (GeneralException) { int ret, flush; z_stream s; unsigned char b_in[CHUNK]; @@ -944,8 +944,8 @@ int Handle::zlib_deflate(Handle * in, Handle * out) throw (GeneralException) { have = total_out = 0; - ret = deflateInit(&s, Z_DEFAULT_COMPRESSION); - if (ret != Z_OK ) { + ret = deflateInit2(&s, level, Z_DEFLATED, raw ? -15 : 15, 8, Z_DEFAULT_STRATEGY); + if (ret != Z_OK) { throw GeneralException("zlib: deflateInit() failed: " + String(ret)); } |