summaryrefslogtreecommitdiff
path: root/lib/Buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Buffer.cc')
-rw-r--r--lib/Buffer.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc
index 164c961..57b1bf8 100644
--- a/lib/Buffer.cc
+++ b/lib/Buffer.cc
@@ -32,7 +32,7 @@ ssize_t Buffer::read(void *buf, size_t count) {
ptr += count;
if (ptr >= realloc_threshold) {
- int numblocks = (ptr / realloc_threshold) - (bufsiz / realloc_threshold);
+ int numblocks = (bufsiz / realloc_threshold) - (ptr / realloc_threshold);
memmove(buffer, buffer + numblocks * realloc_threshold, numblocks * realloc_threshold);
buffer = (char *) realloc(buffer, bufsiz = (numblocks * realloc_threshold));
ptr -= numblocks * realloc_threshold;