summaryrefslogtreecommitdiff
path: root/graphics/jbigkit/files/patch-warnings
blob: 760c0d74bc7e7013b9f1f7b9d51739aaaa4ecb38 (plain) (blame)
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
--- pbmtools/pbmtojbg85.c	2014-03-27 14:47:15.000000000 -0400
+++ pbmtools/pbmtojbg85.c	2014-04-08 09:00:16.000000000 -0400
@@ -71,8 +71,12 @@
   if (c != EOF) {
     ungetc(c, f);
-    fscanf(f, "%lu", &i);
-  }
+    if (fscanf(f, "%lu", &i) == 1)
+       return i;
+    else
+       fprintf(stderr, "%s: corrupt input", progname);
+  } else
+       fprintf(stderr, "%s: unexpected end of input", progname);
 
-  return i;
+  return -1;
 }

--- pbmtools/pbmtojbg.c	2014-03-27 14:47:15.000000000 -0400
+++ pbmtools/pbmtojbg.c	2014-04-08 09:00:16.000000000 -0400
@@ -87,8 +87,12 @@
   if (c != EOF) {
     ungetc(c, f);
-    fscanf(f, "%lu", &i);
-  }
+    if (fscanf(f, "%lu", &i) == 1)
+       return i;
+    else
+       fprintf(stderr, "%s: corrupt input", progname);
+  } else
+       fprintf(stderr, "%s: unexpected end of input", progname);
 
-  return i;
+  return -1;
 }