summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c11
-rw-r--r--src/char/int_auction.c2
-rw-r--r--src/char/int_pet.c27
-rw-r--r--src/char/int_storage.c17
-rw-r--r--src/char/inter.c10
-rw-r--r--src/char/inter.h2
6 files changed, 32 insertions, 37 deletions
diff --git a/src/char/char.c b/src/char/char.c
index fe17fd14f..9abb17257 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3146,9 +3146,8 @@ int parse_frommap(int fd)
int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2);
struct online_char_data* character;
- if (size - 13 != sizeof(struct mmo_charstatus))
- {
- ShowError("parse_from_map (save-char): Size mismatch! %d != %d\n", size-13, sizeof(struct mmo_charstatus));
+ if (size - 13 != sizeof(struct mmo_charstatus)) {
+ ShowError("parse_from_map (save-char): Size mismatch! %d != %"PRIuS"\n", size-13, sizeof(struct mmo_charstatus));
RFIFOSKIP(fd,size);
break;
}
@@ -5025,7 +5024,7 @@ int char_lan_config_read(const char *lancfgName)
if ((line[0] == '/' && line[1] == '/') || line[0] == '\n' || line[1] == '\n')
continue;
- if(sscanf(line,"%[^:]: %[^:]:%[^:]:%[^\r\n]", w1, w2, w3, w4) != 4) {
+ if (sscanf(line,"%63[^:]: %63[^:]:%63[^:]:%63[^\r\n]", w1, w2, w3, w4) != 4) {
ShowWarning("Error syntax of configuration file %s in line %d.\n", lancfgName, line_num);
continue;
@@ -5074,7 +5073,7 @@ void sql_config_read(const char* cfgName)
if(line[0] == '/' && line[1] == '/')
continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
+ if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2)
continue;
if(!strcmpi(w1,"char_db"))
@@ -5182,7 +5181,7 @@ int char_config_read(const char* cfgName)
if (line[0] == '/' && line[1] == '/')
continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
+ if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2)
continue;
remove_control_chars(w1);
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index 8cd870647..ddfef68c2 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -115,7 +115,7 @@ unsigned int auction_create(struct auction_data *auction)
auction->auction_id = (unsigned int)SQL->StmtLastInsertId(stmt);
auction->auction_end_timer = timer->add( timer->gettick() + tick , auction_end_timer, auction->auction_id, 0);
- ShowInfo("New Auction %u | time left %u ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
+ ShowInfo("New Auction %u | time left %"PRId64" ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
CREATE(auction_, struct auction_data, 1);
memcpy(auction_, auction, sizeof(struct auction_data));
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;
}
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index bf7b76da0..882d9b2a5 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -220,16 +220,13 @@ int mapif_parse_SaveGuildStorage(int fd)
guild_id = RFIFOL(fd,8);
len = RFIFOW(fd,2);
- if( sizeof(struct guild_storage) != len - 12 )
- {
- ShowError("inter storage: data size error %d != %d\n", sizeof(struct guild_storage), len - 12);
- }
- else
- {
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id) )
+ if (sizeof(struct guild_storage) != len - 12) {
+ ShowError("inter storage: data size mismatch: %d != %"PRIuS"\n", len - 12, sizeof(struct guild_storage));
+ } else {
+ if (SQL_ERROR == SQL->Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id)) {
Sql_ShowDebug(sql_handle);
- else if( SQL->NumRows(sql_handle) > 0 )
- {// guild exists
+ } else if(SQL->NumRows(sql_handle) > 0) {
+ // guild exists
SQL->FreeResult(sql_handle);
guild_storage_tosql(guild_id, (struct guild_storage*)RFIFOP(fd,12));
mapif_save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 0);
@@ -397,7 +394,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd)
if( j )
StrBuf->AppendStr(&buf, ",");
- StrBuf->Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
+ StrBuf->Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%"PRIu64"'",
guild_id, items[j].nameid, items[j].amount, items[j].equip, items[j].identify, items[j].refine,
items[j].attribute, items[j].expire_time, items[j].bound, items[j].unique_id);
for( s = 0; s < MAX_SLOTS; ++s )
diff --git a/src/char/inter.c b/src/char/inter.c
index c2d8de37a..ab53fc6da 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -107,7 +107,7 @@ bool msg_config_read(const char *cfg_name, bool allow_override) {
while(fgets(line, sizeof(line), fp) ) {
if (line[0] == '/' && line[1] == '/')
continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
+ if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2)
continue;
if (strcmpi(w1, "import") == 0)
@@ -562,7 +562,8 @@ void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) {
* @param msg Message format string
* @param ... Additional parameters for (v)sprinf
*/
-void inter_msg_to_fd(int fd, int u_fd, int aid, char* msg, ...) {
+void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5)));
+void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) {
va_list ap;
va_start(ap,msg);
inter_vmsg_to_fd(fd, u_fd, aid, msg, ap);
@@ -917,9 +918,8 @@ static int inter_config_read(const char* cfgName)
return 1;
}
- while(fgets(line, sizeof(line), fp))
- {
- i = sscanf(line, "%[^:]: %[^\r\n]", w1, w2);
+ while (fgets(line, sizeof(line), fp)) {
+ i = sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2);
if(i != 2)
continue;
diff --git a/src/char/inter.h b/src/char/inter.h
index ab2478ae6..0bea21363 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -18,7 +18,7 @@ int mapif_send_gmaccounts(void);
int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason);
void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state);
-int inter_log(char *fmt,...);
+int inter_log(char *fmt, ...) __attribute__((format(printf, 1, 2)));
int inter_vlog(char *fmt, va_list ap);
#define inter_cfgName "conf/inter-server.conf"