aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-02-28 08:49:51 +0000
committerTorbjörn Andersson2006-02-28 08:49:51 +0000
commit005861cb1431c5521160112fee3ba00033fa352b (patch)
treed6a0b6c963a2f44b1f89639f339273f2d15bdafb
parent41e7bb67e4fa57e42c36975f3393a34a12afbed0 (diff)
downloadscummvm-rg350-005861cb1431c5521160112fee3ba00033fa352b.tar.gz
scummvm-rg350-005861cb1431c5521160112fee3ba00033fa352b.tar.bz2
scummvm-rg350-005861cb1431c5521160112fee3ba00033fa352b.zip
This may be needless paranoia, but I always get nervous about order of
evaluation when there are multiple side-effects on the same variable (in this case the internal state modified by va_arg()) in the same expression. So let's just humor me and do the va_arg() calls one at a time. svn-id: r20970
-rw-r--r--engines/kyra/sound_adlib.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index 295e722e42..e15dd5e11c 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -449,14 +449,19 @@ int AdlibDriver::snd_unkOpcode3(va_list &list) {
}
int AdlibDriver::snd_readByte(va_list &list) {
- uint8 *ptr = _soundData + READ_LE_UINT16(&_soundData[va_arg(list, int) << 1]) + va_arg(list, int);
+ int a = va_arg(list, int);
+ int b = va_arg(list, int);
+ uint8 *ptr = _soundData + READ_LE_UINT16(&_soundData[a << 1]) + b;
return *ptr;
}
int AdlibDriver::snd_writeByte(va_list &list) {
- uint8 *ptr = _soundData + READ_LE_UINT16(&_soundData[va_arg(list, int) << 1]) + va_arg(list, int);
+ int a = va_arg(list, int);
+ int b = va_arg(list, int);
+ int c = va_arg(list, int);
+ uint8 *ptr = _soundData + READ_LE_UINT16(&_soundData[a << 1]) + b;
uint8 oldValue = *ptr;
- *ptr = (uint8)va_arg(list, int);
+ *ptr = (uint8)c;
return oldValue;
}
@@ -567,7 +572,7 @@ void AdlibDriver::callbackProcess() {
unkOutput1(table);
} else {
int8 opcode = 0;
- while (1 && table.dataptr) {
+ while (table.dataptr) {
uint16 command = READ_LE_UINT16(table.dataptr);
table.dataptr += 2;
if (command & 0x0080) {