harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r421190 - in /incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors: linux/ shared/
Date Wed, 12 Jul 2006 08:39:02 GMT
Author: hindessm
Date: Wed Jul 12 01:39:01 2006
New Revision: 421190

URL: http://svn.apache.org/viewvc?rev=421190&view=rev
Log:
Convert accessor natives to C.

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c
      - copied, changed from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.c
      - copied, changed from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.c
      - copied, changed from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c
      - copied, changed from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.c
      - copied, changed from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.cpp
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.cpp
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.cpp
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/linux/makefile

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/linux/makefile
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/linux/makefile?rev=421190&r1=421189&r2=421190&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/linux/makefile
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/linux/makefile
Wed Jul 12 01:39:01 2006
@@ -29,8 +29,6 @@
 	$(DLLPATH)libhysig.so $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib.so $(LIBPATH)libhycommon.a
\
 	$(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a $(DLLPATH)libhythr.so $(LIBPATH)libvmi.so
 
-SYSLIBFILES=-lstdc++
-
 DLLNAME=../libaccessors.so
 
 include $(HY_HDK)/build/make/rules.mk

Copied: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c
(from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.cpp)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c?p2=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c&p1=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.cpp&r1=421183&r2=421190&rev=421190&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.cpp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c
Wed Jul 12 01:39:01 2006
@@ -27,7 +27,7 @@
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticLockArray
   (JNIEnv *env, jclass clazz, jobject array) {
-    return addr2jlong(env->GetPrimitiveArrayCritical((jarray)array, NULL));
+    return addr2jlong((*env)->GetPrimitiveArrayCritical(env, (jarray)array, NULL));
 }
 
 
@@ -38,7 +38,7 @@
  */
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnlockArray
   (JNIEnv *env, jclass clazz, jobject array, jlong addr) {
-    env->ReleasePrimitiveArrayCritical((jarray)array,  jlong2addr(jlong, addr), 0);
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array,  jlong2addr(jlong, addr),
0);
 }
 
 /*
@@ -48,7 +48,7 @@
  */
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnlockArrayNoCopy
   (JNIEnv *env, jclass clazz, jobject array, jlong addr) {
-    env->ReleasePrimitiveArrayCritical((jarray)array,  jlong2addr(jlong, addr), JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array,  jlong2addr(jlong, addr),
JNI_ABORT);
 }
 
 
