diff options
author | Filippos Karapetis | 2014-03-28 01:30:38 +0200 |
---|---|---|
committer | Filippos Karapetis | 2014-03-28 01:30:38 +0200 |
commit | c3003eec851d6c8f0e4fccca4b618f74c718966a (patch) | |
tree | c33014ca0149a57c9aab3e460b15e3fe6df11d40 | |
parent | 19f427f9a510866cecdeed896a4724401e1167bd (diff) | |
download | scummvm-rg350-c3003eec851d6c8f0e4fccca4b618f74c718966a.tar.gz scummvm-rg350-c3003eec851d6c8f0e4fccca4b618f74c718966a.tar.bz2 scummvm-rg350-c3003eec851d6c8f0e4fccca4b618f74c718966a.zip |
COMMON: Reduce the warnings related to backwards seeking in ZIP files
The warnings are now changed to debug statements, are only shown once
per session (instead of once per stream) and are only enabled for debug
builds.
-rw-r--r-- | common/zlib.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/common/zlib.cpp b/common/zlib.cpp index 448e1eadd5..c22ea1e660 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -27,6 +27,7 @@ #include "common/ptr.h" #include "common/util.h" #include "common/stream.h" +#include "common/debug.h" #include "common/textconsole.h" #if defined(USE_ZLIB) @@ -140,6 +141,10 @@ bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcL return true; } +#ifndef RELEASE_BUILD +static bool _shownBackwardSeekingWarning = false; +#endif + /** * A simple wrapper class which can be used to wrap around an arbitrary * other SeekableReadStream and will then provide on-the-fly decompression support. @@ -159,11 +164,10 @@ protected: uint32 _pos; uint32 _origSize; bool _eos; - bool _shownBackwardSeekingWarning; public: - GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream(), _shownBackwardSeekingWarning(false) { + GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() { assert(w != 0); // Verify file header is correct @@ -263,13 +267,15 @@ public: // from the start of the file. A rather wasteful operation, best // to avoid it. :/ +#ifndef RELEASE_BUILD if (!_shownBackwardSeekingWarning) { // We only throw this warning once per stream, to avoid // getting the console swarmed with warnings when consecutive // seeks are made. - warning("Backward seeking in GZipReadStream detected"); + debug(1, "Backward seeking in GZipReadStream detected"); _shownBackwardSeekingWarning = true; } +#endif _pos = 0; _wrapped->seek(0, SEEK_SET); |