summaryrefslogtreecommitdiff
path: root/lib/Buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Buffer.cc')
-rw-r--r--lib/Buffer.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc
index 16966e4..216a1f6 100644
--- a/lib/Buffer.cc
+++ b/lib/Buffer.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Buffer.cc,v 1.22 2003-12-12 12:45:20 pixel Exp $ */
+/* $Id: Buffer.cc,v 1.23 2004-04-27 11:23:29 pixel Exp $ */
#include <string.h>
#ifdef HAVE_CONFIG_H
@@ -71,6 +71,7 @@ ssize_t Buffer::read(void *buf, size_t count) throw (GeneralException) {
int numblocks = (bufsiz / realloc_threshold) - (ptr / realloc_threshold);
memmove(buffer, buffer + (bufsiz - numblocks * realloc_threshold), numblocks * realloc_threshold);
ptr -= (bufsiz - numblocks * realloc_threshold);
+ wptr -= (bufsiz - numblocks * realloc_threshold);
realsiz -= (bufsiz - numblocks * realloc_threshold);
buffer = (Byte *) realloc(buffer, bufsiz = (numblocks * realloc_threshold));
}
@@ -200,3 +201,8 @@ off_t Buffer::wseek(off_t off, int wheel) throw (GeneralException) {
off_t Buffer::wtell() const {
return wptr;
}
+
+void Buffer::reset() {
+ free(buffer);
+ realsiz = bufsiz = ptr = wptr = 0;
+}