From: Bruno Haible Date: Sun, 7 Nov 2010 17:57:08 +0000 (+0100) Subject: vasnprintf: Support I flag on glibc systems. X-Git-Tag: v0.18.2~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12452d87fefaf31cce1b9206e663defa27197a40;p=thirdparty%2Fgettext.git vasnprintf: Support I flag on glibc systems. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index d021ef51a..76b0f49b6 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,11 @@ +2010-11-07 Bruno Haible + + vasnprintf: Support I flag on glibc systems. + * printf-parse.h (FLAG_LOCALIZED): New macro. + * printf-parse.c (PRINTF_PARSE): Handle the 'I' flag. + * vasnprintf.c (VASNPRINTF): Pass the 'I' flag on to the system's + snprintf function. + 2010-11-07 Bruno Haible Rename libgnuintl.h.in to libgnuintl.in.h. diff --git a/gettext-runtime/intl/printf-parse.c b/gettext-runtime/intl/printf-parse.c index 3f3174d06..5fe8da673 100644 --- a/gettext-runtime/intl/printf-parse.c +++ b/gettext-runtime/intl/printf-parse.c @@ -207,6 +207,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) dp->flags |= FLAG_ZERO; cp++; } +#if __GLIBC__ >= 2 + else if (*cp == 'I') + { + dp->flags |= FLAG_LOCALIZED; + cp++; + } +#endif else break; } diff --git a/gettext-runtime/intl/printf-parse.h b/gettext-runtime/intl/printf-parse.h index 51ead29ec..82e5359b6 100644 --- a/gettext-runtime/intl/printf-parse.h +++ b/gettext-runtime/intl/printf-parse.h @@ -29,6 +29,9 @@ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 +#if __GLIBC__ >= 2 +# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */ +#endif /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) diff --git a/gettext-runtime/intl/vasnprintf.c b/gettext-runtime/intl/vasnprintf.c index 3dd8b3f30..55dbb27af 100644 --- a/gettext-runtime/intl/vasnprintf.c +++ b/gettext-runtime/intl/vasnprintf.c @@ -4753,6 +4753,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, *fbp++ = ' '; if (flags & FLAG_ALT) *fbp++ = '#'; +#if __GLIBC__ >= 2 + if (flags & FLAG_LOCALIZED) + *fbp++ = 'I'; +#endif if (!pad_ourselves) { if (flags & FLAG_ZERO) diff --git a/gettext-runtime/libasprintf/ChangeLog b/gettext-runtime/libasprintf/ChangeLog index 8a38e514e..50f619f2c 100644 --- a/gettext-runtime/libasprintf/ChangeLog +++ b/gettext-runtime/libasprintf/ChangeLog @@ -1,3 +1,11 @@ +2010-11-07 Bruno Haible + + vasnprintf: Support I flag on glibc systems. + * printf-parse.h (FLAG_LOCALIZED): New macro. + * printf-parse.c (PRINTF_PARSE): Handle the 'I' flag. + * vasnprintf.c (VASNPRINTF): Pass the 'I' flag on to the system's + snprintf function. + 2010-11-07 Bruno Haible Rename autosprintf.h.in to autosprintf.in.h. diff --git a/gettext-runtime/libasprintf/printf-parse.c b/gettext-runtime/libasprintf/printf-parse.c index 3f3174d06..5fe8da673 100644 --- a/gettext-runtime/libasprintf/printf-parse.c +++ b/gettext-runtime/libasprintf/printf-parse.c @@ -207,6 +207,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) dp->flags |= FLAG_ZERO; cp++; } +#if __GLIBC__ >= 2 + else if (*cp == 'I') + { + dp->flags |= FLAG_LOCALIZED; + cp++; + } +#endif else break; } diff --git a/gettext-runtime/libasprintf/printf-parse.h b/gettext-runtime/libasprintf/printf-parse.h index 51ead29ec..82e5359b6 100644 --- a/gettext-runtime/libasprintf/printf-parse.h +++ b/gettext-runtime/libasprintf/printf-parse.h @@ -29,6 +29,9 @@ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 +#if __GLIBC__ >= 2 +# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */ +#endif /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) diff --git a/gettext-runtime/libasprintf/vasnprintf.c b/gettext-runtime/libasprintf/vasnprintf.c index 3dd8b3f30..55dbb27af 100644 --- a/gettext-runtime/libasprintf/vasnprintf.c +++ b/gettext-runtime/libasprintf/vasnprintf.c @@ -4753,6 +4753,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, *fbp++ = ' '; if (flags & FLAG_ALT) *fbp++ = '#'; +#if __GLIBC__ >= 2 + if (flags & FLAG_LOCALIZED) + *fbp++ = 'I'; +#endif if (!pad_ourselves) { if (flags & FLAG_ZERO)