X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_print.c;h=c14516f6913dfbba39ccace1efd4664b7024c3b5;hp=03623948d45ae8856548a07f0b4137196d9af3c3;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=af7b48b211498ff4ef7aba6db89b90b760cdd3d5 diff --git a/functions/stdio/_PDCLIB_print.c b/functions/stdio/_PDCLIB_print.c index 0362394..c14516f 100644 --- a/functions/stdio/_PDCLIB_print.c +++ b/functions/stdio/_PDCLIB_print.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* _PDCLIB_print( const char *, struct _PDCLIB_status_t * ) This file is part of the Public Domain C Library (PDCLib). @@ -16,7 +14,7 @@ #include #ifndef REGTEST -#include <_PDCLIB_io.h> +#include "_PDCLIB_io.h" /* Using an integer's bits as flags for both the conversion flags and length modifiers. @@ -503,7 +501,8 @@ int _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status ) /* TODO: Check for invalid flag combinations. */ if ( status->flags & E_unsigned ) { - uintmax_t value; + /* TODO: Marking the default case _PDCLIB_UNREACHABLE breaks %ju test driver? */ + uintmax_t value = 0; switch ( status->flags & E_TYPES ) { case E_char: @@ -538,7 +537,7 @@ int _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status ) } else { - intmax_t value; + intmax_t value = 0; switch ( status->flags & E_TYPES ) { case E_char: @@ -568,6 +567,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 ) ) @@ -590,7 +591,7 @@ int _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status ) #define _PDCLIB_FILEID "_PDCLIB/print.c" #define _PDCLIB_STRINGIO -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" #ifndef REGTEST static size_t testcb( void *p, const char *buf, size_t size ) @@ -616,7 +617,7 @@ static int testprintf( char * buffer, const char * format, ... ) status.write = testcb; va_start( status.arg, format ); memset( buffer, '\0', 100 ); - if ( _PDCLIB_print( format, &status ) != strlen( format ) ) + if ( _PDCLIB_print( format, &status ) != (int)strlen( format ) ) { printf( "_PDCLIB_print() did not return end-of-specifier on '%s'.\n", format ); ++TEST_RESULTS;