Skip to content

Commit

Permalink
Merge pull request #124 from uyjulian/waddress
Browse files Browse the repository at this point in the history
[NFC] GCC14 fixes
  • Loading branch information
uyjulian authored May 23, 2024
2 parents c46c88c + a8ca8ce commit aa7be34
Show file tree
Hide file tree
Showing 31 changed files with 245 additions and 219 deletions.
7 changes: 4 additions & 3 deletions SMB_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ size_t storeSMBCNF(char *cnf_buf)
int i;

for (CNF_size = 0, i = 0; i < smbServerListCount; i++) { // loop for each SMB server in the list
size_step = 0;
sprintf(cnf_buf + CNF_size,
"smbIndex = %d\r\n"
"smbServer_IP = %s\r\n"
Expand Down Expand Up @@ -104,7 +105,7 @@ size_t storeSMBCNF(char *cnf_buf)
//---------------------------------------------------------------------------
// saveSMBCNF will save SMB specific settings to an SMB CNF file
//------------------------------
int saveSMBCNF(char *CNFpath)
int saveSMBCNF(const char *CNFpath)
{
int ret, fd;
char tmp[SERVERLIST_MAX * 1500]; // Must have room for entire SMB CNF file
Expand All @@ -129,7 +130,7 @@ int saveSMBCNF(char *CNFpath)
//---------------------------------------------------------------------------
// scanSMBCNF will check for SMB specific variables of an SMB CNF in RAM
//------------------------------
int scanSMBCNF(unsigned char *name, unsigned char *value)
int scanSMBCNF(const unsigned char *name, const unsigned char *value)
{
if (!strcmp(name, "smbIndex")) {
int test;
Expand Down Expand Up @@ -169,7 +170,7 @@ int scanSMBCNF(unsigned char *name, unsigned char *value)
//---------------------------------------------------------------------------
// loadSMBCNF will load SMB specific settings from an SMB CNF file
//------------------------------
int loadSMBCNF(char *path)
int loadSMBCNF(const char *path)
{
int var_cnt;
unsigned char *RAM_p, *CNF_p, *name, *value;
Expand Down
34 changes: 21 additions & 13 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int CheckMC(void)
return -11;
}
//---------------------------------------------------------------------------
unsigned long hextoul(char *string)
unsigned long hextoul(const char *string)
{
unsigned long value;
char c;
Expand All @@ -152,6 +152,7 @@ static size_t storeSkinCNF(char *cnf_buf)
{
size_t CNF_size;

CNF_size = 0;
sprintf(cnf_buf,
"GUI_Col_1_ABGR = %08X\r\n"
"GUI_Col_2_ABGR = %08X\r\n"
Expand Down Expand Up @@ -197,7 +198,7 @@ static size_t storeSkinCNF(char *cnf_buf)
//---------------------------------------------------------------------------
// saveSkinCNF will save most cosmetic settings to a skin CNF file
//------------------------------
static int saveSkinCNF(char *CNF)
static int saveSkinCNF(const char *CNF)
{
int ret, fd;
char tmp[26 * MAX_PATH + 30 * MAX_PATH];
Expand Down Expand Up @@ -277,7 +278,7 @@ static void saveSkinBrowser(void)
//---------------------------------------------------------------------------
// preloadCNF loads an entire CNF file into RAM it allocates
//------------------------------
char *preloadCNF(char *path)
char *preloadCNF(const char *path)
{
int fd, tst;
s64 CNF_size;
Expand Down Expand Up @@ -309,7 +310,7 @@ char *preloadCNF(char *path)
//---------------------------------------------------------------------------
// scanSkinCNF will check for most cosmetic variables of a CNF
//------------------------------
int scanSkinCNF(char *name, char *value)
int scanSkinCNF(const char *name, const char *value)
{
if (!strcmp(name, "GUI_Col_1_ABGR"))
setting->color[COLOR_BACKGR] = hextoul(value);
Expand Down Expand Up @@ -357,7 +358,7 @@ int scanSkinCNF(char *name, char *value)
//---------------------------------------------------------------------------
// loadSkinCNF will load most cosmetic settings from CNF file
//------------------------------
int loadSkinCNF(char *path)
int loadSkinCNF(const char *path)
{
int var_cnt;
char *RAM_p, *CNF_p, *name, *value;
Expand All @@ -369,7 +370,7 @@ int loadSkinCNF(char *path)
scanSkinCNF(name, value);
free(RAM_p);
updateScreenMode();
if (setting->skin)
if (setting->skin[0])
loadSkin(BACKGROUND_PIC, 0, 0);
return 0;
}
Expand Down Expand Up @@ -401,17 +402,19 @@ void loadSkinBrowser(void)
// polo: ADD save SKIN_FILE string
// suloku: ADD save MAIN_SKIN string //dlanor: changed to GUI_SKIN_FILE
//---------------------------------------------------------------------------
void saveConfig(char *mainMsg, char *CNF)
void saveConfig(char *mainMsg, const char *CNF)
{
int i, ret, fd;
char c[MAX_PATH], tmp[26 * MAX_PATH + 30 * MAX_PATH];
char cnf_path[MAX_PATH];
size_t CNF_size, CNF_step;

CNF_size = 0;
sprintf(tmp, "CNF_version = 3\r\n%n", &CNF_size); // Start CNF with version header

for (i = 0; i < SETTING_LK_COUNT; i++) { // Loop to save the ELF paths for launch keys
if ((i <= SETTING_LK_SELECT) || (setting->LK_Flag[i] != 0)) {
CNF_step = 0;
sprintf(tmp + CNF_size,
"LK_%s_E1 = %s\r\n"
"%n", // %n causes NO output, but only a measurement
Expand All @@ -424,6 +427,7 @@ void saveConfig(char *mainMsg, char *CNF)
} // ends for

i = strlen(setting->Misc);
CNF_step = 0;
sprintf(tmp + CNF_size,
"Misc = %s\r\n"
"Misc_PS2Disc = %s\r\n"
Expand Down Expand Up @@ -468,6 +472,7 @@ void saveConfig(char *mainMsg, char *CNF)

CNF_size += storeSkinCNF(tmp + CNF_size);

CNF_step = 0;
sprintf(tmp + CNF_size,
"LK_auto_Timer = %d\r\n"
"Menu_Hide_Paths = %d\r\n"
Expand Down Expand Up @@ -524,6 +529,7 @@ void saveConfig(char *mainMsg, char *CNF)

for (i = 0; i < SETTING_LK_BTN_COUNT; i++) { // Loop to save user defined launch key titles
if (setting->LK_Title[i][0]) { // Only save non-empty strings
CNF_step = 0;
sprintf(tmp + CNF_size,
"LK_%s_Title = %s\r\n"
"%n", // %n causes NO output, but only a measurement
Expand All @@ -535,6 +541,7 @@ void saveConfig(char *mainMsg, char *CNF)
} // ends if
} // ends for

CNF_step = 0;
sprintf(tmp + CNF_size,
"PathPad_Lock = %d\r\n"
"%n", // %n causes NO output, but only a measurement
Expand All @@ -545,6 +552,7 @@ void saveConfig(char *mainMsg, char *CNF)

for (i = 0; i < MAX_PATH_PAD; i++) { // Loop to save non-empty PathPad entries
if (PathPad[i][0]) { // Only save non-empty strings
CNF_step = 0;
sprintf(tmp + CNF_size,
"PathPad[%02d] = %s\r\n"
"%n", // %n causes NO output, but only a measurement
Expand Down Expand Up @@ -694,7 +702,7 @@ void initConfig(void)
// suloku: ADD load MAIN_SKIN string //dlanor: changed to GUI_SKIN_FILE
// dlanor: added error flag return value 0==OK, -1==failure
//---------------------------------------------------------------------------
int loadConfig(char *mainMsg, char *CNF)
int loadConfig(char *mainMsg, const char *CNF)
{
int i, fd, tst, len, mcport, var_cnt, CNF_version;
char tsts[256];
Expand Down Expand Up @@ -1976,7 +1984,7 @@ static void saveNetworkSettings(char *Message)
//---------------------------------------------------------------------------
// Convert IP string to numbers
//---------------------------------------------------------------------------
static void ipStringToOctet(char *ip, int ip_octet[4])
static void ipStringToOctet(const char *ip, int ip_octet[4])
{

// This takes a string (ip) representing an IP address and converts it
Expand All @@ -1991,7 +1999,7 @@ static void ipStringToOctet(char *ip, int ip_octet[4])
oct_str[0] = 0;

for (i = 0; ((i <= strlen(ip)) && (oct_cnt < 4)); i++) {
if ((ip[i] == '.') | (i == strlen(ip))) {
if ((ip[i] == '.') || (i == strlen(ip))) {
ip_octet[oct_cnt] = atoi(oct_str);
oct_cnt++;
oct_str[0] = 0;
Expand All @@ -2002,7 +2010,7 @@ static void ipStringToOctet(char *ip, int ip_octet[4])
}
}
//---------------------------------------------------------------------------
static data_ip_struct BuildOctets(char *ip, char *nm, char *gw)
static data_ip_struct BuildOctets(const char *ip, const char *nm, const char *gw)
{

// Populate 3 arrays with the ip address (as ints)
Expand Down Expand Up @@ -2266,11 +2274,11 @@ enum CONFIG_MAIN {
CONFIG_MAIN_COUNT
};

void config(char *mainMsg, char *CNF)
void config(char *mainMsg, const char *CNF)
{
char c[MAX_PATH];
char title_tmp[MAX_ELF_TITLE];
char *localMsg;
const char *localMsg;
int i;
int s;
int x, y;
Expand Down
16 changes: 8 additions & 8 deletions draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ static int ShrinkData(u8 *pInBuff, u16 wWidth, u16 wHeight, u8 *pOutBuff, u16 wN
static int EnlargeData(u8 *pInBuff, u16 wWidth, u16 wHeight, u8 *pOutBuff, u16 wNewWidth, u16 wNewHeight)
{

u8 *pLine = pInBuff,
*pPix = pLine,
*pPixOld,
*pUpPix,
*pUpPixOld;
u8 *pLine = pInBuff;
u8 *pPix = pLine;
const u8 *pPixOld;
u8 *pUpPix;
const u8 *pUpPixOld;
u8 *pOutLine = pOutBuff;
u32 dwInLn = (3 * wWidth + 3) & ~3;
u32 dwOutLn = (3 * wNewWidth + 3) & ~3;
Expand Down Expand Up @@ -659,7 +659,7 @@ void updateScreenMode(void)
gsKit_set_display_offset(gsGlobal, setting->screen_x, setting->screen_y);
}
//--------------------------------------------------------------
void loadSkin(int Picture, char *Path, int ThumbNum)
void loadSkin(int Picture, const char *Path, int ThumbNum)
{
char tmpPath[MAX_PATH], skinpath[MAX_PATH];

Expand Down Expand Up @@ -848,7 +848,7 @@ void loadIcon(void)
free(TexIcon[1].Mem);
}
//--------------------------------------------------------------
int loadFont(char *path_arg)
int loadFont(const char *path_arg)
{
int fd;

Expand Down Expand Up @@ -961,7 +961,7 @@ void drawFrame(int x1, int y1, int x2, int y2, u64 color)
void drawChar(unsigned int c, int x, int y, u64 colour)
{
int i, j, pixMask;
u8 *cm;
const u8 *cm;

updateScr_1 = 1;

Expand Down
8 changes: 4 additions & 4 deletions editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int Windows_Selector(void);
static void Init(void);
static int New(int Win);
static int OpenFile(int Win);
static int Open(int Win, char *path);
static int Open(int Win, const char *path);
static void Close(int Win);
static void Save(int Win);
static void Save_As(int Win);
Expand Down Expand Up @@ -1047,7 +1047,7 @@ static int OpenFile(int Win)
return Open(Win, Path[Win]);
}

static int Open(int Win, char *path)
static int Open(int Win, const char *path)
{
int fd, i, ret = 0;
char filePath[MAX_PATH];
Expand Down Expand Up @@ -1173,7 +1173,7 @@ static void Save_As(int Win)
{
int fd, ret = 0;
char tmp[MAX_PATH], oldPath[MAX_PATH], filePath[MAX_PATH];
char *p;
const char *p;

tmp[0] = '\0', oldPath[0] = '\0', filePath[0] = '\0';

Expand Down Expand Up @@ -1234,7 +1234,7 @@ static void Save_As(int Win)
; // display operation result during 1.5 sec.
}
//--------------------------------------------------------------
void TextEditor(char *path)
void TextEditor(const char *path)
{
char tmp[MAX_PATH], tmp1[MAX_PATH], tmp2[MAX_PATH];
int ch;
Expand Down
10 changes: 5 additions & 5 deletions elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int checkELFheader(char *path)
{
elf_header_t elf_head;
u8 *boot_elf = (u8 *)&elf_head;
elf_header_t *eh = (elf_header_t *)boot_elf;
const elf_header_t *eh = (const elf_header_t *)boot_elf;
int fd, size = 0, ret;
char fullpath[MAX_PATH], tmp[MAX_PATH], *p;

Expand Down Expand Up @@ -85,7 +85,7 @@ int checkELFheader(char *path)
goto error;
fullpath[7] += ret;
} else if (!strncmp(fullpath, "mass", 4)) {
char *pathSep;
const char *pathSep;

pathSep = strchr(path, '/');
if (pathSep && (pathSep - path < 7) && pathSep[-1] == ':')
Expand Down Expand Up @@ -127,11 +127,11 @@ void RunLoaderElf(char *filename, char *party)
u8 *boot_elf;
elf_header_t *eh;
elf_pheader_t *eph;
void *pdata;
const void *pdata;
int i;
char *argv[2], bootpath[256];

if ((!strncmp(party, "hdd0:", 5)) && (!strncmp(filename, "pfs0:", 5))) {
if ((!strncmp(party, "hdd0:", 5))) {
if (0 > fileXioMount("pfs0:", party, FIO_MT_RDONLY)) {
// Some error occurred, it could be due to something else having used pfs0
unmountParty(0); // So we try unmounting pfs0, to try again
Expand All @@ -149,7 +149,7 @@ void RunLoaderElf(char *filename, char *party)

argv[0] = filename;
argv[1] = bootpath;
} else if ((!strncmp(party, "dvr_hdd0:", 9)) && (!strncmp(filename, "dvr_pfs0:", 9))) {
} else if ((!strncmp(party, "dvr_hdd0:", 9))) {
if (0 > fileXioMount("dvr_pfs0:", party, FIO_MT_RDONLY)) {
// Some error occurred, it could be due to something else having used pfs0
unmountDVRPParty(0); // So we try unmounting pfs0, to try again
Expand Down
Loading

0 comments on commit aa7be34

Please sign in to comment.