macOS: fix compile warnings

This commit is contained in:
李通洲
2022-10-11 13:17:32 +08:00
parent 2e42bbb1a2
commit 3d2497f963
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ static void calculatePercentage(FFMemoryStorage* storage)
if(storage->bytesTotal == 0)
storage->percentage = 0;
else
storage->percentage = (uint8_t) ((storage->bytesUsed / (long double) storage->bytesTotal) * 100.0);
storage->percentage = (uint8_t) (((long double) storage->bytesUsed / (long double) storage->bytesTotal) * 100.0);
}
const FFMemoryResult* ffDetectMemory()
+1 -1
View File
@@ -11,7 +11,7 @@ uint32_t ffDetectProcesses(FFinstance* instance, FFstrbuf* error)
if(sysctl(request, sizeof(request) / sizeof(*request), NULL, &length, NULL, 0) != 0)
{
ffStrbufAppend(error, "sysctl() failed");
ffStrbufAppendS(error, "sysctl() failed");
return 0;
}
return (uint32_t)(length / sizeof(struct kinfo_proc));
+1 -1
View File
@@ -207,7 +207,7 @@ static const char *smcReadValue(io_connect_t conn, const UInt32Char_t key, doubl
uint64_t tmp = 0;
for (uint32_t i = 0; i < val.dataSize; i++)
tmp += (uint64_t)((uint8_t)(val.bytes[i]) * pow(256, val.dataSize - 1 - i));
*value = tmp;
*value = (double)tmp;
}
else if (strcmp(val.dataType, kDataTypeFlt) == 0)
{
+1 -1
View File
@@ -24,7 +24,7 @@ static void printFolder(FFinstance* instance, FFDiskResult* folder)
});
}
uint8_t percentage = (uint8_t) ((folder->used / (long double) folder->total) * 100.0);
uint8_t percentage = (uint8_t) (((long double) folder->used / (long double) folder->total) * 100.0);
FFstrbuf usedPretty;
ffStrbufInit(&usedPretty);