From ec5840fb2a943984da48896da092d41bb07ba891 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 14 Jan 2003 20:30:36 +0000 Subject: [PATCH] Added overloaded write functions for MemBuffer. committer: mfx 1042576236 +0000 --- src/file.cpp | 17 +++++++++++++++-- src/file.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/file.cpp b/src/file.cpp index e452b2cd..f49594e0 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -260,13 +260,13 @@ int InputFile::readx(void *buf, int len) int InputFile::read(MemBuffer *buf, int len) { assert((unsigned)len <= buf->getSize()); - return super::read(buf->getVoidPtr(), len); + return read(buf->getVoidPtr(), len); } int InputFile::readx(MemBuffer *buf, int len) { assert((unsigned)len <= buf->getSize()); - return super::readx(buf->getVoidPtr(), len); + return read(buf->getVoidPtr(), len); } @@ -369,6 +369,19 @@ void OutputFile::write(const void *buf, int len) } +void OutputFile::write(const MemBuffer *buf, int len) +{ + assert((unsigned)len <= buf->getSize()); + write(buf->getVoidPtr(), len); +} + + +void OutputFile::write(const MemBuffer &buf, int len) +{ + write(&buf, len); +} + + void OutputFile::dump(const char *name, const void *buf, int len, int flags) { if (flags < 0) diff --git a/src/file.h b/src/file.h index bb6fe05e..81dbf6d3 100644 --- a/src/file.h +++ b/src/file.h @@ -123,6 +123,8 @@ public: virtual bool openStdout(int flags=0, bool force=false); virtual void write(const void *buf, int len); + virtual void write(const MemBuffer *buf, int len); + virtual void write(const MemBuffer &buf, int len); off_t getBytesWritten() const { return bytes_written; }