Use size_t for lengths in stream objects

Provides safety against them accidentally becoming negative because
of bugs in the calculations.

Also does the same to CharArray and friends as they were strongly
connection to the stream objects.
This commit is contained in:
Pierre Ossman
2019-09-23 11:00:17 +02:00
committed by Lauri Kasanen
parent 346fccb96c
commit 259f1055cb
31 changed files with 180 additions and 178 deletions

View File

@@ -26,24 +26,24 @@ namespace rdr {
class HexOutStream : public OutStream {
public:
HexOutStream(OutStream& os, int buflen=0);
HexOutStream(OutStream& os, size_t buflen=0);
virtual ~HexOutStream();
void flush();
int length();
size_t length();
static char intToHex(int i);
static char* binToHexStr(const char* data, int length);
static char* binToHexStr(const char* data, size_t length);
private:
void writeBuffer();
int overrun(int itemSize, int nItems);
size_t overrun(size_t itemSize, size_t nItems);
OutStream& out_stream;
U8* start;
int offset;
int bufSize;
size_t offset;
size_t bufSize;
};
}