From 9e9e0532a493ae3d07b2f4e958d2030f8d937065 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 31 Mar 2000 06:57:36 +0000 Subject: Update. 2000-03-29 Geoff Clare * stdlib/strfmon.c: Corrected problems with the code that sets default values for [np]_sep_by_space and [np]_sign_posn; also the new positive/negative alignment code from the previous patch was not quite right for [np]_sign_posn = 0. * localedata/tst-fmon.data: Changes corresponding to the two sets of fixes made to stdlib/strfmon.c. --- stdlib/strfmon.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'stdlib') diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c index d7213cae7a..b0c9375247 100644 --- a/stdlib/strfmon.c +++ b/stdlib/strfmon.c @@ -193,14 +193,8 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) va_end (ap); return -1; } - if (*_NL_CURRENT (LC_MONETARY, P_SIGN_POSN) == '\0') - p_sign_posn = 1; - else - p_sign_posn = *_NL_CURRENT (LC_MONETARY, P_SIGN_POSN); - if (*_NL_CURRENT (LC_MONETARY, N_SIGN_POSN) == '\0') - n_sign_posn = 1; - else - n_sign_posn = *_NL_CURRENT (LC_MONETARY, N_SIGN_POSN); + p_sign_posn = *_NL_CURRENT (LC_MONETARY, P_SIGN_POSN); + n_sign_posn = *_NL_CURRENT (LC_MONETARY, N_SIGN_POSN); continue; case '(': /* Use ( ) for negative sign. */ if (n_sign_posn != -1) @@ -385,10 +379,14 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) cs_precedes = 1; if (other_cs_precedes != 0) other_cs_precedes = 1; - if (sep_by_space == 127) + if (sep_by_space == CHAR_MAX) sep_by_space = 0; - if (other_sep_by_space == 127) + if (other_sep_by_space == CHAR_MAX) other_sep_by_space = 0; + if (sign_posn == CHAR_MAX) + sign_posn = 1; + if (other_sign_posn == CHAR_MAX) + other_sign_posn = 1; /* Set the left precision and padding needed for alignment */ if (left_prec == -1) @@ -404,7 +402,10 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) int sign_precedes = 0; int other_sign_precedes = 0; - left_pad = 0; + if (sign_posn == 0 && !is_negative) + left_pad = 1; + else + left_pad = 0; if (!cs_precedes && other_cs_precedes) { -- cgit 1.4.1