From 583aa4ed3bf498170d2aa343848b0379120573b4 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 27 Apr 2024 16:39:54 +0200 Subject: [PATCH] *: use unsigned for bit-fields This should resolve Clang's warning error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] Signed-off-by: Fabian Groffen --- conffile.h | 4 ++-- dispatcher.c | 8 ++++---- server.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/conffile.h b/conffile.h index e4bbb611..99306a16 100644 --- a/conffile.h +++ b/conffile.h @@ -70,7 +70,7 @@ typedef struct _validate { typedef struct _cluster { char *name; enum clusttype type; - char isdynamic:1; + unsigned char isdynamic:1; union { chashring *ch; servers *forward; @@ -95,7 +95,7 @@ typedef struct _route { char *strmatch; /* string to search for if type not REGEX or MATCHALL */ destinations *dests; /* where matches should go */ char *masq; /* when set, what to feed to the hashfunc when routing */ - char stop:1; /* whether to continue matching rules after this one */ + unsigned char stop:1;/* whether to continue matching rules after this one */ enum { MATCHALL, /* the '*', don't do anything, just match everything */ REGEX, /* a regex match */ diff --git a/dispatcher.c b/dispatcher.c index 54a487be..3ec1600f 100644 --- a/dispatcher.c +++ b/dispatcher.c @@ -124,10 +124,10 @@ typedef struct _connection { char srcaddr[24]; /* string representation of source address */ char buf[METRIC_BUFSIZ]; int buflen; - char needmore:1; - char noexpire:1; - char isaggr:1; - char isudp:1; + unsigned char needmore:1; + unsigned char noexpire:1; + unsigned char isaggr:1; + unsigned char isudp:1; char datawaiting; /* full byte for atomic access */ char metric[METRIC_BUFSIZ]; destination dests[CONN_DESTS_SIZE]; diff --git a/server.c b/server.c index ac8d6d36..10dfa50c 100644 --- a/server.c +++ b/server.c @@ -94,7 +94,6 @@ struct _server { char *instance; struct addrinfo *saddr; struct addrinfo *hint; - char reresolve:1; int fd; z_strm *strm; queue *queue; @@ -111,7 +110,8 @@ struct _server { pthread_t tid; struct _server **secondaries; size_t secondariescnt; - char failover:1; + unsigned char reresolve:1; + unsigned char failover:1; char failure; /* full byte for atomic access */ char running; /* full byte for atomic access */ char keep_running; /* full byte for atomic access */