summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-08-07 03:39:13 +0200
committerHaru <haru@dotalux.com>2014-08-07 05:37:38 +0200
commitc45e3fa9793a273a0eab40d1626bcda7d710552c (patch)
tree4f6c9d47770a15c8cbfe065f7ee9203f77e57022 /src/map/intif.c
parentcaf89724767465ecf339c391bb6d7a937d563fb2 (diff)
downloadhercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.gz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.bz2
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.xz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.zip
Corrected several format-string errors through the code
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index 432154f04..be82a7583 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1111,8 +1111,8 @@ void intif_parse_LoadGuildStorage(int fd)
ShowWarning("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", flag?sd->status.account_id:0, flag?sd->status.char_id:0);
return;
}
- if( RFIFOW(fd,2)-13 != sizeof(struct guild_storage) ){
- ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-13 , sizeof(struct guild_storage));
+ if (RFIFOW(fd,2)-13 != sizeof(struct guild_storage)) {
+ ShowError("intif_parse_LoadGuildStorage: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd,2)-13, sizeof(struct guild_storage));
gstor->storage_status = 0;
return;
}
@@ -1137,16 +1137,16 @@ void intif_parse_PartyCreated(int fd)
}
// Receive party info
-void intif_parse_PartyInfo(int fd)
-{
- if( RFIFOW(fd,2) == 12 ){
+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));
party->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4));
return;
}
- if( RFIFOW(fd,2) != 8+sizeof(struct party) )
- ShowError("intif: party info : data size error (char_id=%d party_id=%d packet_len=%d expected_len=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party));
+ 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",
+ RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party));
party->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4));
}
@@ -1195,13 +1195,14 @@ void intif_parse_GuildCreated(int fd) {
// ACK guild infos
void intif_parse_GuildInfo(int fd) {
- if(RFIFOW(fd,2) == 8) {
+ if (RFIFOW(fd,2) == 8) {
ShowWarning("intif: guild noinfo %d\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 error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4);
+ 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);
guild->recv_info((struct guild *)RFIFOP(fd,4));
}
@@ -1295,8 +1296,9 @@ 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 error\n %d %d %d",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12);
+ 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);
guild->position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12));
}
@@ -1345,9 +1347,9 @@ void intif_parse_RecvPetData(int fd) {
struct s_pet p;
int len;
len=RFIFOW(fd,2);
- if(sizeof(struct s_pet)!=len-9) {
- if(battle_config.etc_log)
- ShowError("intif: pet data: data size error %d %d\n",sizeof(struct s_pet),len-9);
+ if (sizeof(struct s_pet) != len-9) {
+ if (battle_config.etc_log)
+ ShowError("intif: pet data: data size mismatch %d != %"PRIuS"\n", len-9, sizeof(struct s_pet));
} else {
memcpy(&p,RFIFOP(fd,9),sizeof(struct s_pet));
pet->recv_petdata(RFIFOL(fd,4),&p,RFIFOB(fd,8));
@@ -1392,9 +1394,9 @@ void intif_parse_ChangeNameOk(int fd)
void intif_parse_CreateHomunculus(int fd) {
int len = RFIFOW(fd,2)-9;
- if(sizeof(struct s_homunculus)!=len) {
- if(battle_config.etc_log)
- ShowError("intif: create homun data: data size error %d != %d\n",sizeof(struct s_homunculus),len);
+ if (sizeof(struct s_homunculus) != len) {
+ if (battle_config.etc_log)
+ ShowError("intif: create homun data: data size mismatch %d != %"PRIuS"\n", len, sizeof(struct s_homunculus));
return;
}
homun->recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8)) ;
@@ -1403,9 +1405,9 @@ void intif_parse_CreateHomunculus(int fd) {
void intif_parse_RecvHomunculusData(int fd) {
int len = RFIFOW(fd,2)-9;
- if(sizeof(struct s_homunculus)!=len) {
- if(battle_config.etc_log)
- ShowError("intif: homun data: data size error %d %d\n",sizeof(struct s_homunculus),len);
+ if (sizeof(struct s_homunculus) != len) {
+ if (battle_config.etc_log)
+ ShowError("intif: homun data: data size mismatch %d != %"PRIuS"\n", len, sizeof(struct s_homunculus));
return;
}
homun->recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8));
@@ -1571,7 +1573,7 @@ void intif_parse_MailInboxReceived(int fd) {
}
if (RFIFOW(fd,2) - 9 != sizeof(struct mail_data)) {
- ShowError("intif_parse_MailInboxReceived: data size error %d %d\n", RFIFOW(fd,2) - 9, sizeof(struct mail_data));
+ ShowError("intif_parse_MailInboxReceived: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd,2) - 9, sizeof(struct mail_data));
return;
}
@@ -1632,7 +1634,7 @@ void intif_parse_MailGetAttach(int fd) {
}
if (RFIFOW(fd,2) - 12 != sizeof(struct item)) {
- ShowError("intif_parse_MailGetAttach: data size error %d %d\n", RFIFOW(fd,2) - 16, sizeof(struct item));
+ ShowError("intif_parse_MailGetAttach: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd,2) - 16, sizeof(struct item));
return;
}
@@ -1749,7 +1751,7 @@ void intif_parse_MailSend(int fd) {
bool fail;
if( RFIFOW(fd,2) - 4 != sizeof(struct mail_message) ) {
- ShowError("intif_parse_MailSend: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct mail_message));
+ ShowError("intif_parse_MailSend: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd,2) - 4, sizeof(struct mail_message));
return;
}
@@ -1838,8 +1840,8 @@ void intif_parse_AuctionRegister(int fd) {
struct map_session_data *sd;
struct auction_data auction;
- if( RFIFOW(fd,2) - 4 != sizeof(struct auction_data) ) {
- ShowError("intif_parse_AuctionRegister: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct auction_data));
+ if (RFIFOW(fd,2) - 4 != sizeof(struct auction_data)) {
+ ShowError("intif_parse_AuctionRegister: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd,2) - 4, sizeof(struct auction_data));
return;
}
@@ -1988,9 +1990,9 @@ int intif_mercenary_create(struct s_mercenary *merc)
void intif_parse_MercenaryReceived(int fd) {
int len = RFIFOW(fd,2) - 5;
- if( sizeof(struct s_mercenary) != len ) {
- if( battle_config.etc_log )
- ShowError("intif: create mercenary data size error %d != %d\n", sizeof(struct s_mercenary), len);
+ if (sizeof(struct s_mercenary) != len) {
+ if (battle_config.etc_log)
+ ShowError("intif: create mercenary data size mismatch %d != %"PRIuS"\n", len, sizeof(struct s_mercenary));
return;
}
@@ -2068,9 +2070,9 @@ int intif_elemental_create(struct s_elemental *ele)
void intif_parse_ElementalReceived(int fd) {
int len = RFIFOW(fd,2) - 5;
- if( sizeof(struct s_elemental) != len ) {
- if( battle_config.etc_log )
- ShowError("intif: create elemental data size error %d != %d\n", sizeof(struct s_elemental), len);
+ if (sizeof(struct s_elemental) != len) {
+ if (battle_config.etc_log)
+ ShowError("intif: create elemental data size mismatch %d != %"PRIuS"\n", len, sizeof(struct s_elemental));
return;
}