]> git.saurik.com Git - apple/libc.git/blame - gdtoa/FreeBSD/gdtoa-strtodg.c.patch
Libc-391.tar.gz
[apple/libc.git] / gdtoa / FreeBSD / gdtoa-strtodg.c.patch
CommitLineData
3d9156a7
A
1--- gdtoa-strtodg.c.orig 2005-01-20 20:12:37.000000000 -0800
2+++ gdtoa-strtodg.c 2005-02-17 01:32:24.000000000 -0800
3@@ -29,6 +29,8 @@
4 /* Please send bug reports to David M. Gay (dmg at acm dot org,
5 * with " at " changed at "@" and " dot " changed to "."). */
6
7+#include "xlocale_private.h"
8+
9 #include "gdtoaimp.h"
10
11 #ifdef USE_LOCALE
12@@ -316,10 +318,10 @@
13 int
14 strtodg
15 #ifdef KR_headers
16- (s00, se, fpi, exp, bits)
17- CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits;
18+ (s00, se, fpi, exp, bits, loc)
19+ CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
20 #else
21- (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
22+ (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
23 #endif
24 {
25 int abe, abits, asub;
26@@ -367,7 +369,7 @@
27 switch(s[1]) {
28 case 'x':
29 case 'X':
30- irv = gethex(&s, fpi, exp, &rvb, sign);
31+ irv = gethex(&s, fpi, exp, &rvb, sign, loc);
32 if (irv == STRTOG_NoNumber) {
33 s = s00;
34 sign = 0;
35@@ -389,8 +391,9 @@
36 else if (nd < 16)
37 z = 10*z + c - '0';
38 nd0 = nd;
39+ NORMALIZE_LOCALE(loc);
40 #ifdef USE_LOCALE
41- if (c == *localeconv()->decimal_point)
42+ if (c == *localeconv_l(loc)->decimal_point)
43 #else
44 if (c == '.')
45 #endif
46@@ -676,6 +679,9 @@
47 rvb->x[0] = 0;
48 *exp = emin;
49 irv = STRTOG_Underflow | STRTOG_Inexlo;
50+#ifndef NO_ERRNO
51+ errno = ERANGE;
52+#endif
53 goto ret;
54 }
55 rvb->x[0] = rvb->wds = rvbits = 1;