From ab3e3ceaedcd52a4a743543af43fb2eb853815d1 Mon Sep 17 00:00:00 2001 From: Eric Branlund Date: Sat, 4 Apr 2020 15:52:26 -0700 Subject: [PATCH] Replaced instances of fprintf(fd, s) with fputs(s, fd) as has been done in 2.2.1.7; that avoids potential problems if s contains something that looks like a format specifier and gets rid of compiler warnings. --- src/cmd4.c | 16 ++++++++-------- src/files.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cmd4.c b/src/cmd4.c index d6a960661..25fc38b10 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -5906,7 +5906,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message) tmpfff = my_fopen(buf, "r"); if (!tmpfff) { for (i = 0; html_head[i]; i++) - fprintf(fff, html_head[i]); + fputs(html_head[i], fff); } else { yomikomu = 0; @@ -5968,7 +5968,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message) if (!tmpfff) { for (i = 0; html_foot[i]; i++) - fprintf(fff, html_foot[i]); + fputs(html_foot[i], fff); } else { rewind(tmpfff); @@ -8727,7 +8727,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff) quest[i].name, quest[i].level, note); #endif - fprintf(fff, tmp_str); + fputs(tmp_str, fff); if (quest[i].status == QUEST_STATUS_COMPLETED) { @@ -8736,7 +8736,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff) #else sprintf(tmp_str, " Quest Completed - Unrewarded\n"); #endif - fprintf(fff, tmp_str); + fputs(tmp_str, fff); } else { @@ -8790,7 +8790,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff) } /* Print the current random quest */ - if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str); + if (rand_tmp_str[0]) fputs(rand_tmp_str, fff); #ifdef JP if (!total) fprintf(fff, " ¤Ê¤·\n"); @@ -8881,7 +8881,7 @@ void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[]) #endif } - fprintf(fff, tmp_str); + fputs(tmp_str, fff); } } #ifdef JP @@ -8955,7 +8955,7 @@ void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[]) quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev); #endif } - fprintf(fff, tmp_str); + fputs(tmp_str, fff); } } #ifdef JP @@ -8997,7 +8997,7 @@ static void do_cmd_knowledge_quests_wiz_random(FILE *fff) sprintf(tmp_str, " %s (%d, %s)\n", quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name); #endif - fprintf(fff, tmp_str); + fputs(tmp_str, fff); } } #ifdef JP diff --git a/src/files.c b/src/files.c index 5b5a8e240..e995de5c8 100644 --- a/src/files.c +++ b/src/files.c @@ -4262,7 +4262,7 @@ errr make_character_dump(FILE *fff) for (i=0;i<=col;i++) { - fprintf(fff, p[i]); + fputs(p[i], fff); } fputc('\n', fff); -- 2.11.0