aboutsummaryrefslogtreecommitdiffstats
path: root/scoretbl.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-03-28 05:51:43 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-03-28 05:51:43 +0000
commit97117a4ed0666afd9bac1b332412a9137487651a (patch)
tree0df8fa396f60e64bdb57c3e5cf4c9ee0f0108547 /scoretbl.c
parente98e408926dda6874d884f13df0682251cd7a08f (diff)
downloadgrv-97117a4ed0666afd9bac1b332412a9137487651a.tar.gz
grv-97117a4ed0666afd9bac1b332412a9137487651a.tar.xz
grv-97117a4ed0666afd9bac1b332412a9137487651a.zip
More fixes for Windows compatibility: avoid %ll formats; fix the new
networking abstraction
Diffstat (limited to 'scoretbl.c')
-rw-r--r--scoretbl.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/scoretbl.c b/scoretbl.c
index c9932b5..7bd3469 100644
--- a/scoretbl.c
+++ b/scoretbl.c
@@ -165,7 +165,7 @@ void highscore_parse(void *f, char (*mygets)(char *, int, void *))
{
char line[MAXLINE], pname[MAXLINE];
uint64_t gameid;
- long long score;
+ int64_t score;
long time_ms;
int lvl;
unsigned char *pptr;
@@ -174,17 +174,17 @@ void highscore_parse(void *f, char (*mygets)(char *, int, void *))
if ( !strchr(line, '\n') )
return; /* Something bogus here... */
- if ( sscanf(line, "TS %llx %lld %d %[0-9a-f]",
+ if ( sscanf(line, "TS %" SCNx64 " %" SCNd64 " %d %[0-9a-f]",
&gameid, &score, &lvl, pname) == 4 ) {
highscore_add_total(gameid, score, lvl-1, &pptr);
if ( pptr ) {
strncpy(pptr, unquote(pname), PLAYER_LEN+1);
pptr[PLAYER_LEN] = '\0';
}
- } else if ( sscanf(line, "LS %llx %d %lld",
+ } else if ( sscanf(line, "LS %" SCNx64 " %d %" SCNd64,
&gameid, &lvl, &score) == 3 ) {
highscore_add_level_score(gameid, lvl-1, score);
- } else if ( sscanf(line, "LT %llx %d %ld",
+ } else if ( sscanf(line, "LT %" SCNx64 " %d %" SCNd32,
&gameid, &lvl, &time_ms) == 3 ) {
highscore_add_level_time(gameid, lvl-1, time_ms);
}
@@ -203,10 +203,10 @@ int highscore_write(void *f, int (*myputs)(char *, void *))
for ( i = 0 ; i < MAX_BEST ; i++ ) {
if ( bests.total[i].score ) {
- sprintf(buffer, "TS %llx %lld %d %s\n", bests.total[i].gameid,
- bests.total[i].score, bests.total[i].endlvl+1,
- quote(bests.total[i].player));
- if ( myputs(buffer, f) )
+ sprintf(buffer, "TS %" PRIx64 " %" PRId64 " %d %s\n",
+ bests.total[i].gameid, bests.total[i].score,
+ bests.total[i].endlvl+1, quote(bests.total[i].player));
+ if ( myputs(buffer, f) == EOF )
return -1;
}
}
@@ -214,16 +214,18 @@ int highscore_write(void *f, int (*myputs)(char *, void *))
for ( i = 0 ; i < MAX_LEVEL ; i++ ) {
for ( j = 0 ; j < MAX_PER_LEVEL ; j++ ) {
if ( bests.level[i].score[j].score )
- sprintf(buffer, "LS %llx %d %lld\n", bests.level[i].score[j].gameid,
+ sprintf(buffer, "LS %" PRIx64 " %d %" PRId64 "\n",
+ bests.level[i].score[j].gameid,
i+1, bests.level[i].score[j].score);
- if ( myputs(buffer, f) )
+ if ( myputs(buffer, f) == EOF )
return -1;
}
for ( j = 0 ; j < MAX_PER_LEVEL ; j++ ) {
if ( bests.level[i].time_ms[j].time_ms != NO_TIME )
- sprintf(f, "LT %llx %d %d\n", bests.level[i].time_ms[j].gameid,
+ sprintf(buffer, "LT %" PRIx64 " %d %" PRId32 "\n",
+ bests.level[i].time_ms[j].gameid,
i+1, bests.level[i].time_ms[j].time_ms);
- if ( myputs(buffer, f) )
+ if ( myputs(buffer, f) == EOF )
return -1;
}
}