From: Martin Baute Date: Mon, 7 Mar 2016 20:32:49 +0000 (+0100) Subject: Fixing compiler warnings. X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=36ba0291514888662188f6a64fe34e9acad1c298 Fixing compiler warnings. --- diff --git a/functions/stdio/_PDCLIB_print.c b/functions/stdio/_PDCLIB_print.c index e832782..8e2a68b 100644 --- a/functions/stdio/_PDCLIB_print.c +++ b/functions/stdio/_PDCLIB_print.c @@ -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 ) ) diff --git a/functions/stdio/_PDCLIB_scan.c b/functions/stdio/_PDCLIB_scan.c index f3846b6..9940fc0 100644 --- a/functions/stdio/_PDCLIB_scan.c +++ b/functions/stdio/_PDCLIB_scan.c @@ -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) == '%' ) { diff --git a/testing/_PDCLIB_iotest.h b/testing/_PDCLIB_iotest.h index f0b425d..155ac16 100644 --- a/testing/_PDCLIB_iotest.h +++ b/testing/_PDCLIB_iotest.h @@ -15,7 +15,10 @@ #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 )