natString.cc (getBytes): Correctly size result buffer.

* java/lang/natString.cc (getBytes): Correctly size result
	buffer.  From Bryce McKinlay <bryce@albatross.co.nz>.

From-SVN: r26575
This commit is contained in:
Tom Tromey 1999-04-21 11:49:39 +00:00 committed by Tom Tromey
parent 11bbe619e3
commit 47e2610954
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
1999-04-21 Tom Tromey <tromey@cygnus.com>
* java/lang/natString.cc (getBytes): Correctly size result
buffer. From Bryce McKinlay <bryce@albatross.co.nz>.
1999-04-20 Andrew Haley <aph@cygnus.com>
* include/sparc-signal.h: new file.

View File

@ -487,8 +487,8 @@ java::lang::String::getBytes (jstring enc)
}
if (bufpos == buflen)
return buffer;
jbyteArray result = JvNewByteArray(bufpos);
memcpy (elements (result), elements (buffer), bufpos);
jbyteArray result = JvNewByteArray(buflen);
memcpy (elements (result), elements (buffer), buflen);
return result;
}