aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/zlib.cpp12
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);