about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-08-07 19:28:26 +0000
committerJakub Jelinek <jakub@redhat.com>2006-08-07 19:28:26 +0000
commit503d6a958581777473c31f73113d0fa6cff19b30 (patch)
treec8526f0403ac272cba94213a3c5b10a369876d78 /stdio-common
parent98d2266156a49df5f93726c8f0b148bbdee41c9d (diff)
downloadglibc-503d6a958581777473c31f73113d0fa6cff19b30.tar.gz
glibc-503d6a958581777473c31f73113d0fa6cff19b30.tar.xz
glibc-503d6a958581777473c31f73113d0fa6cff19b30.zip
Updated to fedora-glibc-20060807T1859 cvs/fedora-glibc-2_4_90-18
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/Makefile2
-rw-r--r--stdio-common/bug16.c20
-rw-r--r--stdio-common/printf_fphex.c13
3 files changed, 29 insertions, 6 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 70f6d64c9a..37bcdb3bc8 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -54,7 +54,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
 	 tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
 	 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
-	 tst-fwrite
+	 tst-fwrite bug16
 
 test-srcs = tst-unbputc tst-printf
 
diff --git a/stdio-common/bug16.c b/stdio-common/bug16.c
new file mode 100644
index 0000000000..42e37fa8b6
--- /dev/null
+++ b/stdio-common/bug16.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+  char buf[100];
+  snprintf (buf, sizeof (buf), "%.0LA", 0x0.FFFFp+0L);
+
+  if (strcmp (buf, "0X1P+0") != 0)
+    {
+      printf ("got \"%s\", expected \"0X1P+0\"\n", buf);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index fd790d5bf3..4e30d94c61 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -1,5 +1,5 @@
 /* Print floating point number in hexadecimal notation according to ISO C99.
-   Copyright (C) 1997-2002,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997-2002,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -399,12 +399,15 @@ __printf_fphex (FILE *fp,
 		++leading;
 	      else
 		{
-		  leading = 1;
+		  leading = '1';
 		  if (expnegative)
 		    {
-		      exponent += 4;
-		      if (exponent >= 0)
-			expnegative = 0;
+		      exponent -= 4;
+		      if (exponent <= 0)
+			{
+			  exponent = -exponent;
+			  expnegative = 0;
+			}
 		    }
 		  else
 		    exponent += 4;