--- gdtoa-strtodg.c.orig 2005-10-08 11:33:23.000000000 -0700 +++ gdtoa-strtodg.c 2005-10-08 11:40:57.000000000 -0700 @@ -29,6 +29,8 @@ /* Please send bug reports to David M. Gay (dmg at acm dot org, * with " at " changed at "@" and " dot " changed to "."). */ +#include "xlocale_private.h" + #include "gdtoaimp.h" #ifdef USE_LOCALE @@ -316,10 +318,10 @@ int strtodg #ifdef KR_headers - (s00, se, fpi, exp, bits) - CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; + (s00, se, fpi, exp, bits, loc) + CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc; #else - (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits) + (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc) #endif { int abe, abits, asub; @@ -367,7 +369,7 @@ switch(s[1]) { case 'x': case 'X': - irv = gethex(&s, fpi, exp, &rvb, sign); + irv = gethex(&s, fpi, exp, &rvb, sign, loc); if (irv == STRTOG_NoNumber) { s = s00; sign = 0; @@ -389,8 +391,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) #else if (c == '.') #endif @@ -668,6 +671,9 @@ rvb->x[0] = 0; *exp = emin; irv = STRTOG_Underflow | STRTOG_Inexlo; +#ifndef NO_ERRNO + errno = ERANGE; +#endif goto ret; } rvb->x[0] = rvb->wds = rvbits = 1;