aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-09-01 14:55:28 +0000
committerFilippos Karapetis2009-09-01 14:55:28 +0000
commit3d0e8a568c804a7807ccd3c5de7040502718ec1b (patch)
tree4dda6d2aa2b66e3daa34fe064e5d0f65a8284f47
parentfbfe40d7e2b69dfe2ba0a6fad3a692eb26ffaffd (diff)
downloadscummvm-rg350-3d0e8a568c804a7807ccd3c5de7040502718ec1b.tar.gz
scummvm-rg350-3d0e8a568c804a7807ccd3c5de7040502718ec1b.tar.bz2
scummvm-rg350-3d0e8a568c804a7807ccd3c5de7040502718ec1b.zip
Fixed incorrect usage of ARRAYSIZE (thanks fingolfin)
svn-id: r43886
-rw-r--r--engines/sci/engine/static_selectors.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp
index 1ff5dd8c2e..f3f4a27fc4 100644
--- a/engines/sci/engine/static_selectors.cpp
+++ b/engines/sci/engine/static_selectors.cpp
@@ -96,6 +96,7 @@ Common::StringList Kernel::checkStaticSelectorNames(SciVersion version) {
int count = ARRAYSIZE(sci0Selectors) + offset;
names.resize(count);
const SelectorRemap *selectorRemap = sci0SelectorRemap;
+ uint32 selectorRemapSize = 0;
int i;
for (i = 0; i < offset; i++)
@@ -106,6 +107,7 @@ Common::StringList Kernel::checkStaticSelectorNames(SciVersion version) {
if (version <= SCI_VERSION_01) {
selectorRemap = sci0SelectorRemap;
+ selectorRemapSize = ARRAYSIZE(sci0SelectorRemap);
} else {
int count2 = ARRAYSIZE(sci1Selectors);
names[handleIndex + offset] = "nodePtr";
@@ -115,10 +117,16 @@ Common::StringList Kernel::checkStaticSelectorNames(SciVersion version) {
for (i = count; i < count + count2; i++)
names[i] = sci1Selectors[i - count];
- selectorRemap = (version < SCI_VERSION_1_1) ? sci1SelectorRemap : sci11SelectorRemap;
+ if (version < SCI_VERSION_1_1) {
+ selectorRemap = sci1SelectorRemap;
+ selectorRemapSize = ARRAYSIZE(sci1SelectorRemap);
+ } else {
+ selectorRemap = sci11SelectorRemap;
+ selectorRemapSize = ARRAYSIZE(sci11SelectorRemap);
+ }
}
- for (uint32 k = 0; k < ARRAYSIZE(selectorRemap); k++) {
+ for (uint32 k = 0; k < selectorRemapSize; k++) {
if (selectorRemap[k].slot >= names.size())
names.resize(selectorRemap[k].slot + 1);
names[selectorRemap[k].slot] = selectorRemap[k].name;