aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/riven_scripts.cpp
diff options
context:
space:
mode:
authorThierry Crozat2017-10-06 00:59:11 +0100
committerThierry Crozat2017-10-06 01:01:16 +0100
commita6caf3a951b695c6f42683598043531f82a54b20 (patch)
tree99bb57c40a3f31cd84f474d5f739e83a5d3e5ce3 /engines/mohawk/riven_scripts.cpp
parent448779ad8ecdb3d7e95f0f475f566fe2eaf3c83f (diff)
downloadscummvm-rg350-a6caf3a951b695c6f42683598043531f82a54b20.tar.gz
scummvm-rg350-a6caf3a951b695c6f42683598043531f82a54b20.tar.bz2
scummvm-rg350-a6caf3a951b695c6f42683598043531f82a54b20.zip
MOHAWK: Fix undefined behaviour in variadic functions
Passing a type that undergoes default argument promotion as last argument of a variadic function results in undefined behaviour.
Diffstat (limited to 'engines/mohawk/riven_scripts.cpp')
-rw-r--r--engines/mohawk/riven_scripts.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index cb040ee4a0..18a3597086 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -147,13 +147,13 @@ void RivenScriptManager::runQueuedScripts() {
_runningQueuedScripts = false;
}
-RivenScriptPtr RivenScriptManager::createScriptFromData(uint16 commandCount, ...) {
+RivenScriptPtr RivenScriptManager::createScriptFromData(uint commandCount, ...) {
va_list args;
va_start(args, commandCount);
// Build a script from the variadic arguments
Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
- writeStream.writeUint16BE(commandCount);
+ writeStream.writeUint16BE((uint16)commandCount);
for (uint i = 0; i < commandCount; i++) {
uint16 command = va_arg(args, int);