summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Buffer.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc
index 9d2f66a..a9768ba 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.25 2004-11-27 21:46:04 pixel Exp $ */
+/* $Id: Buffer.cc,v 1.26 2004-12-21 22:40:24 pixel Exp $ */
#include <string.h>
#ifdef HAVE_CONFIG_H
@@ -26,13 +26,13 @@
#include "Buffer.h"
#include "generic.h"
-Buffer::Buffer(bool _seekable) : Handle(-1), buffer(0), zero(0), realsiz(0), bufsiz(0), ptr(0), wptr(0), seekable(_seekable) { }
+Buffer::Buffer(bool _seekable) : Handle(-1), buffer(0), zero(0), realsiz(0), bufsiz(0), ptr(0), wptr(0), seekable(_seekable), got_eof(false) { }
Buffer::~Buffer() {
free(buffer);
}
-Buffer::Buffer(const Buffer & b) : Handle(-1), buffer(0), zero(b.zero), realsiz(b.realsiz), bufsiz(b.bufsiz), ptr(b.ptr), wptr(b.wptr), seekable(b.seekable) {
+Buffer::Buffer(const Buffer & b) : Handle(-1), buffer(0), zero(b.zero), realsiz(b.realsiz), bufsiz(b.bufsiz), ptr(b.ptr), wptr(b.wptr), seekable(b.seekable), got_eof(b.got_eof) {
buffer = (Byte *) malloc(bufsiz);
memcpy(buffer, b.buffer, bufsiz);
}
@@ -60,6 +60,9 @@ ssize_t Buffer::read(void *buf, size_t count) throw (GeneralException) {
count = MIN(count, realsiz - ptr);
if (!count) {
+ if (got_eof)
+ close();
+ got_eof = true;
return 0;
}