]> pd.if.org Git - pdclib/commitdiff
Fixing compiler warnings.
authorMartin Baute <solar@rootdirectory.de>
Mon, 7 Mar 2016 20:32:49 +0000 (21:32 +0100)
committerMartin Baute <solar@rootdirectory.de>
Mon, 7 Mar 2016 20:32:49 +0000 (21:32 +0100)
functions/stdio/_PDCLIB_print.c
functions/stdio/_PDCLIB_scan.c
testing/_PDCLIB_iotest.h

index e832782fd32c45c37fc2a2e1342cff3729608540..8e2a68b4319afe13e8dec966a360b01d7981e07d 100644 (file)
@@ -530,6 +530,8 @@ int _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status )
                     break;
                 case E_intmax:
                     value = va_arg( status->arg, uintmax_t );
+                default:
+                    _PDCLIB_UNREACHABLE;
             }
             if ( !int2base( value, status ) )
                 return -1;
@@ -566,6 +568,8 @@ int _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status )
                 case E_intmax:
                     value = va_arg( status->arg, intmax_t );
                     break;
+                default:
+                    _PDCLIB_UNREACHABLE;
             }
 
             if (!int2base( value, status ) )
index f3846b6967fdeff77c926637b51500cbec1b9735..9940fc028e07b1b9166fc50972fd4d0032dfdf5d 100644 (file)
@@ -16,6 +16,8 @@
 
 #ifndef REGTEST
 
+#include "_PDCLIB_io.h"
+
 /* Using an integer's bits as flags for both the conversion flags and length
    modifiers.
 */
@@ -116,7 +118,7 @@ static bool IN_SCANSET( const char * scanlist, const char * end_scanlist, int rc
 const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
 {
     /* generic input character */
-    int rc;
+    int rc = EOF;
     const char * orig_spec = spec;
     if ( *(++spec) == '%' )
     {
index f0b425ddf31683f4b1083e3638add93c6dd1564a..155ac16d51036c3935227ec85df331186403aee7 100644 (file)
 #if defined( _PDCLIB_FILEIO )
    #define GET_RESULT \
       rewind( target ); \
-      fread( result_buffer, 1, actual_rc, target );
+      if ( (int)fread( result_buffer, 1, actual_rc, target ) != actual_rc ) \
+      { \
+          fprintf( stderr, "GET_RESULT failed." ); \
+      }
    #define RESULT_MISMATCH( act, exp ) strcmp( result_buffer, exp ) != 0
    #define RESULT_STRING( tgt ) result_buffer
 #elif defined( _PDCLIB_STRINGIO )