summaryrefslogtreecommitdiff
path: root/src/common/socket.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-08 11:16:04 +0100
committerHaru <haru@dotalux.com>2016-02-24 21:00:31 +0100
commit312f1b940e587a10b55fd544eaf4cc2197b1acd5 (patch)
treef02f2f6ec776c3234777519e2fed166a4fe0d221 /src/common/socket.h
parent900af5d0b8f5b6f20a1967c9cfb83bcefdb5de8e (diff)
downloadhercules-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>
Diffstat (limited to 'src/common/socket.h')
-rw-r--r--src/common/socket.h7
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)))