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 b5d3b8c059
commit 6a48380461
169 changed files with 1849 additions and 1818 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ struct JASNonCopyable {
JASNonCopyable() {}
~JASNonCopyable() {}
/* 0x0 */ int field_0x0;
/* 0x0 */ void* field_0x0;
}; // Size: 0x4
/**
@@ -56,7 +56,7 @@ public:
mParams.init();
mMaxActiveSe = 0;
mMaxInactiveSe = 0;
field_0x0 = 0;
field_0x0 = NULL;
}
virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
+4 -3
View File
@@ -5,6 +5,7 @@
#include "JSystem/JAudio2/JAIAudible.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "global.h"
#include <cstdint>
class JAISound;
@@ -134,7 +135,7 @@ struct JAISoundStatus_ {
u8 flag8 : 1;
} flags;
} state;
/* 0x4 */ u32 userdata_;
/* 0x4 */ uintptr_t userdata_;
}; // Size: 0x8
/**
@@ -294,8 +295,8 @@ public:
void setAnimationState(u32 state) {
status_.state.flags.animationState = state;
}
u32 getUserData() const { return status_.userdata_; }
void setUserData(u32 userData) { status_.userdata_ = userData; }
uintptr_t getUserData() const { return status_.userdata_; }
void setUserData(uintptr_t userData) { status_.userdata_ = userData; }
JAIAudible* getAudible() { return audible_; }
bool isHandleAttached() const { return handle_ != NULL; }
bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
+1 -1
View File
@@ -112,7 +112,7 @@ namespace JASDsp {
void invalChannelAll();
void initBuffer();
int setFXLine(u8, s16*, JASDsp::FxlineConfig_*);
BOOL changeFXLineParam(u8, u8, u32);
BOOL changeFXLineParam(u8, u8, uintptr_t);
extern u8 const DSPADPCM_FILTER[64];
extern u32 const DSPRES_FILTER[320];
+3 -3
View File
@@ -8,10 +8,10 @@ namespace JASResArcLoader {
size_t getResSize(JKRArchive const*, u16);
size_t getResMaxSize(JKRArchive const*);
static void loadResourceCallback(void*);
int loadResourceAsync(JKRArchive*, u16, u8*, u32, void (*)(u32, u32), u32);
int loadResourceAsync(JKRArchive*, u16, u8*, u32, void (*)(u32, uintptr_t), uintptr_t);
// from pikmin2
typedef void (*LoadCallback)(u32, u32);
typedef void (*LoadCallback)(u32, uintptr_t);
struct TLoadResInfo {
inline TLoadResInfo(JKRArchive* archive, u16 id, void* buf, u32 size)
@@ -30,7 +30,7 @@ namespace JASResArcLoader {
void* mBuffer; // _08
u32 mBufferSize; // _0C
LoadCallback mCallback; // _10
u32 mCallbackArg; // _14, arg to pass to mCallback along with readResource result
uintptr_t mCallbackArg; // _14, arg to pass to mCallback along with readResource result
OSMessageQueue* mQueue; // _18
};
};