mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:24:58 +02:00
Global: pack all enums and make flag enums unsigned
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
typedef enum FFformatArgType
|
||||
typedef enum __attribute__((__packed__)) FFformatArgType
|
||||
{
|
||||
FF_FORMAT_ARG_TYPE_NULL = 0,
|
||||
FF_FORMAT_ARG_TYPE_UINT,
|
||||
|
||||
+2
-1
@@ -87,11 +87,12 @@ static inline bool ffReadFileBufferRelative(FFNativeFD dfd, const char* fileName
|
||||
}
|
||||
|
||||
//Bit flags, combine with |
|
||||
typedef enum FFPathType
|
||||
typedef enum __attribute__((__packed__)) FFPathType
|
||||
{
|
||||
FF_PATHTYPE_FILE = 1 << 0,
|
||||
FF_PATHTYPE_DIRECTORY = 1 << 1,
|
||||
FF_PATHTYPE_ANY = FF_PATHTYPE_FILE | FF_PATHTYPE_DIRECTORY,
|
||||
FF_PATHTYPE_FORCE_UNSIGNED = UINT8_MAX,
|
||||
} FFPathType;
|
||||
|
||||
static inline bool ffPathExists(const char* path, FFPathType pathType)
|
||||
|
||||
+2
-1
@@ -45,12 +45,13 @@ static inline void ffOptionInitModuleBaseInfo(
|
||||
baseInfo->generateJsonConfig = (__typeof__(baseInfo->generateJsonConfig)) generateJsonConfig;
|
||||
}
|
||||
|
||||
typedef enum FFModuleKeyType
|
||||
typedef enum __attribute__((__packed__)) FFModuleKeyType
|
||||
{
|
||||
FF_MODULE_KEY_TYPE_NONE = 0,
|
||||
FF_MODULE_KEY_TYPE_STRING = 1 << 0,
|
||||
FF_MODULE_KEY_TYPE_ICON = 1 << 1,
|
||||
FF_MODULE_KEY_TYPE_BOTH = FF_MODULE_KEY_TYPE_STRING | FF_MODULE_KEY_TYPE_ICON,
|
||||
FF_MODULE_KEY_TYPE_FORCE_UNSIGNED = UINT8_MAX,
|
||||
} FFModuleKeyType;
|
||||
|
||||
typedef struct FFModuleArgs
|
||||
|
||||
@@ -14,7 +14,7 @@ static void appendOutputColor(FFstrbuf* buffer, const FFModuleArgs* module)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", instance.config.display.colorOutput.chars);
|
||||
}
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module)
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, const FFModuleArgs* module)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -104,7 +104,7 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig con
|
||||
}
|
||||
}
|
||||
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module)
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, bool parentheses, const FFModuleArgs* module)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -156,7 +156,7 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig con
|
||||
ffStrbufAppendC(buffer, ')');
|
||||
}
|
||||
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config)
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentageModuleConfig* config)
|
||||
{
|
||||
if (!ffStrStartsWithIgnCase(subkey, "percent-"))
|
||||
return false;
|
||||
@@ -190,7 +190,7 @@ bool ffPercentParseCommandOptions(const char* key, const char* subkey, const cha
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config)
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentageModuleConfig* config)
|
||||
{
|
||||
if (!ffStrEqualsIgnCase(key, "percent"))
|
||||
return false;
|
||||
@@ -228,7 +228,7 @@ bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeCo
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config)
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentageModuleConfig defaultConfig, FFPercentageModuleConfig config)
|
||||
{
|
||||
if (config.green == defaultConfig.green && config.yellow == defaultConfig.yellow)
|
||||
return;
|
||||
|
||||
+16
-7
@@ -4,14 +4,23 @@
|
||||
#include "common/parsing.h"
|
||||
#include "common/option.h"
|
||||
|
||||
enum FFPercentageTypeFlags
|
||||
typedef enum __attribute__((__packed__)) FFPercentageTypeFlags
|
||||
{
|
||||
FF_PERCENTAGE_TYPE_NONE = 0,
|
||||
FF_PERCENTAGE_TYPE_NUM_BIT = 1 << 0,
|
||||
FF_PERCENTAGE_TYPE_BAR_BIT = 1 << 1,
|
||||
FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT = 1 << 2,
|
||||
FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3,
|
||||
FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT = FF_PERCENTAGE_TYPE_NUM_COLOR_BIT,
|
||||
};
|
||||
FF_PERCENTAGE_TYPE_FORCE_UNSIGNED_ = UINT8_MAX,
|
||||
} FFPercentageTypeFlags;
|
||||
static_assert(sizeof(FFPercentageTypeFlags) == 1, "");
|
||||
|
||||
typedef struct FFPercentageModuleConfig
|
||||
{
|
||||
uint8_t green;
|
||||
uint8_t yellow;
|
||||
} FFPercentageModuleConfig;
|
||||
|
||||
// if (green <= yellow)
|
||||
// [0, green]: print green
|
||||
@@ -23,12 +32,12 @@ enum FFPercentageTypeFlags
|
||||
// [yellow, green): print yellow
|
||||
// [0, yellow): print red
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module);
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, const FFModuleArgs* module);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentageModuleConfig config, bool parentheses, const FFModuleArgs* module);
|
||||
|
||||
typedef struct yyjson_val yyjson_val;
|
||||
typedef struct yyjson_mut_doc yyjson_mut_doc;
|
||||
typedef struct yyjson_mut_val yyjson_mut_val;
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config);
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config);
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config);
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentageModuleConfig* config);
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentageModuleConfig* config);
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentageModuleConfig defaultConfig, FFPercentageModuleConfig config);
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/format.h"
|
||||
|
||||
typedef enum FFPrintType {
|
||||
typedef enum __attribute__((__packed__)) FFPrintType {
|
||||
FF_PRINT_TYPE_DEFAULT = 0,
|
||||
FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0, // key has been formatted outside
|
||||
FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR = 1 << 1,
|
||||
FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH = 1 << 2,
|
||||
FF_PRINT_TYPE_NO_CUSTOM_OUTPUT_FORMAT = 1 << 3, // reserved
|
||||
FF_PRINT_TYPE_FORCE_UNSIGNED = UINT8_MAX,
|
||||
} FFPrintType;
|
||||
|
||||
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
typedef enum FFvarianttype
|
||||
typedef enum __attribute__((__packed__)) FFvarianttype
|
||||
{
|
||||
FF_VARIANT_TYPE_STRING,
|
||||
FF_VARIANT_TYPE_BOOL,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#if defined(FF_HAVE_IMAGEMAGICK7) || defined(FF_HAVE_IMAGEMAGICK6)
|
||||
|
||||
typedef enum FFLogoImageResult
|
||||
typedef enum __attribute__((__packed__)) FFLogoImageResult
|
||||
{
|
||||
FF_LOGO_IMAGE_RESULT_SUCCESS, //Logo printed
|
||||
FF_LOGO_IMAGE_RESULT_INIT_ERROR, //Failed to load library, try again with next IM version
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef enum FFLogoSize
|
||||
typedef enum __attribute__((__packed__)) FFLogoSize
|
||||
{
|
||||
FF_LOGO_SIZE_UNKNOWN,
|
||||
FF_LOGO_SIZE_NORMAL,
|
||||
|
||||
+2
-1
@@ -2,11 +2,12 @@
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
typedef enum FFLogoLineType
|
||||
typedef enum __attribute__((__packed__)) FFLogoLineType
|
||||
{
|
||||
FF_LOGO_LINE_TYPE_NORMAL = 0,
|
||||
FF_LOGO_LINE_TYPE_SMALL_BIT = 1 << 0, // The names of small logo must end with `_small` or `-small`
|
||||
FF_LOGO_LINE_TYPE_ALTER_BIT = 1 << 1,
|
||||
FF_LOGO_LINE_TYPE_FORCE_UNSIGNED = UINT8_MAX,
|
||||
} FFLogoLineType;
|
||||
|
||||
typedef struct FFlogo
|
||||
|
||||
@@ -301,7 +301,7 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20 };
|
||||
|
||||
#ifdef _WIN32
|
||||
options->useSetupApi = false;
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef struct FFBatteryOptions
|
||||
|
||||
bool temp;
|
||||
FFColorRangeConfig tempConfig;
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
|
||||
#ifdef _WIN32
|
||||
bool useSetupApi;
|
||||
|
||||
@@ -202,7 +202,7 @@ void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->showDisconnected = false;
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20 };
|
||||
}
|
||||
|
||||
void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
|
||||
|
||||
@@ -11,5 +11,5 @@ typedef struct FFBluetoothOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool showDisconnected;
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFBluetoothOptions;
|
||||
|
||||
@@ -237,7 +237,7 @@ void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->ddcciSleep = 10;
|
||||
options->percent = (FFColorRangeConfig) { 100, 100 };
|
||||
options->percent = (FFPercentageModuleConfig) { 100, 100 };
|
||||
options->compact = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,6 @@ typedef struct FFBrightnessOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
uint32_t ddcciSleep; // ms
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
bool compact;
|
||||
} FFBrightnessOptions;
|
||||
|
||||
@@ -245,7 +245,7 @@ void ffInitBtrfsOptions(FFBtrfsOptions* options)
|
||||
ffGenerateBtrfsJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyBtrfsOptions(FFBtrfsOptions* options)
|
||||
|
||||
@@ -10,5 +10,5 @@ typedef struct FFBtrfsOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFBtrfsOptions;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFColorsSymbol
|
||||
typedef enum __attribute__((__packed__)) FFColorsSymbol
|
||||
{
|
||||
FF_COLORS_SYMBOL_BLOCK,
|
||||
FF_COLORS_SYMBOL_BACKGROUND,
|
||||
|
||||
@@ -214,7 +214,7 @@ void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->separate = false;
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
options->waitTime = 200;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,6 @@ typedef struct FFCPUUsageOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool separate;
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
uint32_t waitTime; // in ms
|
||||
} FFCPUUsageOptions;
|
||||
|
||||
@@ -473,7 +473,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
|
||||
ffStrbufInit(&options->folders);
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef enum FFDiskVolumeType
|
||||
typedef enum __attribute__((__packed__)) FFDiskVolumeType
|
||||
{
|
||||
FF_DISK_VOLUME_TYPE_NONE = 0,
|
||||
FF_DISK_VOLUME_TYPE_REGULAR_BIT = 1 << 0,
|
||||
@@ -14,9 +14,10 @@ typedef enum FFDiskVolumeType
|
||||
FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT = 1 << 3,
|
||||
FF_DISK_VOLUME_TYPE_UNKNOWN_BIT = 1 << 4,
|
||||
FF_DISK_VOLUME_TYPE_READONLY_BIT = 1 << 5,
|
||||
FF_DISK_VOLUME_TYPE_FORCE_UNSIGNED = UINT8_MAX,
|
||||
} FFDiskVolumeType;
|
||||
|
||||
typedef enum FFDiskCalcType
|
||||
typedef enum __attribute__((__packed__)) FFDiskCalcType
|
||||
{
|
||||
FF_DISK_CALC_TYPE_FREE,
|
||||
FF_DISK_CALC_TYPE_AVAILABLE,
|
||||
@@ -30,5 +31,5 @@ typedef struct FFDiskOptions
|
||||
FFstrbuf folders;
|
||||
FFDiskVolumeType showTypes;
|
||||
FFDiskCalcType calcType;
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFDiskOptions;
|
||||
|
||||
@@ -4,15 +4,16 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFDisplayCompactType
|
||||
typedef enum __attribute__((__packed__)) FFDisplayCompactType
|
||||
{
|
||||
FF_DISPLAY_COMPACT_TYPE_NONE = 0,
|
||||
FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT = 1 << 0,
|
||||
FF_DISPLAY_COMPACT_TYPE_SCALED_BIT = 1 << 1,
|
||||
FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT = 1 << 2,
|
||||
FF_DISPLAY_COMPACT_TYPE_UNSIGNED = UINT8_MAX,
|
||||
} FFDisplayCompactType;
|
||||
|
||||
typedef enum FFDisplayOrder
|
||||
typedef enum __attribute__((__packed__)) FFDisplayOrder
|
||||
{
|
||||
FF_DISPLAY_ORDER_NONE,
|
||||
FF_DISPLAY_ORDER_ASC,
|
||||
|
||||
@@ -122,6 +122,8 @@ void ffGenerateDNSJsonConfig(FFDNSOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
|
||||
if (defaultOptions.showType != options->showType)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wswitch" // FF_DNS_TYPE_FORCE_UNSIGNED
|
||||
switch (options->showType)
|
||||
{
|
||||
case FF_DNS_TYPE_IPV4_BIT:
|
||||
@@ -134,6 +136,7 @@ void ffGenerateDNSJsonConfig(FFDNSOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
yyjson_mut_obj_add_str(doc, module, "showType", "both");
|
||||
break;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFDNSShowType {
|
||||
typedef enum __attribute__((__packed__)) FFDNSShowType {
|
||||
FF_DNS_TYPE_IPV4_BIT = 1,
|
||||
FF_DNS_TYPE_IPV6_BIT = 2,
|
||||
FF_DNS_TYPE_BOTH = FF_DNS_TYPE_IPV4_BIT | FF_DNS_TYPE_IPV6_BIT,
|
||||
FF_DNS_TYPE_FORCE_UNSIGNED = UINT8_MAX,
|
||||
} FFDNSShowType;
|
||||
|
||||
typedef struct FFDNSOptions
|
||||
|
||||
@@ -160,7 +160,7 @@ void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||
ffGenerateGamepadJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20 };
|
||||
}
|
||||
|
||||
void ffDestroyGamepadOptions(FFGamepadOptions* options)
|
||||
|
||||
@@ -9,5 +9,5 @@ typedef struct FFGamepadOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFGamepadOptions;
|
||||
|
||||
@@ -439,7 +439,7 @@ void ffInitGPUOptions(FFGPUOptions* options)
|
||||
options->temp = false;
|
||||
options->hideType = FF_GPU_TYPE_UNKNOWN;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options)
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef enum FFGPUType
|
||||
typedef enum __attribute__((__packed__)) FFGPUType
|
||||
{
|
||||
FF_GPU_TYPE_UNKNOWN,
|
||||
FF_GPU_TYPE_INTEGRATED,
|
||||
FF_GPU_TYPE_DISCRETE,
|
||||
} FFGPUType;
|
||||
|
||||
typedef enum FFGPUDetectionMethod
|
||||
typedef enum __attribute__((__packed__)) FFGPUDetectionMethod
|
||||
{
|
||||
FF_GPU_DETECTION_METHOD_AUTO,
|
||||
FF_GPU_DETECTION_METHOD_PCI,
|
||||
@@ -32,5 +32,5 @@ typedef struct FFGPUOptions
|
||||
bool driverSpecific;
|
||||
bool forceMethod;
|
||||
FFColorRangeConfig tempConfig;
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFGPUOptions;
|
||||
|
||||
@@ -204,7 +204,7 @@ void ffInitLoadavgOptions(FFLoadavgOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
options->ndigits = 2;
|
||||
options->compact = true;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ typedef struct FFLoadavgOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
uint8_t ndigits;
|
||||
bool compact;
|
||||
} FFLoadavgOptions;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFLocalIpType
|
||||
typedef enum __attribute__((__packed__)) FFLocalIpType
|
||||
{
|
||||
FF_LOCALIP_TYPE_NONE,
|
||||
FF_LOCALIP_TYPE_LOOP_BIT = 1 << 0,
|
||||
@@ -19,7 +19,9 @@ typedef enum FFLocalIpType
|
||||
FF_LOCALIP_TYPE_COMPACT_BIT = 1 << 10,
|
||||
FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT = 1 << 11,
|
||||
FF_LOCALIP_TYPE_ALL_IPS_BIT = 1 << 12,
|
||||
FF_LOCALIP_TYPE_FORCE_UNSIGNED = UINT16_MAX,
|
||||
} FFLocalIpType;
|
||||
static_assert(sizeof(FFLocalIpType) == sizeof(uint16_t), "");
|
||||
|
||||
typedef struct FFLocalIpOptions
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ void ffInitMemoryOptions(FFMemoryOptions* options)
|
||||
ffGenerateMemoryJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyMemoryOptions(FFMemoryOptions* options)
|
||||
|
||||
@@ -10,5 +10,5 @@ typedef struct FFMemoryOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFMemoryOptions;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFOpenGLLibrary
|
||||
typedef enum __attribute__((__packed__)) FFOpenGLLibrary
|
||||
{
|
||||
FF_OPENGL_LIBRARY_AUTO,
|
||||
FF_OPENGL_LIBRARY_EGL,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFPackagesFlags
|
||||
typedef enum __attribute__((__packed__)) FFPackagesFlags
|
||||
{
|
||||
FF_PACKAGES_FLAG_NONE = 0,
|
||||
FF_PACKAGES_FLAG_APK_BIT = 1 << 0,
|
||||
@@ -35,7 +35,9 @@ typedef enum FFPackagesFlags
|
||||
FF_PACKAGES_FLAG_PACSTALL_BIT = 1 << 25,
|
||||
FF_PACKAGES_FLAG_MPORT_BIT = 1 << 26,
|
||||
FF_PACKAGES_FLAG_QI_BIT = 1 << 27,
|
||||
FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT32_MAX,
|
||||
} FFPackagesFlags;
|
||||
static_assert(sizeof(FFPackagesFlags) == sizeof(uint32_t), "");
|
||||
|
||||
typedef struct FFPackagesOptions
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef enum FFSoundType
|
||||
typedef enum __attribute__((__packed__)) FFSoundType
|
||||
{
|
||||
FF_SOUND_TYPE_MAIN,
|
||||
FF_SOUND_TYPE_ACTIVE,
|
||||
@@ -18,5 +18,5 @@ typedef struct FFSoundOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFSoundType soundType;
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFSoundOptions;
|
||||
|
||||
@@ -253,7 +253,7 @@ void ffInitSoundOptions(FFSoundOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->soundType = FF_SOUND_TYPE_MAIN;
|
||||
options->percent = (FFColorRangeConfig) { 80, 90 };
|
||||
options->percent = (FFPercentageModuleConfig) { 80, 90 };
|
||||
}
|
||||
|
||||
void ffDestroySoundOptions(FFSoundOptions* options)
|
||||
|
||||
@@ -10,5 +10,5 @@ typedef struct FFSwapOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFSwapOptions;
|
||||
|
||||
@@ -161,7 +161,7 @@ void ffInitSwapOptions(FFSwapOptions* options)
|
||||
ffGenerateSwapJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroySwapOptions(FFSwapOptions* options)
|
||||
|
||||
@@ -9,5 +9,5 @@ typedef struct FFWifiOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFWifiOptions;
|
||||
|
||||
@@ -222,7 +222,7 @@ void ffInitWifiOptions(FFWifiOptions* options)
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->percent = (FFColorRangeConfig) { 50, 20 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20 };
|
||||
}
|
||||
|
||||
void ffDestroyWifiOptions(FFWifiOptions* options)
|
||||
|
||||
@@ -10,5 +10,5 @@ typedef struct FFZpoolOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorRangeConfig percent;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFZpoolOptions;
|
||||
|
||||
@@ -205,7 +205,7 @@ void ffInitZpoolOptions(FFZpoolOptions* options)
|
||||
ffGenerateZpoolJsonConfig
|
||||
);
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFColorRangeConfig) { 50, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80 };
|
||||
}
|
||||
|
||||
void ffDestroyZpoolOptions(FFZpoolOptions* options)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
typedef enum FFSizeBinaryPrefixType
|
||||
typedef enum __attribute__((__packed__)) FFSizeBinaryPrefixType
|
||||
{
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_IEC, // 1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_SI, // 1000 Bytes = 1 KB, 1000 KB = 1 MB, ...
|
||||
FF_SIZE_BINARY_PREFIX_TYPE_JEDEC, // 1024 Bytes = 1 kB, 1024 kB = 1 MB, ...
|
||||
} FFSizeBinaryPrefixType;
|
||||
|
||||
typedef enum FFTemperatureUnit
|
||||
typedef enum __attribute__((__packed__)) FFTemperatureUnit
|
||||
{
|
||||
FF_TEMPERATURE_UNIT_CELSIUS,
|
||||
FF_TEMPERATURE_UNIT_FAHRENHEIT,
|
||||
@@ -46,7 +46,7 @@ typedef struct FFOptionsDisplay
|
||||
FFstrbuf barBorderLeft;
|
||||
FFstrbuf barBorderRight;
|
||||
uint8_t barWidth;
|
||||
uint8_t percentType;
|
||||
FFPercentageTypeFlags percentType;
|
||||
uint8_t percentNdigits;
|
||||
FFstrbuf percentColorGreen;
|
||||
FFstrbuf percentColorYellow;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
typedef enum FFDsForceDrmType
|
||||
typedef enum __attribute__((__packed__)) FFDsForceDrmType
|
||||
{
|
||||
FF_DS_FORCE_DRM_TYPE_FALSE = 0, // Disable
|
||||
FF_DS_FORCE_DRM_TYPE_TRUE = 1, // Try `libdrm`, then `sysfs` if libdrm failed
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
#define FASTFETCH_LOGO_MAX_NAMES 9
|
||||
#define FASTFETCH_LOGO_MAX_COLORS 9 //two digits would make parsing much more complicated (index 1 - 9)
|
||||
|
||||
typedef enum FFLogoType
|
||||
typedef enum __attribute__((__packed__)) FFLogoType
|
||||
{
|
||||
FF_LOGO_TYPE_AUTO, //if something is given, first try builtin, then file. Otherwise detect logo
|
||||
FF_LOGO_TYPE_BUILTIN, //builtin ascii art
|
||||
@@ -23,7 +23,7 @@ typedef enum FFLogoType
|
||||
FF_LOGO_TYPE_NONE, //--logo none
|
||||
} FFLogoType;
|
||||
|
||||
typedef enum FFLogoPosition
|
||||
typedef enum __attribute__((__packed__)) FFLogoPosition
|
||||
{
|
||||
FF_LOGO_POSITION_LEFT,
|
||||
FF_LOGO_POSITION_TOP,
|
||||
|
||||
Reference in New Issue
Block a user