fixes for gcc 5.4
Stefan Schuermans

Stefan Schuermans commited on 2016-09-04 11:52:29
Showing 1 changed files, with 6 additions and 6 deletions.


make it compile with gcc 5.4
problem found during preparation of "Solinger Lichterfest 2016"
  together with "Dr Stahl" at "zWerkstatt"
... ...
@@ -17,7 +17,7 @@ st_bd_fmt * bd_fmt_load( char * filename )
17 17
 {
18 18
   FILE * p_file;
19 19
   st_bd_fmt * p_bd_fmt;
20
-  int cnt, newline;
20
+  int cnt, z1, z2, newline;
21 21
   unsigned short x, y;
22 22
   char buffer[16];
23 23
 
... ...
@@ -46,11 +46,11 @@ st_bd_fmt * bd_fmt_load( char * filename )
46 46
   }
47 47
 
48 48
   //read width and height
49
-  fscanf( p_file, "%*[ \t\r]" );
49
+  z1 = fscanf( p_file, "%*[ \t\r]" );
50 50
   cnt = fscanf( p_file, "%hu%*[ \t\r]%hu", &p_bd_fmt->width, &p_bd_fmt->height );
51
-  fscanf( p_file, "%*[ \t\r]" );
51
+  z2 = fscanf( p_file, "%*[ \t\r]" );
52 52
   newline = fgetc( p_file ) == '\n';
53
-  if( cnt != 2 || ! newline )
53
+  if( z1 != 0 || cnt != 2 || z2 != 0 || ! newline )
54 54
   {
55 55
     free( p_bd_fmt );
56 56
     fclose( p_file );
... ...
@@ -159,9 +159,9 @@ st_bd_fmt * bd_fmt_load( char * filename )
159 159
     if( x < p_bd_fmt->width )
160 160
       break;
161 161
     //read newline
162
-    fscanf( p_file, "%*[ \t\r]" );
162
+    z1 = fscanf( p_file, "%*[ \t\r]" );
163 163
     newline = fgetc( p_file ) == '\n';
164
-    if( ! newline )
164
+    if( z1 != 0 || ! newline )
165 165
     {
166 166
       if( ! feof( p_file ) )
167 167
         printf( "bd_fmt: too much pixels specified for row %d\n", y );
168 168