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:
committed by
Lauri Kasanen
parent
346fccb96c
commit
259f1055cb
@@ -35,25 +35,25 @@ namespace rdr {
|
||||
|
||||
public:
|
||||
|
||||
ZlibOutStream(OutStream* os=0, int bufSize=0, int compressionLevel=-1);
|
||||
ZlibOutStream(OutStream* os=0, size_t bufSize=0, int compressionLevel=-1);
|
||||
virtual ~ZlibOutStream();
|
||||
|
||||
void setUnderlying(OutStream* os);
|
||||
void setCompressionLevel(int level=-1);
|
||||
void flush();
|
||||
int length();
|
||||
size_t length();
|
||||
|
||||
private:
|
||||
|
||||
int overrun(int itemSize, int nItems);
|
||||
size_t overrun(size_t itemSize, size_t nItems);
|
||||
void deflate(int flush);
|
||||
void checkCompressionLevel();
|
||||
|
||||
OutStream* underlying;
|
||||
int compressionLevel;
|
||||
int newLevel;
|
||||
int bufSize;
|
||||
int offset;
|
||||
size_t bufSize;
|
||||
size_t offset;
|
||||
z_stream_s* zs;
|
||||
U8* start;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user