diff options
author | Thierry Crozat | 2017-11-10 22:20:54 +0000 |
---|---|---|
committer | GitHub | 2017-11-10 22:20:54 +0000 |
commit | 2b00829f09609447758dc55956dd6a345b878c4b (patch) | |
tree | 06de1770adfa05ba89df7398dc48eb9fef1da133 /engines/mohawk | |
parent | b73892e441bc3fde3b36f76aa675c59a652ca95c (diff) | |
parent | b1ba071ea8a128f94f70f9a28270644e5d70b6fb (diff) | |
download | scummvm-rg350-2b00829f09609447758dc55956dd6a345b878c4b.tar.gz scummvm-rg350-2b00829f09609447758dc55956dd6a345b878c4b.tar.bz2 scummvm-rg350-2b00829f09609447758dc55956dd6a345b878c4b.zip |
Merge pull request #1041 from criezy/variadic-undefined
Fix undefined behaviour in variadic functions
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.h | 2 |
2 files changed, 3 insertions, 3 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); diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index 25cf363450..423434fe59 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -179,7 +179,7 @@ public: RivenScriptPtr readScriptFromData(uint16 *data, uint16 size); /** Create a script from the caller provided arguments containing raw data */ - RivenScriptPtr createScriptFromData(uint16 commandCount, ...); + RivenScriptPtr createScriptFromData(uint commandCount, ...); /** * Create a script with a single user provided command |