OSDN Git Service

Fix JNI GetDirectBufferAddress.
authorAndy McFadden <fadden@android.com>
Fri, 5 Jun 2009 20:36:44 +0000 (13:36 -0700)
committerAndy McFadden <fadden@android.com>
Fri, 5 Jun 2009 20:36:44 +0000 (13:36 -0700)
The GetDirectBufferAddress JNI function was using the buffer's base
address, rather than it's "effective" base address.  The difference
becomes important when you create a direct buffer by "slicing" it off
of another at a nonzero offset.

For internal bug 1898762.

vm/Jni.c

index f7a21ff..09e36a5 100644 (file)
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -2747,7 +2747,7 @@ static void* GetDirectBufferAddress(JNIEnv * env, jobject buf)
         return 0;
     }
 
-    tempMethod = (*env)->GetMethodID(env, tempClass, "getBaseAddress",
+    tempMethod = (*env)->GetMethodID(env, tempClass, "getEffectiveAddress",
              "()Lorg/apache/harmony/luni/platform/PlatformAddress;");        
     if(!tempMethod){
         return 0;