mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Disk: don't convert NAN to integer; don't print 0B / 0B (0%)
fix ASAN warning: `runtime error: nan is outside the range of representable values of type 'unsigned char'`
This commit is contained in:
@@ -19,13 +19,6 @@ const FFDiskResult* ffDetectDisks()
|
||||
if(result.disks.length == 0 && result.error.length == 0)
|
||||
ffStrbufAppendS(&result.error, "No disks found");
|
||||
|
||||
for(uint32_t i = 0; i < result.disks.length; ++i)
|
||||
{
|
||||
FFDisk* disk = ffListGet(&result.disks, i);
|
||||
disk->bytesPercentage = (uint8_t) (((long double) disk->bytesUsed / (long double) disk->bytesTotal) * 100.0);
|
||||
disk->filesPercentage = (uint8_t) (((long double) disk->filesUsed / (long double) disk->filesTotal) * 100.0);
|
||||
}
|
||||
|
||||
//We need to sort the disks, so that we can detect, which disk a path resides on
|
||||
// For example for /boot/efi/bootmgr we need to check /boot/efi before /boot
|
||||
//Note that we sort alphabetically here for a better ordering when printing the list,
|
||||
|
||||
Reference in New Issue
Block a user