@@ -66,15 +66,15 @@
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticPin##TypeArray
\
 (JNIEnv *env, jclass clss, jobject array) { \
     jboolean isCopy; \
-    return addr2jlong(env->Get##TypeArrayElements((typeArray)array, &isCopy)); \
+    return addr2jlong((*env)->Get##TypeArrayElements(env, (typeArray)array, &isCopy));
\
 } \
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnpin##TypeArray
\
 (JNIEnv *env, jclass clss, jobject array, jlong addr) { \
-  env->Release##TypeArrayElements((typeArray)array, jlong2addr(t, addr), 0); \
+  (*env)->Release##TypeArrayElements(env, (typeArray)array, jlong2addr(t, addr), 0); \
 } \
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnpin##TypeArrayNoCopy
\
 (JNIEnv *env, jclass clss, jobject array, jlong addr) { \
-  env->Release##TypeArrayElements((typeArray)array, jlong2addr(t, addr), JNI_ABORT); \
+  (*env)->Release##TypeArrayElements(env, (typeArray)array, jlong2addr(t, addr), JNI_ABORT);
\
 }
 
 pinFunctions(ByteArray, ByteArrayNoCopy, ByteArrayElements, jbyteArray, jbyte)
@@ -97,17 +97,17 @@
  */
 #define setGetFunctions(TI, TIT, t, typeArray) \
  JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_getElement___3##TI
\
-  (JNIEnv *env, jobject, typeArray array, jint index) { \
-    t* ptr = (t*)env->GetPrimitiveArrayCritical((jarray)array, NULL); \
+  (JNIEnv *env, jobject obj, typeArray array, jint index) { \
+    t* ptr = (t*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, NULL); \
     t res = ptr[index]; \
-    env->ReleasePrimitiveArrayCritical((jarray)array, ptr, 0); \
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, ptr, 0); \
     return res; \
   } \
  JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_setElement___3##TIT
\
-(JNIEnv *env, jobject, typeArray array, jint index, t value) { \
-    t* ptr = (t*)env->GetPrimitiveArrayCritical((jarray)array, NULL); \
+(JNIEnv *env, jobject obj, typeArray array, jint index, t value) { \
+    t* ptr = (t*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, NULL); \
     ptr[index] = value; \
-    env->ReleasePrimitiveArrayCritical((jarray)array, ptr, 0); \
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, ptr, 0); \
 }
 
 setGetFunctions(BI, BIB, jbyte, jbyteArray);
@@ -125,8 +125,8 @@
  * Signature: ([Ljava/lang/Object;I)Ljava/lang/Object;
  */
 JNIEXPORT jobject JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_getElement___3Ljava_lang_Object_2I
-(JNIEnv *env, jobject, jobjectArray array, jint index) {
-    return env->GetObjectArrayElement(array, index);
+(JNIEnv *env, jobject obj, jobjectArray array, jint index) {
+    return (*env)->GetObjectArrayElement(env, array, index);
 }
 
 /*
@@ -135,7 +135,7 @@
  * Signature: ([Ljava/lang/Object;ILjava/lang/Object;)V
  */
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_setElement___3Ljava_lang_Object_2ILjava_lang_Object_2
-(JNIEnv *env, jobject, jobjectArray array, jint index, jobject value) {
-    env->SetObjectArrayElement(array, index, value);
+(JNIEnv *env, jobject obj, jobjectArray array, jint index, jobject value) {
+    (*env)->SetObjectArrayElement(env, array, index, value);
 }
 

Copied: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.c
(from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.cpp)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.c?p2=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.c&p1=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.cpp&r1=421183&r2=421190&rev=421190&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.cpp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_Malloc.c
Wed Jul 12 01:39:01 2006
@@ -41,7 +41,7 @@
  * Signature: (JJ)J
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_Malloc_realloc
-  (JNIEnv *, jclass clazz, jlong addr, jlong size)
+  (JNIEnv *env, jclass clazz, jlong addr, jlong size)
 {
     return addr2jlong(realloc(jlong2addr(void, addr), (size_t)size));
 }

Copied: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.c
(from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.cpp)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.c?p2=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.c&p1=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.cpp&r1=421183&r2=421190&rev=421190&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.cpp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.c
Wed Jul 12 01:39:01 2006
@@ -27,7 +27,7 @@
  * Signature: ()I
  */
 JNIEXPORT jint JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_getNativeByteOrder0
-  (JNIEnv *env, jobject) 
+  (JNIEnv *env, jobject obj) 
 {
     short value = 0x1234;
     return (*(char *)&value) == 0x34 ? 1 : 0;
@@ -355,11 +355,11 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_getArray
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-  char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+  char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
   memcpy(buf + offset, jlong2addr(char, addr), size);
 
-  env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+  (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 
 /*
@@ -370,11 +370,11 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_setArray
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-  char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+  char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
   memcpy(jlong2addr(char, addr), buf + offset, size);
 
-  env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+  (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 
 /*
@@ -385,15 +385,16 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_getArrayReorder16
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-  char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+  int i;
+  char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
   jshort *src = jlong2addr(jshort, addr);
   jshort *dst = (jshort*)buf + offset;
-  for(int i = 0; i < size; ++i)  {
+  for(i = 0; i < size; ++i)  {
       dst[i] = byte_swap_16(src[i]);
   }
 
-  env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+  (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 /*
  * Class:     org_apache_harmony_misc_accessors_MemoryAccessor
@@ -403,15 +404,16 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_getArrayReorder32
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-    char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+    int i;
+    char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
     jint *src = jlong2addr(jint, addr);
     jint *dst = (jint*)buf + offset;
-    for(int i = 0; i < size; ++i)  {
+    for(i = 0; i < size; ++i)  {
         dst[i] = byte_swap_32(src[i]);
     }
 
-    env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 
 /*
@@ -422,15 +424,16 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_getArrayReorder64
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-    char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+    int i;
+    char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
     jlong *src = jlong2addr(jlong, addr);
     jlong *dst = (jlong*)buf + offset;
-    for(int i = 0; i < size; ++i)  {
+    for(i = 0; i < size; ++i)  {
         dst[i] = byte_swap_64(src[i]);
     }
 
-    env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 
 /*
@@ -441,15 +444,16 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_setArrayReorder16
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-  char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+  int i;
+  char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
   jshort *dst = jlong2addr(jshort, addr);
   jshort *src = (jshort*)buf + offset;
-  for(int i = 0; i < size; ++i)  {
+  for(i = 0; i < size; ++i)  {
       dst[i] = byte_swap_16(src[i]);
   }
 
-  env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+  (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 /*
  * Class:     org_apache_harmony_misc_accessors_MemoryAccessor
@@ -459,15 +463,16 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_setArrayReorder32
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-    char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+    int i;
+    char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
     jint *dst = jlong2addr(jint, addr);
     jint *src = (jint*)buf + offset;
-    for(int i = 0; i < size; ++i)  {
+    for(i = 0; i < size; ++i)  {
         dst[i] = byte_swap_32(src[i]);
     }
 
-    env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 
 /*
@@ -478,15 +483,16 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_MemoryAccessor_setArrayReorder64
   (JNIEnv *env, jobject self, jlong addr, jobject array, jlong offset, jlong size)
 {
-    char *buf = (char*)env->GetPrimitiveArrayCritical((jarray)array, 0);
+    int i;
+    char *buf = (char*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, 0);
 
     jlong *dst = jlong2addr(jlong, addr);
     jlong *src = (jlong*)buf + offset;
-    for(int i = 0; i < size; ++i)  {
+    for(i = 0; i < size; ++i)  {
         dst[i] = byte_swap_64(src[i]);
     }
 
-    env->ReleasePrimitiveArrayCritical((jarray)array, buf, 0);
+    (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, buf, 0);
 }
 
 /*
@@ -562,9 +568,10 @@
   (JNIEnv *env, jobject self, jlong addr, jlong size)
 {
     int mult = 1;
+    int i;
     jbyte* block = jlong2addr(jbyte, addr);
     jint res = 0;
-    for (int i = size - 1; i >= 0; i--) {
+    for (i = size - 1; i >= 0; i--) {
         res += block[i] * mult;
         mult *= 31;
     }

Copied: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c
(from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.cpp)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c?p2=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c&p1=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.cpp&r1=421183&r2=421190&rev=421190&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.cpp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c
Wed Jul 12 01:39:01 2006
@@ -36,19 +36,19 @@
 #define fieldAccessFunctions(t,T,F) \
 JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_get##T \
 (JNIEnv *env, jobject accessorObj, jobject obj, jlong fieldID) { \
-    return env->Get##F(obj, (jfieldID)(intptr_t)fieldID); \
+    return (*env)->Get##F(env, obj, (jfieldID)(intptr_t)fieldID); \
 } \
 JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getStatic##T \
   (JNIEnv *env, jobject accessorObj, jclass clss, jlong fieldID) { \
-  return env->GetStatic##F(clss, (jfieldID)(intptr_t)fieldID); \
+  return (*env)->GetStatic##F(env, clss, (jfieldID)(intptr_t)fieldID); \
 } \
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_set##T \
 (JNIEnv *env, jobject accessorObj, jobject obj, jlong fieldID, t value) { \
-    env->Set##F(obj, (jfieldID)(intptr_t)fieldID, value); \
+    (*env)->Set##F(env, obj, (jfieldID)(intptr_t)fieldID, value); \
 } \
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_setStatic##T
\
 (JNIEnv *env, jobject accessorObj, jclass clss, jlong fieldID, t value) { \
-    env->SetStatic##F(clss, (jfieldID)(intptr_t)fieldID, value); \
+    (*env)->SetStatic##F(env, clss, (jfieldID)(intptr_t)fieldID, value); \
 }
 
 
@@ -66,35 +66,35 @@
 // Cached references to primitive type wrapping classes
 jclass findIntClass(JNIEnv* env) {
     static jclass intClass;
-    return intClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Integer"))
: intClass;
+    return intClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Integer")) : intClass;
 }
 jclass findBooleanClass(JNIEnv* env) {
     static jclass booleanClass;
-    return booleanClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Boolean"))
: booleanClass;
+    return booleanClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Boolean")) : booleanClass;
 }
 jclass findByteClass(JNIEnv* env) {
     static jclass byteClass;
-    return byteClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Byte"))
: byteClass;
+    return byteClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Byte")) : byteClass;
 }
 jclass findShortClass(JNIEnv* env) {
     static jclass shortClass;
-    return shortClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Short"))
: shortClass;
+    return shortClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Short")) : shortClass;
 }
 jclass findCharClass(JNIEnv* env) {
     static jclass charClass;
-    return charClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Character"))
: charClass;
+    return charClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Character")) : charClass;
 }
 jclass findLongClass(JNIEnv* env) {
     static jclass longClass;
-    return longClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Long"))
: longClass;
+    return longClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Long")) : longClass;
 }
 jclass findFloatClass(JNIEnv* env) {
     static jclass floatClass;
-    return floatClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Float"))
: floatClass;
+    return floatClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Float")) : floatClass;
 }
 jclass findDoubleClass(JNIEnv* env) {
     static jclass doubleClass;
-    return doubleClass == NULL ? (jclass)env->NewGlobalRef(env->FindClass("java/lang/Double"))
: doubleClass;
+    return doubleClass == NULL ? (jclass)(*env)->NewGlobalRef(env, (*env)->FindClass(env,
"java/lang/Double")) : doubleClass;
 }
 
 
@@ -103,14 +103,18 @@
  * Method for debugging purposes - can be used to print java object name.
  */
 void printObjectName(JNIEnv* env, jobject obj) {
-    jmethodID id = env->GetMethodID(env->GetObjectClass(obj), "toString", "()Ljava/lang/String;");
+    jmethodID id = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, obj), "toString",
"()Ljava/lang/String;");
+    jstring jstr;
+    jboolean isCopy;
+    const char* str;
+
     assert(id != NULL);
-    jstring jstr = (jstring)env->CallObjectMethodA(obj, id, NULL);
+    jstr = (jstring)(*env)->CallObjectMethodA(env, obj, id, NULL);
     assert(jstr != NULL);
-    jboolean isCopy;
-    const char* str = env->GetStringUTFChars(jstr, &isCopy);
+    str = (*env)->GetStringUTFChars(env, jstr, &isCopy);
+
     printf("Object: %s\n", str);
-    env->ReleaseStringUTFChars(jstr, str);
+    (*env)->ReleaseStringUTFChars(env, jstr, str);
 }
 
 
@@ -118,39 +122,40 @@
  * Convenience method - converts an object array to array of jvalues suitable for CallXXX
functions.
  */
 jvalue* jarrayToValues(JNIEnv* env, jobjectArray array) {
-    int len = env->GetArrayLength(array);
+    int len = (*env)->GetArrayLength(env, array);
     jvalue* pargs = (jvalue*)malloc(len * sizeof(jvalue));
     jobject obj;
     jclass clss;
     jmethodID methodID;
-    for (int i = 0; i < len; i++) {
-        obj = env->GetObjectArrayElement(array, i);
-        clss = env->GetObjectClass(obj);
+    int i;
+    for (i = 0; i < len; i++) {
+        obj = (*env)->GetObjectArrayElement(env, array, i);
+        clss = (*env)->GetObjectClass(env, obj);
         // Do unboxing for primitive type wrappers
-        if (env->IsSameObject(clss, findIntClass(env))) {
-            methodID = env->GetMethodID(clss, "intValue", "()I");
-            pargs[i].i = env->CallIntMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findLongClass(env))) {
-            methodID = env->GetMethodID(clss, "longValue", "()J");
-            pargs[i].j = env->CallLongMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findShortClass(env))) {
-            methodID = env->GetMethodID(clss, "shortValue", "()S");
-            pargs[i].s = env->CallShortMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findByteClass(env))) {
-            methodID = env->GetMethodID(clss, "byteValue", "()B");
-            pargs[i].b = env->CallByteMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findCharClass(env))) {
-            methodID = env->GetMethodID(clss, "charValue", "()C");
-            pargs[i].c = env->CallCharMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findFloatClass(env))) {
-            methodID = env->GetMethodID(clss, "floatValue", "()F");
-            pargs[i].f = env->CallFloatMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findDoubleClass(env))) {
-            methodID = env->GetMethodID(clss, "doubleValue", "()D");
-            pargs[i].d = env->CallDoubleMethodA(obj, methodID, NULL);
-        } else if(env->IsSameObject(clss, findBooleanClass(env))) {
-            methodID = env->GetMethodID(clss, "booleanValue", "()Z");
-            pargs[i].z = env->CallBooleanMethodA(obj, methodID, NULL);
+        if ((*env)->IsSameObject(env, clss, findIntClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "intValue", "()I");
+            pargs[i].i = (*env)->CallIntMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findLongClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "longValue", "()J");
+            pargs[i].j = (*env)->CallLongMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findShortClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "shortValue", "()S");
+            pargs[i].s = (*env)->CallShortMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findByteClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "byteValue", "()B");
+            pargs[i].b = (*env)->CallByteMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findCharClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "charValue", "()C");
+            pargs[i].c = (*env)->CallCharMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findFloatClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "floatValue", "()F");
+            pargs[i].f = (*env)->CallFloatMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findDoubleClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "doubleValue", "()D");
+            pargs[i].d = (*env)->CallDoubleMethodA(env, obj, methodID, NULL);
+        } else if((*env)->IsSameObject(env, clss, findBooleanClass(env))) {
+            methodID = (*env)->GetMethodID(env, clss, "booleanValue", "()Z");
+            pargs[i].z = (*env)->CallBooleanMethodA(env, obj, methodID, NULL);
         } else {
             pargs[i].l = obj;
         }
