Skip to content

Commit

Permalink
TONY: Fix undefined behaviour in variadic functions
Browse files Browse the repository at this point in the history
Passing a type that undergoes default argument promotion as last
argument of a variadic function results in undefined behaviour.
  • Loading branch information
criezy committed Oct 6, 2017
1 parent a6caf3a commit 9b374ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions engines/tony/mpal/mpal.cpp
Expand Up @@ -1548,7 +1548,7 @@ void mpalFree() {
* @remarks This is the specialized version of the original single mpalQuery
* method that returns numeric results.
*/
uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
uint32 mpalQueryDWORD(uint wQueryType, ...) {
Common::String buf;
uint32 dwRet = 0;

Expand Down Expand Up @@ -1744,7 +1744,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
* @remarks This is the specialized version of the original single mpalQuery
* method that returns a pointer or handle.
*/
MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) {
MpalHandle mpalQueryHANDLE(uint wQueryType, ...) {
Common::String buf;
va_list v;
va_start(v, wQueryType);
Expand Down
4 changes: 2 additions & 2 deletions engines/tony/mpal/mpal.h
Expand Up @@ -394,7 +394,7 @@ void mpalFree();
* @remarks This is the specialized version of the original single mpalQuery
* method that returns numeric results.
*/
uint32 mpalQueryDWORD(uint16 wQueryType, ...);
uint32 mpalQueryDWORD(uint wQueryType, ...);

/**
* This is a general function to communicate with the library, to request information
Expand All @@ -405,7 +405,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...);
* @remarks This is the specialized version of the original single mpalQuery
* method that returns a pointer or handle.
*/
MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...);
MpalHandle mpalQueryHANDLE(uint wQueryType, ...);

/**
* This is a general function to communicate with the library, to request information
Expand Down

0 comments on commit 9b374ac

Please sign in to comment.