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
+1 -1
View File
@@ -108,5 +108,5 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FF
}
}
return NULL;
return nullptr;
}
+2 -2
View File
@@ -12,7 +12,7 @@ static int enumDev(FF_A_UNUSED int sockfd, struct bt_devinfo const* dev, FFlist*
dev->devname
#endif
);
ffStrbufInitS(&device->address, bt_ntoa(&dev->bdaddr, NULL));
ffStrbufInitS(&device->address, bt_ntoa(&dev->bdaddr, nullptr));
ffStrbufUpperCase(&device->address);
ffStrbufInit(&device->type);
device->battery = 0;
@@ -26,5 +26,5 @@ const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FF_A_UNUS
return "bt_devenum() failed";
}
return NULL;
return nullptr;
}
+2 -2
View File
@@ -11,7 +11,7 @@ const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FFlist* d
LocalDevice* dev = LocalDevice::GetLocalDevice();
if (!dev) {
return NULL;
return nullptr;
}
BString devClass;
@@ -26,5 +26,5 @@ const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FFlist* d
// TODO: more devices?
return NULL;
return nullptr;
}
+10 -10
View File
@@ -124,14 +124,14 @@ static void detectBluetoothProperty(FFDBusData* dbus, DBusMessageIter* iter, FFB
static FFBluetoothResult* detectBluetoothObject(FFlist* devices, FFDBusData* dbus, DBusMessageIter* iter) {
if (dbus->lib->ffdbus_message_iter_get_arg_type(iter) != DBUS_TYPE_DICT_ENTRY) {
return NULL;
return nullptr;
}
DBusMessageIter dictIter;
dbus->lib->ffdbus_message_iter_recurse(iter, &dictIter);
if (dbus->lib->ffdbus_message_iter_get_arg_type(&dictIter) != DBUS_TYPE_OBJECT_PATH) {
return NULL;
return nullptr;
}
const char* objectPath;
@@ -139,13 +139,13 @@ static FFBluetoothResult* detectBluetoothObject(FFlist* devices, FFDBusData* dbu
// We don't want adapter objects
if (!ffStrContains(objectPath, "/dev_")) {
return NULL;
return nullptr;
}
dbus->lib->ffdbus_message_iter_next(&dictIter);
if (dbus->lib->ffdbus_message_iter_get_arg_type(&dictIter) != DBUS_TYPE_ARRAY) {
return NULL;
return nullptr;
}
DBusMessageIter arrayIter;
@@ -202,7 +202,7 @@ static const char* detectBluetooth(FFBluetoothOptions* options, FFlist* devices,
return error;
}
DBusMessage* managedObjects = ffDBusGetMethodReply(&dbus, "org.bluez", "/", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects", NULL, NULL);
DBusMessage* managedObjects = ffDBusGetMethodReply(&dbus, "org.bluez", "/", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects", nullptr, nullptr);
if (!managedObjects) {
return "Failed to call GetManagedObjects";
}
@@ -216,19 +216,19 @@ static const char* detectBluetooth(FFBluetoothOptions* options, FFlist* devices,
detectBluetoothRoot(options, devices, &dbus, &rootIter, connectedCount);
dbus.lib->ffdbus_message_unref(managedObjects);
return NULL;
return nullptr;
}
static uint32_t connectedDevices(void) {
FF_AUTO_CLOSE_DIR DIR* dirp = opendir("/sys/class/bluetooth");
if (dirp == NULL) {
if (dirp == nullptr) {
return 0;
}
uint32_t result = 0;
struct dirent* entry;
while ((entry = readdir(dirp)) != NULL) {
if (strchr(entry->d_name, ':') != NULL) {
while ((entry = readdir(dirp)) != nullptr) {
if (strchr(entry->d_name, ':') != nullptr) {
++result;
}
}
@@ -244,7 +244,7 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FF
if (!options->showDisconnected) {
connectedCount = (int32_t) connectedDevices();
if (connectedCount == 0) {
return NULL;
return nullptr;
}
}
+4 -4
View File
@@ -35,7 +35,7 @@ static const char* ffBluetoothDetectBattery(FFlist* devices) {
}
if (idListLength == 0) {
return NULL;
return nullptr;
}
wchar_t* FF_AUTO_FREE idList = (wchar_t*) malloc((size_t) idListLength * sizeof(wchar_t));
@@ -94,7 +94,7 @@ static const char* ffBluetoothDetectBattery(FFlist* devices) {
}
}
return NULL;
return nullptr;
}
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */) {
@@ -114,7 +114,7 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FF
&btdi);
if (!hFind) {
if (GetLastError() == ERROR_NO_MORE_ITEMS) {
return NULL;
return nullptr;
}
return "BluetoothFindFirstDevice() failed";
}
@@ -219,5 +219,5 @@ const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FF
ffBluetoothDetectBattery(devices);
}
return NULL;
return nullptr;
}