[Scummvm-cvs-logs] scummvm master -> c3003eec851d6c8f0e4fccca4b618f74c718966a

bluegr bluegr at gmail.com
Fri Mar 28 00:31:21 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c3003eec85 COMMON: Reduce the warnings related to backwards seeking in ZIP files


Commit: c3003eec851d6c8f0e4fccca4b618f74c718966a
    https://github.com/scummvm/scummvm/commit/c3003eec851d6c8f0e4fccca4b618f74c718966a
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-03-28T01:30:38+02:00

Commit Message:
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.

Changed paths:
    common/zlib.cpp



diff --git a/common/zlib.cpp b/common/zlib.cpp
index 448e1ea..c22ea1e 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);






More information about the Scummvm-git-logs mailing list