harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r454533 - in /incubator/harmony/enhanced/classlib/trunk/modules: luni/src/main/native/luni/linux/ luni/src/main/native/luni/shared/ luni/src/main/native/luni/windows/ prefs/src/main/native/prefs/windows/
Date Mon, 09 Oct 2006 22:15:23 GMT
Author: tellison
Date: Mon Oct  9 15:15:21 2006
New Revision: 454533

URL: http://svn.apache.org/viewvc?view=rev&rev=454533
Log:
Apply patch HARMONY-1634 ([classlib][native] unbalanced GetPrimitiveArrayCritical in classlib
native code)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/native/prefs/windows/PreferencesImpl.c

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c?view=diff&rev=454533&r1=454532&r2=454533
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
Mon Oct  9 15:15:21 2006
@@ -70,10 +70,7 @@
   jboolean isCopy;
   jbyte *bytes = (*env)->GetByteArrayElements (env, byteArray, &isCopy);
   memcpy (bytes + offset, (const void *) ((IDATA) address), (size_t) length);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
-    }
+  (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
 }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSMemory_setByteArray
@@ -84,10 +81,7 @@
   jbyte *bytes = (*env)->GetByteArrayElements (env, byteArray, &isCopy);
   memcpy ((void *) ((IDATA) address),
 	  (const jbyte *) ((IDATA) bytes + offset), (size_t) length);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseByteArrayElements (env, byteArray, bytes, JNI_ABORT);
-    }
+  (*env)->ReleaseByteArrayElements (env, byteArray, bytes, JNI_ABORT);
 }
 
 JNIEXPORT jbyte JNICALL Java_org_apache_harmony_luni_platform_OSMemory_getByte

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c?view=diff&rev=454533&r1=454532&r2=454533
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c
Mon Oct  9 15:15:21 2006
@@ -71,10 +71,7 @@
   result =
     (jlong) hyfile_read ((IDATA) fd, (void *) (bytes + offset),
                          (IDATA) nbytes);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
-    }
+  (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
 
   return result;
 }
@@ -95,10 +92,7 @@
   result =
     (jlong) hyfile_write ((IDATA) fd, (void *) (bytes + offset),
                          (IDATA) nbytes);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseByteArrayElements (env, byteArray, bytes, JNI_ABORT);
-    }
+   (*env)->ReleaseByteArrayElements (env, byteArray, bytes, JNI_ABORT);
 
   return result;
 }
@@ -273,9 +267,7 @@
     jlong result;
 
     result = (jlong) hytty_get_chars((char *)(bytes + offset), (IDATA) nbytes);
-    if (isCopy == JNI_TRUE) {
-        (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
-    }
+    (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
 
     return result;
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c?view=diff&rev=454533&r1=454532&r2=454533
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
Mon Oct  9 15:15:21 2006
@@ -67,10 +67,7 @@
   jboolean isCopy;
   jbyte *bytes = (*env)->GetByteArrayElements (env, byteArray, &isCopy);
   memcpy (bytes + offset, (const void *) address, (size_t) length);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
-    }
+  (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
 }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSMemory_getCharArray
@@ -78,10 +75,7 @@
   jboolean isCopy;
   jchar *dest = (*env)->GetCharArrayElements (env, jdest, &isCopy);
   memcpy (dest + offset, (const void *) address, (size_t) length);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseCharArrayElements (env, jdest, dest, 0);
-    }
+  (*env)->ReleaseCharArrayElements (env, jdest, dest, 0);
   }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSMemory_setByteArray
@@ -91,10 +85,7 @@
   jboolean isCopy;
   jbyte *bytes = (*env)->GetByteArrayElements (env, byteArray, &isCopy);
   memcpy ((void *) address, (const jbyte *) bytes + offset, (size_t) length);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseByteArrayElements (env, byteArray, bytes, JNI_ABORT);
-    }
+  (*env)->ReleaseByteArrayElements (env, byteArray, bytes, JNI_ABORT);
 }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSMemory_setCharArray
@@ -102,10 +93,7 @@
   jboolean isCopy;
   jchar *src = (*env)->GetCharArrayElements (env, jsrc, &isCopy);
   memcpy ((void *) address, (const jchar *) src + offset, (size_t) length);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleaseCharArrayElements (env, jsrc, src, JNI_ABORT);
