[Scummvm-git-logs] scummvm branch-2-1 -> a56fa40f3b9968b38c0a092bca077352f63c0e6e

bluegr bluegr at gmail.com
Sat Jan 11 16:15:47 UTC 2020


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:
86f1d09638 CRUISE: Fix Missing Default Switch Cases
a56fa40f3b CRUISE: Correct Parameter Sanity Checks in Several Functions


Commit: 86f1d0963848940fade33ae20a54c357c6043436
    https://github.com/scummvm/scummvm/commit/86f1d0963848940fade33ae20a54c357c6043436
Author: D G Turner (digitall at scummvm.org)
Date: 2020-01-11T18:15:31+02:00

Commit Message:
CRUISE: Fix Missing Default Switch Cases

These are flagged by GCC if -Wswitch-default is enabled.

Changed paths:
    engines/cruise/background.cpp
    engines/cruise/dataLoader.cpp
    engines/cruise/linker.cpp
    engines/cruise/mainDraw.cpp
    engines/cruise/menu.cpp
    engines/cruise/script.cpp


diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index 4cf52f6..4aa33cf 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -179,6 +179,7 @@ int loadBackground(const char *name, int idx) {
 
 		default:
 			assert(0);
+			break;
 		}
 
 		gfxModuleData_setPal256(palScreen[idx]);
@@ -199,6 +200,9 @@ int loadBackground(const char *name, int idx) {
 			memcpy(backgroundScreens[idx], ptr2, 320 * 200);
 			ptr2 += 320 * 200;
 			break;
+		default:
+			assert(0);
+			break;
 		}
 
 		loadMEN(&ptr2);
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index 2eff82b..d5b6541 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -128,6 +128,8 @@ void decodeGfxUnified(dataFileEntry *pCurrentFileEntry, int16 format) {
 
 		break;
 	}
+	default:
+		break;
 	}
 
 	MemFree(pCurrentFileEntry->subData.ptr);
diff --git a/engines/cruise/linker.cpp b/engines/cruise/linker.cpp
index 9786de7..68ed923 100644
--- a/engines/cruise/linker.cpp
+++ b/engines/cruise/linker.cpp
@@ -249,6 +249,8 @@ int updateScriptImport(int ovlIdx) {
 					ovlData->arrayMsgRelHeader[linkEntryIdx].obj2Number = pFoundExport->idx;
 					break;
 				}
+				default:
+					break;
 				}
 			}
 		}
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 5777b84..015d0b0 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -1370,6 +1370,8 @@ int getValueFromObjectQuerry(objectParamsQuery *params, int idx) {
 		return params->state2;
 	case 7:
 		return params->nbState;
+	default:
+		break;
 	}
 
 	assert(0);
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index cf0b872..1abc7df 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -300,6 +300,8 @@ int playerMenu(int menuX, int menuY) {
 			break;
 		case 7: // exit
 			return 1;
+		default:
+			break;
 		}
 	}
 
diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp
index aee3e8b..f4593a1 100644
--- a/engines/cruise/script.cpp
+++ b/engines/cruise/script.cpp
@@ -264,6 +264,8 @@ int32 opcodeType2() {
 
 	}
 	break;
+	default:
+		break;
 	}
 
 	return 0;
@@ -313,6 +315,9 @@ int32 opcodeType4() {		// test
 		if (var2 >= var1)
 			boolVar = 1;
 		break;
+
+	default:
+		break;
 	}
 
 	pushVar(boolVar);
@@ -398,6 +403,9 @@ int32 opcodeType5() {
 	case 7:
 		currentScriptPtr->scriptOffset = newSi;	//always
 		break;
+
+	default:
+		break;
 	}
 
 	return (0);
@@ -441,6 +449,8 @@ int32 opcodeType3()	{	// math
 		pushVar(pop2 & pop1);
 		return (0);
 
+	default:
+		break;
 	}
 
 	return 0;


Commit: a56fa40f3b9968b38c0a092bca077352f63c0e6e
    https://github.com/scummvm/scummvm/commit/a56fa40f3b9968b38c0a092bca077352f63c0e6e
Author: D G Turner (digitall at scummvm.org)
Date: 2020-01-11T18:15:31+02:00

Commit Message:
CRUISE: Correct Parameter Sanity Checks in Several Functions

This was flagged by GCC -Wlogical-op as the inverted logical operation
was causing these checks to always return true.

Changed paths:
    engines/cruise/function.cpp


diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 3f794c4..18dcaee 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -508,7 +508,7 @@ int16 Op_LoadBackground() {
 
 	bgIdx = popVar();
 
-	if (bgIdx >= 0 || bgIdx < NBSCREENS) {
+	if (bgIdx >= 0 && bgIdx < NBSCREENS) {
 		strToUpper(bgName);
 
 		gfxModuleData_gfxWaitVSync();
@@ -553,7 +553,7 @@ int16 Op_LoadFrame() {
 	param2 = popVar();
 	param3 = popVar();
 
-	if (param3 >= 0 || param3 < NUM_FILE_ENTRIES) {
+	if (param3 >= 0 && param3 < NUM_FILE_ENTRIES) {
 		strToUpper(name);
 
 		gfxModuleData_gfxWaitVSync();




More information about the Scummvm-git-logs mailing list