bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-vsprintf-posix: make check failure


From: Eric Blake
Subject: Re: test-vsprintf-posix: make check failure
Date: Mon, 22 Sep 2008 19:46:57 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> It looks like the solution is to also add 
> support at line 3149 (for long double) for the %a format

Like so.  Bruno, okay to apply?  (gmane probably botched this patch, so you can 
also see it at
http://repo.or.cz/w/gnulib/ericb.git?a=shortlog;h=refs/heads/vasnprintf)


From: Eric Blake <address@hidden>
Date: Mon, 22 Sep 2008 12:15:03 -0600
Subject: [PATCH] vasnprintf: fix x86/glibc regression on printf("%La", 0.0L)

* lib/vasnprintf.c (VASNPRINTF): Support 0.0 on platforms that
supply %A but mishandle pseudo-NaN.
Reported by Simon Josefsson.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog        |    9 ++++++++-
 lib/vasnprintf.c |   21 +++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5b06d29..ad7cefc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-22  Eric Blake  <address@hidden>
+
+       vasnprintf: fix x86/glibc regression on printf("%La", 0.0L)
+       * lib/vasnprintf.c (VASNPRINTF): Support 0.0 on platforms that
+       supply %A but mishandle pseudo-NaN.
+       Reported by Simon Josefsson.
+
 2008-09-21  Bruno Haible  <address@hidden>
 
        * tests/test-lock.c (main): Tweak skip message.
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index e4bfca3..19f28bc 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -3182,6 +3182,27 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                      *p++ = '0';
                                  }
                              }
+                            else if (dp->conversion == 'a' || dp->conversion 
== 'A')
+                              {
+                                *p++ = '0';
+                                *p++ = dp->conversion - 'A' + 'X';
+                                pad_ptr = p;
+                                *p++ = '0';
+                                if (!has_precision)
+                                  precision = 0;
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    while (precision > 0)
+                                      {
+                                        *p++ = '0';
+                                        precision--;
+                                      }
+                                  }
+                                *p++ = dp->conversion - 'A' + 'P';
+                                *p++ = '+';
+                                *p++ = '0';
+                              }
                            else
                              abort ();
 #  endif
-- 
1.6.0.2







reply via email to

[Prev in Thread] Current Thread [Next in Thread]