summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-30 15:15:47 +0200
committerHaru <haru@dotalux.com>2016-04-30 15:15:47 +0200
commit1a2a4f1477ebddcaefd132c141f7bbf64b23f016 (patch)
treee426e3bd8001b05be6408f33fefae324c7995022
parent16dba4f8334c4894d39ac1b17734119b404a9d47 (diff)
downloadhercules-1a2a4f1477ebddcaefd132c141f7bbf64b23f016.tar.gz
hercules-1a2a4f1477ebddcaefd132c141f7bbf64b23f016.tar.bz2
hercules-1a2a4f1477ebddcaefd132c141f7bbf64b23f016.tar.xz
hercules-1a2a4f1477ebddcaefd132c141f7bbf64b23f016.zip
Fixed a warning in VS2015
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/clif.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 96e458600..cf742fbf6 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5490,23 +5490,24 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val
/// Send message (modified by [Yor]) (ZC_NOTIFY_PLAYERCHAT).
/// 008e <packet len>.W <message>.?B
-void clif_displaymessage(const int fd, const char* mes) {
+void clif_displaymessage(const int fd, const char *mes)
+{
nullpo_retv(mes);
- if( map->cpsd_active && fd == 0 ) {
+ if (map->cpsd_active && fd == 0) {
ShowInfo("HCP: %s\n",mes);
- } else if ( fd > 0 ) {
+ } else if (fd > 0) {
#if PACKETVER == 20141022
/** for some reason game client crashes depending on message pattern (only for this packet) **/
/** so we redirect to ZC_NPC_CHAT **/
clif->messagecolor_self(fd, COLOR_DEFAULT, mes);
#else
- size_t len;
+ int len = (int)strnlen(mes, 255);
- if ( ( len = strnlen(mes, 255) ) > 0 ) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
+ if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
WFIFOHEAD(fd, 5 + len);
WFIFOW(fd,0) = 0x8e;
- WFIFOW(fd,2) = 5 + len; // 4 + len + NULL terminate
+ WFIFOW(fd,2) = 5 + len; // 4 + len + NUL terminate
safestrncpy(WFIFOP(fd,4), mes, len + 1);
WFIFOSET(fd, 5 + len);
}