From 428cd03159f5b1be72d06ea5eb110e9238dae4e3 Mon Sep 17 00:00:00 2001 From: hunt Date: Fri, 21 Jul 2006 00:01:37 +0000 Subject: 2006-07-20 Martin Hunt * vsprintf.c (_stp_vsnprintf): %p format fixes. --- runtime/vsprintf.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'runtime/vsprintf.c') diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c index 7abb5dc5..4582ad83 100644 --- a/runtime/vsprintf.c +++ b/runtime/vsprintf.c @@ -296,12 +296,14 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) case 'p': len = 2*sizeof(void *) + 2; - if (field_width == -1) { + flags |= STP_ZEROPAD; + + if (field_width == -1) field_width = len; - flags |= STP_ZEROPAD; - } + if (!(flags & STP_LEFT)) { - while (len < field_width--) { + while (len < field_width) { + field_width--; if (str <= end) *str = ' '; ++str; @@ -315,9 +317,10 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) *str++ = 'x'; field_width--; } + str = number(str, end, (unsigned long) va_arg(args, int64_t), - 16, field_width, precision, flags); + 16, field_width, field_width, flags); continue; case 'n': -- cgit