diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-11-15 07:28:55 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-11-15 07:28:55 -0500 |
commit | 15a4eb04228064518daf4ba6e0985e39fe64c8e9 (patch) | |
tree | c6ac5398222444a8595f18eec3c612c38b39deb3 | |
parent | 9bf033dd667a85d0f8ca84084bdf518b44bdb4bc (diff) | |
download | rockbox-15a4eb0422.tar.gz rockbox-15a4eb0422.zip |
debug: Correct most of the sector_t printf()s
The 'll' printf modifier is currently broken. Fortunately all but
one of the uses is printing MB instead of bytes, which means we can
cast the value to a 'unsigned long' without risk of overflow/wraps.
...There's one remaining use ('%llx') which still needs to be sorted
out.
Change-Id: I89f406f6c085be153531d1ec1f2a314ae172b129
-rw-r--r-- | apps/debug_menu.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index dfc81232c7..39d9a2a4e2 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -565,12 +565,12 @@ static const char* dbg_partitions_getname(int selected_item, void *data, // XXX and if mounted, show free info... if (selected_item%2) { - snprintf(buffer, buffer_len, " T:%x %llu MB", p.type, - (uint64_t)(p.size / ( 2048 / ( SECTOR_SIZE / 512 )))); + snprintf(buffer, buffer_len, " T:%x %lu MB", p.type, + (unsigned long)(p.size / ( 2048 / ( SECTOR_SIZE / 512 )))); } else { - snprintf(buffer, buffer_len, "P%d: S:%llx", partition, (uint64_t)p.start); + snprintf(buffer, buffer_len, "P%d: S:%llx", partition, (unsigned long long)p.start); } return buffer; } @@ -1450,7 +1450,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) total_sectors *= sector_size; /* Convert to bytes */ total_sectors /= (1024 * 1024); /* Convert to MB */ - simplelist_addline("Size: %llu MB", (uint64_t)total_sectors); + simplelist_addline("Size: %lu MB", (unsigned long)total_sectors); simplelist_addline("Logical sector size: %lu B", sector_size); #ifdef MAX_VIRT_SECTOR_SIZE simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier()); @@ -1466,7 +1466,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) sector_t free; volume_size( IF_MV(0,) NULL, &free ); simplelist_addline( - "Free: %llu MB", (uint64_t)(free / 1024)); + "Free: %lu MB", (unsigned long)(free / 1024)); #endif simplelist_addline("SSD detected: %s", ata_disk_isssd() ? "yes" : "no"); @@ -1805,7 +1805,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) simplelist_addline("Model: %s", info.product); simplelist_addline("Firmware: %s", info.revision); simplelist_addline( - "Size: %llu MB", (uint64_t)(info.num_sectors*(info.sector_size/512)/2048)); + "Size: %lu MB", (unsigned long)(info.num_sectors*(info.sector_size/512)/2048)); sector_t free; volume_size( IF_MV(0,) NULL, &free ); simplelist_addline( |