@@ -163,19 +168,19 @@
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_invokeNonVirtualVoid
 (JNIEnv *env, jobject accessorObj, jclass clss, jobject obj, jlong methodID, jobjectArray
args){
     jvalue* pargs = jarrayToValues(env, args);
-    env->CallNonvirtualVoidMethodA(obj, clss, (jmethodID)(intptr_t)methodID, pargs);
+    (*env)->CallNonvirtualVoidMethodA(env, obj, clss, (jmethodID)(intptr_t)methodID, pargs);
     free(pargs);
 }
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_invokeStaticVoid
 (JNIEnv *env, jobject accessorObj, jclass clss, jlong methodID, jobjectArray args) {
     jvalue* pargs = jarrayToValues(env, args);
-    env->CallStaticVoidMethodA(clss, (jmethodID)(intptr_t)methodID, pargs);
+    (*env)->CallStaticVoidMethodA(env, clss, (jmethodID)(intptr_t)methodID, pargs);
     free(pargs);
 }
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_invokeVirtualVoid
 (JNIEnv *env, jobject accessorObj, jobject obj, jlong methodID, jobjectArray args) {
     jvalue* pargs = jarrayToValues(env, args);
-    env->CallVoidMethodA(obj, (jmethodID)(intptr_t)methodID, pargs);
+    (*env)->CallVoidMethodA(env, obj, (jmethodID)(intptr_t)methodID, pargs);
     free(pargs);
 }
 
