mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Global: replaces NULL to nullptr
This commit is contained in:
@@ -22,19 +22,19 @@ static inline void wrapIoDestroyPlugInInterface(IOCFPlugInInterface*** pluginInf
|
||||
|
||||
static const char* detectSsdTemp(io_service_t entryPhysical, double* temp) {
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
FF_A_CLEANUP(wrapIoDestroyPlugInInterface) IOCFPlugInInterface** pluginInf = NULL;
|
||||
FF_A_CLEANUP(wrapIoDestroyPlugInInterface) IOCFPlugInInterface** pluginInf = nullptr;
|
||||
int32_t score;
|
||||
if (IOCreatePlugInInterfaceForService(entryPhysical, kIONVMeSMARTUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInf, &score) != kIOReturnSuccess) {
|
||||
return "IOCreatePlugInInterfaceForService() failed";
|
||||
}
|
||||
|
||||
IONVMeSMARTInterface** smartInf = NULL;
|
||||
IONVMeSMARTInterface** smartInf = nullptr;
|
||||
if ((*pluginInf)->QueryInterface(pluginInf, CFUUIDGetUUIDBytes(kIONVMeSMARTInterfaceID), (LPVOID) &smartInf) != kIOReturnSuccess) {
|
||||
return "QueryInterface() failed";
|
||||
}
|
||||
|
||||
NVMeSMARTData smartData;
|
||||
const char* error = NULL;
|
||||
const char* error = nullptr;
|
||||
if ((*smartInf)->SMARTReadData(smartInf, &smartData) == kIOReturnSuccess) {
|
||||
*temp = smartData.TEMPERATURE - 273;
|
||||
} else {
|
||||
@@ -76,14 +76,14 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
}
|
||||
|
||||
if (deviceName.length == 0) {
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef deviceCharacteristics = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyDeviceCharacteristicsKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef deviceCharacteristics = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyDeviceCharacteristicsKey), nullptr, kNilOptions);
|
||||
if (deviceCharacteristics) {
|
||||
if (ffCfDictGetString(deviceCharacteristics, CFSTR(kIOPropertyVendorNameKey), &deviceName) == NULL && deviceName.length > 0) {
|
||||
if (ffCfDictGetString(deviceCharacteristics, CFSTR(kIOPropertyVendorNameKey), &deviceName) == nullptr && deviceName.length > 0) {
|
||||
ffStrbufAppendC(&deviceName, ' ');
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
if (ffCfDictGetString(deviceCharacteristics, CFSTR(kIOPropertyProductNameKey), &name) == NULL) {
|
||||
if (ffCfDictGetString(deviceCharacteristics, CFSTR(kIOPropertyProductNameKey), &name) == nullptr) {
|
||||
ffStrbufAppend(&deviceName, &name);
|
||||
}
|
||||
}
|
||||
@@ -96,9 +96,9 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
FFPhysicalDiskType type = FF_PHYSICALDISK_TYPE_NONE;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY interconnect = ffStrbufCreate();
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef protocolCharacteristics = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyProtocolCharacteristicsKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef protocolCharacteristics = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyProtocolCharacteristicsKey), nullptr, kNilOptions);
|
||||
if (protocolCharacteristics) {
|
||||
if (ffCfDictGetString(protocolCharacteristics, CFSTR(kIOPropertyPhysicalInterconnectTypeKey), &interconnect) == NULL) {
|
||||
if (ffCfDictGetString(protocolCharacteristics, CFSTR(kIOPropertyPhysicalInterconnectTypeKey), &interconnect) == nullptr) {
|
||||
if (ffStrbufEqualS(&interconnect, kIOPropertyPhysicalInterconnectTypeVirtual)) {
|
||||
if (options->hideType & FF_PHYSICALDISK_TYPE_VIRTUAL) {
|
||||
continue;
|
||||
@@ -106,7 +106,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
type |= FF_PHYSICALDISK_TYPE_VIRTUAL;
|
||||
FF_STRBUF_AUTO_DESTROY location = ffStrbufCreate();
|
||||
if (ffCfDictGetString(protocolCharacteristics, CFSTR(kIOPropertyPhysicalInterconnectLocationKey), &location) == NULL) {
|
||||
if (ffCfDictGetString(protocolCharacteristics, CFSTR(kIOPropertyPhysicalInterconnectLocationKey), &location) == nullptr) {
|
||||
ffStrbufAppendS(&interconnect, " - ");
|
||||
ffStrbufAppend(&interconnect, &location);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
uint64_t size = 0;
|
||||
if (entryMedia != IO_OBJECT_NULL) {
|
||||
FF_CFTYPE_AUTO_RELEASE CFNumberRef mediaSize = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOMediaSizeKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFNumberRef mediaSize = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOMediaSizeKey), nullptr, kNilOptions);
|
||||
if (mediaSize) {
|
||||
ffCfNumGetInt64(mediaSize, (int64_t*) &size);
|
||||
}
|
||||
@@ -141,24 +141,24 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
device->temperature = FF_PHYSICALDISK_TEMP_UNSET;
|
||||
|
||||
if (entryMedia != IO_OBJECT_NULL) {
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef removable = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOMediaRemovableKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef removable = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOMediaRemovableKey), nullptr, kNilOptions);
|
||||
if (removable) {
|
||||
device->type |= CFBooleanGetValue(removable) ? FF_PHYSICALDISK_TYPE_REMOVABLE : FF_PHYSICALDISK_TYPE_FIXED;
|
||||
}
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef writable = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOMediaWritableKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef writable = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOMediaWritableKey), nullptr, kNilOptions);
|
||||
if (writable) {
|
||||
device->type |= CFBooleanGetValue(writable) ? FF_PHYSICALDISK_TYPE_READWRITE : FF_PHYSICALDISK_TYPE_READONLY;
|
||||
}
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFStringRef bsdName = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOBSDNameKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFStringRef bsdName = IORegistryEntryCreateCFProperty(entryMedia, CFSTR(kIOBSDNameKey), nullptr, kNilOptions);
|
||||
if (bsdName) {
|
||||
ffCfStrGetString(bsdName, &device->devPath);
|
||||
ffStrbufPrependS(&device->devPath, "/dev/");
|
||||
}
|
||||
}
|
||||
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef deviceCharacteristics = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyDeviceCharacteristicsKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef deviceCharacteristics = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyDeviceCharacteristicsKey), nullptr, kNilOptions);
|
||||
if (deviceCharacteristics) {
|
||||
ffCfDictGetString(deviceCharacteristics, CFSTR(kIOPropertyProductSerialNumberKey), &device->serial);
|
||||
ffStrbufTrimSpace(&device->serial);
|
||||
@@ -179,7 +179,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
if (!(device->type & FF_PHYSICALDISK_TYPE_VIRTUAL) && options->temp) {
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef nvmeSMARTCapable = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyNVMeSMARTCapableKey), NULL, kNilOptions);
|
||||
FF_CFTYPE_AUTO_RELEASE CFBooleanRef nvmeSMARTCapable = IORegistryEntryCreateCFProperty(entryPhysical, CFSTR(kIOPropertyNVMeSMARTCapableKey), nullptr, kNilOptions);
|
||||
if (nvmeSMARTCapable && CFBooleanGetValue(nvmeSMARTCapable)) {
|
||||
detectSsdTemp(entryPhysical, &device->temperature);
|
||||
}
|
||||
@@ -187,5 +187,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
void* snap = geom_stats_snapshot_get();
|
||||
struct devstat* snapIter;
|
||||
while ((snapIter = geom_stats_snapshot_next(snap)) != NULL) {
|
||||
while ((snapIter = geom_stats_snapshot_next(snap)) != nullptr) {
|
||||
if (snapIter->device_type & DEVSTAT_TYPE_PASS) {
|
||||
continue;
|
||||
}
|
||||
struct gident* geomId = geom_lookupid(&geomTree, snapIter->id);
|
||||
if (geomId == NULL) {
|
||||
if (geomId == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (geomId->lg_what != ISPROVIDER) {
|
||||
@@ -118,7 +118,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
geom_stats_snapshot_free(snap);
|
||||
geom_stats_close();
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) {
|
||||
|
||||
@@ -77,7 +77,7 @@ static const char* searchRawDeviceFile(FFstrbuf* path, const char* diskType, FFl
|
||||
|
||||
ffStrbufSubstrBefore(path, baseLen);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) {
|
||||
@@ -100,5 +100,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ static double detectNvmeTemp(int devfd) {
|
||||
ssize_t size = ffReadFileDataRelative(devfd, pathHwmon, ARRAY_SIZE(buffer), buffer);
|
||||
if (size > 0) {
|
||||
buffer[size] = '\0';
|
||||
double temp = strtod(buffer, NULL);
|
||||
double temp = strtod(buffer, nullptr);
|
||||
return temp > 0 && temp < 10000000 /*VMware*/ ? temp / 1000 : FF_PHYSICALDISK_TEMP_UNSET;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
|
||||
ssize_t fileSize = ffReadFileDataRelative(dfd, "size", ARRAY_SIZE(blkSize) - 1, blkSize);
|
||||
if (fileSize > 0) {
|
||||
blkSize[fileSize] = 0;
|
||||
size = (uint64_t) strtoul(blkSize, NULL, 10) * 512;
|
||||
size = (uint64_t) strtoul(blkSize, nullptr, 10) * 512;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,15 +118,15 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
|
||||
snprintf(pathSysDeviceLink, ARRAY_SIZE(pathSysDeviceLink), "/sys/block/%s/device", devName);
|
||||
char pathSysDeviceReal[PATH_MAX];
|
||||
if (realpath(pathSysDeviceLink, pathSysDeviceReal)) {
|
||||
if (strstr(pathSysDeviceReal, "/usb") != NULL) {
|
||||
if (strstr(pathSysDeviceReal, "/usb") != nullptr) {
|
||||
ffStrbufSetStatic(&device->interconnect, "USB");
|
||||
} else if (strstr(pathSysDeviceReal, "/ata") != NULL) {
|
||||
} else if (strstr(pathSysDeviceReal, "/ata") != nullptr) {
|
||||
ffStrbufSetStatic(&device->interconnect, "ATA");
|
||||
} else if (strstr(pathSysDeviceReal, "/scsi") != NULL) {
|
||||
} else if (strstr(pathSysDeviceReal, "/scsi") != nullptr) {
|
||||
ffStrbufSetStatic(&device->interconnect, "SCSI");
|
||||
} else if (strstr(pathSysDeviceReal, "/nvme") != NULL) {
|
||||
} else if (strstr(pathSysDeviceReal, "/nvme") != nullptr) {
|
||||
ffStrbufSetStatic(&device->interconnect, "NVMe");
|
||||
} else if (strstr(pathSysDeviceReal, "/virtio") != NULL) {
|
||||
} else if (strstr(pathSysDeviceReal, "/virtio") != nullptr) {
|
||||
ffStrbufSetStatic(&device->interconnect, "VirtIO");
|
||||
isVirtio = true; // VirtIO devices are virtual, but we still want to report it
|
||||
} else {
|
||||
@@ -177,12 +177,12 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
|
||||
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) {
|
||||
FF_AUTO_CLOSE_DIR DIR* sysBlockDirp = opendir("/sys/block/");
|
||||
if (sysBlockDirp == NULL) {
|
||||
return "opendir(\"/sys/block/\") == NULL";
|
||||
if (sysBlockDirp == nullptr) {
|
||||
return "opendir(\"/sys/block/\") == nullptr";
|
||||
}
|
||||
|
||||
struct dirent* sysBlockEntry;
|
||||
while ((sysBlockEntry = readdir(sysBlockDirp)) != NULL) {
|
||||
while ((sysBlockEntry = readdir(sysBlockDirp)) != nullptr) {
|
||||
const char* const devName = sysBlockEntry->d_name;
|
||||
|
||||
if (devName[0] == '.') {
|
||||
@@ -198,5 +198,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
FF_DEBUG("Disk names: %s", diskNames.chars);
|
||||
|
||||
char* diskName = NULL;
|
||||
char* diskName = nullptr;
|
||||
size_t len = 0;
|
||||
while (ffStrbufGetdelim(&diskName, &len, ' ', &diskNames)) {
|
||||
FF_DEBUG("Probing disk: %s", diskName);
|
||||
@@ -158,9 +158,9 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
unsigned long sectorsPerUnit, sectorSize;
|
||||
|
||||
const char* devType = NULL;
|
||||
const char* devType = nullptr;
|
||||
|
||||
prop_dictionary_t dict = NULL;
|
||||
prop_dictionary_t dict = nullptr;
|
||||
if (prop_dictionary_recv_ioctl(f, DIOCGDISKINFO, &dict) == 0) {
|
||||
FF_DEBUG("DIOCGDISKINFO succeeded for %s", diskName);
|
||||
prop_dictionary_get_string(dict, "type", &devType);
|
||||
@@ -228,7 +228,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
if (dict) {
|
||||
prop_object_release(dict);
|
||||
dict = NULL;
|
||||
dict = nullptr;
|
||||
}
|
||||
|
||||
struct scsipi_inquiry_data inquiry = {};
|
||||
@@ -320,5 +320,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
FF_DEBUG("Detected disk '%s' (%s), type=%u", device->name.chars, diskName, (unsigned) device->type);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
|
||||
FF_DEBUG("Disk names: %s", diskNames.chars);
|
||||
|
||||
char* diskName = NULL;
|
||||
char* diskName = nullptr;
|
||||
size_t len = 0;
|
||||
while (ffStrbufGetdelim(&diskName, &len, ',', &diskNames)) {
|
||||
char* colon = strchr(diskName, ':');
|
||||
@@ -138,7 +138,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
continue;
|
||||
}
|
||||
|
||||
char* devPath = NULL;
|
||||
char* devPath = nullptr;
|
||||
FF_AUTO_CLOSE_FD int f = opendev(diskName, O_RDONLY, OPENDEV_PART, &devPath);
|
||||
if (f < 0) {
|
||||
if (errno == EACCES) {
|
||||
@@ -275,5 +275,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
FF_DEBUG("Detected disk '%s' (%s), type=%u", device->name.chars, diskName, (unsigned) device->type);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -103,5 +103,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
di_walk_minor(rootNode, DDI_NT_BLOCK, DI_WALK_CLDFIRST, &(struct FFWalkTreeBundle) { options, result }, (void*) walkDevTree);
|
||||
di_fini(rootNode);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <cfgmgr32.h>
|
||||
|
||||
static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* szDevice, FFlist* result, FFPhysicalDiskOptions* options) {
|
||||
FF_AUTO_CLOSE_FD HANDLE hDevice = CreateFileW(szDevice, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
FF_AUTO_CLOSE_FD HANDLE hDevice = CreateFileW(szDevice, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (hDevice == INVALID_HANDLE_VALUE) {
|
||||
return "CreateFileW() failed";
|
||||
}
|
||||
@@ -19,30 +19,30 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
FFPhysicalDiskType type = FF_PHYSICALDISK_TYPE_NONE;
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
|
||||
const char* interconnect = NULL;
|
||||
const char* interconnect = nullptr;
|
||||
uint64_t size = 0;
|
||||
{
|
||||
alignas(DISK_GEOMETRY_EX) uint8_t dgeBuffer[4096];
|
||||
if (DeviceIoControl(
|
||||
hDevice,
|
||||
IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
dgeBuffer,
|
||||
sizeof(dgeBuffer),
|
||||
&retSize,
|
||||
NULL)) {
|
||||
nullptr)) {
|
||||
const DISK_GEOMETRY_EX* dge = (const DISK_GEOMETRY_EX*) dgeBuffer;
|
||||
size = (uint64_t) dge->DiskSize.QuadPart;
|
||||
} else if (DeviceIoControl(
|
||||
hDevice,
|
||||
IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
dgeBuffer,
|
||||
sizeof(dgeBuffer),
|
||||
&retSize,
|
||||
NULL) &&
|
||||
nullptr) &&
|
||||
retSize >= sizeof(DISK_GEOMETRY)) {
|
||||
const DISK_GEOMETRY* dg = (const DISK_GEOMETRY*) dgeBuffer;
|
||||
size = (uint64_t) dg->BytesPerSector * dg->SectorsPerTrack * dg->TracksPerCylinder * (uint64_t) dg->Cylinders.QuadPart;
|
||||
@@ -91,7 +91,7 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
type |= FF_PHYSICALDISK_TYPE_UNUSED;
|
||||
}
|
||||
|
||||
const STORAGE_DEVICE_DESCRIPTOR* sdd = NULL;
|
||||
const STORAGE_DEVICE_DESCRIPTOR* sdd = nullptr;
|
||||
alignas(STORAGE_DEVICE_DESCRIPTOR) uint8_t sddBuffer[4096];
|
||||
if (!interconnect) {
|
||||
if (DeviceIoControl(
|
||||
@@ -105,7 +105,7 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
&sddBuffer,
|
||||
sizeof(sddBuffer),
|
||||
&retSize,
|
||||
NULL) ||
|
||||
nullptr) ||
|
||||
retSize == 0) {
|
||||
sdd = (const STORAGE_DEVICE_DESCRIPTOR*) sddBuffer;
|
||||
|
||||
@@ -236,12 +236,12 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
if (DeviceIoControl(
|
||||
hDevice,
|
||||
IOCTL_STORAGE_GET_MEDIA_TYPES_EX,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
gmt,
|
||||
sizeof(buffer),
|
||||
&retSize,
|
||||
NULL) &&
|
||||
nullptr) &&
|
||||
gmt->MediaInfoCount > 0) {
|
||||
// DiskInfo and RemovableDiskInfo have the same structures. TapeInfo doesn't.
|
||||
if (gmt->DeviceType != FILE_DEVICE_TAPE) {
|
||||
@@ -275,7 +275,7 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
&dspd,
|
||||
sizeof(dspd),
|
||||
&retSize,
|
||||
NULL) &&
|
||||
nullptr) &&
|
||||
retSize == sizeof(dspd)) {
|
||||
device->type |= dspd.IncursSeekPenalty ? FF_PHYSICALDISK_TYPE_HDD : FF_PHYSICALDISK_TYPE_SSD;
|
||||
}
|
||||
@@ -293,14 +293,14 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s
|
||||
&stdd,
|
||||
sizeof(stdd),
|
||||
&retSize,
|
||||
NULL) &&
|
||||
nullptr) &&
|
||||
retSize == sizeof(stdd)) {
|
||||
device->temperature = stdd.TemperatureInfo[0].Temperature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void detectPhysicalDisksByInterfaceClass(const char* type, const GUID* interfaceClassGuid, FFlist* result, FFPhysicalDiskOptions* options) {
|
||||
@@ -308,7 +308,7 @@ static void detectPhysicalDisksByInterfaceClass(const char* type, const GUID* in
|
||||
if (CM_Get_Device_Interface_List_SizeW(
|
||||
&cchDeviceInterfaces,
|
||||
(LPGUID) interfaceClassGuid,
|
||||
NULL,
|
||||
nullptr,
|
||||
CM_GET_DEVICE_INTERFACE_LIST_PRESENT) != CR_SUCCESS ||
|
||||
cchDeviceInterfaces <= 1) {
|
||||
return;
|
||||
@@ -321,7 +321,7 @@ static void detectPhysicalDisksByInterfaceClass(const char* type, const GUID* in
|
||||
|
||||
if (CM_Get_Device_Interface_ListW(
|
||||
(LPGUID) interfaceClassGuid,
|
||||
NULL,
|
||||
nullptr,
|
||||
mszDeviceInterfaces,
|
||||
cchDeviceInterfaces,
|
||||
CM_GET_DEVICE_INTERFACE_LIST_PRESENT) != CR_SUCCESS) {
|
||||
@@ -332,7 +332,7 @@ static void detectPhysicalDisksByInterfaceClass(const char* type, const GUID* in
|
||||
for (const wchar_t* p = mszDeviceInterfaces; *p; p += wcslen(p) + 1) {
|
||||
FF_DEBUG("Probing %s: %ls", type, p);
|
||||
FF_A_UNUSED const char* error = detectPhysicalDisk(type, p, result, options);
|
||||
if (error == NULL) {
|
||||
if (error == nullptr) {
|
||||
FF_DEBUG("Detected device \"%s\"", FF_LIST_LAST(FFPhysicalDiskResult, *result)->name.chars);
|
||||
} else {
|
||||
FF_DEBUG("Failed to detect device %s: %s", type, error);
|
||||
@@ -345,5 +345,5 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
detectPhysicalDisksByInterfaceClass("Disk", &GUID_DEVINTERFACE_DISK, result, options);
|
||||
detectPhysicalDisksByInterfaceClass("CD-ROM", &GUID_DEVINTERFACE_CDROM, result, options);
|
||||
detectPhysicalDisksByInterfaceClass("Tape", &GUID_DEVINTERFACE_TAPE, result, options);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user