X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fvasnprintf.c;h=421e4454641914228bfdb936b6c63d5f03b5838c;hb=04606dd55fd8f1a122a21c4b4e09ab2a36498385;hp=f50ca3fcd44751c256d8a67630bb254fc03991d9;hpb=cb0fce1e8a7ba381bb1d108d82b384da0f688bc3;p=gnulib.git diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index f50ca3fcd..421e44546 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -215,7 +215,7 @@ local_wcslen (const wchar_t *s) #undef remainder #define remainder rem -#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 @@ -2663,9 +2663,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* POSIX specifies the default precision to be 6 for %f, %F, %e, %E, but not for %g, %G. Implementations appear to use - the same default precision also for %g, %G. */ + the same default precision also for %g, %G. But for %a, %A, + the default precision is 0. */ if (!has_precision) - precision = 6; + if (!(dp->conversion == 'a' || dp->conversion == 'A')) + precision = 6; /* Allocate a temporary buffer of sufficient size. */ # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE @@ -3167,11 +3169,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } *p++ = dp->conversion; /* 'e' or 'E' */ *p++ = '+'; - /* Produce the same number of exponent digits as - the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - *p++ = '0'; -# endif *p++ = '0'; *p++ = '0'; } @@ -3187,6 +3184,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, *p++ = '0'; } } + else if (dp->conversion == 'a' || dp->conversion == 'A') + { + *p++ = '0'; + *p++ = dp->conversion - 'A' + 'X'; + pad_ptr = p; + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + *p++ = dp->conversion - 'A' + 'P'; + *p++ = '+'; + *p++ = '0'; + } else abort (); # endif