summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-07 16:43:54 +0100
committerHaru <haru@dotalux.com>2016-02-24 20:57:53 +0100
commita79ab6c3d11c7d6fcd1f04400f50b93f72e570e1 (patch)
tree8f165c5992d1a3c35430d80e2b0a356514d55430
parentebe7347a6e67be6d7a6613089227fcb6647ccf22 (diff)
downloadhercules-a79ab6c3d11c7d6fcd1f04400f50b93f72e570e1.tar.gz
hercules-a79ab6c3d11c7d6fcd1f04400f50b93f72e570e1.tar.bz2
hercules-a79ab6c3d11c7d6fcd1f04400f50b93f72e570e1.tar.xz
hercules-a79ab6c3d11c7d6fcd1f04400f50b93f72e570e1.zip
Changed RFIFOP and WFIFOP to return const void * and void * respectively
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/common/socket.h4
-rw-r--r--src/map/clif.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/common/socket.h b/src/common/socket.h
index 29f3eb3d7..07c8608d8 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -47,8 +47,8 @@ struct config_setting_t;
sockt->realloc_writefifo((fd), (size)); \
} while(0)
-#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 RFIFOP(fd,pos) ((const void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (pos)))
+#define WFIFOP(fd,pos) ((void *)(sockt->session[fd]->wdata + sockt->session[fd]->wdata_size + (pos)))
#define RFIFOB(fd,pos) (*(const uint8*)RFIFOP((fd),(pos)))
#define WFIFOB(fd,pos) (*(uint8*)WFIFOP((fd),(pos)))
diff --git a/src/map/clif.c b/src/map/clif.c
index 7152aaa14..1cb925303 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -18817,7 +18817,9 @@ int clif_parse(int fd) {
if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) {
// Note: Overriding const qualifier to re-inject the decoded packet ID.
- int16 *packet_id = (int16 *)RFIFOP(fd, 0);
+#define RFIFOP_mutable(fd, pos) ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (pos)))
+ int16 *packet_id = RFIFOP_mutable(fd, 0);
+#undef RFIFOP_mutable
*packet_id = cmd;
if( sd ) {
sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; // Update key for the next packet