[Scummvm-cvs-logs] scummvm master -> 10a947a0be80ea8c5c88bd3493a5057b1223ce45

tramboi bertrand_augereau at yahoo.fr
Thu Aug 30 18:47:49 CEST 2012


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:
3b4d713ba1 GRAPHICS: Undefined behaviour/warnings removal in the TGA decoder
10a947a0be GRAPHICS: Scope reduction of the sometimes unused alpha component in TGADecoder::readHeader


Commit: 3b4d713ba114a692354f2a9dc68d7b9c3cfe5560
    https://github.com/scummvm/scummvm/commit/3b4d713ba114a692354f2a9dc68d7b9c3cfe5560
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2012-08-30T09:13:00-07:00

Commit Message:
GRAPHICS: Undefined behaviour/warnings removal in the TGA decoder

Changed paths:
    graphics/decoders/tga.cpp



diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp
index 7d214a6..c27cd2b 100644
--- a/graphics/decoders/tga.cpp
+++ b/graphics/decoders/tga.cpp
@@ -191,6 +191,9 @@ bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, b
 			PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
 			uint16 color = tga.readUint16LE();
 			format.colorToARGB(color, a, r, g, b);
+		} else {
+			warning("Unsupported image type: %d", imageType);
+			r = g = b = a = 0;
 		}
 #ifdef SCUMM_LITTLE_ENDIAN
 		_colorMap[i] = r;


Commit: 10a947a0be80ea8c5c88bd3493a5057b1223ce45
    https://github.com/scummvm/scummvm/commit/10a947a0be80ea8c5c88bd3493a5057b1223ce45
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2012-08-30T09:32:27-07:00

Commit Message:
GRAPHICS: Scope reduction of the sometimes unused alpha component in TGADecoder::readHeader

Changed paths:
    graphics/decoders/tga.cpp



diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp
index c27cd2b..0b2318e 100644
--- a/graphics/decoders/tga.cpp
+++ b/graphics/decoders/tga.cpp
@@ -178,8 +178,9 @@ bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte &imageType, by
 bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth) {
 	_colorMap = new byte[3 * _colorMapLength];
 	for (int i = 0; i < _colorMapLength * 3; i += 3) {
-		byte r, g, b, a;
+		byte r, g, b;
 		if (_colorMapEntryLength == 32) {
+			byte a;
 			PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24);
 			uint32 color = tga.readUint32LE();
 			format.colorToARGB(color, a, r, g, b);
@@ -188,12 +189,13 @@ bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, b
 			g = tga.readByte();
 			b = tga.readByte();
 		} else if (_colorMapEntryLength == 16) {
+			byte a;
 			PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
 			uint16 color = tga.readUint16LE();
 			format.colorToARGB(color, a, r, g, b);
 		} else {
 			warning("Unsupported image type: %d", imageType);
-			r = g = b = a = 0;
+			r = g = b = 0;
 		}
 #ifdef SCUMM_LITTLE_ENDIAN
 		_colorMap[i] = r;






More information about the Scummvm-git-logs mailing list