Revert erroneously checked in files.

This commit is contained in:
Corinna Vinschen 2009-03-26 10:04:40 +00:00
parent 7ca98b4901
commit f6e29e076a
3 changed files with 23 additions and 36 deletions

View File

@ -35,7 +35,10 @@ THIS SOFTWARE.
#include "mprec.h" #include "mprec.h"
#include "gdtoa.h" #include "gdtoa.h"
#include "gd_qnan.h" #include "gd_qnan.h"
#ifdef USE_LOCALE
#include "locale.h" #include "locale.h"
#endif
unsigned char hexdig[256]; unsigned char hexdig[256];
@ -148,10 +151,11 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
int esign, havedig, irv, k, n, nbits, up, zret; int esign, havedig, irv, k, n, nbits, up, zret;
__ULong L, lostbits, *x; __ULong L, lostbits, *x;
Long e, e1; Long e, e1;
unsigned char *decimalpoint = (unsigned char *) #ifdef USE_LOCALE
localeconv()->decimal_point; unsigned char decimalpoint = *localeconv()->decimal_point;
size_t decp_len = strlen ((const char *) decimalpoint); #else
unsigned char decp_end = decimalpoint[decp_len - 1]; #define decimalpoint '.'
#endif
if (!hexdig['0']) if (!hexdig['0'])
hexdig_init(); hexdig_init();
@ -166,9 +170,9 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
e = 0; e = 0;
if (!hexdig[*s]) { if (!hexdig[*s]) {
zret = 1; zret = 1;
if (strcmp ((const char *) s, (const char *) decimalpoint) != 0) if (*s != decimalpoint)
goto pcheck; goto pcheck;
decpt = (s += decp_len); decpt = ++s;
if (!hexdig[*s]) if (!hexdig[*s])
goto pcheck; goto pcheck;
while(*s == '0') while(*s == '0')
@ -180,9 +184,8 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
} }
while(hexdig[*s]) while(hexdig[*s])
s++; s++;
if (strcmp ((const char *) s, (const char *) decimalpoint) == 0 if (*s == decimalpoint && !decpt) {
&& !decpt) { decpt = ++s;
decpt = (s += decp_len);
while(hexdig[*s]) while(hexdig[*s])
s++; s++;
} }
@ -223,12 +226,8 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
n = 0; n = 0;
L = 0; L = 0;
while(s1 > s0) { while(s1 > s0) {
if (*--s1 == decp_end && s1 - decp_len + 1 >= s0 if (*--s1 == decimalpoint)
&& strcmp ((const char *) s1 - decp_len + 1,
(const char *) decimalpoint) == 0) {
s1 -= decp_len - 1; /* Note the --s1 above! */
continue; continue;
}
if (n == 32) { if (n == 32) {
*x++ = L; *x++ = L;
L = 0; L = 0;

View File

@ -122,7 +122,9 @@ THIS SOFTWARE.
/* #include <fenv.h> */ /* #include <fenv.h> */
/* #endif */ /* #endif */
#ifdef USE_LOCALE
#include "locale.h" #include "locale.h"
#endif
#ifdef IEEE_Arith #ifdef IEEE_Arith
#ifndef NO_IEEE_Scale #ifndef NO_IEEE_Scale
@ -305,10 +307,14 @@ _DEFUN (_strtod_r, (ptr, s00, se),
else if (nd < 16) else if (nd < 16)
z = 10*z + c - '0'; z = 10*z + c - '0';
nd0 = nd; nd0 = nd;
if (strcmp (s, localeconv()->decimal_point) == 0) #ifdef USE_LOCALE
if (c == *localeconv()->decimal_point)
#else
if (c == '.')
#endif
{ {
decpt = 1; decpt = 1;
c = *(s += strlen (localeconv()->decimal_point)); c = *++s;
if (!nd) { if (!nd) {
for(; c == '0'; c = *++s) for(; c == '0'; c = *++s)
nz++; nz++;

View File

@ -116,10 +116,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <_ansi.h> #include <_ansi.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <locale.h>
#include <math.h> #include <math.h>
double double
@ -169,25 +167,9 @@ _DEFUN (_wcstod_r, (ptr, nptr, endptr),
* where it ended, count multibyte characters to find the * where it ended, count multibyte characters to find the
* corresponding position in the wide char string. * corresponding position in the wide char string.
*/ */
if (endptr != NULL) { if (endptr != NULL)
/* The only valid multibyte char in a float converted by /* XXX Assume each wide char is one byte. */
strtod/wcstod is the radix char. What we do here is,
figure out if the radix char was in the valid leading
float sequence in the incoming string. If so, the
multibyte float string is strlen(radix char) - 1 bytes
longer than the incoming wide char string has characters.
To fix endptr, reposition end as if the radix char was
just one byte long. The resulting difference (end - buf)
is then equivalent to the number of valid wide characters
in the input string. */
len = strlen (localeconv ()->decimal_point);
if (len > 1) {
char *d = strstr (buf, localeconv ()->decimal_point);
if (d && d < end)
end -= len - 1;
}
*endptr = (wchar_t *)nptr + (end - buf); *endptr = (wchar_t *)nptr + (end - buf);
}
_free_r(ptr, buf); _free_r(ptr, buf);