From 98d1a3e9455c7c64c4b219c9022d0e1efb187cf3 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Sun, 22 May 2016 17:02:35 -0400 Subject: [PATCH] work around compiler warnings in high score read Check return values of fscanf() (just bail early if it fails) Don't use titles as scanf templates, compiler can't seem to figure out that these come from string literals. Insteadd use fscanf(..., strlen...) --- score.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/score.c b/score.c index 8648679..8c5bc59 100644 --- a/score.c +++ b/score.c @@ -64,15 +64,21 @@ void read_high_score_table() { FILE *f; - int i, j; + int i, j, ret; f = open_score_file("r"); if(f) { // If the file exists, read from it for(j=0; j<2; j++) { - fscanf(f, titles[j]); + ret = fseek(f, strlen(titles[j]), SEEK_CUR); + if (ret != 0) { + break; + } for(i = 0; i