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.
This commit is contained in:
Lemongrass3110 2015-11-29 14:23:21 +01:00
parent c68680ab6b
commit 86d6113801
3 changed files with 14 additions and 15 deletions

View File

@ -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 <packet len>.W <id>.L <color>.L <message>.?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 <packet len>.W <id>.L <color>.L <message>.?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);

View File

@ -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<ARRAYLENGTH(dbsubpath); i++){
uint8 n1 = strlen(db_path)+strlen(dbsubpath[i])+1;
uint8 n2 = strlen(db_path)+strlen(DBPATH)+strlen(dbsubpath[i])+1;
uint8 n1 = (uint8)(strlen(db_path)+strlen(dbsubpath[i])+1);
uint8 n2 = (uint8)(strlen(db_path)+strlen(DBPATH)+strlen(dbsubpath[i])+1);
char* dbsubpath1 = (char*)aMalloc(n1+1);
char* dbsubpath2 = (char*)aMalloc(n2+1);

View File

@ -10840,8 +10840,8 @@ void pc_readdb(void) {
// reset then read statspoint
memset(statp,0,sizeof(statp));
for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
uint8 n1 = strlen(db_path)+strlen(dbsubpath[i])+1;
uint8 n2 = strlen(db_path)+strlen(DBPATH)+strlen(dbsubpath[i])+1;
uint8 n1 = (uint8)(strlen(db_path)+strlen(dbsubpath[i])+1);
uint8 n2 = (uint8)(strlen(db_path)+strlen(DBPATH)+strlen(dbsubpath[i])+1);
char* dbsubpath1 = (char*)aMalloc(n1+1);
char* dbsubpath2 = (char*)aMalloc(n2+1);