summaryrefslogtreecommitdiffstats
path: root/core/jni/android_hardware_Camera.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_hardware_Camera.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_hardware_Camera.cpp')
-rw-r--r--core/jni/android_hardware_Camera.cpp9
1 files changed, 6 insertions, 3 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) {