[PATCH] ldbl128 printf_fphex.c fix

Jakub Jelinek jakub@redhat.com
Mon Apr 17 07:21:00 GMT 2000


Hi!

This has been broken for a while, I just saw it in the warnings. ldbl96 has
been changed in February.

2000-04-17  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ieee754/ldbl-128/printf_fphex.c (PRINT_FPHEX_LONG_DOUBLE):
	Create wnumstr as well as numstr to support wide character output
	correctly.

--- libc/sysdeps/ieee754/ldbl-128/printf_fphex.c.jj	Fri Nov 12 16:30:31 1999
+++ libc/sysdeps/ieee754/ldbl-128/printf_fphex.c	Mon Apr 17 12:21:12 2000
@@ -1,6 +1,6 @@
 /* Print floating point number in hexadecimal notation according to
    ISO C99.
-   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -36,23 +36,43 @@ do {									      \
       zero_mantissa = (num0|num1) == 0;					      \
 									      \
       if (sizeof (unsigned long int) > 6)				      \
-	numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16,		      \
-			     info->spec == 'A');			      \
+	{								      \
+	  numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16,	      \
+			       info->spec == 'A');			      \
+	  wnumstr = _itowa_word (num1, wnumbuf + sizeof wnumbuf, 16,	      \
+				 info->spec == 'A');			      \
+	}								      \
       else								      \
-	numstr = _itoa (num1, numbuf + sizeof numbuf, 16,		      \
-			info->spec == 'A');				      \
+	{								      \
+	  numstr = _itoa (num1, numbuf + sizeof numbuf, 16,		      \
+			  info->spec == 'A');				      \
+	  wnumstr = _itowa (num1, wnumbuf + sizeof wnumbuf, 16,		      \
+			    info->spec == 'A');				      \
+	}								      \
 									      \
       while (numstr > numbuf + (sizeof numbuf - 64 / 4))		      \
-	*--numstr = '0';						      \
+	{								      \
+	  *--numstr = '0';						      \
+	  *--wnumstr = L'0';						      \
+	}								      \
 									      \
       if (sizeof (unsigned long int) > 6)				      \
-	numstr = _itoa_word (num0, numstr, 16, info->spec == 'A');	      \
+	{								      \
+	  numstr = _itoa_word (num0, numstr, 16, info->spec == 'A');	      \
+	  wnumstr = _itowa_word (num0, wnumstr, 16, info->spec == 'A');	      \
+	}								      \
       else								      \
-	numstr = _itoa (num0, numstr, 16, info->spec == 'A');		      \
+	{								      \
+	  numstr = _itoa (num0, numstr, 16, info->spec == 'A');		      \
+	  wnumstr = _itowa (num0, wnumstr, 16, info->spec == 'A');	      \
+	}								      \
 									      \
       /* Fill with zeroes.  */						      \
       while (numstr > numbuf + (sizeof numbuf - 112 / 4))		      \
-	*--numstr = '0';						      \
+	{								      \
+	  *--numstr = '0';						      \
+	  *--wnumstr = L'0';						      \
+	}								      \
 									      \
       leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1';		      \
 									      \

	Jakub


More information about the Libc-hacker mailing list