summaryrefslogtreecommitdiffstats
path: root/core/jni/android_os_Parcel.cpp
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-11-20 11:41:21 -0800
committerDan Albert <danalbert@google.com>2014-11-20 11:47:40 -0800
commit6698749dd4d4d6513b26aa9071af290b956b68a7 (patch)
tree6c0716e521b60ff501f4aa4a3f7aff160578135f /core/jni/android_os_Parcel.cpp
parent36c7f4b67326bad547f16aa6e72140bd839ab28d (diff)
downloadframeworks_base-6698749dd4d4d6513b26aa9071af290b956b68a7.zip
frameworks_base-6698749dd4d4d6513b26aa9071af290b956b68a7.tar.gz
frameworks_base-6698749dd4d4d6513b26aa9071af290b956b68a7.tar.bz2
Add appropriate casts for char16_t.
C++11 defines a real char16_t, which is not implicitly convertible to uint16_t (and by extension jchar). Add casts as needed. Bug: 18300613 Change-Id: I00752002ef2e938bdb57f70947e8fd53ec103293
Diffstat (limited to 'core/jni/android_os_Parcel.cpp')
-rw-r--r--core/jni/android_os_Parcel.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp
index 896faa6..16f7d12 100644
--- a/core/jni/android_os_Parcel.cpp
+++ b/core/jni/android_os_Parcel.cpp
@@ -277,7 +277,9 @@ static void android_os_Parcel_writeString(JNIEnv* env, jclass clazz, jlong nativ
if (val) {
const jchar* str = env->GetStringCritical(val, 0);
if (str) {
- err = parcel->writeString16(str, env->GetStringLength(val));
+ err = parcel->writeString16(
+ reinterpret_cast<const char16_t*>(str),
+ env->GetStringLength(val));
env->ReleaseStringCritical(val, str);
}
} else {
@@ -411,7 +413,7 @@ static jstring android_os_Parcel_readString(JNIEnv* env, jclass clazz, jlong nat
size_t len;
const char16_t* str = parcel->readString16Inplace(&len);
if (str) {
- return env->NewString(str, len);
+ return env->NewString(reinterpret_cast<const jchar*>(str), len);
}
return NULL;
}
@@ -453,7 +455,8 @@ static jobject android_os_Parcel_openFileDescriptor(JNIEnv* env, jclass clazz,
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return NULL;
}
- String8 name8(str, env->GetStringLength(name));
+ String8 name8(reinterpret_cast<const char16_t*>(str),
+ env->GetStringLength(name));
env->ReleaseStringCritical(name, str);
int flags=0;
switch (mode&0x30000000) {
@@ -648,7 +651,9 @@ static void android_os_Parcel_writeInterfaceToken(JNIEnv* env, jclass clazz, jlo
// the caller expects to be invoking
const jchar* str = env->GetStringCritical(name, 0);
if (str != NULL) {
- parcel->writeInterfaceToken(String16(str, env->GetStringLength(name)));
+ parcel->writeInterfaceToken(String16(
+ reinterpret_cast<const char16_t*>(str),
+ env->GetStringLength(name)));
env->ReleaseStringCritical(name, str);
}
}
@@ -663,7 +668,8 @@ static void android_os_Parcel_enforceInterface(JNIEnv* env, jclass clazz, jlong
IPCThreadState* threadState = IPCThreadState::self();
const int32_t oldPolicy = threadState->getStrictModePolicy();
const bool isValid = parcel->enforceInterface(
- String16(str, env->GetStringLength(name)),
+ String16(reinterpret_cast<const char16_t*>(str),
+ env->GetStringLength(name)),
threadState);
env->ReleaseStringCritical(name, str);
if (isValid) {