From 312f1b940e587a10b55fd544eaf4cc2197b1acd5 Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 8 Jan 2016 11:16:04 +0100 Subject: Modified the WBUF family of macros to ensure a non-const buffer is used Signed-off-by: Haru --- src/common/socket.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/socket.h b/src/common/socket.h index 5ff56bdc8..b9e6f6f42 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -91,7 +91,12 @@ struct config_setting_t; #define RBUFL(p,pos) (*(const uint32 *)RBUFP((p),(pos))) #define RBUFQ(p,pos) (*(const uint64 *)RBUFP((p),(pos))) -#define WBUFP(p,pos) (((uint8*)(p)) + (pos)) +static inline void *WBUFP_(void *p, int pos) __attribute__((const, unused)); +static inline void *WBUFP_(void *p, int pos) +{ + return ((uint8 *)p) + pos; +} +#define WBUFP(p,pos) WBUFP_(p, (int)(pos)) #define WBUFB(p,pos) (*(uint8*)WBUFP((p),(pos))) #define WBUFW(p,pos) (*(uint16*)WBUFP((p),(pos))) #define WBUFL(p,pos) (*(uint32*)WBUFP((p),(pos))) -- cgit v1.2.3-70-g09d2