Added overloaded write functions for MemBuffer.
committer: mfx <mfx> 1042576236 +0000
This commit is contained in:
parent
9511e3c9b1
commit
ec5840fb2a
17
src/file.cpp
17
src/file.cpp
@ -260,13 +260,13 @@ int InputFile::readx(void *buf, int len)
|
|||||||
int InputFile::read(MemBuffer *buf, int len)
|
int InputFile::read(MemBuffer *buf, int len)
|
||||||
{
|
{
|
||||||
assert((unsigned)len <= buf->getSize());
|
assert((unsigned)len <= buf->getSize());
|
||||||
return super::read(buf->getVoidPtr(), len);
|
return read(buf->getVoidPtr(), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InputFile::readx(MemBuffer *buf, int len)
|
int InputFile::readx(MemBuffer *buf, int len)
|
||||||
{
|
{
|
||||||
assert((unsigned)len <= buf->getSize());
|
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)
|
void OutputFile::dump(const char *name, const void *buf, int len, int flags)
|
||||||
{
|
{
|
||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
|
|||||||
@ -123,6 +123,8 @@ public:
|
|||||||
virtual bool openStdout(int flags=0, bool force=false);
|
virtual bool openStdout(int flags=0, bool force=false);
|
||||||
|
|
||||||
virtual void write(const void *buf, int len);
|
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; }
|
off_t getBytesWritten() const { return bytes_written; }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user