natDouble.cc (parseDouble): Allow a number to end with the f/F/d/D modifiers.
2002-04-13 Adam King <aking@dreammechanics.com> * java/lang/natDouble.cc (parseDouble): Allow a number to end with the f/F/d/D modifiers. From-SVN: r52308
This commit is contained in:
parent
bd6bec6be2
commit
ddfb5e0b69
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-04-13 Adam King <aking@dreammechanics.com>
|
||||||
|
|
||||||
|
* java/lang/natDouble.cc (parseDouble): Allow a number to end with
|
||||||
|
the f/F/d/D modifiers.
|
||||||
|
|
||||||
2002-04-12 Anthony Green <green@redhat.com>
|
2002-04-12 Anthony Green <green@redhat.com>
|
||||||
|
|
||||||
* Makefile.am (jardir, jar_DATA): Define (for libgcj.jar).
|
* Makefile.am (jardir, jar_DATA): Define (for libgcj.jar).
|
||||||
|
|
|
@ -161,9 +161,19 @@ jdouble
|
||||||
java::lang::Double::parseDouble(jstring str)
|
java::lang::Double::parseDouble(jstring str)
|
||||||
{
|
{
|
||||||
int length = str->length();
|
int length = str->length();
|
||||||
|
|
||||||
while (length > 0
|
while (length > 0
|
||||||
&& Character::isWhitespace(str->charAt(length - 1)))
|
&& Character::isWhitespace(str->charAt(length - 1)))
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
|
// The String could end with a f/F/d/D which is valid but we don't need.
|
||||||
|
if (length > 0)
|
||||||
|
{
|
||||||
|
jchar last = str->charAt(length-1);
|
||||||
|
if (last == 'f' || last == 'F' || last == 'd' || last == 'D')
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
|
||||||
jsize start = 0;
|
jsize start = 0;
|
||||||
while (length > 0
|
while (length > 0
|
||||||
&& Character::isWhitespace(str->charAt(start)))
|
&& Character::isWhitespace(str->charAt(start)))
|
||||||
|
@ -184,7 +194,7 @@ java::lang::Double::parseDouble(jstring str)
|
||||||
if (endptr == data + blength)
|
if (endptr == data + blength)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
throw new NumberFormatException;
|
throw new NumberFormatException(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue