summaryrefslogtreecommitdiffstats
path: root/libjava/java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-02 23:27:03 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-02 23:27:03 +0000
commitd0a041e753de2eb43269d8ca19c702775883ebfa (patch)
tree3c0a5c3cdf3e3ce58bc3c73fa45fba97764da564 /libjava/java
parent2ec5f626041b28aa194bf8eb677e35bdbf14212d (diff)
downloadppe42-gcc-d0a041e753de2eb43269d8ca19c702775883ebfa.tar.gz
ppe42-gcc-d0a041e753de2eb43269d8ca19c702775883ebfa.zip
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=238755
* java/lang/natCharacter.cc (Character::getType): Handle negative code points. (Character::toLowerCase): Likewise. (Character::toUpperCase): Likewise. (Character::digit): Likewise. (Character::getNumericValue): Likewise. (Character::getDirectionality): Likewise. (Character::toTitleCase): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124370 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/lang/natCharacter.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/libjava/java/lang/natCharacter.cc b/libjava/java/lang/natCharacter.cc
index 8d246dd566e..dea2086eb52 100644
--- a/libjava/java/lang/natCharacter.cc
+++ b/libjava/java/lang/natCharacter.cc
@@ -1,5 +1,5 @@
/* java.lang.Character -- Wrapper class for char, and Unicode subsets
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -90,7 +90,7 @@ jint
java::lang::Character::getType(jint codePoint)
{
jint plane = codePoint >> 16;
- if (plane > 2 && plane != 14)
+ if (plane < 0 || (plane > 2 && plane != 14))
{
if (plane > 14 && ((codePoint & 0xffff) < 0xfffe))
return (jint) PRIVATE_TYPE;
@@ -112,7 +112,7 @@ jint
java::lang::Character::toLowerCase(jint codePoint)
{
jint plane = codePoint >> 16;
- if (plane > 2 && plane != 14)
+ if (plane < 0 || (plane > 2 && plane != 14))
return codePoint;
return (lower[plane][readCodePoint(codePoint) >> 7]) + codePoint;
}
@@ -127,7 +127,7 @@ jint
java::lang::Character::toUpperCase(jint codePoint)
{
jint plane = codePoint >> 16;
- if (plane > 2 && plane != 14)
+ if (plane < 0 || (plane > 2 && plane != 14))
return codePoint;
return (upper[plane][readCodePoint(codePoint) >> 7]) + codePoint;
}
@@ -147,7 +147,7 @@ java::lang::Character::toTitleCase(jint codePoint)
{
// As of Unicode 4.0.0 no characters outside of plane 0 have titlecase
// mappings that are different from their uppercase mapping.
- if (codePoint < 0x10000)
+ if (codePoint >= 0 && codePoint < 0x10000)
return toTitleCase((jchar)codePoint);
return toUpperCase(codePoint);
}
@@ -177,7 +177,7 @@ java::lang::Character::digit(jint codePoint, jint radix)
return (jint) -1;
jint plane = codePoint >> 16;
- if (plane > 2 && plane != 14)
+ if (plane < 0 || (plane > 2 && plane != 14))
return UNASSIGNED_DIGIT;
jchar attr = readCodePoint(codePoint);
@@ -207,7 +207,7 @@ jint
java::lang::Character::getNumericValue(jint codePoint)
{
jint plane = codePoint >> 16;
- if (plane > 2 && plane != 14)
+ if (plane < 0 || (plane > 2 && plane != 14))
return UNASSIGNED_NUMERIC_VALUE;
jshort num = numValue[plane][readCodePoint(codePoint) >> 7];
if (num <= -3)
@@ -225,7 +225,7 @@ jbyte
java::lang::Character::getDirectionality(jint codePoint)
{
jint plane = codePoint >> 16;
- if (plane > 2 && plane != 14)
+ if (plane < 0 || (plane > 2 && plane != 14))
{
if (plane > 14 && ((codePoint & 0xffff) < 0xfffe))
return (jint) PRIVATE_DIRECTION;
@@ -233,5 +233,3 @@ java::lang::Character::getDirectionality(jint codePoint)
}
return direction[plane][readCodePoint(codePoint) >> 7];
}
-
-
OpenPOWER on IntegriCloud