Merge pull request #624 from mame98/cleanup

Minor cleanups reported by clang-tidy
This commit is contained in:
Carter Li
2023-11-18 21:05:21 +08:00
committed by GitHub
13 changed files with 20 additions and 21 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ bool ffPathExists(const char* path, FFPathType type)
if(stat(path, &fileStat) != 0)
return false;
int mode = fileStat.st_mode & S_IFMT;
unsigned int mode = fileStat.st_mode & S_IFMT;
if(type & FF_PATHTYPE_REGULAR && mode == S_IFREG)
return true;
+1 -1
View File
@@ -13,7 +13,7 @@
enum { FF_PIPE_BUFSIZ = 4096 };
static inline void waitpid_wrapper(pid_t* pid)
static inline void waitpid_wrapper(const pid_t* pid)
{
// remove zombie processes
if (*pid > 0)
+1 -1
View File
@@ -9,4 +9,4 @@ typedef struct FFBoardResult
FFstrbuf version;
} FFBoardResult;
const char* ffDetectBoard(FFBoardResult* result);
const char* ffDetectBoard(FFBoardResult* board);
+1 -1
View File
@@ -155,7 +155,7 @@ const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FFDEOpti
{
if (ffStrbufEqualS(deName, FF_DE_PRETTY_PLASMA))
getKDE(result, options);
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME) || ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME))
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME))
getGnome(result, options);
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_CINNAMON))
getCinnamon(result, options);
+1 -1
View File
@@ -23,4 +23,4 @@ typedef struct FFDisk
* Returns a List of FFDisk, sorted alphabetically by mountpoint.
* If error is not set, disks contains at least one disk.
*/
const char* ffDetectDisks(FFDiskOptions* options, FFlist* result /* list of FFDisk */);
const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks /* list of FFDisk */);
+1 -1
View File
@@ -60,7 +60,7 @@ static void* xcbGetProperty(XcbPropertyData* data, xcb_connection_t* connection,
}
//Why are xcb property strings not null terminated???
void* replyValue = malloc((size_t) (length + 1));
void* replyValue = malloc((size_t)length + 1);
memcpy(replyValue, data->ffxcb_get_property_value(propertyReply), (size_t) length);
((char*) replyValue)[length] = '\0';
+2 -2
View File
@@ -192,7 +192,7 @@ FF_MAYBE_UNUSED static void pciDetectType(FFGPUResult* gpu)
//and their memory sizes are usually smaller than 1GB.
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
{
gpu->type = gpu->dedicated.total > 1024 * 1024 * 1024 // 1GB
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 // 1GB
? FF_GPU_TYPE_DISCRETE
: FF_GPU_TYPE_INTEGRATED;
}
@@ -252,7 +252,7 @@ static void pciHandleDevice(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
}, "libnvidia-ml.so");
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
gpu->type = gpu->dedicated.total > 1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
}
#ifdef __linux__
+1 -1
View File
@@ -11,4 +11,4 @@ typedef struct FFHostResult
FFstrbuf sysVendor;
} FFHostResult;
const char* ffDetectHost(FFHostResult* result);
const char* ffDetectHost(FFHostResult* host);
+1 -1
View File
@@ -8,4 +8,4 @@ typedef struct FFMemoryResult
uint64_t bytesTotal;
} FFMemoryResult;
const char* ffDetectMemory(FFMemoryResult* result);
const char* ffDetectMemory(FFMemoryResult* ram);
+1 -1
View File
@@ -8,4 +8,4 @@ typedef struct FFSwapResult
uint64_t bytesTotal;
} FFSwapResult;
const char* ffDetectSwap(FFSwapResult* result);
const char* ffDetectSwap(FFSwapResult* swap);
@@ -59,8 +59,6 @@ FF_MAYBE_UNUSED static void detectTTY(FFTerminalFontResult* terminalFont)
#if defined(_WIN32) || defined(__linux__)
#include "common/library.h"
#include "common/processing.h"
#include <stdlib.h>
static const char* detectWTProfile(yyjson_val* profile, FFstrbuf* name, double* size)
+9 -7
View File
@@ -56,14 +56,16 @@ static const char* detectWifiWithLibnm(FFlist* result)
{
NMDevice *device = g_ptr_array_index(devices, i);
if (!({
GTypeInstance *__inst = (GTypeInstance*) device; GType __t = ffnm_device_wifi_get_type(); gboolean __r;
if (!__inst)
__r = FALSE;
else if (__inst->g_class && __inst->g_class->g_type == __t)
__r = TRUE;
GTypeInstance *inst = (GTypeInstance*) device;
GType type = ffnm_device_wifi_get_type();
gboolean return_value;
if (!inst)
return_value = FALSE;
else if (inst->g_class && inst->g_class->g_type == type)
return_value = TRUE;
else
__r = ffg_type_check_instance_is_a (__inst, __t);
__r;
return_value = ffg_type_check_instance_is_a (inst, type);
return_value;
}) //NM_IS_DEVICE_WIFI(device)
)
continue;
-1
View File
@@ -2,7 +2,6 @@
#include "common/parsing.h"
#include "common/printing.h"
#include "common/jsonconfig.h"
#include "common/parsing.h"
#include "detection/host/host.h"
#include "detection/gpu/gpu.h"
#include "modules/gpu/gpu.h"