251 |
return 0.0; /* OutOfMemoryError already thrown */ |
return 0.0; /* OutOfMemoryError already thrown */ |
252 |
} |
} |
253 |
|
|
254 |
|
#ifdef DEBUG |
255 |
|
fprintf (stderr, "java.lang.Double.parseDouble0 (%s)\n", buf); |
256 |
|
#endif |
257 |
|
|
258 |
if (strlen(buf) > 0) |
if (strlen(buf) > 0) |
259 |
{ |
{ |
260 |
struct _Jv_reent reent; |
struct _Jv_reent reent; |
262 |
|
|
263 |
#ifdef KISSME_LINUX_USER |
#ifdef KISSME_LINUX_USER |
264 |
val = strtod ( buf, &endptr); |
val = strtod ( buf, &endptr); |
265 |
#else |
#else |
266 |
val = _strtod_r (&reent, buf, &endptr); |
val = _strtod_r (&reent, buf, &endptr); |
267 |
#endif |
#endif |
268 |
if (endptr == buf + strlen(buf)) |
|
269 |
|
length = strlen(buf); |
270 |
|
if ((buf[length-1] == 'f') |
271 |
|
|| (buf[length-1] == 'F') |
272 |
|
|| (buf[length-1] == 'd') |
273 |
|
|| (buf[length-1] == 'D')) |
274 |
|
length = length - 1; |
275 |
|
|
276 |
|
#ifdef DEBUG |
277 |
|
fprintf (stderr, "java.lang.Double.parseDouble0 val = %g\n", val); |
278 |
|
fprintf (stderr, "java.lang.Double.parseDouble0 %i = %i + %i\n", endptr, buf, length); |
279 |
|
#endif |
280 |
|
|
281 |
|
if (endptr == buf + length) |
282 |
return val; |
return val; |
283 |
} |
} |
284 |
JCL_ThrowException(env, "java/lang/NumberFormatException", "unable to parse double"); |
JCL_ThrowException(env, "java/lang/NumberFormatException", "unable to parse double"); |