From b17a65bc945e32e23f02d6bcfeee3ff4b7abc27a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 4 Dec 2023 12:49:20 +0000 Subject: xdgmimecache: Clarify operator precedence in OUT_OF_BOUNDS macro If the arguments are expressions rather than single variables, the compiler spews warnings suggesting to add parentheses to clarify operator precedence between `+` and `&` operators. Add those parentheses. Signed-off-by: Philip Withnall --- src/xdgmimecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xdgmimecache.c b/src/xdgmimecache.c index 5677481..6d89f10 100644 --- a/src/xdgmimecache.c +++ b/src/xdgmimecache.c @@ -81,7 +81,7 @@ struct _XdgMimeCache // a 4-byte boundary, and that offset+(n*record_size) does not overflow. // `record_size` values are known constants and never 0. #define OUT_OF_BOUNDS(offset,n,record_size,max) \ - ((offset & 0x3) || offset > max || n > (max - offset) / record_size) + (((offset) & 0x3) || (offset) > (max) || (n) > ((max) - (offset)) / (record_size)) XdgMimeCache * _xdg_mime_cache_ref (XdgMimeCache *cache) -- cgit v1.2.3