diff options
-rw-r--r-- | include/Buffer.h | 3 | ||||
-rw-r--r-- | lib/Buffer.cc | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/include/Buffer.h b/include/Buffer.h index dceac94..e088f35 100644 --- a/include/Buffer.h +++ b/include/Buffer.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Buffer.h,v 1.19 2004-11-27 21:46:02 pixel Exp $ */ +/* $Id: Buffer.h,v 1.20 2004-12-21 22:40:24 pixel Exp $ */ #ifndef __BUFFER_H__ #define __BUFFER_H__ @@ -56,6 +56,7 @@ class Buffer : public Handle { Byte * buffer, zero; size_t realsiz, bufsiz, ptr, wptr; bool seekable; + bool got_eof; }; #endif 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; } |