mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 01:56:28 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -32,5 +32,5 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
}
|
||||
IOHIDManagerClose(manager, kIOHIDOptionsTypeNone);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ static const char* detectByIoctl(FFlist* devices) {
|
||||
ffStrbufAppendF(&device->name, " (kbd%d)", kbdInfo.kb_index);
|
||||
|
||||
ffStrbufInit(&device->serial);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#define MAX_UHID_KBDS 64
|
||||
@@ -80,13 +80,13 @@ static const char* detectByUsbhid(FFlist* devices) {
|
||||
hid_dispose_report_desc(repDesc);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
detectByUsbhid(devices);
|
||||
if (devices->length > 0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return detectByIoctl(devices);
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
ffStrbufInitS(&item->name, device->Name());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
// This detects both wired and Bluetooth keyboards uniformly.
|
||||
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
|
||||
if (!ffAppendFileBuffer("/proc/bus/input/devices", &content)) {
|
||||
return "ffAppendFileBuffer(\"/proc/bus/input/devices\") == NULL";
|
||||
return "ffAppendFileBuffer(\"/proc/bus/input/devices\") == nullptr";
|
||||
}
|
||||
|
||||
FFstrbuf kbd = ffStrbufCreateStatic("kbd");
|
||||
@@ -19,7 +19,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
.serial = ffStrbufCreate()
|
||||
};
|
||||
|
||||
char* line = NULL;
|
||||
char* line = nullptr;
|
||||
size_t len = 0;
|
||||
while (ffStrbufGetline(&line, &len, &content)) {
|
||||
switch (line[0]) {
|
||||
@@ -51,7 +51,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
if (ffStrStartsWith(bits, "EV=")) {
|
||||
// Check EV_REP (auto-repeat, bit 20) to filter pseudo-keyboards (Power Button, PC Speaker).
|
||||
const char* evBits = bits + strlen("EV=");
|
||||
uint64_t val = strtoull(evBits, NULL, 16);
|
||||
uint64_t val = strtoull(evBits, nullptr, 16);
|
||||
if (!(val & (1ULL << EV_REP))) {
|
||||
goto skipDevice;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
const char* lastWord = memrchr(keyBits, ' ', len - (size_t) (keyBits - line));
|
||||
lastWord = lastWord ? lastWord + 1 : keyBits;
|
||||
|
||||
uint64_t val = strtoull(lastWord, NULL, 16);
|
||||
uint64_t val = strtoull(lastWord, nullptr, 16);
|
||||
if (!(val & (1ULL << KEY_A))) {
|
||||
goto skipDevice;
|
||||
}
|
||||
@@ -100,5 +100,5 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
ffStrbufDestroy(&device.serial);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
UINT nDevices = 0;
|
||||
if (GetRawInputDeviceList(NULL, &nDevices, sizeof(RAWINPUTDEVICELIST))) {
|
||||
return "GetRawInputDeviceList(NULL) failed";
|
||||
if (GetRawInputDeviceList(nullptr, &nDevices, sizeof(RAWINPUTDEVICELIST))) {
|
||||
return "GetRawInputDeviceList(nullptr) failed";
|
||||
}
|
||||
if (nDevices == 0) {
|
||||
return "No HID devices found";
|
||||
@@ -49,7 +49,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
|
||||
wchar_t buffer[MAX_PATH];
|
||||
|
||||
HANDLE FF_AUTO_CLOSE_FD hHidFile = CreateFileW(devName, 0 /* must be 0 instead of GENERIC_READ */, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
HANDLE FF_AUTO_CLOSE_FD hHidFile = CreateFileW(devName, 0 /* must be 0 instead of GENERIC_READ */, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (hHidFile != INVALID_HANDLE_VALUE) {
|
||||
if (HidD_GetProductString(hHidFile, buffer, (ULONG) sizeof(buffer))) {
|
||||
ffStrbufSetWS(&device->name, buffer);
|
||||
@@ -81,5 +81,5 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user