diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Handle.cc | 4 | ||||
-rw-r--r-- | lib/LuaHandle.cc | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index 39bc981..4ee233c 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -869,7 +869,7 @@ int Handle::GetNbHandles() { // // shamelessly ripped from http://www.zlib.net/zpipe.c // -int Handle::zlib_inflate(Handle * in, Handle * out) throw (GeneralException) { +int Handle::zlib_inflate(Handle * in, Handle * out, bool raw) throw (GeneralException) { int ret; z_stream s; unsigned char b_in[CHUNK]; @@ -886,7 +886,7 @@ int Handle::zlib_inflate(Handle * in, Handle * out) throw (GeneralException) { have = total_out = 0; - ret = inflateInit(&s); + ret = inflateInit2(&s, raw ? -15 : 0); if (ret != Z_OK) { throw GeneralException("zlib: inflateInit() failed: " + String(ret)); } diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 08f4911..ba66afc 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -809,15 +809,18 @@ int sLuaHandle::zlib_inflate(lua_State * __L) { int n = L->gettop(); Handle * s, * d; int r; + bool raw = false; - if (n != 2) { + if ((n < 2) || (n > 3) || ((n == 3) && !L->isboolean(3))) { L->error("Incorrect arguments to method `Handle::zlib_inflate'"); } s = L->recast<Handle>(1); d = L->recast<Handle>(2); + if (n >= 3) + raw = L->toboolean(3); - r = Handle::zlib_inflate(s, d); + r = Handle::zlib_inflate(s, d, raw); L->push((lua_Number) r); |