summaryrefslogtreecommitdiff
path: root/src/common/socket.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-07 03:24:06 +0100
committerHaru <haru@dotalux.com>2016-02-24 19:40:31 +0100
commita9326b175d42b9f6448d97b52108be907194854c (patch)
tree91c9b0e594217bf54130709beeed588f6d830a5a /src/common/socket.h
parent9ee06831aec11a8ffea77f3b5c81465579f993e9 (diff)
downloadhercules-a9326b175d42b9f6448d97b52108be907194854c.tar.gz
hercules-a9326b175d42b9f6448d97b52108be907194854c.tar.bz2
hercules-a9326b175d42b9f6448d97b52108be907194854c.tar.xz
hercules-a9326b175d42b9f6448d97b52108be907194854c.zip
Added const qualifier to the {RFIFO,RBUF}{B,W,L,Q} families
A read FIFO/buffer should be, well, read-only. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/socket.h')
-rw-r--r--src/common/socket.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/socket.h b/src/common/socket.h
index e1ea94f5a..29f3eb3d7 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -50,13 +50,13 @@ struct config_setting_t;
#define RFIFOP(fd,pos) (sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (pos))
#define WFIFOP(fd,pos) (sockt->session[fd]->wdata + sockt->session[fd]->wdata_size + (pos))
-#define RFIFOB(fd,pos) (*(uint8*)RFIFOP((fd),(pos)))
+#define RFIFOB(fd,pos) (*(const uint8*)RFIFOP((fd),(pos)))
#define WFIFOB(fd,pos) (*(uint8*)WFIFOP((fd),(pos)))
-#define RFIFOW(fd,pos) (*(uint16*)RFIFOP((fd),(pos)))
+#define RFIFOW(fd,pos) (*(const uint16*)RFIFOP((fd),(pos)))
#define WFIFOW(fd,pos) (*(uint16*)WFIFOP((fd),(pos)))
-#define RFIFOL(fd,pos) (*(uint32*)RFIFOP((fd),(pos)))
+#define RFIFOL(fd,pos) (*(const uint32*)RFIFOP((fd),(pos)))
#define WFIFOL(fd,pos) (*(uint32*)WFIFOP((fd),(pos)))
-#define RFIFOQ(fd,pos) (*(uint64*)RFIFOP((fd),(pos)))
+#define RFIFOQ(fd,pos) (*(const uint64*)RFIFOP((fd),(pos)))
#define WFIFOQ(fd,pos) (*(uint64*)WFIFOP((fd),(pos)))
#define RFIFOSPACE(fd) (sockt->session[fd]->max_rdata - sockt->session[fd]->rdata_size)
#define WFIFOSPACE(fd) (sockt->session[fd]->max_wdata - sockt->session[fd]->wdata_size)
@@ -85,11 +85,11 @@ struct config_setting_t;
#define WP2PTR(fd) WFIFO2PTR(fd)
// buffer I/O macros
-#define RBUFP(p,pos) (((const uint8*)(p)) + (pos))
-#define RBUFB(p,pos) (*(const uint8*)RBUFP((p),(pos)))
-#define RBUFW(p,pos) (*(const uint16*)RBUFP((p),(pos)))
-#define RBUFL(p,pos) (*(const uint32*)RBUFP((p),(pos)))
-#define RBUFQ(p,pos) (*(const uint64*)RBUFP((p),(pos)))
+#define RBUFP(p,pos) (((const uint8 *)(p)) + (pos))
+#define RBUFB(p,pos) (*(const uint8 *)RBUFP((p),(pos)))
+#define RBUFW(p,pos) (*(const uint16 *)RBUFP((p),(pos)))
+#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))
#define WBUFB(p,pos) (*(uint8*)WBUFP((p),(pos)))