diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-10-15 18:47:41 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-10-15 18:50:35 -0400 |
commit | a2efbf05895ff1c2592a0432b22d8758f5a60973 (patch) | |
tree | 0c00adba36b953bdc900e9aeda3e1187f1522900 | |
parent | d3b7eba405d35c42297ce9c6b866bb467da7f3b1 (diff) | |
download | rockbox-a2efbf0589.tar.gz rockbox-a2efbf0589.zip |
list: Flag simplelist_addline() as accepting format specifiers
And fix up all the problems I've found so far.
...This will undoubtedly introduce a pile of new warnings.
Change-Id: I868de507a0e9790f289676c198e2977c26755f22
-rw-r--r-- | apps/debug_menu.c | 32 | ||||
-rw-r--r-- | apps/gui/list.h | 10 |
2 files changed, 21 insertions, 21 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index e3f4175b78..bd94155882 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1318,8 +1318,8 @@ static int disk_callback(int btn, struct gui_synclist *lists) #if (CONFIG_STORAGE & STORAGE_SD) "O=%c%c", (int) card_extract_bits(card->cid, 127, 8), - card_extract_bits(card->cid, 119, 8), - card_extract_bits(card->cid, 111, 8) + (int) card_extract_bits(card->cid, 119, 8), + (int) card_extract_bits(card->cid, 111, 8) #elif (CONFIG_STORAGE & STORAGE_MMC) "O=%04x", (int) card_extract_bits(card->cid, 127, 8), @@ -1449,7 +1449,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) total_sectors /= (1024 * 1024); /* Convert to MB */ simplelist_addline("Size: %llu MB", (uint64_t)total_sectors); - simplelist_addline("Logical sector size: %u B", sector_size); + simplelist_addline("Logical sector size: %lu B", sector_size); #ifdef MAX_LOG_SECTOR_SIZE simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier()); #endif @@ -1457,7 +1457,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) if((identify_info[106] & 0xe000) == 0x6000) sector_size *= BIT_N(identify_info[106] & 0x000f); simplelist_addline( - "Physical sector size: %d B", sector_size); + "Physical sector size: %lu B", sector_size); #ifndef HAVE_MULTIVOLUME // XXX this needs to be fixed for multi-volume setups @@ -1887,13 +1887,13 @@ static int dircache_callback(int btn, struct gui_synclist *lists) simplelist_set_line_count(0); simplelist_addline("Cache status: %s", info.statusdesc); - simplelist_addline("Last size: %lu B", info.last_size); - simplelist_addline("Size: %lu B", info.size); + simplelist_addline("Last size: %zu B", info.last_size); + simplelist_addline("Size: %zu B", info.size); unsigned int utilized = info.size ? 1000ull*info.sizeused / info.size : 0; - simplelist_addline("Used: %lu B (%u.%u%%)", info.sizeused, + simplelist_addline("Used: %zu B (%u.%u%%)", info.sizeused, utilized / 10, utilized % 10); - simplelist_addline("Limit: %lu B", info.size_limit); - simplelist_addline("Reserve: %lu/%lu B", info.reserve_used, info.reserve); + simplelist_addline("Limit: %zu B", info.size_limit); + simplelist_addline("Reserve: %zu/%zu B", info.reserve_used, info.reserve); long ticks = ALIGN_UP(info.build_ticks, HZ / 10); simplelist_addline("Scanning took: %ld.%ld s", ticks / HZ, (ticks*10 / HZ) % 10); @@ -2681,12 +2681,12 @@ static bool dbg_syscfg(void) { return simplelist_show_list(&info); } - simplelist_addline("Total size: %u bytes, %u entries", syscfg_hdr.size, syscfg_hdr.num_entries); + simplelist_addline("Total size: %lu bytes, %lu entries", syscfg_hdr.size, syscfg_hdr.num_entries); size_t calculated_syscfg_size = syscfg_hdr_size + syscfg_entry_size * syscfg_hdr.num_entries; if (syscfg_hdr.size != calculated_syscfg_size) { - simplelist_addline("Wrong size: expected %u, got %u", calculated_syscfg_size, syscfg_hdr.size); + simplelist_addline("Wrong size: expected %zu, got %lu", calculated_syscfg_size, syscfg_hdr.size); bootflash_close(SPI_PORT); return simplelist_show_list(&info); } @@ -2711,13 +2711,13 @@ static bool dbg_syscfg(void) { simplelist_addline("Serial number (SrNm): %s", entry->data); break; case SYSCFG_TAG_FWID: - simplelist_addline("Firmware ID (FwId): %07X", data32[1] & 0x0FFFFFFF); + simplelist_addline("Firmware ID (FwId): %07lX", data32[1] & 0x0FFFFFFF); break; case SYSCFG_TAG_HWID: - simplelist_addline("Hardware ID (HwId): %08X", data32[0]); + simplelist_addline("Hardware ID (HwId): %08lX", data32[0]); break; case SYSCFG_TAG_HWVR: - simplelist_addline("Hardware version (HwVr): %06X", data32[1]); + simplelist_addline("Hardware version (HwVr): %06lX", data32[1]); break; case SYSCFG_TAG_CODC: simplelist_addline("Codec (Codc): %s", entry->data); @@ -2732,10 +2732,10 @@ static bool dbg_syscfg(void) { simplelist_addline("Model number (Mod#): %s", entry->data); break; case SYSCFG_TAG_REGN: - simplelist_addline("Sales region (Regn): %08X %08X", data32[0], data32[1]); + simplelist_addline("Sales region (Regn): %08lX %08lX", data32[0], data32[1]); break; default: - simplelist_addline("%c%c%c%c: %08X %08X %08X %08X", + simplelist_addline("%c%c%c%c: %08lX %08lX %08lX %08lX", tag[3], tag[2], tag[1], tag[0], data32[0], data32[1], data32[2], data32[3] ); diff --git a/apps/gui/list.h b/apps/gui/list.h index 40a27d1061..88d9e0d9bd 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -134,7 +134,7 @@ struct list_selection_color unsigned bg_color; /* To enable: * call gui_synclist_set_sel_color(gui_synclist*, list_selection_color*) - * If using the default viewport you should call + * If using the default viewport you should call * gui_synclist_set_sel_color(gui_synclist*, NULL) when finished */ }; #endif @@ -264,8 +264,8 @@ extern bool list_do_action(int context, int timeout, /** Simplelist implementation. - USe this if you dont need to reimplement the list code, - and just need to show a list + USe this if you dont need to reimplement the list code, + and just need to show a list **/ struct simplelist_info { @@ -282,7 +282,7 @@ struct simplelist_info { was exited with ACTION_STD_CANCEL */ int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */ /* action_callback notes: - action == the action pressed by the user + action == the action pressed by the user _after_ gui_synclist_do_button returns. lists == the lists struct so the callback can get selection and count etc. */ enum themable_icons title_icon; @@ -312,7 +312,7 @@ void simplelist_set_line_count(int lines); /* get the current amount of lines shown */ int simplelist_get_line_count(void); /* add a line in the list. */ -void simplelist_addline(const char *fmt, ...); +void simplelist_addline(const char *fmt, ...) __attribute__((format(printf,1,2))); /* setup the info struct. members not setup in this function need to be assigned manually members set in this function: |