commit bb5ad73c5fff8c13c10c8e2948af09559f3b397c
parent ce8a29585d83c952fd0a9c12e9cc197e5c968dd9
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sun, 27 Apr 2025 13:12:57 +0200
microhttpd2.h: fixed warnings in external events macros
Diffstat:
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
@@ -2670,7 +2670,7 @@ enum MHD_FIXED_ENUM_ MHD_FdState
/* The rest of the list is a bit-wise combination of three main
* states. Application may use three main states directly as
- * a bit-mask instead of using of following values
+ * a bit-mask instead of using of the following values
*/
/**
@@ -2699,9 +2699,10 @@ enum MHD_FIXED_ENUM_ MHD_FdState
/**
* Checks whether specific @a state is enabled/set in the @a var
*/
-#define MHD_FD_STATE_IS_SET(var,state) \
- (MHD_FD_STATE_NONE != \
- (((enum MHD_FdState) (var)) & ((enum MHD_FdState) (state))))
+#define MHD_FD_STATE_IS_SET(var,state) \
+ (MHD_FD_STATE_NONE != \
+ ((enum MHD_FdState) (((unsigned int) (var)) \
+ & ((unsigned int) (state)))))
/**
* Checks whether RECV is enabled/set in the @a var
@@ -2724,7 +2725,8 @@ enum MHD_FIXED_ENUM_ MHD_FdState
* Set/enable specific @a state in the @a var
*/
#define MHD_FD_STATE_SET(var,state) \
- (var) = (enum MHD_FdState) ((var) | (state))
+ ((var) = \
+ (enum MHD_FdState) (((unsigned int) var) | ((unsigned int) state)))
/**
* Set/enable RECV state in the @a var
*/
@@ -2743,7 +2745,11 @@ enum MHD_FIXED_ENUM_ MHD_FdState
* Clear/disable specific @a state in the @a var
*/
#define MHD_FD_STATE_CLEAR(var,state) \
- (var) = (enum MHD_FdState) ((var) & (((enum MHD_FdState))(~state)))
+ ( (var) = \
+ (enum MHD_FdState) \
+ (((unsigned int) var) \
+ & ((enum MHD_FdState) (~((unsigned int) state)))) \
+ )
/**
* Clear/disable RECV state in the @a var
*/
diff --git a/src/include/microhttpd2_preamble.h.in b/src/include/microhttpd2_preamble.h.in
@@ -2670,7 +2670,7 @@ enum MHD_FIXED_ENUM_ MHD_FdState
/* The rest of the list is a bit-wise combination of three main
* states. Application may use three main states directly as
- * a bit-mask instead of using of following values
+ * a bit-mask instead of using of the following values
*/
/**
@@ -2699,9 +2699,10 @@ enum MHD_FIXED_ENUM_ MHD_FdState
/**
* Checks whether specific @a state is enabled/set in the @a var
*/
-#define MHD_FD_STATE_IS_SET(var,state) \
- (MHD_FD_STATE_NONE != \
- (((enum MHD_FdState) (var)) & ((enum MHD_FdState) (state))))
+#define MHD_FD_STATE_IS_SET(var,state) \
+ (MHD_FD_STATE_NONE != \
+ ((enum MHD_FdState) (((unsigned int) (var)) \
+ & ((unsigned int) (state)))))
/**
* Checks whether RECV is enabled/set in the @a var
@@ -2724,7 +2725,8 @@ enum MHD_FIXED_ENUM_ MHD_FdState
* Set/enable specific @a state in the @a var
*/
#define MHD_FD_STATE_SET(var,state) \
- (var) = (enum MHD_FdState) ((var) | (state))
+ ((var) = \
+ (enum MHD_FdState) (((unsigned int) var) | ((unsigned int) state)))
/**
* Set/enable RECV state in the @a var
*/
@@ -2743,7 +2745,11 @@ enum MHD_FIXED_ENUM_ MHD_FdState
* Clear/disable specific @a state in the @a var
*/
#define MHD_FD_STATE_CLEAR(var,state) \
- (var) = (enum MHD_FdState) ((var) & (((enum MHD_FdState))(~state)))
+ ( (var) = \
+ (enum MHD_FdState) \
+ (((unsigned int) var) \
+ & ((enum MHD_FdState) (~((unsigned int) state)))) \
+ )
/**
* Clear/disable RECV state in the @a var
*/