More GCC compatibility/warning fixes (#3118)

* Wrap >4-char literals in a MULTI_CHAR macro

Modern compilers do not support CW's non-standard behavior with
>4 char literals. We can, however, use a constexpr function to
compute the u64 values directly. This leaves <=4 char literals
unchanged.

* Replace non-pointer usages of NULL with 0

* Define NULL to nullptr on C++11 and above

* Fix more -Wpointer-arith and -Woverflow warnings

* Replace u32/s32 with uintptr_t/intptr_t where appropriate

* JSUOutputStream: Overload all standard int types
This commit is contained in:
Luke Street
2026-02-28 21:19:17 -07:00
committed by GitHub
parent 38b7156a8e
commit 6e748ac283
169 changed files with 1849 additions and 1818 deletions
+5 -5
View File
@@ -53,14 +53,14 @@ static int tandem;
static int demo_f;
static int target_info[10];
static void* target_info[10];
static int target_info_count;
static void* s_ks_sub(void* param_1, void* param_2) {
if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == 0x60) {
if (target_info_count < 10) {
target_info[target_info_count] = (intptr_t)param_1;
target_info[target_info_count] = param_1;
target_info_count++;
}
return param_1;
@@ -77,7 +77,7 @@ static int hit_check(obj_lp_class* i_this, wd_ss* WdSs) {
fVar1 = 50.0f;
for (int i = 0; i < target_info_count; i++) {
sp6c = WdSs->field_0x10 - *(cXyz *)(target_info[i] + 0x4d0);
sp6c = WdSs->field_0x10 - *(cXyz *)((u8 *)target_info[i] + 0x4d0);
if (sp6c.y >= -3.0f) {
f32 dist = JMAFastSqrt(sp6c.x * sp6c.x + sp6c.z * sp6c.z);
if (dist <= fVar1 * WdSs->field_0x3c) {
@@ -126,7 +126,7 @@ static int hit_check(obj_lp_class* i_this, wd_ss* WdSs) {
cLib_addCalc2(&WdSs->field_0x10.y, WdSs->field_0x4.y + fVar8 * -0.5f, 0.5f, 3.0f);
cLib_addCalc2(&WdSs->field_0x28.x, fVar8, 0.1f, fVar8 * 0.5f);
cLib_addCalcAngleS2(&WdSs->field_0x34, cM_atan2s(sp6c.x, sp6c.z), 0x20, 0x400);
cLib_addCalcAngleS2(&WdSs->field_0x36, 0xfffff060, 0x20, 0x400);
cLib_addCalcAngleS2(&WdSs->field_0x36, -4000, 0x20, 0x400);
rv = 1;
}
}
@@ -221,7 +221,7 @@ static int daObj_Lp_Execute(obj_lp_class* i_this) {
target_info[i] = 0;
}
target_info[0] = (intptr_t)dComIfGp_getPlayer(0);
target_info[0] = dComIfGp_getPlayer(0);
target_info_count = 1;
if (strcmp(dComIfGp_getStartStageName(), "D_MN05") == 0) {