diff options
author | Ashok Bhat <ashok.bhat@arm.com> | 2013-12-17 19:04:19 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-01-07 12:52:57 +0000 |
commit | e2e59326f13cf291bf5b37989390fd2a55a94f0c (patch) | |
tree | 10e48409726a6d4f96d5e48b619a57a0c0870fa3 /media/jni/android_mtp_MtpServer.cpp | |
parent | 9bc6acf27ac446b7e18a51a926caafd99cf34713 (diff) |
AArch64: Use long for pointers in MTP classes
For storing pointers, long is used in MTP classes,
as native pointers can be 64-bit.
In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use
of jint instead of int in JNI function prototypes)
Change-Id: I67805547251722e7b77611d47d0bb632a64d3e6d
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Diffstat (limited to 'media/jni/android_mtp_MtpServer.cpp')
-rw-r--r-- | media/jni/android_mtp_MtpServer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/media/jni/android_mtp_MtpServer.cpp b/media/jni/android_mtp_MtpServer.cpp index 5252a3afc20f..9d7f1c2614c4 100644 --- a/media/jni/android_mtp_MtpServer.cpp +++ b/media/jni/android_mtp_MtpServer.cpp @@ -53,7 +53,7 @@ static Mutex sMutex; extern MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database); static inline MtpServer* getMtpServer(JNIEnv *env, jobject thiz) { - return (MtpServer*)env->GetIntField(thiz, field_MtpServer_nativeContext); + return (MtpServer*)env->GetLongField(thiz, field_MtpServer_nativeContext); } static void @@ -63,7 +63,7 @@ android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase, jbo if (fd >= 0) { MtpServer* server = new MtpServer(fd, getMtpDatabase(env, javaDatabase), usePtp, AID_MEDIA_RW, 0664, 0775); - env->SetIntField(thiz, field_MtpServer_nativeContext, (int)server); + env->SetLongField(thiz, field_MtpServer_nativeContext, (jlong)server); } else { ALOGE("could not open MTP driver, errno: %d", errno); } @@ -87,7 +87,7 @@ android_mtp_MtpServer_cleanup(JNIEnv *env, jobject thiz) MtpServer* server = getMtpServer(env, thiz); if (server) { delete server; - env->SetIntField(thiz, field_MtpServer_nativeContext, 0); + env->SetLongField(thiz, field_MtpServer_nativeContext, 0); } else { ALOGE("server is null in cleanup"); } @@ -226,7 +226,7 @@ int register_android_mtp_MtpServer(JNIEnv *env) ALOGE("Can't find android/mtp/MtpServer"); return -1; } - field_MtpServer_nativeContext = env->GetFieldID(clazz, "mNativeContext", "I"); + field_MtpServer_nativeContext = env->GetFieldID(clazz, "mNativeContext", "J"); if (field_MtpServer_nativeContext == NULL) { ALOGE("Can't find MtpServer.mNativeContext"); return -1; |