From: Jason Woofenden Date: Sun, 22 May 2016 21:02:35 +0000 (-0400) Subject: work around compiler warnings in high score read X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=commitdiff_plain;h=98d1a3e9455c7c64c4b219c9022d0e1efb187cf3;hp=58c8abeeaed3bf55b7ac7451776e7100dbdad969 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...) --- 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