harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r431684 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_array.cpp
Date Tue, 15 Aug 2006 19:31:37 GMT
Author: geirm
Date: Tue Aug 15 12:31:37 2006
New Revision: 431684

URL: http://svn.apache.org/viewvc?rev=431684&view=rev
Log:
patch from HARMONY-1156 to make Get*ArrayRegiion work like RI


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_array.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_array.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_array.cpp?rev=431684&r1=431683&r2=431684&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_array.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_array.cpp Tue Aug 15 12:31:37
2006
@@ -1243,10 +1243,9 @@
 {
     TRACE2("jni", "GetBooleanArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1273,10 +1272,9 @@
 {
     TRACE2("jni", "GetByteArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1303,10 +1301,9 @@
 {
     TRACE2("jni", "GetCharArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1333,10 +1330,9 @@
 {
     TRACE2("jni", "GetShortArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1363,10 +1359,9 @@
 {
     TRACE2("jni", "GetIntArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1393,10 +1388,9 @@
 {
     TRACE2("jni", "GetLongArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1423,10 +1417,9 @@
 {
     TRACE2("jni", "GetFloatArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1453,10 +1446,9 @@
 {
     TRACE2("jni", "GetDoubleArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1491,10 +1483,9 @@
 {
     TRACE2("jni", "SetBooleanArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1523,12 +1514,9 @@
 {
     TRACE2("jni", "SetByteArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
-    if (len == 0) //don't need to do set exactly
-        return;
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1557,10 +1545,9 @@
 {
     TRACE2("jni", "SetCharArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1589,10 +1576,9 @@
 {
     TRACE2("jni", "SetShortArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1621,10 +1607,9 @@
 {
     TRACE2("jni", "SetIntArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1653,10 +1638,9 @@
 {
     TRACE2("jni", "SetLongArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1685,10 +1669,9 @@
 {
     TRACE2("jni", "SetFloatArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);
@@ -1717,10 +1700,9 @@
 {
     TRACE2("jni", "SetDoubleArrayRegion called");
     assert(tmn_is_suspend_enabled());
-    assert(len >= 0);
     jsize length = GetArrayLength(env, array);
     jsize end = start + len;
-    if(start < 0 || start >= length || end < 0 || end > length) {
+    if(start < 0 || len < 0 || end > length) {
         char msg[30];
         sprintf(msg, "%d..%d", start, end);
         ThrowNew_Quick(env, "java/lang/ArrayIndexOutOfBoundsException", msg);



Mime
View raw message