diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 10 | ||||
-rw-r--r-- | core/jni/android_net_LocalSocketImpl.cpp | 6 | ||||
-rw-r--r-- | core/jni/android_nio_utils.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_os_Debug.cpp | 6 | ||||
-rw-r--r-- | core/jni/android_server_NetworkManagementSocketTagger.cpp | 4 | ||||
-rw-r--r-- | core/jni/android_text_AndroidBidi.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_text_AndroidCharacter.cpp | 15 | ||||
-rw-r--r-- | core/jni/android_text_format_Time.cpp | 66 | ||||
-rw-r--r-- | core/jni/android_util_Log.cpp | 2 |
9 files changed, 59 insertions, 54 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 92d253f..e2c78b1 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -69,7 +69,7 @@ void TextLayoutCache::operator()(TextLayoutCacheKey& text, sp<TextLayoutValue>& size_t totalSizeToDelete = text.getSize() + desc->getSize(); mSize -= totalSizeToDelete; if (mDebugEnabled) { - ALOGD("Cache value %p deleted, size = %d", desc.get(), totalSizeToDelete); + ALOGD("Cache value %p deleted, size = %zu", desc.get(), totalSizeToDelete); } } @@ -129,7 +129,7 @@ sp<TextLayoutValue> TextLayoutCache::getValue(const SkPaint* paint, bool removedOne = mCache.removeOldest(); LOG_ALWAYS_FATAL_IF(!removedOne, "The cache is non-empty but we " "failed to remove the oldest entry. " - "mSize = %u, size = %u, mMaxSize = %u, mCache.size() = %u", + "mSize = %u, size = %zu, mMaxSize = %u, mCache.size() = %zu", mSize, size, mMaxSize, mCache.size()); } } @@ -148,7 +148,7 @@ sp<TextLayoutValue> TextLayoutCache::getValue(const SkPaint* paint, nsecs_t totalTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; ALOGD("CACHE MISS: Added entry %p " "with start = %d, count = %d, contextCount = %d, " - "entry size %d bytes, remaining space %d bytes" + "entry size %zu bytes, remaining space %d bytes" " - Compute time %0.6f ms - Put time %0.6f ms - Text = '%s'", value.get(), start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime() * 0.000001f, @@ -159,7 +159,7 @@ sp<TextLayoutValue> TextLayoutCache::getValue(const SkPaint* paint, if (mDebugEnabled) { ALOGD("CACHE MISS: Calculated but not storing entry because it is too big " "with start = %d, count = %d, contextCount = %d, " - "entry size %d bytes, remaining space %d bytes" + "entry size %zu bytes, remaining space %d bytes" " - Compute time %0.6f ms - Text = '%s'", start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime() * 0.000001f, @@ -204,7 +204,7 @@ void TextLayoutCache::dumpCacheStats() { ALOGD("------------------------------------------------"); ALOGD("pid : %d", getpid()); ALOGD("running : %.0f seconds", timeRunningInSec); - ALOGD("entries : %d", cacheSize); + ALOGD("entries : %zu", cacheSize); ALOGD("max size : %d bytes", mMaxSize); ALOGD("used : %d bytes according to mSize", mSize); ALOGD("remaining : %d bytes or %2.2f percent", mMaxSize - mSize, remainingPercent); diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp index 9f79f74..98f4bed 100644 --- a/core/jni/android_net_LocalSocketImpl.cpp +++ b/core/jni/android_net_LocalSocketImpl.cpp @@ -111,7 +111,7 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor, /* private native void listen_native(int fd, int backlog) throws IOException; */ static void -socket_listen (JNIEnv *env, jobject object, jobject fileDescriptor, int backlog) +socket_listen (JNIEnv *env, jobject object, jobject fileDescriptor, jint backlog) { int ret; int fd; @@ -231,7 +231,7 @@ java_opt_to_real(int optID, int* opt, int* level) } static jint -socket_getOption(JNIEnv *env, jobject object, jobject fileDescriptor, int optID) +socket_getOption(JNIEnv *env, jobject object, jobject fileDescriptor, jint optID) { int ret, value; int opt, level; @@ -279,7 +279,7 @@ socket_getOption(JNIEnv *env, jobject object, jobject fileDescriptor, int optID) } static void socket_setOption( - JNIEnv *env, jobject object, jobject fileDescriptor, int optID, + JNIEnv *env, jobject object, jobject fileDescriptor, jint optID, jint boolValue, jint intValue) { int ret; int optname; diff --git a/core/jni/android_nio_utils.cpp b/core/jni/android_nio_utils.cpp index 7cbbe12..59d6e41 100644 --- a/core/jni/android_nio_utils.cpp +++ b/core/jni/android_nio_utils.cpp @@ -37,7 +37,7 @@ void* android::nio_getPointer(JNIEnv *_env, jobject buffer, jarray *array) { gNioJNI.getBasePointerID, buffer); if (pointer != 0L) { *array = NULL; - return (void *) (jint) pointer; + return reinterpret_cast<void *>(pointer); } *array = (jarray) _env->CallStaticObjectMethod(gNioJNI.nioAccessClass, diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index a041693..d4873d6 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -800,7 +800,7 @@ static void dumpNativeHeap(FILE* fp) fprintf(fp, "Total memory: %zu\n", totalMemory); fprintf(fp, "Allocation records: %zd\n", recordCount); if (backtraceSize != BACKTRACE_SIZE) { - fprintf(fp, "WARNING: mismatched backtrace sizes (%d vs. %d)\n", + fprintf(fp, "WARNING: mismatched backtrace sizes (%zu vs. %d)\n", backtraceSize, BACKTRACE_SIZE); } fprintf(fp, "\n"); @@ -823,7 +823,11 @@ static void dumpNativeHeap(FILE* fp) if (backtrace[bt] == 0) { break; } else { +#ifdef __LP64__ + fprintf(fp, " %016x", backtrace[bt]); +#else fprintf(fp, " %08x", backtrace[bt]); +#endif } } fprintf(fp, "\n"); diff --git a/core/jni/android_server_NetworkManagementSocketTagger.cpp b/core/jni/android_server_NetworkManagementSocketTagger.cpp index 12beff7..7e12b1e 100644 --- a/core/jni/android_server_NetworkManagementSocketTagger.cpp +++ b/core/jni/android_server_NetworkManagementSocketTagger.cpp @@ -47,8 +47,8 @@ static jint QTagUid_tagSocketFd(JNIEnv* env, jclass, return (jint)res; } -static int QTagUid_untagSocketFd(JNIEnv* env, jclass, - jobject fileDescriptor) { +static jint QTagUid_untagSocketFd(JNIEnv* env, jclass, + jobject fileDescriptor) { int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor); if (env->ExceptionOccurred() != NULL) { diff --git a/core/jni/android_text_AndroidBidi.cpp b/core/jni/android_text_AndroidBidi.cpp index d50a69f..6f7ee49 100644 --- a/core/jni/android_text_AndroidBidi.cpp +++ b/core/jni/android_text_AndroidBidi.cpp @@ -26,7 +26,7 @@ namespace android { static jint runBidi(JNIEnv* env, jobject obj, jint dir, jcharArray chsArray, - jbyteArray infoArray, int n, jboolean haveInfo) + jbyteArray infoArray, jint n, jboolean haveInfo) { // Parameters are checked on java side // Failures from GetXXXArrayElements indicate a serious out-of-memory condition diff --git a/core/jni/android_text_AndroidCharacter.cpp b/core/jni/android_text_AndroidCharacter.cpp index 8b85a7b7..94bd40f 100644 --- a/core/jni/android_text_AndroidCharacter.cpp +++ b/core/jni/android_text_AndroidCharacter.cpp @@ -51,7 +51,8 @@ static int directionality_map[U_CHAR_DIRECTION_COUNT] = { namespace android { -static void getDirectionalities(JNIEnv* env, jobject obj, jcharArray srcArray, jbyteArray destArray, int count) +static void getDirectionalities(JNIEnv* env, jobject obj, jcharArray srcArray, + jbyteArray destArray, jint count) { ScopedCharArrayRO src(env, srcArray); if (src.get() == NULL) { @@ -102,7 +103,7 @@ static jint getEastAsianWidth(JNIEnv* env, jobject obj, jchar input) } static void getEastAsianWidths(JNIEnv* env, jobject obj, jcharArray srcArray, - int start, int count, jbyteArray destArray) + jint start, jint count, jbyteArray destArray) { ScopedCharArrayRO src(env, srcArray); if (src.get() == NULL) { @@ -144,20 +145,20 @@ static void getEastAsianWidths(JNIEnv* env, jobject obj, jcharArray srcArray, } } -static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, int start, int count) +static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, jint start, jint count) { ScopedCharArrayRW data(env, charArray); if (data.get() == NULL) { - return false; + return JNI_FALSE; } if (start < 0 || start > start + count || env->GetArrayLength(charArray) < start + count) { jniThrowException(env, "java/lang/ArrayIndexOutOfBoundsException", NULL); - return false; + return JNI_FALSE; } - bool ret = false; + jboolean ret = JNI_FALSE; for (int i = start; i < start + count; i++) { // XXX this thinks it knows that surrogates are never mirrored @@ -166,7 +167,7 @@ static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, int start if (c1 != c2) { data[i] = c2; - ret = true; + ret = JNI_TRUE; } } return ret; diff --git a/core/jni/android_text_format_Time.cpp b/core/jni/android_text_format_Time.cpp index aa2c5f39..28a8a5d 100644 --- a/core/jni/android_text_format_Time.cpp +++ b/core/jni/android_text_format_Time.cpp @@ -117,7 +117,7 @@ static jlong android_text_format_Time_normalize(JNIEnv* env, jobject This, time2java(env, This, t); RELEASE_TIMEZONE(This, t) - return result; + return static_cast<jlong>(result); } static void android_text_format_Time_switchTimezone(JNIEnv* env, jobject This, @@ -155,7 +155,7 @@ static jint android_text_format_Time_compare(JNIEnv* env, jobject clazz, RELEASE_TIMEZONE(aObject, a) RELEASE_TIMEZONE(bObject, b) - return result; + return static_cast<jint>(result); } static jstring android_text_format_Time_format2445(JNIEnv* env, jobject This) @@ -346,7 +346,7 @@ static jlong android_text_format_Time_toMillis(JNIEnv* env, jobject This, RELEASE_TIMEZONE(This, t) - return result; + return static_cast<jlong>(result); } static void android_text_format_Time_set(JNIEnv* env, jobject This, jlong millis) @@ -400,10 +400,10 @@ static jboolean android_text_format_Time_parse(JNIEnv* env, jobject This, jstrin if (len < 8) { jniThrowException(env, "android/util/TimeFormatException", "String too short -- expected at least 8 characters."); - return false; + return JNI_FALSE; } - jboolean inUtc = false; + jboolean inUtc = JNI_FALSE; ScopedStringChars s(env, strObj); @@ -414,49 +414,49 @@ static jboolean android_text_format_Time_parse(JNIEnv* env, jobject This, jstrin n += get_char(env, s, 1, 100, &thrown); n += get_char(env, s, 2, 10, &thrown); n += get_char(env, s, 3, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_yearField, n); // month n = get_char(env, s, 4, 10, &thrown); n += get_char(env, s, 5, 1, &thrown); n--; - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_monField, n); // day of month n = get_char(env, s, 6, 10, &thrown); n += get_char(env, s, 7, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_mdayField, n); if (len > 8) { // T - if (!check_char(env, s, 8, 'T')) return false; + if (!check_char(env, s, 8, 'T')) return JNI_FALSE; env->SetBooleanField(This, g_allDayField, JNI_FALSE); // hour n = get_char(env, s, 9, 10, &thrown); n += get_char(env, s, 10, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_hourField, n); // min n = get_char(env, s, 11, 10, &thrown); n += get_char(env, s, 12, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_minField, n); // sec n = get_char(env, s, 13, 10, &thrown); n += get_char(env, s, 14, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_secField, n); if (len > 15) { // Z - if (!check_char(env, s, 15, 'Z')) return false; - inUtc = true; + if (!check_char(env, s, 15, 'Z')) return JNI_FALSE; + inUtc = JNI_TRUE; } } else { env->SetBooleanField(This, g_allDayField, JNI_TRUE); @@ -481,10 +481,10 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, if (len < 10) { jniThrowException(env, "android/util/TimeFormatException", "String too short --- expected at least 10 characters."); - return false; + return JNI_FALSE; } - jboolean inUtc = false; + jboolean inUtc = JNI_FALSE; ScopedStringChars s(env, strObj); @@ -495,57 +495,57 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, n += get_char(env, s, 1, 100, &thrown); n += get_char(env, s, 2, 10, &thrown); n += get_char(env, s, 3, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_yearField, n); // - - if (!check_char(env, s, 4, '-')) return false; + if (!check_char(env, s, 4, '-')) return JNI_FALSE; // month n = get_char(env, s, 5, 10, &thrown); n += get_char(env, s, 6, 1, &thrown); --n; - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_monField, n); // - - if (!check_char(env, s, 7, '-')) return false; + if (!check_char(env, s, 7, '-')) return JNI_FALSE; // day n = get_char(env, s, 8, 10, &thrown); n += get_char(env, s, 9, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_mdayField, n); if (len >= 19) { // T - if (!check_char(env, s, 10, 'T')) return false; + if (!check_char(env, s, 10, 'T')) return JNI_FALSE; env->SetBooleanField(This, g_allDayField, JNI_FALSE); // hour n = get_char(env, s, 11, 10, &thrown); n += get_char(env, s, 12, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; int hour = n; // env->SetIntField(This, g_hourField, n); // : - if (!check_char(env, s, 13, ':')) return false; + if (!check_char(env, s, 13, ':')) return JNI_FALSE; // minute n = get_char(env, s, 14, 10, &thrown); n += get_char(env, s, 15, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; int minute = n; // env->SetIntField(This, g_minField, n); // : - if (!check_char(env, s, 16, ':')) return false; + if (!check_char(env, s, 16, ':')) return JNI_FALSE; // second n = get_char(env, s, 17, 10, &thrown); n += get_char(env, s, 18, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; env->SetIntField(This, g_secField, n); // skip the '.XYZ' -- we don't care about subsecond precision. @@ -579,32 +579,32 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env, jniThrowExceptionFmt(env, "android/util/TimeFormatException", "Unexpected character 0x%02x at position %d. Expected + or -", c, tz_index); - return false; + return JNI_FALSE; } - inUtc = true; + inUtc = JNI_TRUE; if (offset != 0) { if (len < tz_index + 6) { jniThrowExceptionFmt(env, "android/util/TimeFormatException", "Unexpected length; should be %d characters", tz_index + 6); - return false; + return JNI_FALSE; } // hour n = get_char(env, s, tz_index + 1, 10, &thrown); n += get_char(env, s, tz_index + 2, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; n *= offset; hour += n; // : - if (!check_char(env, s, tz_index + 3, ':')) return false; + if (!check_char(env, s, tz_index + 3, ':')) return JNI_FALSE; // minute n = get_char(env, s, tz_index + 4, 10, &thrown); n += get_char(env, s, tz_index + 5, 1, &thrown); - if (thrown) return false; + if (thrown) return JNI_FALSE; n *= offset; minute += n; } diff --git a/core/jni/android_util_Log.cpp b/core/jni/android_util_Log.cpp index 536a582..93dcbef 100644 --- a/core/jni/android_util_Log.cpp +++ b/core/jni/android_util_Log.cpp @@ -85,7 +85,7 @@ static jboolean android_util_Log_isLoggable(JNIEnv* env, jobject clazz, jstring jboolean result = false; if ((strlen(chars)+sizeof(LOG_NAMESPACE)) > PROPERTY_KEY_MAX) { char buf2[200]; - snprintf(buf2, sizeof(buf2), "Log tag \"%s\" exceeds limit of %d characters\n", + snprintf(buf2, sizeof(buf2), "Log tag \"%s\" exceeds limit of %zu characters\n", chars, PROPERTY_KEY_MAX - sizeof(LOG_NAMESPACE)); jniThrowException(env, "java/lang/IllegalArgumentException", buf2); |