aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlexander Tkachev2016-08-04 15:14:06 +0600
committerAlexander Tkachev2016-08-04 15:14:06 +0600
commitf58abd95409998d5e0859aaa1ef0df14c0639519 (patch)
tree1c3e87762ec7c1000d8b2f8f6edab263506b16f8 /common
parent7a89caac84d2dd8cb987b20f432609d462a5f5d8 (diff)
downloadscummvm-rg350-f58abd95409998d5e0859aaa1ef0df14c0639519.tar.gz
scummvm-rg350-f58abd95409998d5e0859aaa1ef0df14c0639519.tar.bz2
scummvm-rg350-f58abd95409998d5e0859aaa1ef0df14c0639519.zip
COMMON: Update GZipWriteStream::pos()
Though it seemed the _wrapped stream should return valid position, it was always 0. That's why I've added a _pos field, which is updated in write() and returned in pos().
Diffstat (limited to 'common')
-rw-r--r--common/zlib.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 3b51d66a5b..39130beb4e 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -316,6 +316,7 @@ protected:
ScopedPtr<WriteStream> _wrapped;
z_stream _stream;
int _zlibErr;
+ uint32 _pos;
void processData(int flushType) {
// This function is called by both write() and finalize().
@@ -333,7 +334,7 @@ protected:
}
public:
- GZipWriteStream(WriteStream *w) : _wrapped(w), _stream() {
+ GZipWriteStream(WriteStream *w) : _wrapped(w), _stream(), _pos(0) {
assert(w != 0);
// Adding 16 to windowBits indicates to zlib that it is supposed to
@@ -403,10 +404,11 @@ public:
// ... and flush it to disk
processData(Z_NO_FLUSH);
+ _pos += dataSize - _stream.avail_in;
return dataSize - _stream.avail_in;
}
- virtual int32 pos() const { return _wrapped->pos(); }
+ virtual int32 pos() const { return _pos; }
};
#endif // USE_ZLIB