-    }
+  (*env)->ReleaseCharArrayElements (env, jsrc, src, JNI_ABORT);
   }
 
 JNIEXPORT jbyte JNICALL Java_org_apache_harmony_luni_platform_OSMemory_getByte

Modified: incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/native/prefs/windows/PreferencesImpl.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/native/prefs/windows/PreferencesImpl.c?view=diff&rev=454533&r1=454532&r2=454533
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/native/prefs/windows/PreferencesImpl.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/native/prefs/windows/PreferencesImpl.c
Mon Oct  9 15:15:21 2006
@@ -61,10 +61,7 @@
     keyStr[i] = keyByte[i++];
   keyStr[i] = '\0';
 
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jkey, keyByte, JNI_ABORT);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jkey, keyByte, JNI_ABORT);
   return keyStr;
 }
 
@@ -117,10 +114,7 @@
   if (localErrorCode !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, err, 0);
-	}
       RegCloseKey (hKey);
       hymem_free_memory (keyStr);
       return NULL;
@@ -130,10 +124,7 @@
   localErrorCode = checkErrorCode (errorCode);
   RegCloseKey (hKey);
   hymem_free_memory (keyStr);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, err, 0);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, err, 0);
   err[java_util_prefs_RegistryPreferencesImpl_ERROR_CODE] = localErrorCode;
   if (localErrorCode !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
@@ -181,11 +172,8 @@
   if (localErrorCode !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return;
     }
 
@@ -194,10 +182,7 @@
   err = RegSetValueEx (hKey, keyStr, 0, REG_SZ, valueByte, valueLen);
   errArray[java_util_prefs_RegistryPreferencesImpl_ERROR_CODE] =
     checkErrorCode (err);
-  if (isCopy == JNI_TRUE)
-    {
       (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
   hymem_free_memory (keyStr);
   hymem_free_memory (valueByte);
   RegCloseKey (hKey);
@@ -226,11 +211,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return;
     }
 
@@ -238,10 +220,7 @@
   err = RegDeleteValue (hKey, keyStr);
   errArray[java_util_prefs_RegistryPreferencesImpl_ERROR_CODE] =
     checkErrorCode (err);
-  if (isCopy == JNI_TRUE)
-    {
       (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
   hymem_free_memory (keyStr);
   RegCloseKey (hKey);
   return;
@@ -273,11 +252,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return NULL;
     }
 
@@ -288,11 +264,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       RegCloseKey (hKey);
       return NULL;
     }
@@ -317,10 +290,7 @@
 	    checkErrorCode (err);
 	}
     }
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
   hymem_free_memory (value);
   RegCloseKey (hKey);
   return result;
@@ -348,11 +318,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return;
     }
 
@@ -360,10 +327,7 @@
   err = RegDeleteKey (hKey, nameStr);
   errArray[java_util_prefs_RegistryPreferencesImpl_ERROR_CODE] =
     checkErrorCode (err);
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
   hymem_free_memory (nameStr);
   RegCloseKey (hKey);
   return;
@@ -392,11 +356,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return JNI_FALSE;
     }
 
@@ -407,10 +368,7 @@
   errArray[java_util_prefs_RegistryPreferencesImpl_ERROR_CODE] =
     checkErrorCode (err);
 
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
 
   hymem_free_memory (name);
   RegCloseKey (hKey);
@@ -450,11 +408,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return NULL;
     }
 
@@ -465,11 +420,8 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       RegCloseKey (hKey);
       return NULL;
     }
@@ -495,10 +447,7 @@
 	}
     }
 
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
   hymem_free_memory (value);
   RegCloseKey (hKey);
   return result;
@@ -524,21 +473,15 @@
        checkErrorCode (err)) !=
       java_util_prefs_RegistryPreferencesImpl_RETURN_SUCCESS)
     {
-      if (isCopy == JNI_TRUE)
-	{
 	  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray,
 						 0);
-	}
       return;
     }
 
   errArray[java_util_prefs_RegistryPreferencesImpl_ERROR_CODE] =
     checkErrorCode (RegFlushKey (hKey));
 
-  if (isCopy == JNI_TRUE)
-    {
-      (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
-    }
+  (*env)->ReleasePrimitiveArrayCritical (env, jErrorCode, errArray, 0);
   RegCloseKey (hKey);
   return;
 }



Mime
View raw message