diff options
author | Haru <haru@dotalux.com> | 2015-01-12 20:11:21 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-01-12 20:46:31 +0100 |
commit | 6a5636ddf61e4fca9d258c11ebead182564f234f (patch) | |
tree | e6ba32523f8ba10400cb350ba366586101fdc388 | |
parent | 60da9eab8463052d9196dae774aa91251f06db66 (diff) | |
download | hercules-6a5636ddf61e4fca9d258c11ebead182564f234f.tar.gz hercules-6a5636ddf61e4fca9d258c11ebead182564f234f.tar.bz2 hercules-6a5636ddf61e4fca9d258c11ebead182564f234f.tar.xz hercules-6a5636ddf61e4fca9d258c11ebead182564f234f.zip |
Fixed some -Wformat-security warnings
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/char/int_auction.c | 2 | ||||
-rw-r--r-- | src/char/int_guild.c | 6 | ||||
-rw-r--r-- | src/char/int_mail.c | 14 | ||||
-rw-r--r-- | src/char/int_quest.c | 6 | ||||
-rw-r--r-- | src/char/int_storage.c | 4 | ||||
-rw-r--r-- | src/map/atcommand.c | 4 |
6 files changed, 16 insertions, 20 deletions
diff --git a/src/char/int_auction.c b/src/char/int_auction.c index e28240ca6..5d42e6398 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -188,7 +188,7 @@ void inter_auctions_fromsql(void) StrBuf->Printf(&buf, ",`card%d`", i); StrBuf->Printf(&buf, " FROM `%s` ORDER BY `auction_id` DESC", auction_db); - if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); diff --git a/src/char/int_guild.c b/src/char/int_guild.c index a5623f83d..7af01f883 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -215,7 +215,7 @@ int inter_guild_tosql(struct guild *g,int flag) StrBuf->Printf(&buf, "`guild_lv`=%d, `skill_point`=%d, `exp`=%"PRIu64", `next_exp`=%u, `max_member`=%d", g->guild_lv, g->skill_point, g->exp, g->next_exp, g->max_member); } StrBuf->Printf(&buf, " WHERE `guild_id`=%d", g->guild_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, "%s", StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); } @@ -531,7 +531,7 @@ int inter_guild_castle_tosql(struct guild_castle *gc) for (i = 0; i < MAX_GUARDIANS; ++i) StrBuf->Printf(&buf, ", `visibleG%d`='%d'", i, gc->guardian[i].visible); - if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) Sql_ShowDebug(inter->sql_handle); else if(save_log) ShowInfo("Saved guild castle (%d)\n", gc->castle_id); @@ -557,7 +557,7 @@ struct guild_castle* inter_guild_castle_fromsql(int castle_id) for (i = 0; i < MAX_GUARDIANS; ++i) StrBuf->Printf(&buf, ", `visibleG%d`", i); StrBuf->Printf(&buf, " FROM `%s` WHERE `castle_id`='%d'", guild_castle_db, castle_id); - if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) { + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return NULL; diff --git a/src/char/int_mail.c b/src/char/int_mail.c index 2c0a85f33..0e5043e14 100644 --- a/src/char/int_mail.c +++ b/src/char/int_mail.c @@ -45,7 +45,7 @@ static int inter_mail_fromsql(int char_id, struct mail_data* md) StrBuf->Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' AND `status` < 3 ORDER BY `id` LIMIT %d", mail_db, char_id, MAIL_MAX_INBOX + 1); - if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); @@ -160,16 +160,13 @@ static bool inter_mail_loadmessage(int mail_id, struct mail_message* msg) StrBuf->Printf(&buf, ",`card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `id` = '%d'", mail_db, mail_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) - || SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) - { + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) + || SQL_SUCCESS != SQL->NextRow(inter->sql_handle)) { Sql_ShowDebug(inter->sql_handle); SQL->FreeResult(inter->sql_handle); StrBuf->Destroy(&buf); return false; - } - else - { + } else { char* data; SQL->GetData(inter->sql_handle, 0, &data, NULL); msg->id = atoi(data); @@ -253,8 +250,7 @@ static bool inter_mail_DeleteAttach(int mail_id) StrBuf->Printf(&buf, ", `card%d` = '0'", i); StrBuf->Printf(&buf, " WHERE `id` = '%d'", mail_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) - { + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); diff --git a/src/char/int_quest.c b/src/char/int_quest.c index b993cbc14..dd3d4e1bf 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -60,7 +60,7 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) memset(&tmp_quest, 0, sizeof(struct quest)); - if (SQL_ERROR == SQL->StmtPrepare(stmt, StrBuf->Value(&buf)) + if (SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SQL->StmtExecute(stmt) || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, 0, NULL, NULL) @@ -142,7 +142,7 @@ bool mapif_quest_add(int char_id, struct quest qd) StrBuf->Printf(&buf, ", '%d'", qd.count[i]); } StrBuf->AppendStr(&buf, ")"); - if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) { + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return false; @@ -171,7 +171,7 @@ bool mapif_quest_update(int char_id, struct quest qd) } StrBuf->Printf(&buf, " WHERE `quest_id` = '%d' AND `char_id` = '%d'", qd.quest_id, char_id); - if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) { + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return false; diff --git a/src/char/int_storage.c b/src/char/int_storage.c index d64e11b89..f2dd4d47a 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -51,7 +51,7 @@ int inter_storage_fromsql(int account_id, struct storage_data* p) StrBuf->Printf(&buf, ",`card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `account_id`='%d' ORDER BY `nameid`", storage_db, account_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + if (SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); @@ -109,7 +109,7 @@ int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) StrBuf->Printf(&buf, ",`card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `guild_id`='%d' ORDER BY `nameid`", guild_storage_db, guild_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 215ecbc70..a78b644a9 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -626,9 +626,9 @@ ACMD(who) { if (map_id < 0) { if (count == 0) - StrBuf->Printf(&buf, msg_txt(28)); // No player found. + StrBuf->AppendStr(&buf, msg_txt(28)); // No player found. else if (count == 1) - StrBuf->Printf(&buf, msg_txt(29)); // 1 player found. + StrBuf->AppendStr(&buf, msg_txt(29)); // 1 player found. else StrBuf->Printf(&buf, msg_txt(30), count); // %d players found. } else { |