mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
9bf033dd66
commit
15a4eb0422
1 changed files with 6 additions and 6 deletions
|
@ -565,12 +565,12 @@ static const char* dbg_partitions_getname(int selected_item, void *data,
|
||||||
// XXX and if mounted, show free info...
|
// XXX and if mounted, show free info...
|
||||||
if (selected_item%2)
|
if (selected_item%2)
|
||||||
{
|
{
|
||||||
snprintf(buffer, buffer_len, " T:%x %llu MB", p.type,
|
snprintf(buffer, buffer_len, " T:%x %lu MB", p.type,
|
||||||
(uint64_t)(p.size / ( 2048 / ( SECTOR_SIZE / 512 ))));
|
(unsigned long)(p.size / ( 2048 / ( SECTOR_SIZE / 512 ))));
|
||||||
}
|
}
|
||||||
else
|
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;
|
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 *= sector_size; /* Convert to bytes */
|
||||||
total_sectors /= (1024 * 1024); /* Convert to MB */
|
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);
|
simplelist_addline("Logical sector size: %lu B", sector_size);
|
||||||
#ifdef MAX_VIRT_SECTOR_SIZE
|
#ifdef MAX_VIRT_SECTOR_SIZE
|
||||||
simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier());
|
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;
|
sector_t free;
|
||||||
volume_size( IF_MV(0,) NULL, &free );
|
volume_size( IF_MV(0,) NULL, &free );
|
||||||
simplelist_addline(
|
simplelist_addline(
|
||||||
"Free: %llu MB", (uint64_t)(free / 1024));
|
"Free: %lu MB", (unsigned long)(free / 1024));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
simplelist_addline("SSD detected: %s", ata_disk_isssd() ? "yes" : "no");
|
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("Model: %s", info.product);
|
||||||
simplelist_addline("Firmware: %s", info.revision);
|
simplelist_addline("Firmware: %s", info.revision);
|
||||||
simplelist_addline(
|
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;
|
sector_t free;
|
||||||
volume_size( IF_MV(0,) NULL, &free );
|
volume_size( IF_MV(0,) NULL, &free );
|
||||||
simplelist_addline(
|
simplelist_addline(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue