From a9d57b9ff061b63a1220cfe53205399a576319bd Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 11 Dec 2006 19:24:20 +0000 Subject: More crap git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5929 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ziplink.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index ef64c59ed..634ffccc4 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -128,7 +128,7 @@ class CountedBuffer : public classbase void RemoveFirstFrame() { - SI->Log(DEBUG,"Removing first frame"); + SI->Log(DEBUG,"Removing first frame from buffer sized %d", amount_expected); unsigned char* temp = buffer; bufsz -= (amount_expected + 4); @@ -312,22 +312,21 @@ class ModuleZLib : public Module return 1; unsigned char compr[CHUNK + 1]; + unsigned int total_decomp = 0; readresult = read(fd, compr, CHUNK); if (readresult > 0) { - ServerInstance->Log(DEBUG,"session->inbuf PTR = %d, %08x", fd, session->inbuf); - session->inbuf->AddData(compr, readresult); int size = session->inbuf->GetFrame(compr, CHUNK); - if (size) + while ((size) && (total_decomp < count)) { session->d_stream.next_in = (Bytef*)compr; session->d_stream.avail_in = 0; - session->d_stream.next_out = (Bytef*)buffer; + session->d_stream.next_out = (Bytef*)(buffer + total_decomp); if (inflateInit(&session->d_stream) != Z_OK) return -EBADF; @@ -344,10 +343,14 @@ class ModuleZLib : public Module readresult = session->d_stream.total_out; total_in_uncompressed += session->d_stream.total_out; - buffer[session->d_stream.total_out] = 0; + total_decomp += session->d_stream.total_out; ServerInstance->Log(DEBUG,"Decompressed %d bytes", session->d_stream.total_out); + + size = session->inbuf->GetFrame(compr, CHUNK); } + + buffer[total_decomp] = 0; } return (readresult > 0); } -- cgit v1.2.3