Remove most compiler warnings

This commit is contained in:
2024-06-04 17:43:27 -04:00
parent f8fba122ac
commit 8e876d027b
6 changed files with 25 additions and 26 deletions

View File

@@ -159,7 +159,7 @@ int install_badge_generic(char *file_buf, u64 file_size, u16 *name, int *badge_c
int install_badge_png(FS_Path badge_path, FS_DirectoryEntry badge_file, int *badge_count, int set_id)
{
Result res;
u64 res;
char *file_buf = NULL;
res = file_to_buf(badge_path, ArchiveSD, &file_buf);
if (res != badge_file.fileSize)
@@ -176,7 +176,7 @@ typedef struct {
int installed;
} zip_userdata;
u32 zip_callback(char *file_buf, u64 file_size, char *name, void *userdata)
u32 zip_callback(char *file_buf, u64 file_size, const char *name, void *userdata)
{
zip_userdata *data = (zip_userdata *) userdata;
u16 *utf16_name = calloc(strlen(name), sizeof(u16));
@@ -187,13 +187,12 @@ u32 zip_callback(char *file_buf, u64 file_size, char *name, void *userdata)
return 0;
}
int install_badge_zip(u16 *path, FS_DirectoryEntry zip, int *badge_count, int set_id)
int install_badge_zip(u16 *path, int *badge_count, int set_id)
{
Result res;
zip_userdata data = {0};
data.set_id = set_id;
data.badge_count = badge_count;
for_each_file_zip(path, ArchiveSD, zip_callback, &data);
for_each_file_zip(path, zip_callback, &data);
return data.installed;
}
@@ -220,7 +219,7 @@ int install_badge_dir(FS_DirectoryEntry set_dir, int *badge_count, int set_id)
u32 entries_read;
res = FSDIR_Read(folder, &entries_read, 1024, badge_files);
int badges_in_set = 0;
for (int i = 0; i < entries_read && *badge_count < 1000; ++i)
for (u32 i = 0; i < entries_read && *badge_count < 1000; ++i)
{
if (!strcmp(badge_files[i].shortExt, "PNG"))
{
@@ -243,7 +242,7 @@ int install_badge_dir(FS_DirectoryEntry set_dir, int *badge_count, int set_id)
strucat(path, set_dir.name);
struacat(path, "/");
strucat(path, badge_files[i].name);
badges_in_set += install_badge_zip(path, badge_files[i], badge_count, set_id);
badges_in_set += install_badge_zip(path, badge_count, set_id);
}
}
@@ -345,7 +344,7 @@ Result install_badges(void)
int default_set = 0;
int default_set_count = 0;
int default_idx = 0;
for (int i = 0; i < entries_read && badge_count < 1000; ++i)
for (u32 i = 0; i < entries_read && badge_count < 1000; ++i)
{
if (!strcmp(badge_files[i].shortExt, "PNG"))
{
@@ -370,7 +369,7 @@ Result install_badges(void)
struacat(path, "/Badges/");
strucat(path, badge_files[i].name);
default_set_count += install_badge_zip(path, badge_files[i], &badge_count, default_set);
default_set_count += install_badge_zip(path, &badge_count, default_set);
} else if (badge_files[i].attributes & FS_ATTRIBUTE_DIRECTORY)
{
set_count += 1;

View File

@@ -360,13 +360,13 @@ bool init_qr(void)
if(r == ARCHIVE_OK)
{
EntryMode mode = MODE_AMOUNT;
RemoteMode mode = REMOTE_MODE_AMOUNT;
char * buf = NULL;
do {
if(zip_memory_to_buf("body_LZ.bin", zip_buf, zip_size, &buf) != 0)
{
mode = MODE_THEMES;
mode = REMOTE_MODE_THEMES;
break;
}
@@ -374,7 +374,7 @@ bool init_qr(void)
buf = NULL;
if(zip_memory_to_buf("splash.bin", zip_buf, zip_size, &buf) != 0)
{
mode = MODE_SPLASHES;
mode = REMOTE_MODE_SPLASHES;
break;
}
@@ -382,7 +382,7 @@ bool init_qr(void)
buf = NULL;
if(zip_memory_to_buf("splashbottom.bin", zip_buf, zip_size, &buf) != 0)
{
mode = MODE_SPLASHES;
mode = REMOTE_MODE_SPLASHES;
break;
}
}
@@ -391,7 +391,7 @@ bool init_qr(void)
free(buf);
buf = NULL;
if(mode != MODE_AMOUNT)
if(mode != REMOTE_MODE_AMOUNT)
{
save_zip_to_sd(filename, zip_size, zip_buf, mode);
success = true;

View File

@@ -216,13 +216,13 @@ u32 file_to_buf(FS_Path path, FS_Archive archive, char ** buf)
return (u32)size;
}
s16 for_each_file_zip(u16 *zip_path, FS_Archive archive, u32 (*zip_iter_callback)(char *filebuf, u64 file_size, char *name, void *userdata), void *userdata)
s16 for_each_file_zip(u16 *zip_path, u32 (*zip_iter_callback)(char *filebuf, u64 file_size, const char *name, void *userdata), void *userdata)
{
struct archive *a = archive_read_new();
archive_read_support_format_zip(a);
ssize_t len = strulen(zip_path, 0x106);
char * path = calloc(sizeof(char), len * sizeof(u16));
char * path = calloc(len, sizeof(u16));
utf16_to_utf8((u8 *)path, zip_path, len * sizeof(u16));
DEBUG("Attempting to open zip %s\n", path);
@@ -295,7 +295,7 @@ u32 zip_memory_to_buf(const char * file_name, void * zip_memory, size_t zip_size
u32 zip_file_to_buf(const char * file_name, const u16 * zip_path, char ** buf)
{
ssize_t len = strulen(zip_path, 0x106);
char * path = calloc(sizeof(char), len * sizeof(u16));
char * path = calloc(len, sizeof(u16));
utf16_to_utf8((u8 *)path, zip_path, len * sizeof(u16));
struct archive * a = archive_read_new();

View File

@@ -122,7 +122,7 @@ void stop_audio_ogg(audio_ogg_s ** audio_ptr) {
int init_audio(audio_s *audio)
{
u32 magic = read32(audio->music_buf, &audio->cursor);
DEBUG("Loading music, music_size: %lu, magic: 0x%08lx\n", audio->music_size, magic);
DEBUG("Loading music, music_size: %d, magic: 0x%08lx\n", audio->music_size, magic);
audio->is_little_endian = read16(audio->music_buf, &audio->cursor) == 0xFEFF;
audio->info_offset = 0;
audio->data_offset = 0;
@@ -143,7 +143,7 @@ int init_audio(audio_s *audio)
audio->cursor += 2;
u32 off = read32(audio->music_buf, &audio->cursor);
audio->cursor += 4;
DEBUG("Reading sbc: %04lx, %08lx\n", sec, off);
DEBUG("Reading sbc: %04x, %08lx\n", sec, off);
if (sec == 0x4000) // Info block
audio->info_offset = off;
if (sec == 0x4002) // Data block

View File

@@ -138,7 +138,7 @@ static void load_remote_smdh(Entry_s * entry, C3D_Tex * into_tex, const Entry_Ic
}
}
static void load_remote_entries(Entry_List_s * list, json_t * ids_array, bool ignore_cache, InstallType type, RemoteMode mode)
static void load_remote_entries(Entry_List_s * list, json_t * ids_array, bool ignore_cache, InstallType type)
{
free(list->entries);
list->entries_count = json_array_size(ids_array);
@@ -195,7 +195,7 @@ static void load_remote_list(Entry_List_s * list, json_int_t page, RemoteMode mo
if (json_len)
{
list->tp_current_page = page;
list->mode = mode;
list->mode = (EntryMode) mode;
json_error_t error;
json_t * root = json_loadb(page_json, json_len, 0, &error);
@@ -208,7 +208,7 @@ static void load_remote_list(Entry_List_s * list, json_int_t page, RemoteMode mo
if (json_is_integer(value) && !strcmp(key, THEMEPLAZA_JSON_PAGE_COUNT))
list->tp_page_count = json_integer_value(value);
else if (json_is_array(value) && !strcmp(key, THEMEPLAZA_JSON_PAGE_IDS))
load_remote_entries(list, value, ignore_cache, loading_screen, mode);
load_remote_entries(list, value, ignore_cache, loading_screen);
else if (json_is_string(value) && !strcmp(key, THEMEPLAZA_JSON_ERROR_MESSAGE)
&& !strcmp(json_string_value(value), THEMEPLAZA_JSON_ERROR_MESSAGE_NOT_FOUND))
throw_error(language.remote.no_results, ERROR_LEVEL_WARNING);
@@ -396,7 +396,7 @@ static void jump_menu(Entry_List_s * list)
{
json_int_t newpage = (json_int_t)atoi(numbuf);
if (newpage != list->tp_current_page)
load_remote_list(list, newpage, list->mode, false);
load_remote_list(list, newpage, (RemoteMode) list->mode, false);
}
}
@@ -420,7 +420,7 @@ static void search_menu(Entry_List_s * list)
free(list->tp_search);
list->tp_search = url_escape(search);
DEBUG("Search escaped: %s -> %s\n", search, list->tp_search);
load_remote_list(list, 1, list->mode, false);
load_remote_list(list, 1, (RemoteMode) list->mode, false);
}
free(search);
}
@@ -973,7 +973,7 @@ static size_t handle_data(char *ptr, size_t size, size_t nmemb, void *userdata)
static size_t curl_parse_header(char *buffer, size_t size, size_t nitems, void *userdata)
{
curl_header *header = (curl_header *) userdata;
for (int i = 0; i < size * nitems; ++i)
for (size_t i = 0; i < size * nitems; ++i)
{
if (buffer[i] == '\n' || buffer[i] == '\r')
{