summaryrefslogtreecommitdiffstats
path: root/core/jni/android_util_Process.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-29 13:32:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-29 13:32:33 -0700
commit8f592378a1ea7f31d57253dc202f42707ef4da36 (patch)
treeff92cf68202608d8fdd76e3f47a208a2933f725d /core/jni/android_util_Process.cpp
parent569220399841ae1a3fd62a1b77fa087bca2ee0f3 (diff)
parent69920427ea01421d34f3a7576bdd135527b20859 (diff)
downloadframeworks_base-8f592378a1ea7f31d57253dc202f42707ef4da36.zip
frameworks_base-8f592378a1ea7f31d57253dc202f42707ef4da36.tar.gz
frameworks_base-8f592378a1ea7f31d57253dc202f42707ef4da36.tar.bz2
am 69920427: Merge "Fix a variety of small publicly-reported bugs."
* commit '69920427ea01421d34f3a7576bdd135527b20859': Fix a variety of small publicly-reported bugs.
Diffstat (limited to 'core/jni/android_util_Process.cpp')
-rw-r--r--core/jni/android_util_Process.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 607c429..43a5859 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -395,7 +395,7 @@ static int pid_compare(const void* v1, const void* v2)
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);
@@ -414,7 +414,7 @@ static jlong getFreeMemoryImpl(const char* const sums[], const int sumsLen[], in
}
buffer[len] = 0;
- int numFound = 0;
+ size_t numFound = 0;
jlong mem = 0;
char* p = buffer;
@@ -446,14 +446,14 @@ static jlong getFreeMemoryImpl(const char* const sums[], const int sumsLen[], in
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);
}
@@ -711,13 +711,13 @@ jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz,
jsize end = -1;
if ((mode&PROC_PARENS) != 0) {
- while (buffer[i] != ')' && i < endIndex) {
+ while (i < endIndex && buffer[i] != ')') {
i++;
}
end = i;
i++;
}
- while (buffer[i] != term && i < endIndex) {
+ while (i < endIndex && buffer[i] != term) {
i++;
}
if (end < 0) {
@@ -727,7 +727,7 @@ jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz,
if (i < endIndex) {
i++;
if ((mode&PROC_COMBINE) != 0) {
- while (buffer[i] == term && i < endIndex) {
+ while (i < endIndex && buffer[i] == term) {
i++;
}
}