diff options
Diffstat (limited to 'lib/Buffer.cc')
-rw-r--r-- | lib/Buffer.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 575503c..7def194 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.28 2007-06-23 15:36:02 pixel Exp $ */ +/* $Id: Buffer.cc,v 1.29 2007-09-17 08:33:25 pixel Exp $ */ #include <string.h> #ifdef HAVE_CONFIG_H @@ -66,7 +66,8 @@ ssize_t Buffer::read(void *buf, size_t count) throw (GeneralException) { return 0; } - memcpy(buf, buffer + ptr, count); + if (buf) + memcpy(buf, buffer + ptr, count); ptr += count; if (!seekable) { @@ -123,6 +124,10 @@ ssize_t Buffer::GetSize() const { return realsiz; } +ssize_t Buffer::GetRemaining() const { + return realsiz - ptr; +} + Byte Buffer::operator[](size_t p) const { if (p >= realsiz) { return 0; |