summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2010-01-10 15:54:35 +0100
committerBardur Arantsson <bardur@scientician.net>2010-01-10 19:32:02 +0100
commit3d46b09fe21dfdea43b0e4e224363ecb67a0fb9b (patch)
treef0ca4de091927fe4ddf2b19a105a4afabcd45c63 /src
parentc2d791994cc8b30d9e6aa2c71a94998dfacc07d4 (diff)
Clean up sprintf() usage to always use a "%s" format string.
Diffstat (limited to 'src')
-rw-r--r--src/dungeon.c2
-rw-r--r--src/files.c2
-rw-r--r--src/lua_bind.c2
-rw-r--r--src/plots.c2
-rw-r--r--src/spells1.c3
-rw-r--r--src/squeltch.c2
-rw-r--r--src/util.c6
7 files changed, 10 insertions, 9 deletions
diff --git a/src/dungeon.c b/src/dungeon.c
index 39f1b0ce..6025ee45 100644
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -1489,7 +1489,7 @@ static void process_world(void)
{
char buf[20];
- sprintf(buf, get_day(bst(YEAR, turn) + START_YEAR));
+ sprintf(buf, "%s", get_day(bst(YEAR, turn) + START_YEAR));
cmsg_format(TERM_L_GREEN,
"Today it is %s of the %s year of the third age.",
get_month_name(bst(DAY, turn), wizard, FALSE), buf);
diff --git a/src/files.c b/src/files.c
index 8c934c8c..d4c09bb1 100644
--- a/src/files.c
+++ b/src/files.c
@@ -4856,7 +4856,7 @@ void process_player_name(bool sf)
/* Terminate */
tmp[k] = '\0';
- sprintf(player_base, tmp);
+ sprintf(player_base, "%s", tmp);
/* Require a "base" name */
if (!player_base[0]) strcpy(player_base, "PLAYER");
diff --git a/src/lua_bind.c b/src/lua_bind.c
index daa51f70..04ed8c97 100644
--- a/src/lua_bind.c
+++ b/src/lua_bind.c
@@ -490,7 +490,7 @@ bool alloc_room(int by0, int bx0, int ysize, int xsize, int *y1, int *x1, int *y
/* Files */
void lua_print_hook(cptr str)
{
- fprintf(hook_file, str);
+ fprintf(hook_file, "%s", str);
}
diff --git a/src/plots.c b/src/plots.c
index 8588a96b..4acc4af3 100644
--- a/src/plots.c
+++ b/src/plots.c
@@ -93,7 +93,7 @@ hooks_chain* add_hook(int h_idx, hook_type hook, cptr name)
{
MAKE(new, hooks_chain);
new->hook = hook;
- sprintf(new->name, name);
+ sprintf(new->name, "%s", name);
#ifdef DEBUG_HOOK
if (wizard) cmsg_format(TERM_VIOLET, "HOOK ADD: %s", name);
if (take_notes) add_note(format("HOOK ADD: %s", name), 'D');
diff --git a/src/spells1.c b/src/spells1.c
index 8f9c38c3..4d088f6c 100644
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -7312,7 +7312,8 @@ static bool project_p(int who, int r, int y, int x, int dam, int typ, int a_rad)
if (who == -2)
{
- sprintf(killer, t_name + t_info[cave[p_ptr->py][p_ptr->px].t_idx].name);
+ sprintf(killer, "%s",
+ t_name + t_info[cave[p_ptr->py][p_ptr->px].t_idx].name);
}
/* Analyze the damage */
diff --git a/src/squeltch.c b/src/squeltch.c
index 89104f63..cd52dc1a 100644
--- a/src/squeltch.c
+++ b/src/squeltch.c
@@ -399,7 +399,7 @@ void do_cmd_automatizer()
if (!max) continue;
- sprintf(name, string_exec_lua(format("return __rules[%d].table.args.name", sel)));
+ sprintf(name, "%s", string_exec_lua(format("return __rules[%d].table.args.name", sel)));
if (input_box("New name?", hgt / 2, wid / 2, name, 15))
{
exec_lua(format("auto_aux:rename_rule(%d, '%s')", sel, name));
diff --git a/src/util.c b/src/util.c
index d3152d8f..b199a2a2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -4468,7 +4468,7 @@ cptr get_month_name(int day, bool full, bool compact)
{
char buf2[20];
- sprintf(buf2, get_day(day + 1));
+ sprintf(buf2, "%s", get_day(day + 1));
if (full) sprintf(buf, "%s (%s day)", month_name[i], buf2);
else sprintf(buf, "%s", month_name[i]);
break;
@@ -4479,8 +4479,8 @@ cptr get_month_name(int day, bool full, bool compact)
char buf2[20];
char buf3[20];
- sprintf(buf2, get_day(day + 1 - month_day[i]));
- sprintf(buf3, get_day(day + 1));
+ sprintf(buf2, "%s", get_day(day + 1 - month_day[i]));
+ sprintf(buf3, "%s", get_day(day + 1));
if (full) sprintf(buf, "%s day of %s (%s day)", buf2, month_name[i], buf3);
else if (compact) sprintf(buf, "%s day of %s", buf2, month_name[i]);