summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-12 00:22:09 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-12 00:22:09 +0000
commitb9ff03f9bccd813a5362c6fcdfe8e3c9cd67c920 (patch)
tree415b9e9671048b9daa65444b9ded92e688dbe0d5 /src
parentfafa6af9cd7fbf62da71e3a97586f9be763db7ba (diff)
More comments
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5959 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_ziplink.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp
index 71f710551..5ee3779bd 100644
--- a/src/modules/extra/m_ziplink.cpp
+++ b/src/modules/extra/m_ziplink.cpp
@@ -328,8 +328,9 @@ class ModuleZLib : public Module
session->d_stream.avail_in = 0;
session->d_stream.next_out = (Bytef*)(buffer + offset);
+ /* If we cant call this, well, we're boned. */
if (inflateInit(&session->d_stream) != Z_OK)
- return -EBADF;
+ return 0;
while ((session->d_stream.total_out < count) && (session->d_stream.total_in < (unsigned int)size))
{
@@ -338,14 +339,19 @@ class ModuleZLib : public Module
break;
}
+ /* Stick a fork in me, i'm done */
inflateEnd(&session->d_stream);
+ /* Update counters and offsets */
total_size += session->d_stream.total_out;
total_in_uncompressed += session->d_stream.total_out;
offset += session->d_stream.total_out;
}
+ /* Null-terminate the buffer -- this doesnt harm binary data */
buffer[total_size] = 0;
+
+ /* Set the read size to the correct total size */
readresult = total_size;
}