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
+27 -27
View File
@@ -441,20 +441,20 @@ void dMenu_Insect_c::explain_close_move() {
void dMenu_Insect_c::screenSetBase() {
static const u64 insect_tag[MAX_INSECT_NUM] = {
'ari_os', 'ari_ms', 'kag_os', 'kag_ms', 'kab_os', 'kab_ms', 'kam_os', 'kam_mes',
'kuwa_os', 'kuwa_mes', 'dan_os', 'dan_mes', 'cho_os', 'cho_ms', 'tent_os', 'tent_mes',
'kata_os', 'kata_mes', 'nana_os', 'nana_mes', 'bat_os', 'bat_mes', 'tonb_os', 'tonb_mes',
MULTI_CHAR('ari_os'), MULTI_CHAR('ari_ms'), MULTI_CHAR('kag_os'), MULTI_CHAR('kag_ms'), MULTI_CHAR('kab_os'), MULTI_CHAR('kab_ms'), MULTI_CHAR('kam_os'), MULTI_CHAR('kam_mes'),
MULTI_CHAR('kuwa_os'), MULTI_CHAR('kuwa_mes'), MULTI_CHAR('dan_os'), MULTI_CHAR('dan_mes'), MULTI_CHAR('cho_os'), MULTI_CHAR('cho_ms'), MULTI_CHAR('tent_os'), MULTI_CHAR('tent_mes'),
MULTI_CHAR('kata_os'), MULTI_CHAR('kata_mes'), MULTI_CHAR('nana_os'), MULTI_CHAR('nana_mes'), MULTI_CHAR('bat_os'), MULTI_CHAR('bat_mes'), MULTI_CHAR('tonb_os'), MULTI_CHAR('tonb_mes'),
};
static const u64 ageha_tag[MAX_INSECT_NUM] = {
'ageha00', 'ageha01', 'ageha02', 'ageha03', 'ageha04', 'ageha05', 'ageha06', 'ageha07',
'ageha08', 'ageha09', 'ageha10', 'ageha11', 'ageha12', 'ageha13', 'ageha14', 'ageha15',
'ageha16', 'ageha17', 'ageha18', 'ageha19', 'ageha20', 'ageha21', 'ageha22', 'ageha23',
MULTI_CHAR('ageha00'), MULTI_CHAR('ageha01'), MULTI_CHAR('ageha02'), MULTI_CHAR('ageha03'), MULTI_CHAR('ageha04'), MULTI_CHAR('ageha05'), MULTI_CHAR('ageha06'), MULTI_CHAR('ageha07'),
MULTI_CHAR('ageha08'), MULTI_CHAR('ageha09'), MULTI_CHAR('ageha10'), MULTI_CHAR('ageha11'), MULTI_CHAR('ageha12'), MULTI_CHAR('ageha13'), MULTI_CHAR('ageha14'), MULTI_CHAR('ageha15'),
MULTI_CHAR('ageha16'), MULTI_CHAR('ageha17'), MULTI_CHAR('ageha18'), MULTI_CHAR('ageha19'), MULTI_CHAR('ageha20'), MULTI_CHAR('ageha21'), MULTI_CHAR('ageha22'), MULTI_CHAR('ageha23'),
};
mpScreen = new J2DScreen();
mpScreen->setPriority("zelda_gold_insects.blo", 0x20000, mpArchive);
dPaneClass_showNullPane(mpScreen);
mpParent = new CPaneMgr(mpScreen, 'n_all', 2, NULL);
mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL);
mpParent->setAlphaRate(0.0f);
for (int i = 0; i < MAX_INSECT_NUM; i++) {
mpINSParent[i] = new CPaneMgr(mpScreen, insect_tag[i], 0, NULL);
@@ -475,11 +475,11 @@ void dMenu_Insect_c::screenSetBase() {
}
}
#if VERSION == VERSION_GCN_JPN
J2DTextBox* textBox = (J2DTextBox*)mpScreen->search('t_t00');
mpScreen->search('f_t00')->hide();
J2DTextBox* textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('t_t00'));
mpScreen->search(MULTI_CHAR('f_t00'))->hide();
#else
J2DTextBox* textBox = (J2DTextBox*)mpScreen->search('f_t00');
mpScreen->search('t_t00')->hide();
J2DTextBox* textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('f_t00'));
mpScreen->search(MULTI_CHAR('t_t00'))->hide();
#endif
textBox->setFont(mDoExt_getSubFont());
textBox->setString(0x200, "");
@@ -490,27 +490,27 @@ void dMenu_Insect_c::screenSetExplain() {
mpExpScreen = new J2DScreen();
mpExpScreen->setPriority("zelda_gold_insects_info.blo", 0x20000, mpArchive);
dPaneClass_showNullPane(mpExpScreen);
mpExpParent = new CPaneMgr(mpExpScreen, 'n_all', 2, NULL);
mpExpParent = new CPaneMgr(mpExpScreen, MULTI_CHAR('n_all'), 2, NULL);
mpExpParent->setAlphaRate(0.0f);
mpExpSubWin[0] = new CPaneMgr(mpExpScreen, 'in_win_n', 0, NULL);
mpExpSubWin[1] = new CPaneMgr(mpExpScreen, 'w_d_mo_n', 0, NULL);
mpExpSubWin[0] = new CPaneMgr(mpExpScreen, MULTI_CHAR('in_win_n'), 0, NULL);
mpExpSubWin[1] = new CPaneMgr(mpExpScreen, MULTI_CHAR('w_d_mo_n'), 0, NULL);
if (field_0xf6 == 0) {
mpExpSubWin[1]->hide();
}
#if VERSION == VERSION_GCN_JPN
mpInfoText = new CPaneMgr(mpExpScreen, 'mg_3line', 0, NULL);
mpExpScreen->search('n_e4line')->hide();
field_0x5c = (J2DTextBox*)mpExpScreen->search('w_msg_jp');
mpExpScreen->search('ms_for_2')->hide();
mpInfoText = new CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL);
mpExpScreen->search(MULTI_CHAR('n_e4line'))->hide();
field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('w_msg_jp'));
mpExpScreen->search(MULTI_CHAR('ms_for_2'))->hide();
#else
mpInfoText = new CPaneMgr(mpExpScreen, 'mg_e4lin', 0, NULL);
mpExpScreen->search('n_3line')->hide();
field_0x5c = (J2DTextBox*)mpExpScreen->search('ms_for_2');
mpExpScreen->search('w_msg_jp')->hide();
mpInfoText = new CPaneMgr(mpExpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL);
mpExpScreen->search(MULTI_CHAR('n_3line'))->hide();
field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('ms_for_2'));
mpExpScreen->search(MULTI_CHAR('w_msg_jp'))->hide();
#endif
mpExpScreen->search('ms_for_3')->hide();
field_0x54[0] = (J2DPicture*)mpExpScreen->search('insects');
field_0x54[1] = (J2DPicture*)mpExpScreen->search('insectss');
mpExpScreen->search(MULTI_CHAR('ms_for_3'))->hide();
field_0x54[0] = (J2DPicture*)mpExpScreen->search(MULTI_CHAR('insects'));
field_0x54[1] = (J2DPicture*)mpExpScreen->search(MULTI_CHAR('insectss'));
J2DTextBox* textBox = (J2DTextBox*)mpInfoText->getPanePtr();
textBox->setFont(mDoExt_getMesgFont());
J2DTextBox* textBox2 = (J2DTextBox*)mpInfoText->getPanePtr();
@@ -521,10 +521,10 @@ void dMenu_Insect_c::screenSetExplain() {
void dMenu_Insect_c::screenSetDoIcon() {
static const u64 text_a_tag[5] = {
'atext1_1', 'atext1_2', 'atext1_3', 'atext1_4', 'atext1_5',
MULTI_CHAR('atext1_1'), MULTI_CHAR('atext1_2'), MULTI_CHAR('atext1_3'), MULTI_CHAR('atext1_4'), MULTI_CHAR('atext1_5'),
};
static const u64 text_b_tag[5] = {
'btext1_1', 'btext1_2', 'btext1_3', 'btext1_4', 'btext1_5',
MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5'),
};
mpIconScreen = new J2DScreen();