Global: uses strtoull for uint64_t

Fixes #2563 #2564
This commit is contained in:
李通洲
2026-09-04 19:35:17 +08:00
parent 4e78f1b703
commit ecee5694fb
6 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -712,7 +712,7 @@ static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options) {
while ((p = memmem(p, cpuinfo->length - (uint32_t) (p - cpuinfo->chars), "\nphysical id\t:", strlen("\nphysical id\t:")))) {
p += strlen("\nphysical id\t:");
char* pend;
unsigned long long id = strtoul(p, &pend, 10);
unsigned long id = strtoul(p, &pend, 10);
if (__builtin_expect(id > 64, false)) { // Do 129-socket boards exist?
high |= 1ULL << (id - 64);
} else {
+1 -1
View File
@@ -426,7 +426,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
ffStrbufAppendS(deviceDir, "/revision");
if (ffReadFileBuffer(deviceDir->chars, buffer)) {
char* pend;
uint64_t revision = strtoul(buffer->chars, &pend, 16);
uint32_t revision = (uint32_t) strtoul(buffer->chars, &pend, 16);
if (pend != buffer->chars) {
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
}
+1 -1
View File
@@ -19,7 +19,7 @@ static int walkDevTree(di_node_t node, [[maybe_unused]] di_minor_t minor, FFlist
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->deviceId = strtoul(di_bus_addr(node), nullptr, 16);
gpu->deviceId = (uint64_t) strtoull(di_bus_addr(node), nullptr, 16);
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
gpu->pcieSpeed = FF_GPU_PCIE_SPEED_UNSET;
@@ -34,7 +34,7 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
ssize_t fileSize = ffReadFileDataRelative(dfd, "size", ARRAY_SIZE(blkSize) - 1, blkSize);
if (fileSize > 0) {
blkSize[fileSize] = 0;
size = (uint64_t) strtoul(blkSize, nullptr, 10) * 512;
size = (uint64_t) strtoull(blkSize, nullptr, 10) * 512;
}
}
@@ -38,7 +38,7 @@ static void appendDevice(
if (size)
{
char* unit = nullptr;
device->size = strtoul(size.UTF8String, &unit, 10);
device->size = (uint64_t) strtoull(size.UTF8String, &unit, 10);
if (*unit == ' ') ++unit;
switch (*unit)
+2 -2
View File
@@ -19,11 +19,11 @@ static const char* detectByProcMeminfo(FFlist* result) {
char* token = nullptr;
if ((token = strstr(buf, "SwapTotal:")) != nullptr) {
swapTotal = strtoul(token + strlen("SwapTotal:"), nullptr, 10);
swapTotal = (uint64_t) strtoull(token + strlen("SwapTotal:"), nullptr, 10);
}
if ((token = strstr(buf, "SwapFree:")) != nullptr) {
swapFree = strtoul(token + strlen("SwapFree:"), nullptr, 10);
swapFree = (uint64_t) strtoull(token + strlen("SwapFree:"), nullptr, 10);
}
FFSwapResult* swap = FF_LIST_ADD(FFSwapResult, *result);