From 1a2a4f1477ebddcaefd132c141f7bbf64b23f016 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 30 Apr 2016 15:15:47 +0200 Subject: Fixed a warning in VS2015 Signed-off-by: Haru --- src/map/clif.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/map') 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 .W .?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); } -- cgit v1.2.3-70-g09d2