Global: pack all enums and make flag enums unsigned

This commit is contained in:
李通洲
2024-11-14 10:04:57 +08:00
parent e821a99873
commit 97e1b987dd
54 changed files with 100 additions and 73 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
#include "fastfetch.h"
typedef enum FFCPUCacheType
typedef enum __attribute__((__packed__)) FFCPUCacheType
{
FF_CPU_CACHE_TYPE_UNIFIED = 0,
FF_CPU_CACHE_TYPE_INSTRUCTION = 1,
+2 -2
View File
@@ -42,13 +42,13 @@
#define FF_WM_PROTOCOL_X11 "X11"
#define FF_WM_PROTOCOL_WAYLAND "Wayland"
typedef enum FFDisplayType {
typedef enum __attribute__((__packed__)) FFDisplayType {
FF_DISPLAY_TYPE_UNKNOWN,
FF_DISPLAY_TYPE_BUILTIN,
FF_DISPLAY_TYPE_EXTERNAL,
} FFDisplayType;
typedef enum FFDisplayHdrStatus
typedef enum __attribute__((__packed__)) FFDisplayHdrStatus
{
FF_DISPLAY_HDR_STATUS_UNKNOWN,
FF_DISPLAY_HDR_STATUS_UNSUPPORTED,
@@ -9,7 +9,7 @@
#include "../displayserver_linux.h"
typedef enum WaylandProtocolType
typedef enum __attribute__((__packed__)) WaylandProtocolType
{
FF_WAYLAND_PROTOCOL_TYPE_NONE,
FF_WAYLAND_PROTOCOL_TYPE_GLOBAL,
+2 -1
View File
@@ -2,11 +2,12 @@
#include "gpu.h"
typedef enum FFGpuDriverConditionType
typedef enum __attribute__((__packed__)) FFGpuDriverConditionType
{
FF_GPU_DRIVER_CONDITION_TYPE_BUS_ID = 1 << 0,
FF_GPU_DRIVER_CONDITION_TYPE_DEVICE_ID = 1 << 1,
FF_GPU_DRIVER_CONDITION_TYPE_LUID = 1 << 2,
FF_GPU_DRIVER_CONDITION_TYPE_FORCE_UNSIGNED = UINT8_MAX,
} FFGpuDriverConditionType;
typedef struct FFGpuDriverPciBusId
+1 -1
View File
@@ -18,7 +18,7 @@ static inline bool allValuesSet(const FFQtResult* result)
result->wallpaper.length > 0;
}
typedef enum PlasmaCategory
typedef enum __attribute__((__packed__)) PlasmaCategory
{
PLASMA_CATEGORY_GENERAL,
PLASMA_CATEGORY_KDE,
+4 -1
View File
@@ -2,7 +2,7 @@
#define FF_PHYSICALDISK_TEMP_UNSET (0/0.0)
typedef enum FFPhysicalDiskType
typedef enum __attribute__((__packed__)) FFPhysicalDiskType
{
FF_PHYSICALDISK_TYPE_NONE = 0,
@@ -15,7 +15,10 @@ typedef enum FFPhysicalDiskType
FF_PHYSICALDISK_TYPE_READWRITE = 1 << 4,
FF_PHYSICALDISK_TYPE_READONLY = 1 << 5,
FF_PHYSICALDISK_TYPE_FORCE_UNSIGNED = UINT8_MAX,
} FFPhysicalDiskType;
static_assert(sizeof(FFPhysicalDiskType) == sizeof(uint8_t), "");
typedef struct FFPhysicalDiskResult
{