diff options
author | Haru <haru@dotalux.com> | 2016-01-08 11:16:04 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-02-24 21:00:31 +0100 |
commit | 312f1b940e587a10b55fd544eaf4cc2197b1acd5 (patch) | |
tree | f02f2f6ec776c3234777519e2fed166a4fe0d221 | |
parent | 900af5d0b8f5b6f20a1967c9cfb83bcefdb5de8e (diff) | |
download | hercules-312f1b940e587a10b55fd544eaf4cc2197b1acd5.tar.gz hercules-312f1b940e587a10b55fd544eaf4cc2197b1acd5.tar.bz2 hercules-312f1b940e587a10b55fd544eaf4cc2197b1acd5.tar.xz hercules-312f1b940e587a10b55fd544eaf4cc2197b1acd5.zip |
Modified the WBUF family of macros to ensure a non-const buffer is used
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/common/socket.h | 7 |
1 files changed, 6 insertions, 1 deletions
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))) |