mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -27,7 +27,7 @@ extern int DisplayServicesGetBrightness(CGDirectDisplayID display, float* bright
|
||||
|
||||
// Works for internal display
|
||||
static const char* detectWithDisplayServices(const FFDisplayServerResult* displayServer, FFlist* result) {
|
||||
if (DisplayServicesGetBrightness == NULL) {
|
||||
if (DisplayServicesGetBrightness == nullptr) {
|
||||
return "DisplayServices function DisplayServicesGetBrightness is not available";
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ static const char* detectWithDisplayServices(const FFDisplayServerResult* displa
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef __aarch64__
|
||||
@@ -63,7 +63,7 @@ static const char* detectWithDdcci(FF_A_UNUSED const FFDisplayServerResult* disp
|
||||
|
||||
io_registry_entry_t registryEntry;
|
||||
while ((registryEntry = IOIteratorNext(iterator)) != IO_OBJECT_NULL) {
|
||||
FF_CFTYPE_AUTO_RELEASE IOAVServiceRef service = NULL;
|
||||
FF_CFTYPE_AUTO_RELEASE IOAVServiceRef service = nullptr;
|
||||
{
|
||||
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t entryAv = registryEntry;
|
||||
|
||||
@@ -118,7 +118,7 @@ static const char* detectWithDdcci(FF_A_UNUSED const FFDisplayServerResult* disp
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
static IOOptionBits getSupportedTransactionType(void) {
|
||||
@@ -181,7 +181,7 @@ static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, F
|
||||
}
|
||||
|
||||
uint8_t i2cOut[12] = {};
|
||||
IOI2CConnectRef connect = NULL;
|
||||
IOI2CConnectRef connect = nullptr;
|
||||
if (IOI2CInterfaceOpen(interface, kNilOptions, &connect) != KERN_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, F
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -240,5 +240,5 @@ const char* ffDetectBrightness(FFBrightnessOptions* options, FFlist* result) {
|
||||
detectWithDdcci(displayServer, options, result);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFlist* re
|
||||
brightness->builtin = false;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -125,7 +125,7 @@ const char* detectWithBacklight(FF_A_UNUSED FFBrightnessOptions* options, FFlist
|
||||
ffStrbufAppendS(&brightness->name, path + strlen("/dev/backlight/"));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -143,5 +143,5 @@ const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist*
|
||||
if (options->ddcciSleep != FF_BRIGHTNESS_DDCCI_SLEEP_SKIP && result->length == 0) {
|
||||
detectWithDdcci(options, result);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -42,5 +42,5 @@ const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist*
|
||||
|
||||
} while (screen.SetToNext() == B_OK);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ static const char* detectWithBacklight(FFlist* result) {
|
||||
const char* backlightDirPath = "/sys/class/backlight/";
|
||||
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(backlightDirPath);
|
||||
if (dirp == NULL) {
|
||||
if (dirp == nullptr) {
|
||||
return "Failed to open `/sys/class/backlight/`";
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ static const char* detectWithBacklight(FFlist* result) {
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL) {
|
||||
while ((entry = readdir(dirp)) != nullptr) {
|
||||
if (entry->d_name[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ static const char* detectWithBacklight(FFlist* result) {
|
||||
ffStrbufSubstrBefore(&backlightDir, backlightDirLength);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_DDCUTIL
|
||||
@@ -103,7 +103,7 @@ static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFl
|
||||
if (ffddca_init) {
|
||||
FF_SUPPRESS_IO();
|
||||
// Ref: https://github.com/rockowitz/ddcutil/issues/344
|
||||
if (ffddca_init(NULL, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) {
|
||||
if (ffddca_init(nullptr, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) {
|
||||
return "ddca_init() failed";
|
||||
}
|
||||
} else {
|
||||
@@ -112,11 +112,11 @@ static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFl
|
||||
ffddca_set_default_sleep_multiplier(options->ddcciSleep / 40.0);
|
||||
}
|
||||
|
||||
libddcutil = NULL; // Don't dlclose libddcutil. See https://github.com/rockowitz/ddcutil/issues/330
|
||||
libddcutil = nullptr; // Don't dlclose libddcutil. See https://github.com/rockowitz/ddcutil/issues/330
|
||||
}
|
||||
#else
|
||||
#if DDCUTIL_VMAJOR >= 2
|
||||
if (ddca_init(NULL, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) {
|
||||
if (ddca_init(nullptr, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) {
|
||||
return "ddca_init() failed";
|
||||
}
|
||||
#else
|
||||
@@ -124,7 +124,7 @@ static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FF_AUTO_FREE DDCA_Display_Info_List* infoList = NULL;
|
||||
FF_AUTO_FREE DDCA_Display_Info_List* infoList = nullptr;
|
||||
if (ffddca_get_display_info_list2(false, &infoList) < 0) {
|
||||
return "ddca_get_display_info_list2(false, &infoList) failed";
|
||||
}
|
||||
@@ -138,7 +138,7 @@ static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFl
|
||||
|
||||
DDCA_Display_Handle handle;
|
||||
if (ffddca_open_display2(display->dref, false, &handle) >= 0) {
|
||||
DDCA_Any_Vcp_Value* vcpValue = NULL;
|
||||
DDCA_Any_Vcp_Value* vcpValue = nullptr;
|
||||
if (ffddca_get_any_vcp_value_using_explicit_type(handle, 0x10 /*brightness*/, DDCA_NON_TABLE_VCP_VALUE, &vcpValue) >= 0) {
|
||||
assert(vcpValue->value_type == DDCA_NON_TABLE_VCP_VALUE);
|
||||
int current = VALREC_CUR_VAL(vcpValue), max = VALREC_MAX_VAL(vcpValue);
|
||||
@@ -154,7 +154,7 @@ static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFl
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -170,5 +170,5 @@ const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist*
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -22,5 +22,5 @@ const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist*
|
||||
brightness->current = value;
|
||||
brightness->builtin = true;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -40,5 +40,5 @@ const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist*
|
||||
brightness->builtin = true;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ static const char* detectWithWmi(FFlist* result) {
|
||||
0xd43412ac, 0x67f9, 0x4fbb, { 0xa0, 0x81, 0x17, 0x52, 0xa2, 0xc3, 0x3e, 0x84 }
|
||||
};
|
||||
|
||||
FF_AUTO_CLOSE_WMI_BLOCK HANDLE hBlock = NULL;
|
||||
FF_AUTO_CLOSE_WMI_BLOCK HANDLE hBlock = nullptr;
|
||||
|
||||
ULONG status = WmiOpenBlock(&WmiMonitorBrightnessGuid, WMIGUID_QUERY, &hBlock);
|
||||
if (status != 0) {
|
||||
@@ -54,7 +54,7 @@ static const char* detectWithWmi(FFlist* result) {
|
||||
}
|
||||
|
||||
ULONG bufferSize = 0;
|
||||
status = WmiQueryAllDataW(hBlock, &bufferSize, NULL);
|
||||
status = WmiQueryAllDataW(hBlock, &bufferSize, nullptr);
|
||||
if (status != ERROR_SUCCESS && status != ERROR_INSUFFICIENT_BUFFER) {
|
||||
FF_DEBUG("WMI: first WmiQueryAllDataW failed, bufferSize=%lu: %s", bufferSize, ffDebugWin32Error(status));
|
||||
return "WmiQueryAllDataW() failed";
|
||||
@@ -121,7 +121,7 @@ static const char* detectWithWmi(FFlist* result) {
|
||||
|
||||
FF_DEBUG("WMI: finished detection, total results=%u", result->length);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, FFlist* result) {
|
||||
@@ -159,7 +159,7 @@ static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, F
|
||||
NTSTATUS monitorStatus = ffGetPhysicalMonitors(&deviceName, 1, &monitorCount, &physicalMonitor);
|
||||
if (NT_SUCCESS(monitorStatus) && monitorCount >= 1) {
|
||||
DWORD curr = 0, max = 0;
|
||||
if (NT_SUCCESS(ffDDCCIGetVCPFeature(physicalMonitor, FF_DDC_CI_LUMINANCE_OPCODE, NULL, &curr, &max))) {
|
||||
if (NT_SUCCESS(ffDDCCIGetVCPFeature(physicalMonitor, FF_DDC_CI_LUMINANCE_OPCODE, nullptr, &curr, &max))) {
|
||||
FFBrightnessResult* brightness = FF_LIST_ADD(FFBrightnessResult, *result);
|
||||
if (display->name.length > 0) {
|
||||
ffStrbufInitCopy(&brightness->name, &display->name);
|
||||
@@ -192,7 +192,7 @@ static const char* detectWithDdcci(const FFDisplayServerResult* displayServer, F
|
||||
}
|
||||
|
||||
FF_DEBUG("DDC/CI: finished detection, total results=%u", result->length);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool hasBuiltinDisplay(const FFDisplayServerResult* displayServer) {
|
||||
@@ -219,5 +219,5 @@ const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist*
|
||||
}
|
||||
|
||||
FF_DEBUG("finished, resultCount=%u", result->length);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user