[Scummvm-git-logs] scummvm master -> ed356ad3f964f0375ac589a8142e7143998d7132
bluegr
noreply at scummvm.org
Sun Feb 15 20:43:19 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
ed356ad3f9 JANITORIAL: ENGINES: use ARRAYSIZE macro
Commit: ed356ad3f964f0375ac589a8142e7143998d7132
https://github.com/scummvm/scummvm/commit/ed356ad3f964f0375ac589a8142e7143998d7132
Author: Michael Kuerbis (michael_kuerbis at web.de)
Date: 2026-02-15T22:43:16+02:00
Commit Message:
JANITORIAL: ENGINES: use ARRAYSIZE macro
Changed paths:
engines/ags/tests/test_gfx.cpp
engines/bagel/hodjnpodj/mankala/bgen.h
engines/bagel/hodjnpodj/metagame/bgen/bgen.h
engines/chamber/script.cpp
engines/freescape/games/driller/c64.music.cpp
engines/hadesch/rooms/medisle.cpp
engines/hadesch/rooms/walloffame.cpp
engines/sludge/functionlist.h
engines/vcruise/runtime.cpp
diff --git a/engines/ags/tests/test_gfx.cpp b/engines/ags/tests/test_gfx.cpp
index cde5af78d7f..e31fd85fb66 100644
--- a/engines/ags/tests/test_gfx.cpp
+++ b/engines/ags/tests/test_gfx.cpp
@@ -57,7 +57,7 @@ void Test_GfxSpeed(bool enableSimd, size_t blenderModeStart, size_t blenderModeE
Bitmap *graphics[] = {benchgfx32, benchgfx16, benchgfx8};
uint64 time = 0, numIters = 0, timeNotStretched = 0, numItersNotStretched = 0, timeCommon = 0, numItersCommon = 0;
//int bpps[] = {32, 16, 8};
- if (blenderModeEnd >= sizeof(blenderModes) / sizeof(blenderModes[0])) blenderModeEnd = (sizeof(blenderModes) / sizeof(blenderModes[0])) - 1;
+ if (blenderModeEnd >= ARRAYSIZE(blenderModes)) blenderModeEnd = (ARRAYSIZE(blenderModes)) - 1;
for (int dest = 0; dest < 3; dest++) {
for (int gfx = 0; gfx < 3; gfx++) {
if (dest == 2 && gfx != 2) continue;
diff --git a/engines/bagel/hodjnpodj/mankala/bgen.h b/engines/bagel/hodjnpodj/mankala/bgen.h
index a3cb5fcf04d..e8c272aace2 100644
--- a/engines/bagel/hodjnpodj/mankala/bgen.h
+++ b/engines/bagel/hodjnpodj/mankala/bgen.h
@@ -43,7 +43,7 @@ namespace Mankala {
#define MINNEGINT (-MAXPOSINT-1)
#define MINNEGLONG (-MAXPOSLONG-1)
-#define DIMENSION(a) (sizeof(a) / sizeof(a[0]))
+#define DIMENSION(a) (ARRAYSIZE(a))
#define UPPERBOUND(a) (DIMENSION(a) - 1)
typedef char *XPSTR;
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/bgen.h b/engines/bagel/hodjnpodj/metagame/bgen/bgen.h
index a2363f0e141..e455a7857d0 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/bgen.h
+++ b/engines/bagel/hodjnpodj/metagame/bgen/bgen.h
@@ -38,7 +38,7 @@ namespace Metagame {
#define MINNEGINT (-MAXPOSINT-1)
#define MINNEGLONG (-MAXPOSLONG-1)
-#define DIMENSION(a) (sizeof(a) / sizeof(a[0]))
+#define DIMENSION(a) (ARRAYSIZE(a))
#define UPPERBOUND(a) (DIMENSION(a) - 1)
typedef char *XPSTR ;
diff --git a/engines/chamber/script.cpp b/engines/chamber/script.cpp
index fbd6cd48fa6..110d37718d5 100644
--- a/engines/chamber/script.cpp
+++ b/engines/chamber/script.cpp
@@ -4187,7 +4187,7 @@ cmdhandler_t command_handlers[] = {
CMD_25_LoadGame,
CMD_26_SaveGame
};
-#define MAX_CMD_HANDLERS (sizeof(command_handlers) / sizeof(command_handlers[0]))
+#define MAX_CMD_HANDLERS ARRAYSIZE(command_handlers)
cmdhandler_t script_handlers[] = {
0,
@@ -4298,7 +4298,7 @@ cmdhandler_t script_handlers[] = {
SCR_69_playSound,
SCR_6A_Unused,
};
-#define MAX_SCR_HANDLERS (sizeof(script_handlers) / sizeof(script_handlers[0]))
+#define MAX_SCR_HANDLERS ARRAYSIZE(script_handlers)
#ifdef DEBUG_SCRIPT
int16 runscr_reentr = 0;
diff --git a/engines/freescape/games/driller/c64.music.cpp b/engines/freescape/games/driller/c64.music.cpp
index 52493ae7a0b..68661ca076d 100644
--- a/engines/freescape/games/driller/c64.music.cpp
+++ b/engines/freescape/games/driller/c64.music.cpp
@@ -22,6 +22,7 @@
#include "engines/freescape/games/driller/c64.music.h"
#include "common/textconsole.h"
+#include "common/util.h"
// --- Driller Music Data (Embedded from Disassembly) ---
namespace Freescape {
@@ -163,7 +164,7 @@ const uint8_t *const pattern_addresses[] = {
pattern_24, pattern_25, pattern_26, pattern_27, pattern_28, pattern_29, pattern_30, pattern_31,
pattern_32, pattern_33, pattern_34, pattern_35, pattern_36, pattern_37, pattern_38, pattern_39,
pattern_40, pattern_41};
-const int NUM_PATTERNS = sizeof(pattern_addresses) / sizeof(pattern_addresses[0]);
+const int NUM_PATTERNS = ARRAYSIZE(pattern_addresses);
// Tune Data (0x1054, 0x15D5 - 0x15E5)
const uint8_t tune_tempo_data[] = {0x00, 0x03, 0x03}; // tempos for tune 0, 1, 2
@@ -171,7 +172,7 @@ const uint8_t *const tune_track_data[][3] = {
{nullptr, nullptr, nullptr}, // Tune 0 (null pointers = stop)
{voice1_track_data, voice2_track_data, voice3_track_data}, // Tune 1
};
-const int NUM_TUNES = sizeof(tune_tempo_data) / sizeof(tune_tempo_data[0]);
+const int NUM_TUNES = ARRAYSIZE(tune_tempo_data);
// SID Base Addresses for Voices
const int voice_sid_offset[] = {0, 7, 14};
diff --git a/engines/hadesch/rooms/medisle.cpp b/engines/hadesch/rooms/medisle.cpp
index 71c2c3fbe9d..aeabeba3288 100644
--- a/engines/hadesch/rooms/medisle.cpp
+++ b/engines/hadesch/rooms/medisle.cpp
@@ -920,20 +920,20 @@ TODO (medusa quest):
g_vm->getHeroBelt()->setColour(HeroBelt::kCool);
- for (unsigned i = 0; i < sizeof(ambientsLeft) / sizeof(ambientsLeft[0]); i++) {
+ for (unsigned i = 0; i < ARRAYSIZE(ambientsLeft); i++) {
AmbientAnim(ambientsLeft[i].image, "", ambientsLeft[i].zVal,
ambientsLeft[i].minint, ambientsLeft[i].maxint,
AmbientAnim::DISAPPEAR, Common::Point(0, 0), AmbientAnim::PAN_LEFT).start();
}
- for (unsigned i = 0; i < sizeof(ambientsLeftSnakesAndRats) / sizeof(ambientsLeftSnakesAndRats[0]); i++) {
+ for (unsigned i = 0; i < ARRAYSIZE(ambientsLeftSnakesAndRats); i++) {
AmbientAnim(ambientsLeftSnakesAndRats[i].image, ambientsLeftSnakesAndRats[i].sound, ambientsLeftSnakesAndRats[i].zVal,
ambientsLeftSnakesAndRats[i].minint, ambientsLeftSnakesAndRats[i].maxint,
ambientsLeftSnakesAndRats[i].keep ? AmbientAnim::KEEP_LOOP : AmbientAnim::DISAPPEAR,
Common::Point(0, 0), AmbientAnim::PAN_LEFT).start();
}
- for (unsigned i = 0; i < sizeof(ambientsRight) / sizeof(ambientsRight[0]); i++) {
+ for (unsigned i = 0; i < ARRAYSIZE(ambientsRight); i++) {
AmbientAnim(ambientsRight[i].image, "", ambientsRight[i].zVal,
ambientsRight[i].minint, ambientsRight[i].maxint,
AmbientAnim::KEEP_LOOP, kOffsetRightRoom, AmbientAnim::PAN_RIGHT).start();
diff --git a/engines/hadesch/rooms/walloffame.cpp b/engines/hadesch/rooms/walloffame.cpp
index e4921fda588..4680c57e3ce 100644
--- a/engines/hadesch/rooms/walloffame.cpp
+++ b/engines/hadesch/rooms/walloffame.cpp
@@ -265,7 +265,7 @@ public:
return;
}
- for (unsigned i = 0; i < sizeof (herculesRoomElements) / sizeof(herculesRoomElements[0]); i++)
+ for (unsigned i = 0; i < ARRAYSIZE(herculesRoomElements); i++)
if (hotname == herculesRoomElements[i]) {
room->disableMouse();
room->playAnimKeepLastFrame(hotname + " glow", kGlowZ);
@@ -285,7 +285,7 @@ public:
}
}
- for (unsigned i = 0; i < sizeof (zeusComments) / sizeof(zeusComments[0]); i++)
+ for (unsigned i = 0; i < ARRAYSIZE(zeusComments); i++)
if (hotname == zeusComments[i]) {
room->playSFX("click");
zeusCommentRight(Common::String("zeus ") + hotname);
@@ -567,7 +567,7 @@ public:
break;
case 1019026:
room->enableMouse();
- for (unsigned i = 0; i < sizeof (herculesRoomElements) / sizeof(herculesRoomElements[0]); i++)
+ for (unsigned i = 0; i < ARRAYSIZE(herculesRoomElements); i++)
room->stopAnim(Common::String(herculesRoomElements[i]) + " glow");
break;
case 1019027:
@@ -851,10 +851,10 @@ public:
}
// Hercules room
- for (unsigned i = 0; i < sizeof (herculesRoomElements) / sizeof(herculesRoomElements[0]); i++)
+ for (unsigned i = 0; i < ARRAYSIZE(herculesRoomElements); i++)
room->enableHotzone(herculesRoomElements[i]);
- for (unsigned power = 0; power < sizeof(powerLevelNames) / sizeof(powerLevelNames[0]); power++) {
+ for (unsigned power = 0; power < ARRAYSIZE(powerLevelNames); power++) {
int level = persistent->_powerLevel[power];
if (level > 0) {
int off = (4 - level) * 30;
diff --git a/engines/sludge/functionlist.h b/engines/sludge/functionlist.h
index bdf6db9283d..3d6d201cca3 100644
--- a/engines/sludge/functionlist.h
+++ b/engines/sludge/functionlist.h
@@ -200,6 +200,6 @@ static builtInFunctionData builtInFunctionArray[] = {
};
#undef FUNC
-const static int NUM_FUNCS = (sizeof (builtInFunctionArray) / sizeof (builtInFunctionArray[0]));
+const static int NUM_FUNCS = ARRAYSIZE(builtInFunctionArray);
} // End of namespace Sludge
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index f47f8bcb6a4..7fa2ff90157 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -1835,7 +1835,7 @@ bool Runtime::bootGame(bool newGame) {
Common::IT_ITA,
};
- uint langCount = sizeof(langIndexes) / sizeof(langIndexes[0]);
+ uint langCount = ARRAYSIZE(langIndexes);
for (uint li = 0; li < langCount; li++) {
if (langIndexes[li] == _defaultLanguage)
@@ -1876,7 +1876,7 @@ bool Runtime::bootGame(bool newGame) {
Common::CS_CZE,
};
- uint langCount = sizeof(langIndexes) / sizeof(langIndexes[0]);
+ uint langCount = ARRAYSIZE(langIndexes);
for (uint li = 0; li < langCount; li++) {
if (langIndexes[li] == _defaultLanguage)
More information about the Scummvm-git-logs
mailing list