diff options
| author | Dan Albert <danalbert@google.com> | 2014-11-20 22:25:07 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-20 22:25:07 +0000 |
| commit | d8c169fedf883491e46b354484909694fd52cfaf (patch) | |
| tree | acdec1eddce5fb5c55ab7ee791a54444456bde4d /core | |
| parent | bcb86374dccf15a8ee1dc03a1c69638fc6d9529f (diff) | |
| parent | 0c437fd3a79ba5f9118ec10940a3398665690587 (diff) | |
| download | frameworks_base-d8c169fedf883491e46b354484909694fd52cfaf.zip frameworks_base-d8c169fedf883491e46b354484909694fd52cfaf.tar.gz frameworks_base-d8c169fedf883491e46b354484909694fd52cfaf.tar.bz2 | |
am 0c437fd3: Merge "Add appropriate casts for char16_t."
* commit '0c437fd3a79ba5f9118ec10940a3398665690587':
Add appropriate casts for char16_t.
Diffstat (limited to 'core')
| -rw-r--r-- | core/jni/android_hardware_Camera.cpp | 9 | ||||
| -rw-r--r-- | core/jni/android_media_AudioSystem.cpp | 7 | ||||
| -rw-r--r-- | core/jni/android_os_Debug.cpp | 3 | ||||
| -rw-r--r-- | core/jni/android_os_Parcel.cpp | 16 | ||||
| -rw-r--r-- | core/jni/android_util_AssetManager.cpp | 30 | ||||
| -rw-r--r-- | core/jni/android_util_Binder.cpp | 3 | ||||
| -rw-r--r-- | core/jni/android_util_Process.cpp | 9 | ||||
| -rw-r--r-- | core/jni/android_util_XmlBlock.cpp | 9 | ||||
| -rw-r--r-- | core/jni/android_view_KeyCharacterMap.cpp | 8 |
9 files changed, 63 insertions, 31 deletions
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index f8bab24..0559864 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -474,10 +474,12 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz, jobject weak_this, jint cameraId, jint halVersion, jstring clientPackageName) { // Convert jstring to String16 - const char16_t *rawClientName = env->GetStringChars(clientPackageName, NULL); + const char16_t *rawClientName = reinterpret_cast<const char16_t*>( + env->GetStringChars(clientPackageName, NULL)); jsize rawClientNameLen = env->GetStringLength(clientPackageName); String16 clientName(rawClientName, rawClientNameLen); - env->ReleaseStringChars(clientPackageName, rawClientName); + env->ReleaseStringChars(clientPackageName, + reinterpret_cast<const jchar*>(rawClientName)); sp<Camera> camera; if (halVersion == CAMERA_HAL_API_VERSION_NORMAL_CONNECT) { @@ -740,7 +742,8 @@ static void android_hardware_Camera_setParameters(JNIEnv *env, jobject thiz, jst const jchar* str = env->GetStringCritical(params, 0); String8 params8; if (params) { - params8 = String8(str, env->GetStringLength(params)); + params8 = String8(reinterpret_cast<const char16_t*>(str), + env->GetStringLength(params)); env->ReleaseStringCritical(params, str); } if (camera->setParameters(params8) != NO_ERROR) { diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index 47ba998..0b278d3 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -255,7 +255,9 @@ android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyVa const jchar* c_keyValuePairs = env->GetStringCritical(keyValuePairs, 0); String8 c_keyValuePairs8; if (keyValuePairs) { - c_keyValuePairs8 = String8(c_keyValuePairs, env->GetStringLength(keyValuePairs)); + c_keyValuePairs8 = String8( + reinterpret_cast<const char16_t*>(c_keyValuePairs), + env->GetStringLength(keyValuePairs)); env->ReleaseStringCritical(keyValuePairs, c_keyValuePairs); } int status = check_AudioSystem_Command(AudioSystem::setParameters(c_keyValuePairs8)); @@ -268,7 +270,8 @@ android_media_AudioSystem_getParameters(JNIEnv *env, jobject thiz, jstring keys) const jchar* c_keys = env->GetStringCritical(keys, 0); String8 c_keys8; if (keys) { - c_keys8 = String8(c_keys, env->GetStringLength(keys)); + c_keys8 = String8(reinterpret_cast<const char16_t*>(c_keys), + env->GetStringLength(keys)); env->ReleaseStringCritical(keys, c_keys); } return env->NewStringUTF(AudioSystem::getParameters(c_keys8).string()); diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 92a9eee..db32272 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -896,7 +896,8 @@ static void android_os_Debug_dumpNativeBacktraceToFile(JNIEnv* env, jobject claz const jchar* str = env->GetStringCritical(fileName, 0); String8 fileName8; if (str) { - fileName8 = String8(str, env->GetStringLength(fileName)); + fileName8 = String8(reinterpret_cast<const char16_t*>(str), + env->GetStringLength(fileName)); env->ReleaseStringCritical(fileName, str); } 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) { diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp index 5fb2e42..2884077 100644 --- a/core/jni/android_util_AssetManager.cpp +++ b/core/jni/android_util_AssetManager.cpp @@ -652,23 +652,29 @@ static jint android_content_AssetManager_getResourceIdentifier(JNIEnv* env, jobj return 0; } - const char16_t* defType16 = defType - ? env->GetStringChars(defType, NULL) : NULL; + const char16_t* defType16 = reinterpret_cast<const char16_t*>(defType) + ? reinterpret_cast<const char16_t*>(env->GetStringChars(defType, NULL)) + : NULL; jsize defTypeLen = defType ? env->GetStringLength(defType) : 0; - const char16_t* defPackage16 = defPackage - ? env->GetStringChars(defPackage, NULL) : NULL; + const char16_t* defPackage16 = reinterpret_cast<const char16_t*>(defPackage) + ? reinterpret_cast<const char16_t*>(env->GetStringChars(defPackage, + NULL)) + : NULL; jsize defPackageLen = defPackage ? env->GetStringLength(defPackage) : 0; jint ident = am->getResources().identifierForName( - name16.get(), name16.size(), defType16, defTypeLen, defPackage16, defPackageLen); + reinterpret_cast<const char16_t*>(name16.get()), name16.size(), + defType16, defTypeLen, defPackage16, defPackageLen); if (defPackage16) { - env->ReleaseStringChars(defPackage, defPackage16); + env->ReleaseStringChars(defPackage, + reinterpret_cast<const jchar*>(defPackage16)); } if (defType16) { - env->ReleaseStringChars(defType, defType16); + env->ReleaseStringChars(defType, + reinterpret_cast<const jchar*>(defType16)); } return ident; @@ -928,8 +934,11 @@ static jobject android_content_AssetManager_getAssignedPackageIdentifiers(JNIEnv const size_t N = res.getBasePackageCount(); for (size_t i = 0; i < N; i++) { const String16 name = res.getBasePackageName(i); - env->CallVoidMethod(sparseArray, gSparseArrayOffsets.put, (jint) res.getBasePackageId(i), - env->NewString(name, name.size())); + env->CallVoidMethod( + sparseArray, gSparseArrayOffsets.put, + static_cast<jint>(res.getBasePackageId(i)), + env->NewString(reinterpret_cast<const jchar*>(name.string()), + name.size())); } return sparseArray; } @@ -1851,7 +1860,8 @@ static jobjectArray android_content_AssetManager_getArrayStringResource(JNIEnv* str = env->NewStringUTF(str8); } else { const char16_t* str16 = pool->stringAt(value.data, &strLen); - str = env->NewString(str16, strLen); + str = env->NewString(reinterpret_cast<const jchar*>(str16), + strLen); } // If one of our NewString{UTF} calls failed due to memory, an diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index 10a5b5a..2496e70 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -935,7 +935,8 @@ static jstring android_os_BinderProxy_getInterfaceDescriptor(JNIEnv* env, jobjec IBinder* target = (IBinder*) env->GetLongField(obj, gBinderProxyOffsets.mObject); if (target != NULL) { const String16& desc = target->getInterfaceDescriptor(); - return env->NewString(desc.string(), desc.size()); + return env->NewString(reinterpret_cast<const jchar*>(desc.string()), + desc.size()); } jniThrowException(env, "java/lang/RuntimeException", "No binder found for object"); diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 41fa681..1d70909 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -109,7 +109,8 @@ jint android_os_Process_getUidForName(JNIEnv* env, jobject clazz, jstring name) const jchar* str16 = env->GetStringCritical(name, 0); String8 name8; if (str16) { - name8 = String8(str16, env->GetStringLength(name)); + name8 = String8(reinterpret_cast<const char16_t*>(str16), + env->GetStringLength(name)); env->ReleaseStringCritical(name, str16); } @@ -140,7 +141,8 @@ jint android_os_Process_getGidForName(JNIEnv* env, jobject clazz, jstring name) const jchar* str16 = env->GetStringCritical(name, 0); String8 name8; if (str16) { - name8 = String8(str16, env->GetStringLength(name)); + name8 = String8(reinterpret_cast<const char16_t*>(str16), + env->GetStringLength(name)); env->ReleaseStringCritical(name, str16); } @@ -385,7 +387,8 @@ void android_os_Process_setArgV0(JNIEnv* env, jobject clazz, jstring name) const jchar* str = env->GetStringCritical(name, 0); String8 name8; if (str) { - name8 = String8(str, env->GetStringLength(name)); + name8 = String8(reinterpret_cast<const char16_t*>(str), + env->GetStringLength(name)); env->ReleaseStringCritical(name, str); } diff --git a/core/jni/android_util_XmlBlock.cpp b/core/jni/android_util_XmlBlock.cpp index 2cccb83..57afc2b 100644 --- a/core/jni/android_util_XmlBlock.cpp +++ b/core/jni/android_util_XmlBlock.cpp @@ -267,19 +267,20 @@ static jint android_content_XmlBlock_nativeGetAttributeIndex(JNIEnv* env, jobjec const char16_t* ns16 = NULL; jsize nsLen = 0; if (ns) { - ns16 = env->GetStringChars(ns, NULL); + ns16 = reinterpret_cast<const char16_t*>(env->GetStringChars(ns, NULL)); nsLen = env->GetStringLength(ns); } - const char16_t* name16 = env->GetStringChars(name, NULL); + const char16_t* name16 = reinterpret_cast<const char16_t*>( + env->GetStringChars(name, NULL)); jsize nameLen = env->GetStringLength(name); jint idx = static_cast<jint>(st->indexOfAttribute(ns16, nsLen, name16, nameLen)); if (ns) { - env->ReleaseStringChars(ns, ns16); + env->ReleaseStringChars(ns, reinterpret_cast<const jchar*>(ns16)); } - env->ReleaseStringChars(name, name16); + env->ReleaseStringChars(name, reinterpret_cast<const jchar*>(name16)); return idx; } diff --git a/core/jni/android_view_KeyCharacterMap.cpp b/core/jni/android_view_KeyCharacterMap.cpp index 4eed5a7..7653f58 100644 --- a/core/jni/android_view_KeyCharacterMap.cpp +++ b/core/jni/android_view_KeyCharacterMap.cpp @@ -150,7 +150,9 @@ static jchar nativeGetMatch(JNIEnv *env, jobject clazz, jlong ptr, jint keyCode, return 0; } - char16_t result = map->getMap()->getMatch(keyCode, chars, size_t(numChars), metaState); + char16_t result = map->getMap()->getMatch( + keyCode, reinterpret_cast<char16_t*>(chars), size_t(numChars), + metaState); env->ReleasePrimitiveArrayCritical(charsArray, chars, JNI_ABORT); return result; @@ -178,7 +180,9 @@ static jobjectArray nativeGetEvents(JNIEnv *env, jobject clazz, jlong ptr, Vector<KeyEvent> events; jobjectArray result = NULL; - if (map->getMap()->getEvents(map->getDeviceId(), chars, size_t(numChars), events)) { + if (map->getMap()->getEvents(map->getDeviceId(), + reinterpret_cast<char16_t*>(chars), + size_t(numChars), events)) { result = env->NewObjectArray(jsize(events.size()), gKeyEventClassInfo.clazz, NULL); if (result) { for (size_t i = 0; i < events.size(); i++) { |
