diff options
-rw-r--r-- | common/file.cpp | 2 | ||||
-rw-r--r-- | common/file.h | 2 | ||||
-rw-r--r-- | common/memstream.h | 4 | ||||
-rw-r--r-- | common/stream.cpp | 2 | ||||
-rw-r--r-- | common/stream.h | 8 | ||||
-rw-r--r-- | common/zlib.cpp | 2 |
6 files changed, 18 insertions, 2 deletions
diff --git a/common/file.cpp b/common/file.cpp index 16e6a0df1a..4d9c630076 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -202,4 +202,6 @@ bool DumpFile::flush() { return _handle->flush(); } +int32 DumpFile::pos() const { return _handle->pos(); } + } // End of namespace Common diff --git a/common/file.h b/common/file.h index c055acc57d..3d174834e9 100644 --- a/common/file.h +++ b/common/file.h @@ -161,6 +161,8 @@ public: virtual uint32 write(const void *dataPtr, uint32 dataSize); virtual bool flush(); + + virtual int32 pos() const; }; } // End of namespace Common diff --git a/common/memstream.h b/common/memstream.h index 94407f5cc9..59d5f15b1a 100644 --- a/common/memstream.h +++ b/common/memstream.h @@ -111,7 +111,7 @@ public: return dataSize; } - uint32 pos() const { return _pos; } + int32 pos() const { return _pos; } uint32 size() const { return _bufSize; } virtual bool err() const { return _err; } @@ -201,7 +201,7 @@ public: return dataSize; } - uint32 pos() const { return _pos; } + int32 pos() const { return _pos; } uint32 size() const { return _size; } byte *getData() { return _data; } diff --git a/common/stream.cpp b/common/stream.cpp index 45060b9db5..a8446a9086 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -500,6 +500,8 @@ public: virtual bool flush() { return flushBuffer(); } + virtual int32 pos() const { return _pos; } + }; } // End of anonymous namespace diff --git a/common/stream.h b/common/stream.h index abe5192b70..c6c300fa97 100644 --- a/common/stream.h +++ b/common/stream.h @@ -103,6 +103,14 @@ public: flush(); } + /** + * Obtains the current value of the stream position indicator of the + * stream. + * + * @return the current position indicator, or -1 if an error occurred. + */ + virtual int32 pos() const = 0; + // The remaining methods all have default implementations; subclasses // need not (and should not) overload them. diff --git a/common/zlib.cpp b/common/zlib.cpp index c22ea1e660..3b51d66a5b 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -405,6 +405,8 @@ public: return dataSize - _stream.avail_in; } + + virtual int32 pos() const { return _wrapped->pos(); } }; #endif // USE_ZLIB |