[Scummvm-git-logs] scummvm master -> 002e66485f3bfe9d5f97d3c29f50dca46c64641c

athrxx noreply at scummvm.org
Mon Sep 19 16:15:29 UTC 2022


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:
87e20640e8 SCUMM: fix dead code warnings
0bb59a7a64 SCUMM: init struct members
002e66485f SCUMM: fix array range check


Commit: 87e20640e80d3d754ebcb2e9929083439ac8bb29
    https://github.com/scummvm/scummvm/commit/87e20640e80d3d754ebcb2e9929083439ac8bb29
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-19T18:14:40+02:00

Commit Message:
SCUMM: fix dead code warnings

For negative resStringId values, the functions would return from the
switch statement default, never meeting the <= 0 condition at the end.

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index a3d9598d931..2a992c06e91 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -875,7 +875,7 @@ const char *ScummEngine_v8::getGUIString(int stringId) {
 		resStringId = 35;
 		break;
 	default:
-		return _emptyMsg;
+		break;
 	}
 
 	if (resStringId > 0)
@@ -1002,12 +1002,12 @@ const char *ScummEngine_v7::getGUIString(int stringId) {
 		resStringId = 58;
 		break;
 	default:
-		return _emptyMsg;
+		break;
 	}
 
 	const char *res =  (resStringId > 0) ? d.getPlainEngineString(resStringId) : _emptyMsg;
 
-	if (_game.id == GID_DIG) {
+	if (_game.id == GID_DIG && resStringId > 0) {
 		convertMessageToString((const byte*)res, _guiStringTransBuff, 512);
 		res = (const char*)_guiStringTransBuff;
 	}
@@ -3121,7 +3121,7 @@ const char *ScummEngine_v6::getGUIString(int stringId) {
 		resStringId = 35;
 		break;
 	default:
-		return _emptyMsg;
+		break;
 	}
 
 	if (resStringId > 0)
@@ -3208,7 +3208,7 @@ const char *ScummEngine::getGUIString(int stringId) {
 		resStringId = 28;
 		break;
 	default:
-		return _emptyMsg;
+		break;
 	}
 
 	if (resStringId > 0)


Commit: 0bb59a7a64ff2803d7af04964e4a6713d3822a71
    https://github.com/scummvm/scummvm/commit/0bb59a7a64ff2803d7af04964e4a6713d3822a71
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-19T18:14:50+02:00

Commit Message:
SCUMM: init struct members

Changed paths:
    engines/scumm/imuse/imuse_internal.h


diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index ba414ce990c..c7d883b83c3 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -91,8 +91,8 @@ inline int transpose_clamp(int a, int b, int c) {
 //////////////////////////////////////////////////
 
 struct TimerCallbackInfo {
-	IMuseInternal *imuse;
-	MidiDriver *driver;
+	IMuseInternal *imuse = nullptr;
+	MidiDriver *driver = nullptr;
 };
 
 struct HookDatas {


Commit: 002e66485f3bfe9d5f97d3c29f50dca46c64641c
    https://github.com/scummvm/scummvm/commit/002e66485f3bfe9d5f97d3c29f50dca46c64641c
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-19T18:14:54+02:00

Commit Message:
SCUMM: fix array range check

The array has size 50 (also in the original interpreter), we also save/load 50
bytes. So the range check should not allow an array index > 49 (although the
original does that, too).

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 2a992c06e91..bae908e959c 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -412,8 +412,8 @@ void ScummEngine::clearBanner() {
 }
 
 void ScummEngine::setBannerColors(int bannerId, byte r, byte g, byte b) {
-	if (bannerId < 0 || bannerId > 50) {
-		debug(1, "ScummEngine::setBannerColors(): invalid slot %d out of range (min %d, max %d)", bannerId, 0, 50);
+	if (bannerId < 0 || bannerId > 49) {
+		debug(1, "ScummEngine::setBannerColors(): invalid slot %d out of range (min %d, max %d)", bannerId, 0, 49);
 		return;
 	}
 




More information about the Scummvm-git-logs mailing list