]> git.saurik.com Git - apple/libc.git/blobdiff - gdtoa/FreeBSD/gdtoa-strtod.c.patch
Libc-594.1.4.tar.gz
[apple/libc.git] / gdtoa / FreeBSD / gdtoa-strtod.c.patch
index 99db605f3be117502021c49439c318e4371bd283..29f9906535037e62bccc01d6dc5c9b505afe6a90 100644 (file)
@@ -1,6 +1,6 @@
---- gdtoa-strtod.c.orig        2005-10-08 11:32:33.000000000 -0700
-+++ gdtoa-strtod.c     2005-10-08 11:38:17.000000000 -0700
-@@ -29,6 +29,8 @@
+--- gdtoa-strtod.c.orig        2008-10-28 12:07:31.000000000 -0700
++++ gdtoa-strtod.c     2008-10-28 12:22:37.000000000 -0700
+@@ -29,6 +29,8 @@ THIS SOFTWARE.
  /* Please send bug reports to David M. Gay (dmg at acm dot org,
   * with " at " changed at "@" and " dot " changed to ".").    */
  
@@ -9,7 +9,7 @@
  #include "gdtoaimp.h"
  #ifndef NO_FENV_H
  #include <fenv.h>
-@@ -59,11 +61,11 @@
+@@ -58,11 +60,11 @@ static CONST double tinytens[] = { 1e-16
  #endif
  
   double
  #endif
  {
  #ifdef Avoid_Underflow
-@@ -126,7 +128,7 @@
+@@ -79,13 +81,14 @@ strtod
+       int inexact, oldinexact;
+ #endif
+ #ifdef USE_LOCALE
++      NORMALIZE_LOCALE(loc);
+ #ifdef NO_LOCALE_CACHE
+-      char *decimalpoint = localeconv()->decimal_point;
++      char *decimalpoint = localeconv_l(loc)->decimal_point;
  #else
+       char *decimalpoint;
+       static char *decimalpoint_cache;
+       if (!(s0 = decimalpoint_cache)) {
+-              s0 = localeconv()->decimal_point;
++              s0 = localeconv_l(loc)->decimal_point;
+               if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) {
+                       strcpy(decimalpoint_cache, s0);
+                       s0 = decimalpoint_cache;
+@@ -155,7 +158,7 @@ strtod
+ #else /*}{*/
  #define fpi1 fpi
- #endif
+ #endif /*}}*/
 -                      switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
 +                      switch((i = gethex(&s, &fpi1, &exp, &bb, sign, loc)) & STRTOG_Retmask) {
                          case STRTOG_NoNumber:
                                s = s00;
                                sign = 0;
-@@ -156,8 +158,9 @@
-               else if (nd < 16)
-                       z = 10*z + c - '0';
-       nd0 = nd;
-+      NORMALIZE_LOCALE(loc);
- #ifdef USE_LOCALE
--      if (c == *localeconv()->decimal_point)
-+      if (c == *localeconv_l(loc)->decimal_point)
+@@ -545,7 +548,11 @@ strtod
+       /* Put digits into bd: true value = bd * 10^e */
+-      bd0 = s2b(s0, nd0, nd, y);
++#ifdef USE_LOCALE
++      bd0 = s2b(s0, nd0, nd, y, strlen(decimalpoint));
++#else
++      bd0 = s2b(s0, nd0, nd, y, 1);
++#endif
+       for(;;) {
+               bd = Balloc(bd0->k);
+@@ -992,7 +999,7 @@ strtod
+               dval(rv) *= dval(rv0);
+ #ifndef NO_ERRNO
+               /* try to avoid the bug of testing an 8087 register value */
+-#ifdef IEEE_Arith
++#if defined(IEEE_Arith) && __DARWIN_UNIX03
+               if (!(word0(rv) & Exp_mask))
  #else
-       if (c == '.')
- #endif
-@@ -980,3 +983,13 @@
+               if (word0(rv) == 0 && word1(rv) == 0)
+@@ -1020,3 +1027,13 @@ strtod
        return sign ? -dval(rv) : dval(rv);
        }