summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-31 06:57:36 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-31 06:57:36 +0000
commit9e9e0532a493ae3d07b2f4e958d2030f8d937065 (patch)
tree28cc2e87558c3f0595fb8f7d7c3256102a6f272d /stdlib
parentb5567b2af66e2be232c0db9bf189424c039465d2 (diff)
downloadglibc-9e9e0532a493ae3d07b2f4e958d2030f8d937065.tar.gz
glibc-9e9e0532a493ae3d07b2f4e958d2030f8d937065.tar.xz
glibc-9e9e0532a493ae3d07b2f4e958d2030f8d937065.zip
Update.
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.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/strfmon.c23
1 files changed, 12 insertions, 11 deletions
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)
 	    {