Switch frameworks/base/core/jni from gcc to clang.

Switch from gcc to clang and fix errors detected.

The immediate motivation is that gcc with libc++ stl does not use
'explicit' in the stl, causing issues for use of unique_ptr.
The longer term motivation is to fully move to clang.

BUG=22414716

Change-Id: If77436c1e7601f20289603862be33b85880ab4bd
(cherry picked from commit 60b1c8ef86)
This commit is contained in:
Ben Wagner
2016-03-16 17:10:42 -04:00
committed by Stephen Hines
parent 6b6c7fdf65
commit 85ea32b02a
5 changed files with 11 additions and 16 deletions

View File

@@ -248,7 +248,7 @@ nativeGetDynamicSensors(JNIEnv *env, jclass clazz, jlong sensorManager, jobject
mgr->getDynamicSensorList(nativeList);
ALOGI("DYNS native SensorManager.getDynamicSensorList return %d sensors", nativeList.size());
ALOGI("DYNS native SensorManager.getDynamicSensorList return %zu sensors", nativeList.size());
for (size_t i = 0; i < nativeList.size(); ++i) {
jobject sensor = translateNativeSensorToJavaSensor(env, NULL, nativeList[i]);
// add to list

View File

@@ -38,6 +38,8 @@
#include "android_media_PlaybackParams.h"
#include "android_media_DeviceCallback.h"
#include <cinttypes>
// ----------------------------------------------------------------------------
using namespace android;
@@ -219,7 +221,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this, job
jlong nativeAudioTrack) {
ALOGV("sampleRates=%p, channel mask=%x, index mask=%x, audioFormat(Java)=%d, buffSize=%d"
"nativeAudioTrack=0x%llX",
"nativeAudioTrack=0x%" PRIX64,
jSampleRate, channelPositionMask, channelIndexMask, audioFormat, buffSizeInBytes,
nativeAudioTrack);
@@ -714,8 +716,8 @@ static jint android_media_AudioTrack_get_buffer_size_frames(JNIEnv *env, jobjec
ssize_t result = lpTrack->getBufferSizeInFrames();
if (result < 0) {
jniThrowException(env, "java/lang/IllegalStateException",
"Internal error detected in getBufferSizeInFrames() = " + result);
jniThrowExceptionFmt(env, "java/lang/IllegalStateException",
"Internal error detected in getBufferSizeInFrames() = %zd", result);
return (jint)AUDIO_JAVA_ERROR;
}
return (jint)result;
@@ -738,8 +740,8 @@ static jint android_media_AudioTrack_set_buffer_size_frames(JNIEnv *env,
}
ssize_t result = lpTrack->setBufferSizeInFrames(bufferSizeInFrames);
if (result < 0) {
jniThrowException(env, "java/lang/IllegalStateException",
"Internal error detected in setBufferSizeInFrames() = " + result);
jniThrowExceptionFmt(env, "java/lang/IllegalStateException",
"Internal error detected in setBufferSizeInFrames() = %zd", result);
return (jint)AUDIO_JAVA_ERROR;
}
return (jint)result;

View File

@@ -36,7 +36,7 @@ static bool parseStringForPath(JNIEnv* env, jobject, jlong skPathHandle, jstring
PathParser::parseStringForSkPath(skPath, &result, pathString, strLength);
env->ReleaseStringUTFChars(inputPathStr, pathString);
if (result.failureOccurred) {
ALOGE(result.failureMessage.c_str());
ALOGE("%s", result.failureMessage.c_str());
}
return !result.failureOccurred;
}
@@ -62,7 +62,7 @@ static long createPathDataFromStringPath(JNIEnv* env, jobject, jstring inputStr,
return reinterpret_cast<jlong>(pathData);
} else {
delete pathData;
ALOGE(result.failureMessage.c_str());
ALOGE("%s", result.failureMessage.c_str());
return NULL;
}
}

View File

@@ -36,11 +36,6 @@
namespace android {
// Number of events to read at a time from the DisplayEventReceiver pipe.
// The value should be large enough that we can quickly drain the pipe
// using just a few large reads.
static const size_t EVENT_BUFFER_SIZE = 100;
static struct {
jclass clazz;
@@ -63,7 +58,6 @@ private:
jobject mReceiverWeakGlobal;
sp<MessageQueue> mMessageQueue;
DisplayEventReceiver mReceiver;
bool mWaitingForVsync;
virtual void dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count);
virtual void dispatchHotplug(nsecs_t timestamp, int32_t id, bool connected);
@@ -74,7 +68,7 @@ NativeDisplayEventReceiver::NativeDisplayEventReceiver(JNIEnv* env,
jobject receiverWeak, const sp<MessageQueue>& messageQueue) :
DisplayEventDispatcher(messageQueue->getLooper()),
mReceiverWeakGlobal(env->NewGlobalRef(receiverWeak)),
mMessageQueue(messageQueue), mWaitingForVsync(false) {
mMessageQueue(messageQueue) {
ALOGV("receiver %p ~ Initializing display event receiver.", this);
}

View File

@@ -342,7 +342,6 @@ private:
JavaVM* const mVm;
jweak mObserverWeak;
jobject mJavaBufferGlobal;
sp<MessageQueue> mMessageQueue;
sp<NotifyHandler> mMessageHandler;