From b9288b1836d2c9c7d92ca49805acb96551261b55 Mon Sep 17 00:00:00 2001 From: borutr Date: Tue, 3 Mar 2009 19:37:25 +0000 Subject: [PATCH] * device/lib/printf_large.c: fixed bug #2656821: bug in printf git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5406 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ device/lib/printf_large.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00b0be65..d7d1e2a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-03-03 Borut Razem + + * device/lib/printf_large.c: fixed bug #2656821: bug in printf + 2009-03-03 Raphael Neider * device/lib/pic/libdev/Makefile.in: build device-specific diff --git a/device/lib/printf_large.c b/device/lib/printf_large.c index f7be3aad..fba74ff0 100644 --- a/device/lib/printf_large.c +++ b/device/lib/printf_large.c @@ -137,14 +137,14 @@ typedef union /*--------------------------------------------------------------------------*/ #ifdef SDCC_STACK_AUTO - #define OUTPUT_2DIGITS( B ) { output_2digits( B, lower_case, output_char, p ); charsOutputted += 2; } + #define OUTPUT_2DIGITS( B ) { output_2digits( B, lower_case, output_char, p ); charsOutputted += 2; } static void output_2digits( unsigned char b, BOOL lower_case, pfn_outputchar output_char, void* p ) { output_digit( b>>4, lower_case, output_char, p ); output_digit( b&0x0F, lower_case, output_char, p ); } #else - #define OUTPUT_2DIGITS( B ) output_2digits( B ) + #define OUTPUT_2DIGITS( B ) output_2digits( B ) static void output_2digits( unsigned char b ) { output_digit( b>>4 ); @@ -211,7 +211,7 @@ static void calculate_digit( unsigned char radix ) #define DEFAULT_FLOAT_PRECISION 6 #ifdef SDCC_STACK_AUTO -#define OUTPUT_FLOAT(F, W, D, L, Z, S, P) output_float(F, W, D, L, Z, S, P, output_char, p) +#define OUTPUT_FLOAT(F, W, D, L, Z, S, P) output_float(F, W, D, L, Z, S, P, output_char, p) static unsigned char output_float (float f, unsigned char reqWidth, signed char reqDecimals, @@ -225,7 +225,7 @@ output_float (float f, unsigned char reqWidth, char fpBuffer[128]; #endif #else -#define OUTPUT_FLOAT(F, W, D, L, Z, S, P) output_float(F, W, D, L, Z, S, P) +#define OUTPUT_FLOAT(F, W, D, L, Z, S, P) output_float(F, W, D, L, Z, S, P) static void output_float (float f, unsigned char reqWidth, signed char reqDecimals, @@ -511,7 +511,7 @@ get_conversion_spec: goto get_conversion_spec; case 'C': - if( char_argument ) + if( char_argument ) c = va_arg(ap,char); else c = va_arg(ap,int); @@ -566,11 +566,11 @@ get_conversion_spec: #if defined (SDCC_ds390) { unsigned char memtype = value.byte[3]; - if (memtype > 0x80) + if (memtype >= 0x80) c = 'C'; - else if (memtype > 0x60) + else if (memtype >= 0x60) c = 'P'; - else if (memtype > 0x40) + else if (memtype >= 0x40) c = 'I'; else c = 'X'; @@ -585,11 +585,11 @@ get_conversion_spec: #elif defined (SDCC_mcs51) { unsigned char memtype = value.byte[2]; - if (memtype > 0x80) + if (memtype >= 0x80) c = 'C'; - else if (memtype > 0x60) + else if (memtype >= 0x60) c = 'P'; - else if (memtype > 0x40) + else if (memtype >= 0x40) c = 'I'; else c = 'X'; -- 2.30.2