resolved conflicts for merge of ed84dea9 to master
Change-Id: Id214389f321f07aadd7a25e454a07863d7b128cb
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index ad4e4c8..0f610e9 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -159,8 +159,8 @@
SkBitmap bitmap;
SkMemoryStream stream(buffer, len);
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
- codec->setDitherImage(false);
if (codec) {
+ codec->setDitherImage(false);
codec->decode(&stream, &bitmap,
SkBitmap::kARGB_8888_Config,
SkImageDecoder::kDecodePixels_Mode);
@@ -270,7 +270,7 @@
mAndroidAnimation = true;
- // If the device has encryption turned on or is in process
+ // If the device has encryption turned on or is in process
// of being encrypted we show the encrypted boot animation.
char decrypt[PROPERTY_VALUE_MAX];
property_get("vold.decrypt", decrypt, "");
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 054ee4f6..a041693 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -675,6 +675,7 @@
// loop until we have the block that represents this process
do {
if (fgets(line, 1024, fp) == 0) {
+ fclose(fp);
return -1;
}
} while (strncmp(compare, line, len));
@@ -684,13 +685,16 @@
do {
if (fgets(line, 1024, fp) == 0) {
+ fclose(fp);
return -1;
}
} while (strncmp(compare, line, len));
// we have the line, now increment the line ptr to the value
char* ptr = line + len;
- return atoi(ptr);
+ jint result = atoi(ptr);
+ fclose(fp);
+ return result;
}
static jint android_os_Debug_getBinderSentTransactions(JNIEnv *env, jobject clazz)
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index e7e70d1..cbed99f 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -405,7 +405,7 @@
return *((const jint*)v1) - *((const jint*)v2);
}
-static jlong getFreeMemoryImpl(const char* const sums[], const int sumsLen[], int num)
+static jlong getFreeMemoryImpl(const char* const sums[], const size_t sumsLen[], size_t num)
{
int fd = open("/proc/meminfo", O_RDONLY);
@@ -424,7 +424,7 @@
}
buffer[len] = 0;
- int numFound = 0;
+ size_t numFound = 0;
jlong mem = 0;
char* p = buffer;
@@ -456,14 +456,14 @@
static jlong android_os_Process_getFreeMemory(JNIEnv* env, jobject clazz)
{
static const char* const sums[] = { "MemFree:", "Cached:", NULL };
- static const int sumsLen[] = { strlen("MemFree:"), strlen("Cached:"), 0 };
+ static const size_t sumsLen[] = { strlen("MemFree:"), strlen("Cached:"), 0 };
return getFreeMemoryImpl(sums, sumsLen, 2);
}
static jlong android_os_Process_getTotalMemory(JNIEnv* env, jobject clazz)
{
static const char* const sums[] = { "MemTotal:", NULL };
- static const int sumsLen[] = { strlen("MemTotal:"), 0 };
+ static const size_t sumsLen[] = { strlen("MemTotal:"), 0 };
return getFreeMemoryImpl(sums, sumsLen, 1);
}
@@ -728,7 +728,7 @@
jsize end = -1;
if ((mode&PROC_PARENS) != 0) {
- while (buffer[i] != ')' && i < endIndex) {
+ while (i < endIndex && buffer[i] != ')') {
i++;
}
end = i;
@@ -740,7 +740,7 @@
end = i;
i++;
}
- while (buffer[i] != term && i < endIndex) {
+ while (i < endIndex && buffer[i] != term) {
i++;
}
if (end < 0) {
@@ -750,7 +750,7 @@
if (i < endIndex) {
i++;
if ((mode&PROC_COMBINE) != 0) {
- while (buffer[i] == term && i < endIndex) {
+ while (i < endIndex && buffer[i] == term) {
i++;
}
}