mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-16 15:20:48 +08:00
natString.cc (init(jbyteArray,jint,jint,jstring)): Set count to 0 when InputStreamReader returns -1 for EOF.
* java/lang/natString.cc (init(jbyteArray,jint,jint,jstring)): Set count to 0 when InputStreamReader returns -1 for EOF. From-SVN: r26273
This commit is contained in:
parent
dc4618f922
commit
9a566c0926
@ -1,3 +1,8 @@
|
||||
1999-04-07 Warren Levy <warrenl@cygnus.com>
|
||||
|
||||
* java/lang/natString.cc (init(jbyteArray,jint,jint,jstring)):
|
||||
Set count to 0 when InputStreamReader returns -1 for EOF.
|
||||
|
||||
1999-04-07 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* mauve-libgcj: Omit java.text.Collator,
|
||||
|
@ -392,6 +392,10 @@ java::lang::String::init (jbyteArray bytes, jint offset, jint count,
|
||||
boffset = (char *) elements (array) - (char *) array;
|
||||
// FIXME: this can throw IOException.
|
||||
this->count = ir->read(array, 0, count);
|
||||
|
||||
// In case read() doesn't read anything, change -1 for EOF to a count of 0.
|
||||
if (this->count < 0)
|
||||
this->count = 0;
|
||||
}
|
||||
|
||||
jboolean
|
||||
|
Loading…
Reference in New Issue
Block a user