File: 020_scanf.diff

package info (click to toggle)
geki2 2.0.3-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 3,388 kB
  • sloc: ansic: 2,585; sh: 859; makefile: 54
file content (39 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From: Debian Games Team <pkg-games-devel@lists.alioth.debian.org>
Date: Sun, 13 May 2018 16:37:14 +0200
Subject: _scanf

===================================================================
---
 src/load.c    | 2 +-
 src/ranking.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/load.c b/src/load.c
index e771eca..284ed8f 100644
--- a/src/load.c
+++ b/src/load.c
@@ -216,7 +216,7 @@ void LoadStageData(void)
     else
       StageDatas = (StageData **)KXL_Realloc(StageDatas, sizeof(StageData *) * (Root->StageMax + 1));
     StageDatas[Root->StageMax] = (StageData *)KXL_Malloc(sizeof(StageData));
-    sscanf(buff,"%d, %d, %d, %d",
+    sscanf(buff,"%"SCNu16", %"SCNu8", %"SCNu8", %"SCNu16,
            &(StageDatas[Root->StageMax]->Time),
            &(StageDatas[Root->StageMax]->CreateNo),
            &(StageDatas[Root->StageMax]->Max),
diff --git a/src/ranking.c b/src/ranking.c
index 4e3df6c..2ed04af 100644
--- a/src/ranking.c
+++ b/src/ranking.c
@@ -39,9 +39,9 @@ void ReadScore(void)
   Uint16 i;
 
   if ((fp = fopen(DATA_PATH "/.score", "r"))) {
-    fscanf(fp, "%d", &(Root->HiScore));
+    fscanf(fp, "%"SCNu32, &(Root->HiScore));
     for (i = 0; i < 5; i ++)
-      fscanf(fp, "%d %d %d %s",
+      fscanf(fp, "%"SCNu32" %"SCNu8" %"SCNu8" %s",
 	     &(Ranking[i]->Score),
 	     &(Ranking[i]->Stage),
 	     &(Ranking[i]->Loop),