[Scummvm-git-logs] scummvm master -> d31772d4ba79925df2391a774128e5902c580964

aquadran noreply at scummvm.org
Fri Aug 15 15:50:59 UTC 2025


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

Summary:
d31772d4ba WINTERMUTE: Ged rid sizeof(bool)


Commit: d31772d4ba79925df2391a774128e5902c580964
    https://github.com/scummvm/scummvm/commit/d31772d4ba79925df2391a774128e5902c580964
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-08-15T17:50:49+02:00

Commit Message:
WINTERMUTE: Ged rid sizeof(bool)

Changed paths:
    engines/wintermute/base/scriptables/script_ext_file.cpp
    engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp


diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index ec261aa8175..c06437a3ffb 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -363,10 +363,9 @@ bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
 			stack->pushNULL();
 			return STATUS_OK;
 		}
-		bool val;
-		STATIC_ASSERT(sizeof(val) == 1, bool_is_not_1_byte);
-		if (_readFile->read(&val, sizeof(bool)) == sizeof(bool)) {
-			stack->pushBool(val);
+		byte val;
+		if (_readFile->read(&val, sizeof(byte))) {
+			stack->pushBool(val != 0);
 		} else {
 			stack->pushNULL();
 		}
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
index 7cdb298e67c..5e9803204d3 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
@@ -154,10 +154,10 @@ bool SXMemBuffer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt
 	else if (strcmp(name, "GetBool") == 0) {
 		stack->correctParams(1);
 		int start = stack->pop()->getInt();
-		if (!checkBounds(script, start, sizeof(bool))) {
+		if (!checkBounds(script, start, sizeof(byte))) {
 			stack->pushNULL();
 		} else {
-			stack->pushBool(*(bool *)((byte *)_buffer + start));
+			stack->pushBool(*((byte *)_buffer + start) != 0);
 		}
 
 		return STATUS_OK;
@@ -292,10 +292,10 @@ bool SXMemBuffer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt
 		int start = stack->pop()->getInt();
 		bool val = stack->pop()->getBool();
 
-		if (!checkBounds(script, start, sizeof(bool))) {
+		if (!checkBounds(script, start, sizeof(byte))) {
 			stack->pushBool(false);
 		} else {
-			*(bool *)((byte *)_buffer + start) = val;
+			*((byte *)_buffer + start) = (byte)val;
 			stack->pushBool(true);
 		}
 		return STATUS_OK;




More information about the Scummvm-git-logs mailing list