[Scummvm-git-logs] scummvm master -> 649dfb8a31d9f5e46dc9fbbb8b050909fc0fff60

bluegr noreply at scummvm.org
Mon Apr 1 05:32:58 UTC 2024


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

Summary:
d58254b3e9 IMAGE: Fix wrong defines in ICO/CUR/ANI loader
319c0f98ab COMMON: Fix readMultiple not compiling.
649dfb8a31 IMAGE: Use readMultipleLE in AniDecoder parser


Commit: d58254b3e9ae29f6f3b0fa43d84cd5e2c24bd389
    https://github.com/scummvm/scummvm/commit/d58254b3e9ae29f6f3b0fa43d84cd5e2c24bd389
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-04-01T08:32:52+03:00

Commit Message:
IMAGE: Fix wrong defines in ICO/CUR/ANI loader

Changed paths:
    image/ani.h
    image/icocur.h


diff --git a/image/ani.h b/image/ani.h
index dc47b62bb08..e43d599d0bf 100644
--- a/image/ani.h
+++ b/image/ani.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef GFX_ANI_H
-#define GFX_ANI_H
+#ifndef IMAGE_ANI_H
+#define IMAGE_ANI_H
 
 #include "common/array.h"
 #include "common/types.h"
diff --git a/image/icocur.h b/image/icocur.h
index b0858a98aa3..a0c497bb492 100644
--- a/image/icocur.h
+++ b/image/icocur.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef GFX_ICOCUR_H
-#define GFX_ICOCUR_H
+#ifndef IMAGE_ICOCUR_H
+#define IMAGE_ICOCUR_H
 
 #include "common/array.h"
 #include "common/types.h"


Commit: 319c0f98ab6f71ec9958e3875b92e26fd8874354
    https://github.com/scummvm/scummvm/commit/319c0f98ab6f71ec9958e3875b92e26fd8874354
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-04-01T08:32:52+03:00

Commit Message:
COMMON: Fix readMultiple not compiling.

Changed paths:
    common/stream.h


diff --git a/common/stream.h b/common/stream.h
index 5e0c48ecc48..39563a852ce 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -287,7 +287,7 @@ public:
 		byte buffer[DataMultipleIO<TDataFormat, T...>::kMaxSize];
 		const uint actualSize = DataMultipleIO<TDataFormat, T...>::computeSize(dataFormatCopy);
 
-		DataMultipleIO<T...>::encode(dataFormatCopy, buffer, values...);
+		DataMultipleIO<TDataFormat, T...>::encode(dataFormatCopy, buffer, values...);
 
 		if (this->write(buffer, actualSize) != actualSize)
 			return false;
@@ -675,7 +675,7 @@ public:
 		if (read(buffer, actualSize) != actualSize)
 			return false;
 
-		DataMultipleIO<T...>::decode(dataFormatCopy, buffer, values...);
+		DataMultipleIO<TDataFormat, T...>::decode(dataFormatCopy, buffer, values...);
 		return true;
 	}
 


Commit: 649dfb8a31d9f5e46dc9fbbb8b050909fc0fff60
    https://github.com/scummvm/scummvm/commit/649dfb8a31d9f5e46dc9fbbb8b050909fc0fff60
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-04-01T08:32:52+03:00

Commit Message:
IMAGE: Use readMultipleLE in AniDecoder parser

Changed paths:
    image/ani.cpp


diff --git a/image/ani.cpp b/image/ani.cpp
index c556e32815f..f662292205b 100644
--- a/image/ani.cpp
+++ b/image/ani.cpp
@@ -204,34 +204,21 @@ bool AniDecoder::parseListContainer(const RIFFContainerDef &container, Common::S
 }
 
 bool AniDecoder::parseAnimHeaderChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream) {
-	byte animHeader[36];
-	for (byte &b : animHeader)
-		b = 0;
+	const uint32 expectedStructSize = 36;
 
-	uint32 amountToRead = 36;
-	if (chunk.size < amountToRead)
-		amountToRead = chunk.size;
-
-	if (amountToRead > 0 && stream.read(animHeader, amountToRead) != amountToRead) {
-		warning("AniDecoder::parseAnimHeaderChunk: Read failed");
+	if (chunk.size < expectedStructSize) {
+		warning("AniDecoder::parseAnimHeaderChunk: Chunk is too small");
 		return false;
 	}
 
-	uint32 structSize = READ_LE_UINT32(animHeader);
-	if (structSize < 36) {
-		for (uint i = structSize; i < 36; i++)
-			animHeader[i] = 0;
+	uint32 structSize = 0;
+	uint32 flags = 0;
+	if (!stream.readMultipleLE(structSize, _metadata.numFrames, _metadata.numSteps, _metadata.width, _metadata.height,
+		_metadata.bitCount, _metadata.numPlanes, _metadata.perFrameDelay, flags) || structSize < expectedStructSize) {
+		warning("AniDecoder::parseAnimHeaderChunk: Read failed");
+		return false;
 	}
 
-	_metadata.numFrames = READ_LE_UINT32(animHeader + 4);
-	_metadata.numSteps = READ_LE_UINT32(animHeader + 8);
-	_metadata.width = READ_LE_UINT32(animHeader + 12);
-	_metadata.height = READ_LE_UINT32(animHeader + 16);
-	_metadata.bitCount = READ_LE_UINT32(animHeader + 20);
-	_metadata.numPlanes = READ_LE_UINT32(animHeader + 24);
-	_metadata.perFrameDelay = READ_LE_UINT32(animHeader + 28);
-
-	uint32 flags = READ_LE_UINT32(animHeader + 32);
 	_metadata.isCURFormat = ((flags & 1) != 0);
 	_metadata.haveSeqData = ((flags & 2) != 0);
 




More information about the Scummvm-git-logs mailing list