@@ -194,21 +199,21 @@
  JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_invokeNonVirtual##T
\
 (JNIEnv *env, jobject accessorObj, jclass clss, jobject obj, jlong methodID, jobjectArray
args){ \
     jvalue* pargs = jarrayToValues(env, args); \
-    t res = env->CallNonvirtual##M(obj, clss, (jmethodID)(intptr_t)methodID, pargs); \
+    t res = (*env)->CallNonvirtual##M(env, obj, clss, (jmethodID)(intptr_t)methodID, pargs);
\
     free(pargs); \
     return res; \
 } \
 JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_invokeStatic##T
\
 (JNIEnv *env, jobject accessorObj, jclass clss, jlong methodID, jobjectArray args) { \
     jvalue* pargs = jarrayToValues(env, args); \
-    t res = env->CallStatic##M(clss, (jmethodID)(intptr_t)methodID, pargs); \
+    t res = (*env)->CallStatic##M(env, clss, (jmethodID)(intptr_t)methodID, pargs); \
     free(pargs); \
     return res; \
 } \
 JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_invokeVirtual##T
\
 (JNIEnv *env, jobject accessorObj, jobject obj, jlong methodID, jobjectArray args) { \
     jvalue* pargs = jarrayToValues(env, args); \
-    t res = env->Call##M(obj, (jmethodID)(intptr_t)methodID, pargs); \
+    t res = (*env)->Call##M(env, obj, (jmethodID)(intptr_t)methodID, pargs); \
     free(pargs); \
     return res; \
 }
