mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 06:54:28 -04:00
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:
@@ -59,7 +59,7 @@ public:
|
||||
J2DAnmVtxColor() {
|
||||
mKind = KIND_VTX_COLOR;
|
||||
for (int i = 0; i < ARRAY_SIZE(mAnmTableNum); i++) {
|
||||
mAnmTableNum[i] = NULL;
|
||||
mAnmTableNum[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < ARRAY_SIZE(mVtxColorIndexData); i++) {
|
||||
mVtxColorIndexData[i] = NULL;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <dolphin/os.h>
|
||||
#include "global.h"
|
||||
#include <new>
|
||||
#include <cstdint>
|
||||
|
||||
class JKRHeap;
|
||||
typedef void (*JKRErrorHandler)(void*, u32, int);
|
||||
@@ -66,7 +67,7 @@ public:
|
||||
JKRHeap* find(void* ptr) const;
|
||||
JKRHeap* findAllHeap(void* ptr) const;
|
||||
|
||||
void dispose_subroutine(u32 start, u32 end);
|
||||
void dispose_subroutine(uintptr_t start, uintptr_t end);
|
||||
bool dispose(void* ptr, u32 size);
|
||||
void dispose(void* begin, void* end);
|
||||
void dispose();
|
||||
|
||||
@@ -14,7 +14,7 @@ extern const char ga4cSignature[4];
|
||||
|
||||
const int PARAGRAPH_DATA = 1;
|
||||
|
||||
typedef enum TEComposite {
|
||||
enum TEComposite {
|
||||
/* 0x0 */ COMPOSITE_NONE,
|
||||
/* 0x1 */ COMPOSITE_RAW,
|
||||
/* 0x2 */ COMPOSITE_IDX,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JStudio/JStudio/object-id.h"
|
||||
#include "JSystem/JStudio/JStudio/stb-data-parse.h"
|
||||
#include <dolphin/os.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace JStudio {
|
||||
class TObject;
|
||||
@@ -86,7 +87,7 @@ public:
|
||||
const void* getSequence() const { return pSequence; }
|
||||
void setSequence_(const void* arg1) { pSequence = arg1; }
|
||||
const void* getSequence_offset(s32 i_no) const {
|
||||
int s32Val = (s32)getSequence();
|
||||
intptr_t s32Val = (intptr_t)getSequence();
|
||||
return (const void*)(s32Val + i_no);
|
||||
}
|
||||
const void* getSequence_next() const { return pSequence_next; }
|
||||
|
||||
@@ -18,30 +18,24 @@ public:
|
||||
s32 write(const void*, s32);
|
||||
void write(const char*);
|
||||
|
||||
JSUOutputStream& operator<<(u32 param_0) {
|
||||
write(¶m_0, sizeof(u32));
|
||||
return *this;
|
||||
#define JSU_OUTPUTSTREAM_OPERATOR(T) \
|
||||
JSUOutputStream& operator<<(T val) { \
|
||||
write(&val, sizeof(T)); \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
JSUOutputStream& operator<<(s32 param_0) {
|
||||
write(¶m_0, sizeof(s32));
|
||||
return *this;
|
||||
}
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed char)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned char)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed short)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned short)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(int)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned int)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed long)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned long)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed long long)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned long long)
|
||||
|
||||
JSUOutputStream& operator<<(s16 param_0) {
|
||||
write(¶m_0, sizeof(s16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUOutputStream& operator<<(u16 param_0) {
|
||||
write(¶m_0, sizeof(u16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUOutputStream& operator<<(u8 param_0) {
|
||||
write(¶m_0, sizeof(u8));
|
||||
return *this;
|
||||
}
|
||||
#undef JSU_OUTPUTSTREAM_OPERATOR
|
||||
|
||||
JSUOutputStream& operator<<(const char* param_0) {
|
||||
write(param_0);
|
||||
|
||||
@@ -20,7 +20,7 @@ T* JSUConvertOffsetToPtr(const void* ptr, uintptr_t offset) {
|
||||
template <typename T>
|
||||
T* JSUConvertOffsetToPtr(const void* ptr, const void* offset) {
|
||||
T* ret;
|
||||
if (offset == NULL) {
|
||||
if (offset == 0) {
|
||||
ret = NULL;
|
||||
} else {
|
||||
ret = (T*)((intptr_t)ptr + (intptr_t)offset);
|
||||
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
static JUTXfb* sManager;
|
||||
|
||||
private:
|
||||
/* 0x00 */ void* mBuffer[3];
|
||||
/* 0x00 */ u8* mBuffer[3];
|
||||
/* 0x0C */ bool mXfbAllocated[3];
|
||||
/* 0x10 */ s32 mBufferNum;
|
||||
/* 0x14 */ s16 mDrawingXfbIndex;
|
||||
|
||||
Reference in New Issue
Block a user