diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-09-14 14:48:38 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-09-14 14:48:38 +0000 |
commit | 7c411bda5ba29eb8fb5be3841626a485c0d650cb (patch) | |
tree | 049b9b8b77421704c34c29ad0d9a940ff0025f4c /cpukit/libcsupport/src/vprintk.c | |
parent | 2009-09-13 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-7c411bda5ba29eb8fb5be3841626a485c0d650cb.tar.bz2 |
2009-09-14 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* score/src/wkspace.c: Removed work space area consistency checks.
* libblock/include/rtems/ide_part_table.h: Functions are now
deprecated.
* libcsupport/include/rtems/libcsupport.h, libcsupport/src/calloc.c,
libcsupport/src/malloc_boundary.c,
libcsupport/src/malloc_initialize.c,
libcsupport/src/malloc_report_statistics_plugin.c,
libcsupport/src/malloc_statistics_helpers.c,
libcsupport/src/malloc_walk.c, libcsupport/src/realloc.c,
rtems/inline/rtems/rtems/region.inl: Update for heap API changes.
2009-09-14 Christian Mauderer <christian.mauderer@embedded-brains.de>
* libcsupport/src/vprintk.c: Fixed warnings. Print nothing in case the
pointer to the string is NULL.
Diffstat (limited to '')
-rw-r--r-- | cpukit/libcsupport/src/vprintk.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/cpukit/libcsupport/src/vprintk.c b/cpukit/libcsupport/src/vprintk.c index e7d5d1a59e..883ca387e7 100644 --- a/cpukit/libcsupport/src/vprintk.c +++ b/cpukit/libcsupport/src/vprintk.c @@ -25,11 +25,11 @@ #include <rtems/bspIo.h> static void printNum( - long unsigned int num, - int base, - int sign, - int maxwidth, - int lead + long num, + int base, + int sign, + int maxwidth, + int lead ); /* @@ -46,7 +46,7 @@ void vprintk( va_list ap ) { - char c, *str; + char c; int lflag, base, sign, width, lead, minus; for (; *fmt != '\0'; fmt++) { @@ -80,15 +80,20 @@ void vprintk( c = *++fmt; } if ( c == 'c' ) { - BSP_output_char(va_arg(ap, int)); + char chr = (char) va_arg(ap, int); + BSP_output_char(chr); continue; } if ( c == 's' ) { int i, len; - char *s; + char *s, *str; str = va_arg(ap, char *); + if ( str == NULL ) { + str = ""; + } + /* calculate length of string */ for ( len=0, s=str ; *s ; len++, s++ ) ; @@ -133,7 +138,7 @@ void vprintk( } printNum( - lflag ? va_arg(ap, long int) : (long int)va_arg(ap, int), + lflag ? va_arg(ap, long) : (long) va_arg(ap, int), base, sign, width, @@ -149,16 +154,16 @@ void vprintk( * base - base used to print the number. */ static void printNum( - long unsigned int num, - int base, - int sign, - int maxwidth, - int lead + long num, + int base, + int sign, + int maxwidth, + int lead ) { - long unsigned int n; - int count; - char toPrint[20]; + long n; + int count; + char toPrint[20]; if ( (sign == 1) && ((long)num < 0) ) { BSP_output_char('-'); @@ -168,13 +173,13 @@ static void printNum( count = 0; while ((n = num / base) > 0) { - toPrint[count++] = (num - (n*base)); + toPrint[count++] = (char) (num - (n*base)); num = n; } - toPrint[count++] = num; + toPrint[count++] = (char) num; for (n=maxwidth ; n > count; n-- ) - BSP_output_char(lead); + BSP_output_char((char) lead); for (n = 0; n < count; n++) { BSP_output_char("0123456789ABCDEF"[(int)(toPrint[count-(n+1)])]); |