Added read() functions that take a MemBuffer as arg.

committer: mfx <mfx> 1035297017 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2002-10-22 14:30:17 +00:00
parent b082a6f1da
commit 7af193df77
2 changed files with 36 additions and 6 deletions
+25 -1
View File
@@ -28,6 +28,7 @@
#include "conf.h" #include "conf.h"
#include "file.h" #include "file.h"
#include "mem.h"
/************************************************************************* /*************************************************************************
@@ -250,13 +251,36 @@ int InputFile::read(void *buf, int len)
return super::read(buf, len); return super::read(buf, len);
} }
int InputFile::readx(void *buf, int len) int InputFile::readx(void *buf, int len)
{ {
return super::readx(buf, len); return super::readx(buf, len);
} }
int InputFile::read(MemBuffer *buf, int len)
{
assert((unsigned)len <= buf->getSize());
return super::read(buf->getVoidPtr(), len);
}
int InputFile::readx(MemBuffer *buf, int len)
{
assert((unsigned)len <= buf->getSize());
return super::readx(buf->getVoidPtr(), len);
}
int InputFile::read(MemBuffer &buf, int len)
{
return read(&buf, len);
}
int InputFile::readx(MemBuffer &buf, int len)
{
return readx(&buf, len);
}
void InputFile::seek(off_t off, int whence) void InputFile::seek(off_t off, int whence)
{ {
super::seek(off,whence); super::seek(off,whence);
+6
View File
@@ -29,6 +29,8 @@
#ifndef __UPX_FILE_H #ifndef __UPX_FILE_H
#define __UPX_FILE_H #define __UPX_FILE_H
class MemBuffer;
/************************************************************************* /*************************************************************************
// //
@@ -92,6 +94,10 @@ public:
virtual int read(void *buf, int len); virtual int read(void *buf, int len);
virtual int readx(void *buf, int len); virtual int readx(void *buf, int len);
virtual int read(MemBuffer *buf, int len);
virtual int readx(MemBuffer *buf, int len);
virtual int read(MemBuffer &buf, int len);
virtual int readx(MemBuffer &buf, int len);
virtual void seek(off_t off, int whence); virtual void seek(off_t off, int whence);
virtual off_t tell() const; virtual off_t tell() const;