From f39469e71ca045fcf4c049947f7c9537fe7b6556 Mon Sep 17 00:00:00 2001 From: jent Date: Tue, 1 Dec 2009 09:54:36 -0700 Subject: [PATCH] Changes for better memory managment --- classpath/java/lang/String.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classpath/java/lang/String.java b/classpath/java/lang/String.java index e480b47be9..01b66605f1 100644 --- a/classpath/java/lang/String.java +++ b/classpath/java/lang/String.java @@ -185,7 +185,7 @@ public final class String } private static Object decodeUTF8(byte[] s8, int offset, int length) { - Object buf = new byte[s8.length]; + Object buf = new byte[length]; boolean isMultiByte = false; int i=offset, j=0; while(i < offset+length) { @@ -195,14 +195,14 @@ public final class String decodeUTF8_insert(buf, j++, x); } else if((x & 0x0e0) == 0x0c0) { // 2 byte char if(!isMultiByte) { - buf = decodeUTF8_widen(buf, j, s8.length-1); + buf = decodeUTF8_widen(buf, j, length-1); isMultiByte = true; } int y = s8[i++]; decodeUTF8_insert(buf, j++, ((x & 0x1f) << 6) | (y & 0x3f)); } else if((x & 0x0f0) == 0x0e0) { // 3 byte char if(!isMultiByte) { - buf = decodeUTF8_widen(buf, j, s8.length-2); + buf = decodeUTF8_widen(buf, j, length-2); isMultiByte = true; } int y = s8[i++]; int z = s8[i++];