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:
@@ -43,7 +43,7 @@ static bool ffCodecIsHardwareAccelerated(
|
||||
return false;
|
||||
}
|
||||
|
||||
char* codecName = NULL;
|
||||
char* codecName = nullptr;
|
||||
media_status_t status = ffAMediaCodec_getName(codec, &codecName);
|
||||
if (status != AMEDIA_OK || !codecName) {
|
||||
return false;
|
||||
@@ -98,5 +98,5 @@ const char* ffDetectCodecNative(FFCodecOptions* options, FFlist* result /*list o
|
||||
item->platformApi = "AMediaCodec";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ static FFCodecType ffCodecCodecToType(CMVideoCodecType codec) {
|
||||
}
|
||||
|
||||
static FFCodecType ffCodecDetectEncoders(void) {
|
||||
CFArrayRef encoderList = NULL;
|
||||
if (VTCopyVideoEncoderList(NULL, &encoderList) != noErr || !encoderList) {
|
||||
CFArrayRef encoderList = nullptr;
|
||||
if (VTCopyVideoEncoderList(nullptr, &encoderList) != noErr || !encoderList) {
|
||||
return FF_CODEC_TYPE_NONE;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ static FFCodecType ffCodecDetectEncoders(void) {
|
||||
CFDictionaryRef encoder = CFArrayGetValueAtIndex(encoderList, i);
|
||||
bool isHardwareAccelerated;
|
||||
int codec;
|
||||
if (ffCfDictGetBool(encoder, CFSTR("IsHardwareAccelerated"), &isHardwareAccelerated) != NULL ||
|
||||
if (ffCfDictGetBool(encoder, CFSTR("IsHardwareAccelerated"), &isHardwareAccelerated) != nullptr ||
|
||||
!isHardwareAccelerated ||
|
||||
ffCfDictGetInt(encoder, CFSTR("CodecType"), &codec) != NULL) {
|
||||
ffCfDictGetInt(encoder, CFSTR("CodecType"), &codec) != nullptr) {
|
||||
continue;
|
||||
}
|
||||
types |= ffCodecCodecToType((CMVideoCodecType) codec);
|
||||
@@ -92,5 +92,5 @@ const char* ffDetectCodecNative(FFCodecOptions* options, FFlist* result /* list
|
||||
item->platformApi = "VideoToolbox";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -226,13 +226,13 @@ static const char* detectCodecByVaDrm(FFVAData* vaData, FFCodecOptions* options,
|
||||
const char* error = "No DRM device could initialize VA-API";
|
||||
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir("/dev/dri/");
|
||||
if (dirp == NULL) {
|
||||
if (dirp == nullptr) {
|
||||
return "opendir(/dev/dri/) failed";
|
||||
}
|
||||
int drifd = dirfd(dirp);
|
||||
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL) {
|
||||
while ((entry = readdir(dirp)) != nullptr) {
|
||||
if (entry->d_name[0] == '.' || !ffStrStartsWith(entry->d_name, "renderD")) {
|
||||
continue;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ static const char* detectCodecByVaDrm(FFVAData* vaData, FFCodecOptions* options,
|
||||
}
|
||||
|
||||
if (vaDetectDisplay(display, vaData, options, result, "VA-API (DRM)")) {
|
||||
error = NULL;
|
||||
error = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ static const char* detectCodecByVaX11(FFVAData* vaData, FFCodecOptions* options,
|
||||
FF_LIBRARY_LOAD_MESSAGE(libvaX11, "libva-x11" FF_LIBRARY_EXTENSION, 2)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libvaX11, vaGetDisplay)
|
||||
|
||||
Display* x11Display = ffXOpenDisplay(NULL);
|
||||
Display* x11Display = ffXOpenDisplay(nullptr);
|
||||
if (!x11Display) {
|
||||
return "XOpenDisplay() failed";
|
||||
}
|
||||
@@ -283,7 +283,7 @@ static const char* detectCodecByVaX11(FFVAData* vaData, FFCodecOptions* options,
|
||||
}
|
||||
ffXCloseDisplay(x11Display);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -301,14 +301,14 @@ static const char* detectCodecByVa(FFCodecOptions* options, FFlist* result) {
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libva, vaData, vaGetConfigAttributes)
|
||||
|
||||
#if FF_HAVE_VADRM
|
||||
if (detectCodecByVaDrm(&vaData, options, result) == NULL) {
|
||||
return NULL;
|
||||
if (detectCodecByVaDrm(&vaData, options, result) == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FF_HAVE_VAX11
|
||||
if (detectCodecByVaX11(&vaData, options, result) == NULL) {
|
||||
return NULL;
|
||||
if (detectCodecByVaX11(&vaData, options, result) == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -378,26 +378,26 @@ static const char* detectCodecByVdpau(FFCodecOptions* options, FFlist* result) {
|
||||
FF_LIBRARY_LOAD_MESSAGE(libvdpau, "libvdpau" FF_LIBRARY_EXTENSION, 1)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libvdpau, vdp_device_create_x11)
|
||||
|
||||
Display* x11Display = ffXOpenDisplay(NULL);
|
||||
Display* x11Display = ffXOpenDisplay(nullptr);
|
||||
if (!x11Display) {
|
||||
return "XOpenDisplay() failed";
|
||||
}
|
||||
|
||||
VdpDevice device = VDP_INVALID_HANDLE;
|
||||
VdpGetProcAddress* ffvdp_get_proc_address = NULL;
|
||||
VdpGetProcAddress* ffvdp_get_proc_address = nullptr;
|
||||
if (ffvdp_device_create_x11(x11Display, ffXDefaultScreen(x11Display), &device, &ffvdp_get_proc_address) != VDP_STATUS_OK ||
|
||||
device == VDP_INVALID_HANDLE ||
|
||||
ffvdp_get_proc_address == NULL) {
|
||||
ffvdp_get_proc_address == nullptr) {
|
||||
ffXCloseDisplay(x11Display);
|
||||
return "vdp_device_create_x11() failed";
|
||||
}
|
||||
|
||||
VdpDeviceDestroy* ffvdp_device_destroy = NULL;
|
||||
VdpDecoderQueryCapabilities* ffvdp_decoder_query_capabilities = NULL;
|
||||
VdpDeviceDestroy* ffvdp_device_destroy = nullptr;
|
||||
VdpDecoderQueryCapabilities* ffvdp_decoder_query_capabilities = nullptr;
|
||||
if (ffvdp_get_proc_address(device, VDP_FUNC_ID_DEVICE_DESTROY, (void**) &ffvdp_device_destroy) != VDP_STATUS_OK ||
|
||||
ffvdp_get_proc_address(device, VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, (void**) &ffvdp_decoder_query_capabilities) != VDP_STATUS_OK ||
|
||||
ffvdp_device_destroy == NULL ||
|
||||
ffvdp_decoder_query_capabilities == NULL) {
|
||||
ffvdp_device_destroy == nullptr ||
|
||||
ffvdp_decoder_query_capabilities == nullptr) {
|
||||
if (ffvdp_device_destroy) {
|
||||
ffvdp_device_destroy(device);
|
||||
}
|
||||
@@ -426,7 +426,7 @@ static const char* detectCodecByVdpau(FFCodecOptions* options, FFlist* result) {
|
||||
ffXCloseDisplay(x11Display);
|
||||
|
||||
if (decoderTypes == FF_CODEC_TYPE_NONE) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FFCodecResult* item = FF_LIST_ADD(FFCodecResult, *result);
|
||||
@@ -441,7 +441,7 @@ static const char* detectCodecByVdpau(FFCodecOptions* options, FFlist* result) {
|
||||
item->encoders = FF_CODEC_TYPE_NONE;
|
||||
item->platformApi = "VDPAU";
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -449,13 +449,13 @@ const char* ffDetectCodecNative(FFCodecOptions* options, FFlist* result /* list
|
||||
FF_SUPPRESS_IO();
|
||||
|
||||
#if FF_HAVE_VA
|
||||
if (detectCodecByVa(options, result) == NULL) {
|
||||
return NULL;
|
||||
if (detectCodecByVa(options, result) == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
#if FF_HAVE_VDPAU
|
||||
if (detectCodecByVdpau(options, result) == NULL) {
|
||||
return NULL;
|
||||
if (detectCodecByVdpau(options, result) == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
FF_SUPPRESS_IO();
|
||||
|
||||
uint32_t apiVersion = VK_API_VERSION_1_0;
|
||||
PFN_vkEnumerateInstanceVersion ffvkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) ffvkGetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion");
|
||||
if (ffvkEnumerateInstanceVersion != NULL) {
|
||||
PFN_vkEnumerateInstanceVersion ffvkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) ffvkGetInstanceProcAddr(nullptr, "vkEnumerateInstanceVersion");
|
||||
if (ffvkEnumerateInstanceVersion != nullptr) {
|
||||
uint32_t detectedApiVersion = 0;
|
||||
if (ffvkEnumerateInstanceVersion(&detectedApiVersion) == VK_SUCCESS) {
|
||||
apiVersion = detectedApiVersion;
|
||||
@@ -105,7 +105,7 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
.apiVersion = apiVersion,
|
||||
},
|
||||
},
|
||||
NULL,
|
||||
nullptr,
|
||||
&vkInstance);
|
||||
if (res != VK_SUCCESS) {
|
||||
FF_DEBUG("ffvkCreateInstance() failed with VkResult=%d", res);
|
||||
@@ -129,25 +129,25 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
|
||||
PFN_vkGetPhysicalDeviceProperties ffvkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) ffvkGetInstanceProcAddr(vkInstance, "vkGetPhysicalDeviceProperties");
|
||||
if (!ffvkGetPhysicalDeviceProperties) {
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
ffvkDestroyInstance(vkInstance, nullptr);
|
||||
return "vkGetPhysicalDeviceProperties is not available";
|
||||
}
|
||||
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties2 ffvkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) ffvkGetInstanceProcAddr(vkInstance, "vkGetPhysicalDeviceQueueFamilyProperties2");
|
||||
if (!ffvkGetPhysicalDeviceQueueFamilyProperties2) {
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
ffvkDestroyInstance(vkInstance, nullptr);
|
||||
return "vkGetPhysicalDeviceQueueFamilyProperties2 is not available";
|
||||
}
|
||||
|
||||
uint32_t physicalDeviceCount = 0;
|
||||
res = ffvkEnumeratePhysicalDevices(vkInstance, &physicalDeviceCount, NULL);
|
||||
res = ffvkEnumeratePhysicalDevices(vkInstance, &physicalDeviceCount, nullptr);
|
||||
if (res != VK_SUCCESS) {
|
||||
FF_DEBUG("ffvkEnumeratePhysicalDevices(count) failed with VkResult=%d", res);
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
ffvkDestroyInstance(vkInstance, nullptr);
|
||||
return "ffvkEnumeratePhysicalDevices() failed during Vulkan codec detection";
|
||||
}
|
||||
if (physicalDeviceCount == 0) {
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
ffvkDestroyInstance(vkInstance, nullptr);
|
||||
return "No Vulkan physical devices found";
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
res = ffvkEnumeratePhysicalDevices(vkInstance, &physicalDeviceCount, physicalDevices);
|
||||
if (res != VK_SUCCESS) {
|
||||
FF_DEBUG("ffvkEnumeratePhysicalDevices(list) failed with VkResult=%d", res);
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
ffvkDestroyInstance(vkInstance, nullptr);
|
||||
return "ffvkEnumeratePhysicalDevices() failed during Vulkan codec detection";
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
ffvkGetPhysicalDeviceProperties(physicalDevices[i], &properties);
|
||||
|
||||
uint32_t extensionCount = 0;
|
||||
res = ffvkEnumerateDeviceExtensionProperties(physicalDevices[i], NULL, &extensionCount, NULL);
|
||||
res = ffvkEnumerateDeviceExtensionProperties(physicalDevices[i], nullptr, &extensionCount, nullptr);
|
||||
if (res != VK_SUCCESS) {
|
||||
FF_DEBUG("vkEnumerateDeviceExtensionProperties(count) failed for '%s' with VkResult=%d", properties.deviceName, res);
|
||||
continue;
|
||||
@@ -180,7 +180,7 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
|
||||
FF_AUTO_FREE VkExtensionProperties* extensions = (VkExtensionProperties*) malloc(sizeof(VkExtensionProperties) * (size_t) extensionCount);
|
||||
|
||||
res = ffvkEnumerateDeviceExtensionProperties(physicalDevices[i], NULL, &extensionCount, extensions);
|
||||
res = ffvkEnumerateDeviceExtensionProperties(physicalDevices[i], nullptr, &extensionCount, extensions);
|
||||
if (res != VK_SUCCESS) {
|
||||
FF_DEBUG("vkEnumerateDeviceExtensionProperties(list) failed for '%s' with VkResult=%d", properties.deviceName, res);
|
||||
continue;
|
||||
@@ -198,7 +198,7 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
sawVideoQueueExtension = true;
|
||||
|
||||
uint32_t queueFamilyCount = 0;
|
||||
ffvkGetPhysicalDeviceQueueFamilyProperties2(physicalDevices[i], &queueFamilyCount, NULL);
|
||||
ffvkGetPhysicalDeviceQueueFamilyProperties2(physicalDevices[i], &queueFamilyCount, nullptr);
|
||||
if (queueFamilyCount == 0) {
|
||||
FF_DEBUG("Skipping Vulkan device '%s' because it has no queue families", properties.deviceName);
|
||||
continue;
|
||||
@@ -248,10 +248,10 @@ const char* ffDetectCodecVulkan(FFCodecOptions* options, FFlist* result /*list o
|
||||
FF_DEBUG("Added Vulkan codec result for '%s': decoders=%u encoders=%u", properties.deviceName, (unsigned) decoders, (unsigned) encoders);
|
||||
}
|
||||
|
||||
ffvkDestroyInstance(vkInstance, NULL);
|
||||
ffvkDestroyInstance(vkInstance, nullptr);
|
||||
|
||||
if (result->length > 0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return sawVideoQueueExtension ? "No supported Vulkan video codec operations found"
|
||||
|
||||
Reference in New Issue
Block a user