1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00
2000-03-29  Geoff Clare  <gwc@unisoft.com>

	* 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.
This commit is contained in:
Ulrich Drepper
2000-03-31 06:57:36 +00:00
parent b5567b2af6
commit 9e9e0532a4
3 changed files with 37 additions and 22 deletions

View File

@@ -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)
{