File: spurious-static-analysis-warning

package info (click to toggle)
bogl 0.1.18-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,704 kB
  • sloc: ansic: 7,800; makefile: 214; perl: 26; sh: 10
file content (24 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
bdftobogl.c: Rework to avoid letting static analyzers think there's a bug
(Closes: Bug#737606).

diff --git a/bdftobogl.c b/bdftobogl.c
index 538498e..80fda82 100644
--- a/bdftobogl.c
+++ b/bdftobogl.c
@@ -96,13 +96,13 @@ main (int argc, char *argv[])
   printf ("static int _%s_index[%d] = {\n", font->name, index_size);
   i = 0;
   while (i < index_size)
-    if (font->index[i] != 0 && i < index_size - 1)
+    if (font->index[i] == 0)
+      printf ("  %d,\n", font->index[i++]);
+    else if (i < index_size - 1)
       {
 	printf ("  0x%x, %d,\n", font->index[i], font->index[i+1]);
 	i += 2;
       }
-    else if (font->index[i] == 0)
-      printf ("  %d,\n", font->index[i++]);
     else
       printf ("  %d, /* Hm... */\n", font->index[i++]);
   printf ("};\n");