mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 21:24:43 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -44,5 +44,5 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
}
|
||||
IOHIDManagerClose(manager, kIOHIDOptionsTypeNone);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -61,5 +61,5 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
hid_dispose_report_desc(repDesc);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
device->battery = 0;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ static void detectGamepad(FFlist* devices, FFstrbuf* name, FFstrbuf* path) {
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(path->chars);
|
||||
if (dirp) {
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL) {
|
||||
while ((entry = readdir(dirp)) != nullptr) {
|
||||
if (entry->d_name[0] == '.' || (entry->d_type != DT_DIR && entry->d_type != DT_UNKNOWN)) {
|
||||
continue;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ static void detectGamepad(FFlist* devices, FFstrbuf* name, FFstrbuf* path) {
|
||||
if (nRead > 0) // Tested with a PS4 controller
|
||||
{
|
||||
capacity[nRead] = '\0';
|
||||
device->battery = (uint8_t) strtoul(capacity, NULL, 10);
|
||||
device->battery = (uint8_t) strtoul(capacity, nullptr, 10);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -64,15 +64,15 @@ static void detectGamepad(FFlist* devices, FFstrbuf* name, FFstrbuf* path) {
|
||||
|
||||
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir("/sys/class/input/");
|
||||
if (dirp == NULL) {
|
||||
return "opendir(\"/sys/class/input/\") == NULL";
|
||||
if (dirp == nullptr) {
|
||||
return "opendir(\"/sys/class/input/\") == nullptr";
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/class/input/");
|
||||
uint32_t baseLen = path.length;
|
||||
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL) {
|
||||
while ((entry = readdir(dirp)) != nullptr) {
|
||||
if (!ffStrStartsWith(entry->d_name, "js")) {
|
||||
continue;
|
||||
}
|
||||
@@ -93,5 +93,5 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ static const char* detectKnownDeviceName(uint32_t vendorId, uint32_t productId)
|
||||
return "Nintendo Switch SNES Controller";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ static const char* detectKnownDeviceName(uint32_t vendorId, uint32_t productId)
|
||||
return "Sony DualSense Edge";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,20 +67,20 @@ static const char* detectKnownDeviceName(uint32_t vendorId, uint32_t productId)
|
||||
return "Logitech F710";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
case 0x045E: // Microsoft Xbox compatible controllers should be handled by Windows without problems
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
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";
|
||||
@@ -122,7 +122,7 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
if (knownGamepad) {
|
||||
ffStrbufSetS(&device->name, knownGamepad);
|
||||
}
|
||||
HANDLE FF_AUTO_CLOSE_FD hHidFile = CreateFileW(devName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
|
||||
HANDLE FF_AUTO_CLOSE_FD hHidFile = CreateFileW(devName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr);
|
||||
if (hHidFile == INVALID_HANDLE_VALUE) {
|
||||
if (!knownGamepad) {
|
||||
ffStrbufSetF(&device->name, "Unknown gamepad %04X-%04X", (unsigned) rdi.hid.dwVendorId, (unsigned) rdi.hid.dwProductId);
|
||||
@@ -150,7 +150,7 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
ffStrbufSetWS(&device->serial, serialNumber);
|
||||
}
|
||||
|
||||
PHIDP_PREPARSED_DATA preparsedData = NULL;
|
||||
PHIDP_PREPARSED_DATA preparsedData = nullptr;
|
||||
if (HidD_GetPreparsedData(hHidFile, &preparsedData)) {
|
||||
HIDP_CAPS caps;
|
||||
NTSTATUS capsResult = HidP_GetCaps(preparsedData, &caps);
|
||||
@@ -197,5 +197,5 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user