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
+3
View File
@@ -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
}
}
+2 -1
View File
@@ -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