diff options
Diffstat (limited to 'lib/Buffer.cc')
-rw-r--r-- | lib/Buffer.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 6d0317e..123cc65 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -3,7 +3,7 @@ #include "General.h" #include "config.h" -Buffer::Buffer() : Handle(-1), buffer(NULL), realsiz(0), bufsiz(0), ptr(0) { } +Buffer::Buffer() : Handle(-1), buffer(0), realsiz(0), bufsiz(0), ptr(0) { } Buffer::~Buffer() { free(buffer); @@ -21,13 +21,13 @@ ssize_t Buffer::write(const void *buf, size_t count) { return count; } -ssize_t Buffer::read(void *buf, size_t count) { +ssize_t Buffer::read(void *buf, size_t count) throw (GeneralException) { count = MIN(count, realsiz - ptr); - + if (!count) { return 0; } - + memcpy(buf, buffer + ptr, count); ptr += count; |