summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-04-16 10:28:37 -0700
committerMark Salyzyn <salyzyn@google.com>2014-04-16 10:43:48 -0700
commit853940331ff2be48ed3e63f459845e5e43d0a131 (patch)
tree59b0015a213d96ec073b3a3fdd7c3a662c58fbd0 /core/jni
parent0d54e471fa90c2759e86dc47c642f7af277a50f0 (diff)
downloadframeworks_base-853940331ff2be48ed3e63f459845e5e43d0a131.zip
frameworks_base-853940331ff2be48ed3e63f459845e5e43d0a131.tar.gz
frameworks_base-853940331ff2be48ed3e63f459845e5e43d0a131.tar.bz2
frameworks: 64 bit compile issues
ToDo: core/jni/com_android_internal_net_NetworkStatsFactory.cpp (merge issues) Change-Id: I5cf0bbb868e6c18e86c97c6491b6ee983a8ee1a2
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_database_CursorWindow.cpp5
-rw-r--r--core/jni/android_net_TrafficStats.cpp15
-rw-r--r--core/jni/android_os_Debug.cpp5
3 files changed, 15 insertions, 10 deletions
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp
index 67f3879..af6cc72 100644
--- a/core/jni/android_database_CursorWindow.cpp
+++ b/core/jni/android_database_CursorWindow.cpp
@@ -17,6 +17,7 @@
#undef LOG_TAG
#define LOG_TAG "CursorWindow"
+#include <inttypes.h>
#include <jni.h>
#include <JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
@@ -225,7 +226,7 @@ static jstring nativeGetString(JNIEnv* env, jclass clazz, jlong windowPtr,
} else if (type == CursorWindow::FIELD_TYPE_INTEGER) {
int64_t value = window->getFieldSlotValueLong(fieldSlot);
char buf[32];
- snprintf(buf, sizeof(buf), "%lld", value);
+ snprintf(buf, sizeof(buf), "%" PRId64, value);
return env->NewStringUTF(buf);
} else if (type == CursorWindow::FIELD_TYPE_FLOAT) {
double value = window->getFieldSlotValueDouble(fieldSlot);
@@ -314,7 +315,7 @@ static void nativeCopyStringToBuffer(JNIEnv* env, jclass clazz, jlong windowPtr,
} else if (type == CursorWindow::FIELD_TYPE_INTEGER) {
int64_t value = window->getFieldSlotValueLong(fieldSlot);
char buf[32];
- snprintf(buf, sizeof(buf), "%lld", value);
+ snprintf(buf, sizeof(buf), "%" PRId64, value);
fillCharArrayBufferUTF(env, bufferObj, buf, strlen(buf));
} else if (type == CursorWindow::FIELD_TYPE_FLOAT) {
double value = window->getFieldSlotValueDouble(fieldSlot);
diff --git a/core/jni/android_net_TrafficStats.cpp b/core/jni/android_net_TrafficStats.cpp
index f904b62..031637f 100644
--- a/core/jni/android_net_TrafficStats.cpp
+++ b/core/jni/android_net_TrafficStats.cpp
@@ -19,6 +19,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -85,9 +86,9 @@ static int parseIfaceStats(const char* iface, struct Stats* stats) {
uint64_t rxBytes, rxPackets, txBytes, txPackets, tcpRxPackets, tcpTxPackets;
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- int matched = sscanf(buffer, "%31s %llu %llu %llu %llu "
- "%*u %llu %*u %*u %*u %*u "
- "%*u %llu %*u %*u %*u %*u", cur_iface, &rxBytes,
+ int matched = sscanf(buffer, "%31s %" SCNu64 " %" SCNu64 " %" SCNu64
+ " %" SCNu64 " " "%*u %" SCNu64 " %*u %*u %*u %*u "
+ "%*u %" SCNu64 " %*u %*u %*u %*u", cur_iface, &rxBytes,
&rxPackets, &txBytes, &txPackets, &tcpRxPackets, &tcpTxPackets);
if (matched >= 5) {
if (matched == 7) {
@@ -129,9 +130,11 @@ static int parseUidStats(const uint32_t uid, struct Stats* stats) {
uint64_t tag, rxBytes, rxPackets, txBytes, txPackets;
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- if (sscanf(buffer, "%d %31s 0x%llx %u %u %llu %llu %llu %llu", &idx,
- iface, &tag, &cur_uid, &set, &rxBytes, &rxPackets, &txBytes,
- &txPackets) == 9) {
+ if (sscanf(buffer,
+ "%" SCNu32 " %31s 0x%" SCNx64 " %u %u %" SCNu64 " %" SCNu64
+ " %" SCNu64 " %" SCNu64 "",
+ &idx, iface, &tag, &cur_uid, &set, &rxBytes, &rxPackets,
+ &txBytes, &txPackets) == 9) {
if (uid == cur_uid && tag == 0L) {
stats->rxBytes += rxBytes;
stats->rxPackets += rxPackets;
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index d4873d6..86207f0 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -24,6 +24,7 @@
#include <cutils/log.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -824,9 +825,9 @@ static void dumpNativeHeap(FILE* fp)
break;
} else {
#ifdef __LP64__
- fprintf(fp, " %016x", backtrace[bt]);
+ fprintf(fp, " %016" PRIxPTR, backtrace[bt]);
#else
- fprintf(fp, " %08x", backtrace[bt]);
+ fprintf(fp, " %08" PRIxPTR, backtrace[bt]);
#endif
}
}