From 86d6113801db3c18d78d437f54ad623ccf5230df Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sun, 29 Nov 2015 14:23:21 +0100 Subject: [PATCH] VS 2015 support(commit 4/4) Fixed all compiler warnings for the default settings(defines). There might be a lot with different packetversions or other setings. Feel free to create a issue on github if you find any. --- src/map/clif.c | 18 +++++++++--------- src/map/itemdb.c | 7 +++---- src/map/pc.c | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 3a31d928d2..b90f09bf3d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -986,7 +986,7 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool #if PACKETVER < 20110111 WBUFW(buf,2) = (spawn ? 62 : 63)+strlen(name); #elif PACKETVER < 20131223 - WBUFW(buf,2) = (spawn ? 64 : 65)+strlen(name); + WBUFW(buf,2) = (uint16)((spawn ? 64 : 65)+strlen(name)); #elif PACKETVER < 20150513 WBUFW(buf,2) = (spawn ? 77 : 78)+strlen(name); #else @@ -1183,7 +1183,7 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un #if PACKETVER < 20110111 WBUFW(buf, 2) = 69+strlen(name); #elif PACKETVER < 20131223 - WBUFW(buf, 2) = 71+strlen(name); + WBUFW(buf, 2) = (uint16)(71+strlen(name)); #elif PACKETVER < 20150513 WBUFW(buf, 2) = 84+strlen(name); #else @@ -3948,7 +3948,7 @@ void clif_dispchat(struct chat_data* cd, int fd) : 1; WBUFW(buf, 0) = 0xd7; - WBUFW(buf, 2) = 17 + strlen(cd->title); + WBUFW(buf, 2) = (uint16)(17 + strlen(cd->title)); WBUFL(buf, 4) = cd->owner->id; WBUFL(buf, 8) = cd->bl.id; WBUFW(buf,12) = cd->limit; @@ -3986,7 +3986,7 @@ void clif_changechatstatus(struct chat_data* cd) : 1; WBUFW(buf, 0) = 0xdf; - WBUFW(buf, 2) = 17 + strlen(cd->title); + WBUFW(buf, 2) = (uint16)(17 + strlen(cd->title)); WBUFL(buf, 4) = cd->owner->id; WBUFL(buf, 8) = cd->bl.id; WBUFW(buf,12) = cd->limit; @@ -6026,7 +6026,7 @@ void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned l void clif_channel_msg(struct Channel *channel, struct map_session_data *sd, char *msg, short color) { DBIterator *iter; struct map_session_data *user; - unsigned short msg_len = strlen(msg) + 1; + unsigned short msg_len = (unsigned short)(strlen(msg) + 1); WFIFOHEAD(sd->fd,msg_len + 12); WFIFOW(sd->fd,0) = 0x2C1; @@ -9004,7 +9004,7 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen // Modification of clif_messagecolor to send colored messages to players to chat log only (doesn't display overhead) /// 02c1 .W .L .L .?B int clif_colormes(int fd, unsigned long color, const char* msg) { - unsigned short msg_len = strlen(msg) + 1; + unsigned short msg_len = (unsigned short)(strlen(msg) + 1); WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; @@ -9020,7 +9020,7 @@ int clif_colormes(int fd, unsigned long color, const char* msg) { /// Monster/NPC color chat [SnakeDrak] (ZC_NPC_CHAT). /// 02c1 .W .L .L .?B void clif_messagecolor(struct block_list* bl, unsigned long color, const char* msg) { - unsigned short msg_len = strlen(msg) + 1; + unsigned short msg_len = (unsigned short)(strlen(msg) + 1); uint8 buf[256]; color = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16; // RGB to BGR @@ -9042,7 +9042,7 @@ void clif_messagecolor(struct block_list* bl, unsigned long color, const char* m void clif_messagecolor2(struct map_session_data *sd, unsigned long color, const char* msg) { - unsigned short msg_len = strlen(msg) + 1; + unsigned short msg_len = (unsigned short)(strlen(msg) + 1); nullpo_retv(sd); @@ -17934,7 +17934,7 @@ void clif_showscript(struct block_list* bl, const char* message) { } WBUFW(buf,0) = 0x8b3; - WBUFW(buf,2) = (len+8); + WBUFW(buf,2) = (uint16)(len+8); WBUFL(buf,4) = bl->id; safestrncpy((char *) WBUFP(buf,8), message, len); clif_send((unsigned char *) buf, WBUFW(buf,2), bl, ALL_CLIENT); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index be36366216..6f04341104 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -613,8 +613,7 @@ static void itemdb_read_itemgroup_sub(const char* filename, bool silent) // Remove from DB if (strcmpi(str[1], "clear") == 0 && itemdb_group->remove(itemdb_group, db_ui2key(group_id), &data)) { - va_list ap; - itemdb_group_free(db_ui2key(group_id), &data, ap); + itemdb_group_free(db_ui2key(group_id), &data, NULL); ShowNotice("Item Group '%s' has been cleared.\n", str[0]); continue; } @@ -1580,8 +1579,8 @@ static void itemdb_read(void) { itemdb_readdb(); for(i=0; i