@@ -236,7 +241,7 @@
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getFieldID__Ljava_lang_reflect_Field_2
 (JNIEnv *env, jobject accessorObj, jobject field) {
-        return (jlong)(intptr_t)env->FromReflectedField(field);
+        return (jlong)(intptr_t)(*env)->FromReflectedField(env, field);
 }
 
 /*
@@ -245,13 +250,13 @@
  * Signature: (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;)J
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getMethodID0__Ljava_lang_Class_2Ljava_lang_String_2Ljava_lang_String_2
-(JNIEnv *env, jclass, jclass clss, jstring methodName, jstring methodSignature) {
+(JNIEnv *env, jclass cl, jclass clss, jstring methodName, jstring methodSignature) {
     jboolean isCopy;
-    char* method = (char *)env->GetStringUTFChars(methodName, &isCopy);
-    char* sig = (char *)env->GetStringUTFChars(methodSignature, &isCopy);
-    jlong res = (jlong)(intptr_t)env->GetMethodID(clss, method, sig);
-    env->ReleaseStringUTFChars(methodName, method);
-    env->ReleaseStringUTFChars(methodSignature, sig);
+    char* method = (char *)(*env)->GetStringUTFChars(env, methodName, &isCopy);
+    char* sig = (char *)(*env)->GetStringUTFChars(env, methodSignature, &isCopy);
+    jlong res = (jlong)(intptr_t)(*env)->GetMethodID(env, clss, method, sig);
+    (*env)->ReleaseStringUTFChars(env, methodName, method);
+    (*env)->ReleaseStringUTFChars(env, methodSignature, sig);
     return res;
 }
 
@@ -261,13 +266,13 @@
  * Signature: (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;)J
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getStaticMethodID0
-(JNIEnv *env, jclass, jclass clss, jstring methodName, jstring methodSignature) {
+(JNIEnv *env, jclass cl, jclass clss, jstring methodName, jstring methodSignature) {
     jboolean isCopy;
-    char* method = (char *)env->GetStringUTFChars(methodName, &isCopy);
-    char* sig = (char *)env->GetStringUTFChars(methodSignature, &isCopy);
-    jlong res = (jlong)(intptr_t)env->GetStaticMethodID(clss, method, sig);
-    env->ReleaseStringUTFChars(methodName, method);
-    env->ReleaseStringUTFChars(methodSignature, sig);
+    char* method = (char *)(*env)->GetStringUTFChars(env, methodName, &isCopy);
+    char* sig = (char *)(*env)->GetStringUTFChars(env, methodSignature, &isCopy);
+    jlong res = (jlong)(intptr_t)(*env)->GetStaticMethodID(env, clss, method, sig);
+    (*env)->ReleaseStringUTFChars(env, methodName, method);
+    (*env)->ReleaseStringUTFChars(env, methodSignature, sig);
     return res;
 }
 
@@ -278,8 +283,8 @@
  * Signature: (Ljava/lang/reflect/Member;)J
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getMethodID0__Ljava_lang_reflect_Member_2
-(JNIEnv *env, jclass, jobject method) {
-    return (jlong)(intptr_t)env->FromReflectedField(method);
+(JNIEnv *env, jclass cl, jobject method) {
+    return (jlong)(intptr_t)(*env)->FromReflectedField(env, method);
 }
 
 
@@ -291,7 +296,7 @@
  */
 JNIEXPORT jobject JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_allocateObject
 (JNIEnv *env, jobject accessorObj, jclass clazz) {
-     return env->AllocObject(clazz);
+     return (*env)->AllocObject(env, clazz);
 }
 
 /*
@@ -302,7 +307,7 @@
 JNIEXPORT jobject JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_newInstance__Ljava_lang_Class_2J_3Ljava_lang_Object_2
 (JNIEnv *env, jobject accessorObj, jclass clss, jlong ctorID, jobjectArray args) {
     jvalue* pargs = jarrayToValues(env, args);
-    jobject res = env->NewObjectA(clss, (jmethodID)(intptr_t)ctorID, pargs);
+    jobject res = (*env)->NewObjectA(env, clss, (jmethodID)(intptr_t)ctorID, pargs);
     free(pargs);
     return res;
 }
@@ -317,8 +322,8 @@
  */
 JNIEXPORT jobject JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_newInstance__Ljava_lang_Class_2
 (JNIEnv *env, jobject accessorObj, jclass c) {
-    jmethodID ctorID = env->GetMethodID(c, "<init>", "()V");
-    return env->NewObject(c, ctorID);
+    jmethodID ctorID = (*env)->GetMethodID(env, c, "<init>", "()V");
+    return (*env)->NewObject(env, c, ctorID);
 }
 
 /*
@@ -328,8 +333,8 @@
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_hasStaticInitializer
 (JNIEnv *env, jobject accessorObj, jclass c) {
-    jboolean res = env->GetStaticMethodID(c, "<clinit>", "()V") != 0 ? JNI_TRUE
: JNI_FALSE;
-    env->ExceptionClear();
+    jboolean res = (*env)->GetStaticMethodID(env, c, "<clinit>", "()V") != 0 ? JNI_TRUE
: JNI_FALSE;
+    (*env)->ExceptionClear(env);
     return res;
 }
 
@@ -340,7 +345,7 @@
  */
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_monitorEnter
 (JNIEnv *env, jobject accessorObj, jobject obj) {
-    env->MonitorEnter(obj);
+    (*env)->MonitorEnter(env, obj);
 }
 
 /*
@@ -350,7 +355,7 @@
  */
 JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_monitorExit
 (JNIEnv *env, jobject accessorObj, jobject obj) {
-    env->MonitorExit(obj);
+    (*env)->MonitorExit(env, obj);
 }
 
 /*
@@ -361,11 +366,11 @@
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getFieldID__Ljava_lang_Class_2Ljava_lang_String_2Ljava_lang_String_2
 (JNIEnv *env, jobject accessorObj, jclass clss, jstring fieldName, jstring fieldSig) {
     jboolean isCopy;
-    char* name = (char *)env->GetStringUTFChars(fieldName, &isCopy);
-    char* sig = (char *)env->GetStringUTFChars(fieldSig, &isCopy);
-    jlong res = (jlong)(intptr_t)env->GetFieldID(clss, name, sig);
-    env->ReleaseStringUTFChars(fieldName, name);
-    env->ReleaseStringUTFChars(fieldSig, sig);
+    char* name = (char *)(*env)->GetStringUTFChars(env, fieldName, &isCopy);
+    char* sig = (char *)(*env)->GetStringUTFChars(env, fieldSig, &isCopy);
+    jlong res = (jlong)(intptr_t)(*env)->GetFieldID(env, clss, name, sig);
+    (*env)->ReleaseStringUTFChars(env, fieldName, name);
+    (*env)->ReleaseStringUTFChars(env, fieldSig, sig);
     return res;
 }
 
@@ -377,11 +382,11 @@
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_getStaticFieldID
 (JNIEnv *env, jobject accessorObj, jclass clss, jstring fieldName, jstring fieldSig) {
     jboolean isCopy;
-    char* name = (char *)env->GetStringUTFChars(fieldName, &isCopy);
-    char* sig = (char *)env->GetStringUTFChars(fieldSig, &isCopy);
-    jlong res = (jlong)(intptr_t)env->GetStaticFieldID(clss, name, sig);
-    env->ReleaseStringUTFChars(fieldName, name);
-    env->ReleaseStringUTFChars(fieldSig, sig);
+    char* name = (char *)(*env)->GetStringUTFChars(env, fieldName, &isCopy);
+    char* sig = (char *)(*env)->GetStringUTFChars(env, fieldSig, &isCopy);
+    jlong res = (jlong)(intptr_t)(*env)->GetStaticFieldID(env, clss, name, sig);
+    (*env)->ReleaseStringUTFChars(env, fieldName, name);
+    (*env)->ReleaseStringUTFChars(env, fieldSig, sig);
     return res;
 }
 

Copied: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.c
(from r421183, incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.cpp)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.c?p2=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.c&p1=incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.cpp&r1=421183&r2=421190&rev=421190&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.cpp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_StringAccessorImpl.c
Wed Jul 12 01:39:01 2006
@@ -39,11 +39,11 @@
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_StringAccessor_getUTFChars
   (JNIEnv *env, jobject self, jstring str)
 {
-    const char* strPtr = (const char*)env->GetStringUTFChars(str, 0);
-    int len = env->GetStringUTFLength(str);
+    const char* strPtr = (const char*)(*env)->GetStringUTFChars(env, str, 0);
+    int len = (*env)->GetStringUTFLength(env, str);
     char* resPtr = (char*)malloc(len * sizeof(char) + 2);
     memcpy(resPtr, strPtr, len);
-    env->ReleaseStringUTFChars(str, (const char*)strPtr);
+    (*env)->ReleaseStringUTFChars(env, str, (const char*)strPtr);
     resPtr[len + 1] = resPtr[len] = 0;
     return addr2jlong(resPtr);
 
@@ -57,11 +57,11 @@
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_StringAccessor_getChars
   (JNIEnv *env, jobject self, jstring str)
 {
-    const jchar* strPtr = (const jchar*)env->GetStringCritical(str, 0);
-    int len = env->GetStringLength(str);
+    const jchar* strPtr = (const jchar*)(*env)->GetStringCritical(env, str, 0);
+    int len = (*env)->GetStringLength(env, str);
     jchar* resPtr = (jchar*)malloc((len + 1) * sizeof(jchar));
     memcpy(resPtr, strPtr, len * sizeof(jchar));
-    env->ReleaseStringCritical(str, (const jchar*)strPtr);
+    (*env)->ReleaseStringCritical(env, str, (const jchar*)strPtr);
     resPtr[len] = 0;
     return addr2jlong(resPtr);
 }
@@ -74,7 +74,7 @@
 JNIEXPORT jstring JNICALL Java_org_apache_harmony_misc_accessors_StringAccessor_createStringUTF__J
   (JNIEnv *env, jobject self, jlong ptr) 
 {
-    return env->NewStringUTF(jlong2addr(const char, ptr));
+    return (*env)->NewStringUTF(env, jlong2addr(const char, ptr));
 }
 
 /*
@@ -85,7 +85,7 @@
 JNIEXPORT jstring JNICALL Java_org_apache_harmony_misc_accessors_StringAccessor_createString__J
   (JNIEnv *env, jobject self, jlong ptr)
 {
-    return env->NewString(jlong2addr(const jchar, ptr), jstrlen(jlong2addr(const jchar,
ptr)));
+    return (*env)->NewString(env, jlong2addr(const jchar, ptr), jstrlen(jlong2addr(const
jchar, ptr)));
 }
 
 /*
@@ -98,9 +98,10 @@
 {
     const jlong tmplen = len + 2;
     char* cstr = (char*)malloc(tmplen);
+    jstring res;
     memset(cstr, 0, tmplen);
     strncpy(cstr, jlong2addr(const char, ptr), len);
-    jstring res = env->NewStringUTF(cstr);
+    res = (*env)->NewStringUTF(env, cstr);
     free(cstr);
     return res;
 }
@@ -113,5 +114,5 @@
 JNIEXPORT jstring JNICALL Java_org_apache_harmony_misc_accessors_StringAccessor_createString__JJ
   (JNIEnv *env, jobject self, jlong ptr, jlong len)
 {
-    return env->NewString(jlong2addr(const jchar, ptr), min(len >> 1, jstrlen(jlong2addr(const
jchar, ptr))));
+    return (*env)->NewString(env, jlong2addr(const jchar, ptr), min(len >> 1, jstrlen(jlong2addr(const
jchar, ptr))));
 }



Mime
View raw message