From 8dc7572164d1f630fed49e695d4bf62ea8e09a15 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 19 Feb 2016 18:24:22 +0300 Subject: Fix all known warnings from compiler flags -Wformat* Add all missing -Wformat flags into configure. --- src/map/atcommand.c | 16 +++---- src/map/battleground.c | 10 ++-- src/map/channel.c | 2 +- src/map/chrif.c | 8 ++-- src/map/clif.c | 28 +++++------ src/map/instance.c | 4 +- src/map/intif.c | 30 ++++++------ src/map/itemdb.c | 12 ++--- src/map/log.c | 4 +- src/map/map.c | 2 +- src/map/mapreg_sql.c | 8 ++-- src/map/mob.c | 4 +- src/map/npc.c | 14 +++--- src/map/pc.c | 12 ++--- src/map/pc_groups.c | 4 +- src/map/quest.c | 2 +- src/map/script.c | 124 ++++++++++++++++++++++++------------------------- src/map/skill.c | 8 ++-- src/map/status.c | 2 +- src/map/unit.c | 4 +- 20 files changed, 149 insertions(+), 149 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4eb2051da..a9b071fda 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -223,8 +223,8 @@ ACMD(send) // read message type as hex number (without the 0x) if (!*message - || !((sscanf(message, "len %x", &type)==1 && (len=1, true)) - || sscanf(message, "%x", &type)==1) + || !((sscanf(message, "len %x", (unsigned int*)&type)==1 && (len=1, true)) + || sscanf(message, "%x", (unsigned int*)&type)==1) ) { clif->message(fd, msg_fd(fd,900)); // Usage: clif->message(fd, msg_fd(fd,901)); // @send len @@ -252,7 +252,7 @@ ACMD(send) } while(0) //define SKIP_VALUE #define GET_VALUE(p,num) do { \ - if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\ + if(sscanf((p), "x%lx", (long unsigned int*)&(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\ PARSE_ERROR("Invalid number in:",(p));\ return false;\ }\ @@ -2272,11 +2272,11 @@ ACMD(gat) { for (y = 2; y >= -2; y--) { safesnprintf(atcmd_output, sizeof(atcmd_output), "%s (x= %d, y= %d) %02X %02X %02X %02X %02X", map->list[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y, - map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE), - map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE), - map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE), - map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE), - map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE)); + (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE), + (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE), + (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE), + (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE), + (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE)); clif->message(fd, atcmd_output); } diff --git a/src/map/battleground.c b/src/map/battleground.c index ae80d0fc7..311690ec3 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -828,9 +828,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ if ( ( tick = pc_readglobalreg(sd, script->add_str(bg->gdelay_var)) ) && tsec < tick ) { char response[100]; if( (tick-tsec) > 60 ) - sprintf(response, "You are a deserter! Wait %d minute(s) before you can apply again",(tick-tsec)/60); + sprintf(response, "You are a deserter! Wait %u minute(s) before you can apply again", (tick - tsec) / 60); else - sprintf(response, "You are a deserter! Wait %d seconds before you can apply again",(tick-tsec)); + sprintf(response, "You are a deserter! Wait %u seconds before you can apply again", (tick - tsec)); clif->messagecolor_self(sd->fd, COLOR_RED, response); return BGQA_FAIL_DESERTER; } @@ -838,9 +838,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ if ( ( tick = pc_readglobalreg(sd, script->add_str(arena->delay_var)) ) && tsec < tick ) { char response[100]; if( (tick-tsec) > 60 ) - sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %d minute(s)",(tick-tsec)/60); + sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %u minute(s)", (tick - tsec) / 60); else - sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %d seconds",(tick-tsec)); + sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %u seconds", (tick - tsec)); clif->messagecolor_self(sd->fd, COLOR_RED, response); return BGQA_FAIL_COOLDOWN; } @@ -907,7 +907,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ case BGQT_INDIVIDUAL:/* already did */ break; default: - ShowDebug("bg_canqueue: unknown/unsupported type %d\n",type); + ShowDebug("bg_canqueue: unknown/unsupported type %u\n", type); return BGQA_DUPLICATE_REQUEST; } return BGQA_SUCCESS; diff --git a/src/map/channel.c b/src/map/channel.c index 45b59898c..28ef854da 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -792,7 +792,7 @@ void read_channels_config(void) } } - ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel->db), config_filename); + ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel->db), config_filename); } libconfig->destroy(&channels_conf); } diff --git a/src/map/chrif.c b/src/map/chrif.c index 258d550d4..412d8d36a 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -362,7 +362,7 @@ void chrif_recvmap(int fd) { } if (battle_config.etc_log) - ShowStatus("Received maps from %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j); + ShowStatus("Received maps from %u.%u.%u.%u:%u (%d maps)\n", CONVIP(ip), port, j); chrif->other_mapserver_count++; } @@ -379,7 +379,7 @@ void chrif_removemap(int fd) { chrif->other_mapserver_count--; if(battle_config.etc_log) - ShowStatus("remove map of server %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j); + ShowStatus("remove map of server %u.%u.%u.%u:%u (%d maps)\n", CONVIP(ip), port, j); } // received after a character has been "final saved" on the char-server @@ -1410,7 +1410,7 @@ int chrif_parse(int fd) { if (result == 1) continue; // Treated in intif if (result == 2) return 0; // Didn't have enough data (len==-1) - ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, cmd); + ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, (unsigned int)cmd); sockt->eof(fd); return 0; } @@ -1451,7 +1451,7 @@ int chrif_parse(int fd) { case 0x2b25: chrif->deadopt(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; case 0x2b27: chrif->authfail(fd); break; default: - ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd); + ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, (unsigned int)cmd); sockt->eof(fd); return 0; } diff --git a/src/map/clif.c b/src/map/clif.c index 66a8e92b8..a7d73d91f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -645,7 +645,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target break; default: - ShowError("clif_send: Unrecognized type %d\n",type); + ShowError("clif_send: Unrecognized type %u\n", type); return false; } @@ -8475,7 +8475,7 @@ void clif_charnameack (int fd, struct block_list *bl) memcpy(WBUFP(buf,6), BL_UCCAST(BL_ELEM, bl)->db->name, NAME_LENGTH); break; default: - ShowError("clif_charnameack: bad type %d(%d)\n", bl->type, bl->id); + ShowError("clif_charnameack: bad type %u(%d)\n", bl->type, bl->id); return; } @@ -12717,7 +12717,7 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) clif->guild_expulsionlist(sd); break; default: - ShowError("clif: guild request info: unknown type %d\n", RFIFOL(fd,2)); + ShowError("clif: guild request info: unknown type %u\n", RFIFOL(fd,2)); break; } } @@ -15417,7 +15417,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) unsigned short* item_list = (unsigned short*)RFIFOP(fd,10); if( len < 10 || len != 10 + count * 4) { - ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * 4); + ShowWarning("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n", sd->status.char_id, len, 10 + count * 4); return; } fail = npc->cashshop_buylist(sd,points,count,item_list); @@ -16528,7 +16528,7 @@ void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { // TODO: Make this check global for all variable length packets. if( packet_len < 89 ) {// minimum packet length - ShowError("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 89, packet_len, sd->bl.id); + ShowError("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 89U, packet_len, sd->bl.id); return; } @@ -16707,7 +16707,7 @@ void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { if( packet_len < 12 ) {// minimum packet length - ShowError("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 12, packet_len, sd->bl.id); + ShowError("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 12U, packet_len, sd->bl.id); return; } @@ -16720,7 +16720,7 @@ void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { if( packet_len%blocksize ) { - ShowError("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%u, block size=%u)\n", packet_len, sd->bl.id, account_id, blocksize); + ShowError("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n", packet_len, sd->bl.id, account_id, blocksize); return; } count = packet_len/blocksize; @@ -16827,7 +16827,7 @@ void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { if( packet_len < 15 ) {// minimum packet length - ShowError("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 15, packet_len, sd->bl.id); + ShowError("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 15U, packet_len, sd->bl.id); return; } @@ -17009,10 +17009,10 @@ void clif_parse_debug(int fd,struct map_session_data *sd) { if( packet_len == -1 ) {// variable length packet_len = RFIFOW(fd,2); // clif_parse ensures, that this amount of data is already received } - ShowDebug("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n", cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id); + ShowDebug("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n", (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id); } else { packet_len = (int)RFIFOREST(fd); - ShowDebug("Packet debug of 0x%04X (length %d), session #%d\n", cmd, packet_len, fd); + ShowDebug("Packet debug of 0x%04X (length %d), session #%d\n", (unsigned int)cmd, packet_len, fd); } ShowDump(RFIFOP(fd,0), packet_len); @@ -18757,7 +18757,7 @@ int clif_parse(int fd) { // filter out invalid / unsupported packets if (cmd > MAX_PACKET_DB || cmd < MIN_PACKET_DB || packet_db[cmd].len == 0) { ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %"PRIuS" bytes received), disconnecting session #%d.\n", - cmd, RFIFOW(fd,0), RFIFOREST(fd), fd); + (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd); #ifdef DUMP_INVALID_PACKET ShowDump(RFIFOP(fd,0), RFIFOREST(fd)); #endif @@ -18773,7 +18773,7 @@ int clif_parse(int fd) { packet_len = RFIFOW(fd,2); if (packet_len < 4 || packet_len > 32768) { - ShowWarning("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n", cmd, packet_len, fd); + ShowWarning("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n", (unsigned int)cmd, packet_len, fd); #ifdef DUMP_INVALID_PACKET ShowDump(RFIFOP(fd,0), RFIFOREST(fd)); #endif @@ -18861,12 +18861,12 @@ static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) pFunc func; if (cmd > MAX_PACKET_DB) { - ShowError("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n", cmd, MAX_PACKET_DB); + ShowError("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n", (unsigned int)cmd, (unsigned int)MAX_PACKET_DB); return; } if (cmd < MIN_PACKET_DB) { - ShowError("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n", cmd, MIN_PACKET_DB); + ShowError("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n", (unsigned int)cmd, (unsigned int)MIN_PACKET_DB); return; } diff --git a/src/map/instance.c b/src/map/instance.c index 5e8256c88..a6700d486 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -106,7 +106,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ icptr = &g->instances; break; default: - ShowError("instance_create: unknown type %d for owner_id %d and name %s.\n", type,owner_id,name); + ShowError("instance_create: unknown type %u for owner_id %d and name %s.\n", type, owner_id, name); return -1; } @@ -591,7 +591,7 @@ void instance_destroy(int instance_id) { icptr = &g->instances; break; default: - ShowError("instance_destroy: unknown type %d for owner_id %d and name '%s'.\n", instance->list[instance_id].owner_type,instance->list[instance_id].owner_id,instance->list[instance_id].name); + ShowError("instance_destroy: unknown type %u for owner_id %d and name '%s'.\n", instance->list[instance_id].owner_type, instance->list[instance_id].owner_id, instance->list[instance_id].name); break; } diff --git a/src/map/intif.c b/src/map/intif.c index 1968ebe67..9722b8f9a 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1156,7 +1156,7 @@ void intif_parse_LoadGuildStorage(int fd) sd=map->id2sd( RFIFOL(fd,4) ); if( flag ){ //If flag != 0, we attach a player and open the storage if(sd==NULL){ - ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); + ShowError("intif_parse_LoadGuildStorage: user not found %u\n", RFIFOL(fd,4)); return; } } @@ -1194,20 +1194,20 @@ void intif_parse_SaveGuildStorage(int fd) void intif_parse_PartyCreated(int fd) { if(battle_config.etc_log) - ShowInfo("intif: party created by account %d\n\n", RFIFOL(fd,2)); + ShowInfo("intif: party created by account %u\n\n", RFIFOL(fd,2)); party->created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15)); } // Receive party info void intif_parse_PartyInfo(int fd) { if (RFIFOW(fd,2) == 12) { - ShowWarning("intif: party noinfo (char_id=%d party_id=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8)); + ShowWarning("intif: party noinfo (char_id=%u party_id=%u)\n", RFIFOL(fd,4), RFIFOL(fd,8)); party->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4)); return; } if (RFIFOW(fd,2) != 8+sizeof(struct party)) - ShowError("intif: party info: data size mismatch (char_id=%d party_id=%d packet_len=%d expected_len=%"PRIuS")\n", + ShowError("intif: party info: data size mismatch (char_id=%u party_id=%u packet_len=%d expected_len=%"PRIuS")\n", RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party)); party->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4)); } @@ -1216,7 +1216,7 @@ void intif_parse_PartyInfo(int fd) { void intif_parse_PartyMemberAdded(int fd) { if(battle_config.etc_log) - ShowInfo("intif: party member added Party (%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); + ShowInfo("intif: party member added Party (%u), Account(%u), Char(%u)\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); party->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14)); } @@ -1230,7 +1230,7 @@ void intif_parse_PartyOptionChanged(int fd) void intif_parse_PartyMemberWithdraw(int fd) { if(battle_config.etc_log) - ShowInfo("intif: party member withdraw: Party(%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); + ShowInfo("intif: party member withdraw: Party(%u), Account(%u), Char(%u)\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); party->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); } @@ -1258,20 +1258,20 @@ void intif_parse_GuildCreated(int fd) { // ACK guild infos void intif_parse_GuildInfo(int fd) { if (RFIFOW(fd,2) == 8) { - ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4)); + ShowWarning("intif: guild noinfo %u\n", RFIFOL(fd,4)); guild->recv_noinfo(RFIFOL(fd,4)); return; } if (RFIFOW(fd,2)!=sizeof(struct guild)+4) - ShowError("intif: guild info: data size mismatch - Gid: %d recv size: %d Expected size: %"PRIuS"\n", - RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4); + ShowError("intif: guild info: data size mismatch - Gid: %u recv size: %d Expected size: %"PRIuS"\n", + RFIFOL(fd,4), RFIFOW(fd,2), sizeof(struct guild)+4); guild->recv_info((struct guild *)RFIFOP(fd,4)); } // ACK adding guild member void intif_parse_GuildMemberAdded(int fd) { if(battle_config.etc_log) - ShowInfo("intif: guild member added %d %d %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14)); + ShowInfo("intif: guild member added %u %u %u %d\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14)); guild->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14)); } @@ -1357,8 +1357,8 @@ void intif_parse_GuildMemberInfoChanged(int fd) { // ACK change of guild title void intif_parse_GuildPosition(int fd) { if (RFIFOW(fd,2)!=sizeof(struct guild_position)+12) - ShowError("intif: guild info: data size mismatch (%d) %d != %"PRIuS"\n", - RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12); + ShowError("intif: guild info: data size mismatch (%u) %d != %"PRIuS"\n", + RFIFOL(fd,4), RFIFOW(fd,2), sizeof(struct guild_position) + 12); guild->position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); } @@ -1476,7 +1476,7 @@ void intif_parse_RecvHomunculusData(int fd) { /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ void intif_parse_SaveHomunculusOk(int fd) { if(RFIFOB(fd,6) != 1) - ShowError("homunculus data save failure for account %d\n", RFIFOL(fd,2)); + ShowError("homunculus data save failure for account %u\n", RFIFOL(fd,2)); } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ @@ -1691,7 +1691,7 @@ void intif_parse_MailGetAttach(int fd) { sd = map->charid2sd( RFIFOL(fd,4) ); if (sd == NULL) { - ShowError("intif_parse_MailGetAttach: char not found %d\n",RFIFOL(fd,4)); + ShowError("intif_parse_MailGetAttach: char not found %u\n", RFIFOL(fd,4)); return; } @@ -1769,7 +1769,7 @@ void intif_parse_MailReturn(int fd) { short fail = RFIFOB(fd,10); if( sd == NULL ) { - ShowError("intif_parse_MailReturn: char not found %d\n",RFIFOL(fd,2)); + ShowError("intif_parse_MailReturn: char not found %u\n", RFIFOL(fd, 2)); return; } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index da72ab05a..451f447fb 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1280,7 +1280,7 @@ void itemdb_read_combos(void) if (!strchr(p,',')) { /* is there even a single column? */ - ShowError("itemdb_read_combos: Insufficient columns in line %d of \"%s\", skipping.\n", lines, filepath); + ShowError("itemdb_read_combos: Insufficient columns in line %u of \"%s\", skipping.\n", lines, filepath); continue; } @@ -1294,13 +1294,13 @@ void itemdb_read_combos(void) p++; if (str[1][0] != '{') { - ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, filepath); + ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %u of \"%s\", skipping.\n", lines, filepath); continue; } /* no ending key anywhere (missing \}\) */ if ( str[1][strlen(str[1])-1] != '}' ) { - ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, filepath); + ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %u of \"%s\", skipping.\n", lines, filepath); continue; } else { int items[MAX_ITEMS_PER_COMBO]; @@ -1308,14 +1308,14 @@ void itemdb_read_combos(void) struct item_combo *combo = NULL; if((retcount = itemdb->combo_split_atoi(str[0], items)) < 2) { - ShowError("itemdb_read_combos: line %d of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, filepath); + ShowError("itemdb_read_combos: line %u of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, filepath); continue; } /* validate */ for(v = 0; v < retcount; v++) { if( !itemdb->exists(items[v]) ) { - ShowError("itemdb_read_combos: line %d of \"%s\" contains unknown item ID %d, skipping.\n", lines, filepath,items[v]); + ShowError("itemdb_read_combos: line %u of \"%s\" contains unknown item ID %d, skipping.\n", lines, filepath, items[v]); break; } } @@ -1456,7 +1456,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { if (entry->flag.trade_restriction > ITR_ALL) { ShowWarning("itemdb_validate_entry: Invalid trade restriction flag 0x%x for item %d (%s) in '%s', defaulting to none.\n", - entry->flag.trade_restriction, entry->nameid, entry->jname, source); + (unsigned int)entry->flag.trade_restriction, entry->nameid, entry->jname, source); entry->flag.trade_restriction = ITR_NONE; } diff --git a/src/map/log.c b/src/map/log.c index 942acb706..f757faf43 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -66,7 +66,7 @@ char log_picktype2char(e_log_pick_type type) { } // should not get here, fallback - ShowDebug("log_picktype2char: Unknown pick type %d.\n", type); + ShowDebug("log_picktype2char: Unknown pick type %u.\n", type); return 'X'; } @@ -81,7 +81,7 @@ char log_chattype2char(e_log_chat_type type) { } // should not get here, fallback - ShowDebug("log_chattype2char: Unknown chat type %d.\n", type); + ShowDebug("log_chattype2char: Unknown chat type %u.\n", type); return 'O'; } diff --git a/src/map/map.c b/src/map/map.c index c17dd9b0e..f2e47be74 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5017,7 +5017,7 @@ void read_map_zone_db(void) { zone_e = libconfig->setting_get_elem(zones, i); if (!libconfig->setting_lookup_string(zone_e, "name", &zonename)) { - ShowError("map_zone_db: missing zone name, skipping... (%s:%d)\n", + ShowError("map_zone_db: missing zone name, skipping... (%s:%u)\n", config_setting_source_file(zone_e), config_setting_source_line(zone_e)); libconfig->setting_remove_elem(zones,i);/* remove from the tree */ --zone_count; diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index 9bf67196e..46962ac14 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -97,7 +97,7 @@ bool mapreg_setreg(int64 uid, int val) { if (name[1] != '@' && !mapreg->skip_insert) {// write new variable to database char tmp_str[(SCRIPT_VARNAME_LENGTH+1)*2+1]; SQL->EscapeStringLen(map->mysql_handle, tmp_str, name, strnlen(name, SCRIPT_VARNAME_LENGTH+1)); - if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%d')", mapreg->table, tmp_str, i, val) ) + if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%u','%d')", mapreg->table, tmp_str, i, val) ) Sql_ShowDebug(map->mysql_handle); } i64db_put(mapreg->regs.vars, uid, m); @@ -111,7 +111,7 @@ bool mapreg_setreg(int64 uid, int val) { i64db_remove(mapreg->regs.vars, uid); if( name[1] != '@' ) {// Remove from database because it is unused. - if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg->table, name, i) ) + if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%u'", mapreg->table, name, i) ) Sql_ShowDebug(map->mysql_handle); } } @@ -136,7 +136,7 @@ bool mapreg_setregstr(int64 uid, const char* str) { if( i ) script->array_update(&mapreg->regs, uid, true); if(name[1] != '@') { - if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg->table, name, i) ) + if (SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%u'", mapreg->table, name, i)) Sql_ShowDebug(map->mysql_handle); } if( (m = i64db_get(mapreg->regs.vars, uid)) ) { @@ -170,7 +170,7 @@ bool mapreg_setregstr(int64 uid, const char* str) { char tmp_str2[255*2+1]; SQL->EscapeStringLen(map->mysql_handle, tmp_str, name, strnlen(name, SCRIPT_VARNAME_LENGTH+1)); SQL->EscapeStringLen(map->mysql_handle, tmp_str2, str, strnlen(str, 255)); - if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%s')", mapreg->table, tmp_str, i, tmp_str2) ) + if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%u','%s')", mapreg->table, tmp_str, i, tmp_str2) ) Sql_ShowDebug(map->mysql_handle); } i64db_put(mapreg->regs.vars, uid, m); diff --git a/src/map/mob.c b/src/map/mob.c index 2ae54ba69..b2f52f634 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -744,7 +744,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int data.class_ = class_; if( (x <= 0 || y <= 0) && !map->search_freecell(NULL, m, &x, &y, -1,-1, 1) ) { - ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, map->list[m].name); + ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %u) at map %s\n", class_, bg_id, map->list[m].name); return 0; } @@ -4681,7 +4681,7 @@ void mob_readchatdb(void) { if( j < 2 || str[2]==NULL) { - ShowError("mob_readchatdb: Insufficient number of fields for skill at %s, line %d\n", arc, lines); + ShowError("mob_readchatdb: Insufficient number of fields for skill at %s, line %u\n", arc, lines); continue; } diff --git a/src/map/npc.c b/src/map/npc.c index 23b0b9555..837bc6871 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1564,8 +1564,8 @@ void npc_market_fromsql(void) { * Saves persistent NPC Market Data into SQL **/ void npc_market_tosql(struct npc_data *nd, unsigned short index) { - if( SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%d')", - map->npc_market_data_db, nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty) ) + if (SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%u')", + map->npc_market_data_db, nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty)) Sql_ShowDebug(map->mysql_handle); } /** @@ -1771,7 +1771,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po if ((int64)shop[i].value * amount > INT_MAX) { ShowWarning("npc_cashshop_buy: Item '%s' (%d) price overflow attempt!\n", item->name, nameid); - ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%d, amount:%d)\n", + ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%u, amount:%d)\n", nd->exname, map->list[nd->bl.m].name, nd->bl.x, nd->bl.y, sd->status.name, sd->status.account_id, sd->status.char_id, shop[i].value, amount); @@ -2501,7 +2501,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con if( p ) { // :: size_t len = p-name; if( len > NAME_LENGTH ) { - ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH); + ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %d characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH); safestrncpy(nd->name, name, sizeof(nd->name)); } else { memcpy(nd->name, name, len); @@ -2509,12 +2509,12 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con } len = strlen(p+2); if( len > NAME_LENGTH ) - ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH); + ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %d characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH); safestrncpy(nd->exname, p+2, sizeof(nd->exname)); } else {// size_t len = strlen(name); if( len > NAME_LENGTH ) - ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH); + ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %d characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH); safestrncpy(nd->name, name, sizeof(nd->name)); safestrncpy(nd->exname, name, sizeof(nd->exname)); } @@ -4536,7 +4536,7 @@ int npc_script_event(struct map_session_data* sd, enum npce_event type) if (type == NPCE_MAX) return 0; if (!sd) { - ShowError("npc_script_event: NULL sd. Event Type %d\n", type); + ShowError("npc_script_event: NULL sd. Event Type %u\n", type); return 0; } for (i = 0; istatus.name, sd->status.account_id, sd->status.char_id, CONVIP(ip), sd->group_id); @@ -7196,7 +7196,7 @@ int pc_resetstate(struct map_session_data* sd) // New statpoint table used here - Dexity if (sd->status.base_level > MAX_LEVEL) { //pc->statp[] goes out of bounds, can't reset! - ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n", + ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%u) is greater than the max level supported (%d)\n", sd->status.account_id, sd->status.char_id, sd->status.base_level, MAX_LEVEL); return 0; } @@ -9565,7 +9565,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) pos = pc->equippoint(sd,n); //With a few exceptions, item should go in all specified slots. if(battle_config.battle_log) - ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos); + ShowInfo("equip %d(%d) %x:%x\n", sd->status.inventory[n].nameid, n, (unsigned int)(id ? id->equip : 0), (unsigned int)req_pos); if(!pc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris] // FIXME: pc->isequip: equip level failure uses 2 instead of 0 clif->equipitemack(sd,n,0,EIA_FAIL); // fail @@ -9773,7 +9773,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) } if(battle_config.battle_log) - ShowInfo("unequip %d %x:%x\n",n,pc->equippoint(sd,n),sd->status.inventory[n].equip); + ShowInfo("unequip %d %x:%x\n", n, (unsigned int)(pc->equippoint(sd, n)), sd->status.inventory[n].equip); if(!sd->status.inventory[n].equip){ //Nothing to unequip clif->unequipitemack(sd,n,0,UIA_FAIL); @@ -10927,7 +10927,7 @@ int pc_readdb(void) { } maxlv = atoi(split[0]); if (maxlv > MAX_LEVEL) { - ShowWarning("pc_readdb: Specified max level %u for job %d is beyond server's limit (%u).\n ", maxlv, job_id, MAX_LEVEL); + ShowWarning("pc_readdb: Specified max level %u for job %d is beyond server's limit (%d).\n ", maxlv, job_id, MAX_LEVEL); maxlv = MAX_LEVEL; } count++; @@ -11353,7 +11353,7 @@ void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update if( sd->vending[i].amount == 0 ) continue; - if (SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s` (`char_id`,`itemkey`,`amount`,`price`) VALUES ('%d','%d','%d','%d')", + if (SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s` (`char_id`,`itemkey`,`amount`,`price`) VALUES ('%d','%d','%d','%u')", map->autotrade_data_db, sd->status.char_id, sd->status.cart[sd->vending[i].index].id, diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index 72935adc3..b325a8ed7 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -110,7 +110,7 @@ static void read_config(void) { snprintf(temp, sizeof(temp), "Group %d", id); if ((name = config_setting_add(group, "name", CONFIG_TYPE_STRING)) == NULL || !config_setting_set_string(name, temp)) { - ShowError("pc_groups:read_config: failed to set missing group name, id=%d, skipping... (%s:%d)\n", + ShowError("pc_groups:read_config: failed to set missing group name, id=%d, skipping... (%s:%u)\n", id, config_setting_source_file(group), config_setting_source_line(group)); --i; --group_count; @@ -446,7 +446,7 @@ void do_init_pc_groups(void) { for(i = 0; i < len; i++) { unsigned int p; if( ( p = pc_groups_add_permission(pc_g_defaults[i].name) ) != pc_g_defaults[i].permission ) - ShowError("do_init_pc_groups: %s error : %d != %d\n",pc_g_defaults[i].name,p,pc_g_defaults[i].permission); + ShowError("do_init_pc_groups: %s error : %u != %u\n", pc_g_defaults[i].name, p, pc_g_defaults[i].permission); } /** diff --git a/src/map/quest.c b/src/map/quest.c index 7e2421c79..bf0a76b16 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -409,7 +409,7 @@ int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type } return 0; default: - ShowError("quest_check_quest: Unknown parameter %d",type); + ShowError("quest_check_quest: Unknown parameter %u", type); break; } diff --git a/src/map/script.c b/src/map/script.c index 4ae667b37..946b50955 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -235,9 +235,9 @@ void script_reportsrc(struct script_state *st) { break; default: if( bl->m >= 0 ) - ShowDebug("Source (Non-NPC type %d): name %s at %s (%d,%d)\n", bl->type, status->get_name(bl), map->list[bl->m].name, bl->x, bl->y); + ShowDebug("Source (Non-NPC type %u): name %s at %s (%d,%d)\n", bl->type, status->get_name(bl), map->list[bl->m].name, bl->x, bl->y); else - ShowDebug("Source (Non-NPC type %d): name %s (invisible/not on a map)\n", bl->type, status->get_name(bl)); + ShowDebug("Source (Non-NPC type %u): name %s (invisible/not on a map)\n", bl->type, status->get_name(bl)); break; } } @@ -265,7 +265,7 @@ void script_reportdata(struct script_data* data) case C_NAME:// reference if( reference_tovariable(data) ) {// variable const char* name = reference_getname(data); - ShowDebug("Data: variable name='%s' index=%d\n", name, reference_getindex(data)); + ShowDebug("Data: variable name='%s' index=%u\n", name, reference_getindex(data)); } else if( reference_toconstant(data) ) {// constant ShowDebug("Data: constant name='%s' value=%d\n", reference_getname(data), reference_getconstant(data)); } else if( reference_toparam(data) ) {// param @@ -1566,32 +1566,32 @@ const char* parse_curly_close(const char* p) char label[256]; int l; // Remove temporary variables - sprintf(label,"__setr $@__SW%x_VAL,0;",script->syntax.curly[pos].index); + sprintf(label, "__setr $@__SW%x_VAL,0;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // Go to the end pointer unconditionally - sprintf(label,"goto __SW%x_FIN;",script->syntax.curly[pos].index); + sprintf(label,"goto __SW%x_FIN;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // You are here labeled - sprintf(label,"__SW%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); script->set_label(l,script->pos, p); if(script->syntax.curly[pos].flag) { //Exists default - sprintf(label,"goto __SW%x_DEF;",script->syntax.curly[pos].index); + sprintf(label,"goto __SW%x_DEF;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; } // Label end - sprintf(label,"__SW%x_FIN",script->syntax.curly[pos].index); + sprintf(label,"__SW%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos, p); linkdb_final(&script->syntax.curly[pos].case_label); // free the list of case label @@ -1621,16 +1621,16 @@ const char* parse_syntax(const char* p) int pos = script->syntax.curly_count - 1; while(pos >= 0) { if(script->syntax.curly[pos].type == TYPE_DO) { - sprintf(label,"goto __DO%x_FIN;",script->syntax.curly[pos].index); + sprintf(label, "goto __DO%x_FIN;", (unsigned int)script->syntax.curly[pos].index); break; } else if(script->syntax.curly[pos].type == TYPE_FOR) { - sprintf(label,"goto __FR%x_FIN;",script->syntax.curly[pos].index); + sprintf(label, "goto __FR%x_FIN;", (unsigned int)script->syntax.curly[pos].index); break; } else if(script->syntax.curly[pos].type == TYPE_WHILE) { - sprintf(label,"goto __WL%x_FIN;",script->syntax.curly[pos].index); + sprintf(label, "goto __WL%x_FIN;", (unsigned int)script->syntax.curly[pos].index); break; } else if(script->syntax.curly[pos].type == TYPE_SWITCH) { - sprintf(label,"goto __SW%x_FIN;",script->syntax.curly[pos].index); + sprintf(label, "goto __SW%x_FIN;", (unsigned int)script->syntax.curly[pos].index); break; } pos--; @@ -1664,13 +1664,13 @@ const char* parse_syntax(const char* p) char *np; if(script->syntax.curly[pos].count != 1) { //Jump for FALLTHRU - sprintf(label,"goto __SW%x_%xJ;",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label,"goto __SW%x_%xJ;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // You are here labeled - sprintf(label,"__SW%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); script->set_label(l,script->pos, p); } @@ -1702,7 +1702,7 @@ const char* parse_syntax(const char* p) if(*p != ':') disp_error_message("parse_syntax: expect ':'",p); sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;", - v,script->syntax.curly[pos].index,script->syntax.curly[pos].index,script->syntax.curly[pos].count+1); + v, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count+1); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; // Bad I do not parse twice p2 = script->parse_line(label); @@ -1710,7 +1710,7 @@ const char* parse_syntax(const char* p) script->syntax.curly_count--; if(script->syntax.curly[pos].count != 1) { // Label after the completion of FALLTHRU - sprintf(label,"__SW%x_%xJ",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label, "__SW%x_%xJ", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); script->set_label(l,script->pos,p); } @@ -1719,7 +1719,7 @@ const char* parse_syntax(const char* p) disp_error_message("parse_syntax: dup 'case'",p); linkdb_insert(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v), (void*)1); - sprintf(label,"__setr $@__SW%x_VAL,0;",script->syntax.curly[pos].index); + sprintf(label, "__setr $@__SW%x_VAL,0;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); @@ -1733,14 +1733,14 @@ const char* parse_syntax(const char* p) int pos = script->syntax.curly_count - 1; while(pos >= 0) { if(script->syntax.curly[pos].type == TYPE_DO) { - sprintf(label,"goto __DO%x_NXT;",script->syntax.curly[pos].index); + sprintf(label, "goto __DO%x_NXT;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[pos].flag = 1; //Flag put the link for continue break; } else if(script->syntax.curly[pos].type == TYPE_FOR) { - sprintf(label,"goto __FR%x_NXT;",script->syntax.curly[pos].index); + sprintf(label, "goto __FR%x_NXT;", (unsigned int)script->syntax.curly[pos].index); break; } else if(script->syntax.curly[pos].type == TYPE_WHILE) { - sprintf(label,"goto __WL%x_NXT;",script->syntax.curly[pos].index); + sprintf(label, "goto __WL%x_NXT;", (unsigned int)script->syntax.curly[pos].index); break; } pos--; @@ -1777,18 +1777,18 @@ const char* parse_syntax(const char* p) if(*p != ':') { disp_error_message("parse_syntax: need ':'",p); } - sprintf(label,"__SW%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label, "__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); script->set_label(l,script->pos,p); // Skip to the next link w/o condition - sprintf(label,"goto __SW%x_%x;",script->syntax.curly[pos].index,script->syntax.curly[pos].count+1); + sprintf(label, "goto __SW%x_%x;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count + 1); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // The default label - sprintf(label,"__SW%x_DEF",script->syntax.curly[pos].index); + sprintf(label, "__SW%x_DEF", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); @@ -1806,7 +1806,7 @@ const char* parse_syntax(const char* p) script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++; script->syntax.curly[script->syntax.curly_count].flag = 0; // Label of the (do) form here - sprintf(label,"__DO%x_BGN",script->syntax.curly[script->syntax.curly_count].index); + sprintf(label, "__DO%x_BGN", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); l=script->add_str(label); script->set_label(l,script->pos,p); script->syntax.curly_count++; @@ -1837,7 +1837,7 @@ const char* parse_syntax(const char* p) script->syntax.curly_count--; // Form the start of label decision - sprintf(label,"__FR%x_J",script->syntax.curly[pos].index); + sprintf(label, "__FR%x_J", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); @@ -1847,7 +1847,7 @@ const char* parse_syntax(const char* p) ; } else { // Skip to the end point if the condition is false - sprintf(label,"__FR%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__FR%x_FIN", (unsigned int)script->syntax.curly[pos].index); script->addl(script->add_str("__jump_zero")); script->addc(C_ARG); p=script->parse_expr(p); @@ -1860,13 +1860,13 @@ const char* parse_syntax(const char* p) p++; // Skip to the beginning of the loop - sprintf(label,"goto __FR%x_BGN;",script->syntax.curly[pos].index); + sprintf(label, "goto __FR%x_BGN;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // Labels to form the next loop - sprintf(label,"__FR%x_NXT",script->syntax.curly[pos].index); + sprintf(label, "__FR%x_NXT", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); @@ -1879,13 +1879,13 @@ const char* parse_syntax(const char* p) script->parse_syntax_for_flag = 0; // Skip to the determination process conditions - sprintf(label,"goto __FR%x_J;",script->syntax.curly[pos].index); + sprintf(label, "goto __FR%x_J;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // Loop start labeling - sprintf(label,"__FR%x_BGN",script->syntax.curly[pos].index); + sprintf(label, "__FR%x_BGN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); return p; @@ -1926,7 +1926,7 @@ const char* parse_syntax(const char* p) ++script->syntax.curly_count; // Jump over the function code - sprintf(label, "goto __FN%x_FIN;", script->syntax.curly[script->syntax.curly_count-1].index); + sprintf(label, "goto __FN%x_FIN;", (unsigned int)script->syntax.curly[script->syntax.curly_count-1].index); script->syntax.curly[script->syntax.curly_count].type = TYPE_NULL; ++script->syntax.curly_count; script->parse_line(label); @@ -1965,7 +1965,7 @@ const char* parse_syntax(const char* p) script->syntax.curly[script->syntax.curly_count].count = 1; script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++; script->syntax.curly[script->syntax.curly_count].flag = 0; - sprintf(label,"__IF%x_%x",script->syntax.curly[script->syntax.curly_count].index,script->syntax.curly[script->syntax.curly_count].count); + sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[script->syntax.curly_count].index, (unsigned int)script->syntax.curly[script->syntax.curly_count].count); script->syntax.curly_count++; script->addl(script->add_str("__jump_zero")); script->addc(C_ARG); @@ -1989,7 +1989,7 @@ const char* parse_syntax(const char* p) script->syntax.curly[script->syntax.curly_count].count = 1; script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++; script->syntax.curly[script->syntax.curly_count].flag = 0; - sprintf(label,"$@__SW%x_VAL",script->syntax.curly[script->syntax.curly_count].index); + sprintf(label, "$@__SW%x_VAL", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); script->syntax.curly_count++; script->addl(script->add_str("__setr")); script->addc(C_ARG); @@ -2017,12 +2017,12 @@ const char* parse_syntax(const char* p) script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++; script->syntax.curly[script->syntax.curly_count].flag = 0; // Form the start of label decision - sprintf(label,"__WL%x_NXT",script->syntax.curly[script->syntax.curly_count].index); + sprintf(label, "__WL%x_NXT", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); l=script->add_str(label); script->set_label(l,script->pos,p); // Skip to the end point if the condition is false - sprintf(label,"__WL%x_FIN",script->syntax.curly[script->syntax.curly_count].index); + sprintf(label, "__WL%x_FIN", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); script->syntax.curly_count++; script->addl(script->add_str("__jump_zero")); script->addc(C_ARG); @@ -2068,13 +2068,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag) script->parse_nextline(false, p); // Skip to the last location if - sprintf(label,"goto __IF%x_FIN;",script->syntax.curly[pos].index); + sprintf(label, "goto __IF%x_FIN;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // Put the label of the location - sprintf(label,"__IF%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); script->set_label(l,script->pos,p); @@ -2091,7 +2091,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) if(*p != '(') { disp_error_message("need '('",p); } - sprintf(label,"__IF%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count); + sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); script->addl(script->add_str("__jump_zero")); script->addc(C_ARG); p=script->parse_expr(p); @@ -2112,7 +2112,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // Close if script->syntax.curly_count--; // Put the label of the final location - sprintf(label,"__IF%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__IF%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); if(script->syntax.curly[pos].flag == 1) { @@ -2125,7 +2125,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) if(script->syntax.curly[pos].flag) { // (Come here continue) to form the label here - sprintf(label,"__DO%x_NXT",script->syntax.curly[pos].index); + sprintf(label, "__DO%x_NXT", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); } @@ -2145,7 +2145,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // do-block end is a new line script->parse_nextline(false, p); - sprintf(label,"__DO%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__DO%x_FIN", (unsigned int)script->syntax.curly[pos].index); script->addl(script->add_str("__jump_zero")); script->addc(C_ARG); p=script->parse_expr(p); @@ -2154,13 +2154,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag) script->addc(C_FUNC); // Skip to the starting point - sprintf(label,"goto __DO%x_BGN;",script->syntax.curly[pos].index); + sprintf(label, "goto __DO%x_BGN;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // Form label of the end point conditions - sprintf(label,"__DO%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__DO%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); p = script->skip_space(p); @@ -2176,13 +2176,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag) script->parse_nextline(false, p); // Skip to the next loop - sprintf(label,"goto __FR%x_NXT;",script->syntax.curly[pos].index); + sprintf(label, "goto __FR%x_NXT;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // End for labeling - sprintf(label,"__FR%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__FR%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); script->syntax.curly_count--; @@ -2192,13 +2192,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag) script->parse_nextline(false, p); // Skip to the decision while - sprintf(label,"goto __WL%x_NXT;",script->syntax.curly[pos].index); + sprintf(label, "goto __WL%x_NXT;", (unsigned int)script->syntax.curly[pos].index); script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL; script->parse_line(label); script->syntax.curly_count--; // End while labeling - sprintf(label,"__WL%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__WL%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); script->syntax.curly_count--; @@ -2211,7 +2211,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) script->syntax.curly_count--; // Put the label of the location - sprintf(label,"__FN%x_FIN",script->syntax.curly[pos].index); + sprintf(label, "__FN%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); script->set_label(l,script->pos,p); script->syntax.curly_count--; @@ -3615,7 +3615,7 @@ void script_free_state(struct script_state* st) { struct map_session_data *sd = st->rid ? map->id2sd(st->rid) : NULL; if(st->bk_st) {// backup was not restored - ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); + ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%u, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); } if(sd && sd->st == st) { //Current script is aborted. @@ -4262,7 +4262,7 @@ void script_detach_state(struct script_state* st, bool dequeue_event) { npc->event_dequeue(sd); } } else if(st->bk_st) { // rid was set to 0, before detaching the script state - ShowError("script_detach_state: Found previous script state without attached player (rid=%d, oid=%d, state=%d, bk_npcid=%d)\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); + ShowError("script_detach_state: Found previous script state without attached player (rid=%d, oid=%d, state=%u, bk_npcid=%d)\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); script->reportsrc(st->bk_st); script->free_state(st->bk_st); @@ -4282,7 +4282,7 @@ void script_attach_state(struct script_state* st) { { if(st->bk_st) {// there is already a backup - ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); + ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%u, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); } st->bk_st = sd->st; st->bk_npcid = sd->npc_id; @@ -4431,7 +4431,7 @@ void run_script_main(struct script_state *st) { break; default: - ShowError("unknown command : %d @ %d\n",c,st->pos); + ShowError("unknown command : %u @ %d\n", c, st->pos); st->state=END; break; } @@ -7002,7 +7002,7 @@ BUILDIN(checkweight) // item id id = itemdb->exists(script_getnum(st, i)); } else { - ShowError("buildin_checkweight: invalid type for argument '%d'.\n", i); + ShowError("buildin_checkweight: invalid type for argument '%u'.\n", i); script_pushint(st,0); return false; } @@ -9793,7 +9793,7 @@ BUILDIN(monster) size = script_getnum(st, 9); if (size > 3) { - ShowWarning("buildin_monster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_); + ShowWarning("buildin_monster: Attempted to spawn non-existing size %u for monster class %d\n", size, class_); return false; } } @@ -9802,7 +9802,7 @@ BUILDIN(monster) { ai = script_getnum(st, 10); if (ai > AI_FLORA) { - ShowWarning("buildin_monster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_); + ShowWarning("buildin_monster: Attempted to spawn non-existing ai %u for monster class %d\n", ai, class_); return false; } } @@ -9898,7 +9898,7 @@ BUILDIN(areamonster) { if (script_hasdata(st, 11)) { size = script_getnum(st, 11); if (size > 3) { - ShowWarning("buildin_monster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_); + ShowWarning("buildin_monster: Attempted to spawn non-existing size %u for monster class %d\n", size, class_); return false; } } @@ -9906,7 +9906,7 @@ BUILDIN(areamonster) { if (script_hasdata(st, 12)) { ai = script_getnum(st, 12); if (ai > AI_FLORA) { - ShowWarning("buildin_monster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_); + ShowWarning("buildin_monster: Attempted to spawn non-existing ai %u for monster class %d\n", ai, class_); return false; } } @@ -12219,7 +12219,7 @@ BUILDIN(flagemblem) if( nd == NULL ) { ShowError("script:flagemblem: npc %d not found\n", st->oid); } else if( nd->subtype != SCRIPT ) { - ShowError("script:flagemblem: unexpected subtype %d for npc %d '%s'\n", nd->subtype, st->oid, nd->exname); + ShowError("script:flagemblem: unexpected subtype %u for npc %d '%s'\n", nd->subtype, st->oid, nd->exname); } else { bool changed = ( nd->u.scr.guild_id != g_id )?true:false; nd->u.scr.guild_id = g_id; @@ -15936,7 +15936,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle) } } if( i == max_rows && max_rows < SQL->NumRows(handle) ) { - ShowWarning("script:query_sql: Only %d/%u rows have been stored.\n", max_rows, (unsigned int)SQL->NumRows(handle)); + ShowWarning("script:query_sql: Only %u/%u rows have been stored.\n", max_rows, (unsigned int)SQL->NumRows(handle)); script->reportsrc(st); } @@ -16726,7 +16726,7 @@ BUILDIN(unitattack) { BL_UCAST(BL_PET, unit_bl)->target_id = target_bl->id; break; default: - ShowError("script:unitattack: unsupported source unit type %d\n", unit_bl->type); + ShowError("script:unitattack: unsupported source unit type %u\n", unit_bl->type); script_pushint(st, 0); return false; } @@ -17084,7 +17084,7 @@ BUILDIN(checkcell) { cell_chk type = (cell_chk)script_getnum(st,5); if ( m == -1 ) { - ShowWarning("checkcell: Attempted to run on unexsitent map '%s', type %d, x/y %d,%d\n",script_getstr(st,2),type,x,y); + ShowWarning("checkcell: Attempted to run on unexsitent map '%s', type %u, x/y %d,%d\n", script_getstr(st,2), type, x, y); return true; } @@ -17110,7 +17110,7 @@ BUILDIN(setcell) { int x,y; if ( m == -1 ) { - ShowWarning("setcell: Attempted to run on unexistent map '%s', type %d, x1/y1 - %d,%d | x2/y2 - %d,%d\n",script_getstr(st, 2),type,x1,y1,x2,y2); + ShowWarning("setcell: Attempted to run on unexistent map '%s', type %u, x1/y1 - %d,%d | x2/y2 - %d,%d\n", script_getstr(st, 2), type, x1, y1, x2, y2); return true; } diff --git a/src/map/skill.c b/src/map/skill.c index c70b94cd5..a13e3a071 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5123,7 +5123,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { unit->set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1); if(battle_config.skill_log && battle_config.skill_log&src->type) - ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n", + ShowInfo("Type %u, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n", src->type, src->id, ud->skill_id, ud->skill_lv, target->id); map->freeblock_lock(); @@ -10023,7 +10023,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) } if(battle_config.skill_log && battle_config.skill_log&src->type) - ShowInfo("Type %d, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n", + ShowInfo("Type %u, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n", src->type, src->id, ud->skill_id, ud->skill_lv, ud->skillx, ud->skilly); if (ud->walktimer != INVALID_TIMER) @@ -11950,7 +11950,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 case UNT_MANHOLE: return 0; default: - ShowError("skill_unit_onplace_timer: interval error (unit id %x)\n", sg->unit_id); + ShowError("skill_unit_onplace_timer: interval error (unit id %x)\n", (unsigned int)sg->unit_id); return 0; } } @@ -16519,7 +16519,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list } if (j == -1) { - ShowWarning ("skill_unitgrouptickset_search: tickset is full. ( failed for skill '%s' on unit %d )\n",skill->get_name(group->skill_id),bl->type); + ShowWarning ("skill_unitgrouptickset_search: tickset is full. ( failed for skill '%s' on unit %u )\n", skill->get_name(group->skill_id), bl->type); j = id % MAX_SKILLUNITGROUPTICKSET; } diff --git a/src/map/status.c b/src/map/status.c index 39df5c693..c4c0e39a2 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -11016,7 +11016,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { st = status->get_status_data(bl); if (!sc || (sce = sc->data[type]) == NULL) { - ShowDebug("status_change_timer: Null pointer id: %d data: %"PRIdPTR" bl-type: %d\n", id, data, bl->type); + ShowDebug("status_change_timer: Null pointer id: %d data: %"PRIdPTR" bl-type: %u\n", id, data, bl->type); return 0; } diff --git a/src/map/unit.c b/src/map/unit.c index bea0913d2..9a698b77e 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -937,7 +937,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) if (x<0 || y<0) { //Random map position. if (!map->search_freecell(NULL, m, &x, &y, -1, -1, 1)) { - ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y); + ShowWarning("unit_warp failed. Unit Id:%d/Type:%u, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y); return 2; } @@ -947,7 +947,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) if (!map->search_freecell(NULL, m, &x, &y, 4, 4, 1)) { //Can't find a nearby cell - ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y); + ShowWarning("unit_warp failed. Unit Id:%d/Type:%u, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y); return 2; } } -- cgit v1.2.3-60-g2f50