mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-23 06:54:16 -04:00
Use ARRAY_SIZE macro in asserts, fix ARRAY_SIZE macro to match
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
#define ARRAY_SIZE(o) (sizeof((o)) / sizeof(*(o)))
|
||||
#define ARRAY_SIZE(o) (sizeof(o) / sizeof(o[0]))
|
||||
|
||||
// Align X to the previous N bytes (N must be power of two)
|
||||
#define ALIGN_PREV(X, N) ((X) & ~((N)-1))
|
||||
|
||||
+3
-3
@@ -469,7 +469,7 @@ s32 cCc_Init() {
|
||||
if (d.name == NULL)
|
||||
continue;
|
||||
|
||||
JUT_ASSERT(0x39, d.mKey < (sizeof(DMC) / sizeof(DMC[0])));
|
||||
JUT_ASSERT(0x39, d.mKey < ARRAY_SIZE(DMC));
|
||||
JUT_ASSERT(0x3a, DMC[d.mKey] == 0);
|
||||
|
||||
for (int j = 0; j < ARRAY_SIZE(DMC); j++) {
|
||||
@@ -504,7 +504,7 @@ s32 cDyl_IsLinked(s16 i_ProfName) {
|
||||
/* 80022A80-80022B58 .text cDyl_Unlink__Fs */
|
||||
s32 cDyl_Unlink(s16 i_ProfName) {
|
||||
JUT_ASSERT(0xc5, cDyl_Initialized);
|
||||
JUT_ASSERT(0xc6, i_ProfName < (sizeof(DMC) / sizeof(DMC[0])));
|
||||
JUT_ASSERT(0xc6, i_ProfName < ARRAY_SIZE(DMC));
|
||||
|
||||
if (DMC[i_ProfName] != NULL)
|
||||
return DMC[i_ProfName]->unlink();
|
||||
@@ -529,7 +529,7 @@ s32 cDyl_LinkASync(s16 i_ProfName) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
JUT_ASSERT(0x111, i_ProfName < (sizeof(DMC) / sizeof(DMC[0])));
|
||||
JUT_ASSERT(0x111, i_ProfName < ARRAY_SIZE(DMC));
|
||||
DynamicModuleControlBase * d = DMC[i_ProfName];
|
||||
if (d != NULL) {
|
||||
JUT_ASSERT(0x115, cDyl_Initialized);
|
||||
|
||||
+3
-3
@@ -294,7 +294,7 @@ static int dScnPly_Draw(dScnPly_ply_c* i_this) {
|
||||
static s16 l_wipeType[] = {0, 0, 16, 17, 18, 1, 2, 1, 3, 3, 4, 4};
|
||||
|
||||
JUT_ASSERT(VERSION_SELECT(997, 1001, 1001),
|
||||
dComIfGp_getNextStageWipe() < (sizeof(l_wipeType) / sizeof(l_wipeType[0])));
|
||||
dComIfGp_getNextStageWipe() < ARRAY_SIZE(l_wipeType));
|
||||
|
||||
if (strcmp(dComIfGp_getNextStageName(), "ENDING") == 0) {
|
||||
fopScnM_ChangeReq(i_this, PROC_ENDING_SCENE, 0, 5);
|
||||
@@ -1429,7 +1429,7 @@ s32 phase_5(dScnPly_ply_c* i_this) {
|
||||
const char** resName = PreLoadInfoT[preLoadNo].resName;
|
||||
s32 resNameNum = PreLoadInfoT[preLoadNo].resNameNum;
|
||||
if (resName != NULL && resName[0] != NULL) {
|
||||
JUT_ASSERT(VERSION_SELECT(3804, 3824, 3824), resNameNum <= (sizeof(resPhase) / sizeof(resPhase[0])));
|
||||
JUT_ASSERT(VERSION_SELECT(3804, 3824, 3824), resNameNum <= ARRAY_SIZE(resPhase));
|
||||
for (int i = 0; i < resNameNum; i++) {
|
||||
if (dComIfG_resLoad(&resPhase[i], resName[i]) != cPhs_COMPLEATE_e) {
|
||||
rt = cPhs_INIT_e;
|
||||
@@ -1452,7 +1452,7 @@ s32 phase_6(dScnPly_ply_c* i_this) {
|
||||
const s16* dylKeyTbl = PreLoadInfoT[preLoadNo].dylKeyTbl;
|
||||
s32 dylKeyTblNum = PreLoadInfoT[preLoadNo].dylKeyTblNum;
|
||||
if (dylKeyTbl != NULL && dylKeyTbl[0] != NULL) {
|
||||
JUT_ASSERT(VERSION_SELECT(3838, 3858, 3858), dylKeyTblNum <= (sizeof(dylPhase) / sizeof(dylPhase[0])));
|
||||
JUT_ASSERT(VERSION_SELECT(3838, 3858, 3858), dylKeyTblNum <= ARRAY_SIZE(dylPhase));
|
||||
for (int i = 0; i < dylKeyTblNum; i++) {
|
||||
if (cDylPhs::Link(&dylPhase[i], dylKeyTbl[i]) != cPhs_COMPLEATE_e) {
|
||||
rt = cPhs_INIT_e;
|
||||
|
||||
Reference in New Issue
Block a user