summaryrefslogtreecommitdiff
path: root/src/char/int_pet.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/char/int_pet.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/char/int_pet.c')
-rw-r--r--src/char/int_pet.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index 0f7c683f8..bf7961462 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -249,22 +249,21 @@ int mapif_save_pet(int fd, int account_id, struct s_pet *data) {
int len;
RFIFOHEAD(fd);
len=RFIFOW(fd, 2);
- if(sizeof(struct s_pet)!=len-8) {
- ShowError("inter pet: data size error %d %d\n", sizeof(struct s_pet), len-8);
+ if (sizeof(struct s_pet) != len-8) {
+ ShowError("inter pet: data size mismatch: %d != %"PRIuS"\n", len-8, sizeof(struct s_pet));
+ return 0;
}
- else{
- if(data->hungry < 0)
- data->hungry = 0;
- else if(data->hungry > 100)
- data->hungry = 100;
- if(data->intimate < 0)
- data->intimate = 0;
- else if(data->intimate > 1000)
- data->intimate = 1000;
- inter_pet_tosql(data->pet_id,data);
- mapif_save_pet_ack(fd, account_id, 0);
- }
+ if (data->hungry < 0)
+ data->hungry = 0;
+ else if (data->hungry > 100)
+ data->hungry = 100;
+ if (data->intimate < 0)
+ data->intimate = 0;
+ else if (data->intimate > 1000)
+ data->intimate = 1000;
+ inter_pet_tosql(data->pet_id,data);
+ mapif_save_pet_ack(fd, account_id, 0);
return 0;
}