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

lordhoto lordhoto at gmail.com
Sat Jan 26 16:48:56 CET 2013


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

Summary:
36bfaa6a30 COMMON: Return NULL in wrapCompressedReadStream for compressed streams when ZLIB is disabled.
e0c5a78a26 Merge pull request #303 from lordhoto/wrap-compressed


Commit: 36bfaa6a308654862c5d233fe4e86d9f8c4c02bd
    https://github.com/scummvm/scummvm/commit/36bfaa6a308654862c5d233fe4e86d9f8c4c02bd
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-26T06:25:13-08:00

Commit Message:
COMMON: Return NULL in wrapCompressedReadStream for compressed streams when ZLIB is disabled.

Changed paths:
    common/zlib.cpp
    common/zlib.h



diff --git a/common/zlib.cpp b/common/zlib.cpp
index fc8f351..62904cb 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -392,17 +392,21 @@ public:
 #endif	// USE_ZLIB
 
 SeekableReadStream *wrapCompressedReadStream(SeekableReadStream *toBeWrapped, uint32 knownSize) {
-#if defined(USE_ZLIB)
 	if (toBeWrapped) {
 		uint16 header = toBeWrapped->readUint16BE();
 		bool isCompressed = (header == 0x1F8B ||
 				     ((header & 0x0F00) == 0x0800 &&
 				      header % 31 == 0));
 		toBeWrapped->seek(-2, SEEK_CUR);
-		if (isCompressed)
+		if (isCompressed) {
+#if defined(USE_ZLIB)
 			return new GZipReadStream(toBeWrapped, knownSize);
-	}
+#else
+			delete toBeWrapped;
+			return NULL;
 #endif
+		}
+	}
 	return toBeWrapped;
 }
 
diff --git a/common/zlib.h b/common/zlib.h
index 6a840f5..2772ffb 100644
--- a/common/zlib.h
+++ b/common/zlib.h
@@ -103,7 +103,9 @@ bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcL
  * provides transparent on-the-fly decompression. Assumes the data it
  * retrieves from the wrapped stream to be either uncompressed or in gzip
  * format. In the former case, the original stream is returned unmodified
- * (and in particular, not wrapped).
+ * (and in particular, not wrapped). In the latter case the stream is
+ * returned wrapped, unless there is no ZLIB support, then NULL is returned
+ * and the old stream is destroyed.
  *
  * Certain GZip-formats don't supply an easily readable length, if you
  * still need the length carried along with the stream, and you know


Commit: e0c5a78a2662fbc739e5ee68f6d37bbb00bfe9a9
    https://github.com/scummvm/scummvm/commit/e0c5a78a2662fbc739e5ee68f6d37bbb00bfe9a9
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2013-01-26T07:48:23-08:00

Commit Message:
Merge pull request #303 from lordhoto/wrap-compressed

Return NULL in wrapCompressedReadStream for compressed streams when ZLIB is disabled.

Changed paths:
    common/zlib.cpp
    common/zlib.h









More information about the Scummvm-git-logs mailing list