Global: replaces NULL to nullptr

This commit is contained in:
李通洲
2026-07-10 18:08:04 +08:00
parent 873454191f
commit ba18705d2e
387 changed files with 2411 additions and 2411 deletions
+16 -16
View File
@@ -9,10 +9,10 @@ const char* ffGpuDetectDriverVersion(FFlist* gpus);
static double detectGpuTemp(const FFstrbuf* gpuName) {
double result = 0;
const char* error = NULL;
const char* error = nullptr;
if (ffStrbufStartsWithS(gpuName, "Apple M")) {
switch (strtol(gpuName->chars + strlen("Apple M"), NULL, 10)) {
switch (strtol(gpuName->chars + strlen("Apple M"), nullptr, 10)) {
case 0:
error = "Invalid Apple Silicon GPU";
break;
@@ -88,7 +88,7 @@ static const char* detectFrequency(FFGPUResult* gpu) {
}
}
return NULL;
return nullptr;
}
#endif
@@ -123,27 +123,27 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) {
ffStrbufInit(&gpu->driver); // Ok for both Apple and Intel
ffCfDictGetString(properties, CFSTR("CFBundleIdentifier"), &gpu->driver);
if (ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount) != NULL) { // For Apple
if (ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount) != nullptr) { // For Apple
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
}
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
CFDictionaryRef perfStatistics = NULL;
CFDictionaryRef perfStatistics = nullptr;
uint64_t vramUsed = 0, vramTotal = 0;
if (ffCfDictGetDict(properties, CFSTR("PerformanceStatistics"), &perfStatistics) == NULL) {
if (ffCfDictGetDict(properties, CFSTR("PerformanceStatistics"), &perfStatistics) == nullptr) {
int64_t utilization;
if (ffCfDictGetInt64(perfStatistics, CFSTR("Device Utilization %"), &utilization) == NULL) {
if (ffCfDictGetInt64(perfStatistics, CFSTR("Device Utilization %"), &utilization) == nullptr) {
gpu->coreUsage = (double) utilization;
} else if (ffCfDictGetInt64(perfStatistics, CFSTR("GPU Core Utilization"), &utilization) == NULL) {
} else if (ffCfDictGetInt64(perfStatistics, CFSTR("GPU Core Utilization"), &utilization) == nullptr) {
gpu->coreUsage = (double) utilization / 10000000.; // Nvidia?
}
if (ffCfDictGetInt64(perfStatistics, CFSTR("Alloc system memory"), (int64_t*) &vramTotal) == NULL) {
if (ffCfDictGetInt64(perfStatistics, CFSTR("In use system memory"), (int64_t*) &vramUsed) != NULL) {
if (ffCfDictGetInt64(perfStatistics, CFSTR("Alloc system memory"), (int64_t*) &vramTotal) == nullptr) {
if (ffCfDictGetInt64(perfStatistics, CFSTR("In use system memory"), (int64_t*) &vramUsed) != nullptr) {
vramTotal = 0;
}
} else if (ffCfDictGetInt64(perfStatistics, CFSTR("vramFreeBytes"), (int64_t*) &vramTotal) == NULL) {
if (ffCfDictGetInt64(perfStatistics, CFSTR("vramUsedBytes"), (int64_t*) &vramUsed) == NULL) {
} else if (ffCfDictGetInt64(perfStatistics, CFSTR("vramFreeBytes"), (int64_t*) &vramTotal) == nullptr) {
if (ffCfDictGetInt64(perfStatistics, CFSTR("vramUsedBytes"), (int64_t*) &vramUsed) == nullptr) {
vramTotal += vramUsed;
} else {
vramTotal = 0;
@@ -154,9 +154,9 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) {
ffStrbufInit(&gpu->name);
// IOAccelerator returns model / vendor-id properties for Apple Silicon, but not for Intel Iris GPUs.
// Still needs testing for AMD's
if (ffCfDictGetString(properties, CFSTR("model"), &gpu->name) != NULL) {
if (ffCfDictGetString(properties, CFSTR("model"), &gpu->name) != nullptr) {
CFRelease(properties);
properties = NULL;
properties = nullptr;
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t parentEntry = 0;
if (IORegistryEntryGetParentEntry(registryEntry, kIOServicePlane, &parentEntry) != kIOReturnSuccess ||
@@ -169,7 +169,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) {
ffStrbufInit(&gpu->vendor);
int vendorId;
if (ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId) == NULL) {
if (ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId) == nullptr) {
const char* vendorStr = ffGPUGetVendorString((unsigned) vendorId);
ffStrbufAppendS(&gpu->vendor, vendorStr);
if (vendorStr == FF_GPU_VENDOR_NAME_APPLE || vendorStr == FF_GPU_VENDOR_NAME_INTEL) {
@@ -203,5 +203,5 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) {
if (instance.config.general.detectVersion) {
ffGpuDetectDriverVersion(gpus);
}
return NULL;
return nullptr;
}