Fix use of %llx for sscanf 64 bit values.

Change-Id: Ie7a0e243dfcf24722783fe7d697a1412de7efe68
This commit is contained in:
Christopher Ferris
2014-09-03 19:59:08 -07:00
parent d82212d8ae
commit 04d79e7756

View File

@@ -17,6 +17,7 @@
#define LOG_TAG "NetworkStats" #define LOG_TAG "NetworkStats"
#include <errno.h> #include <errno.h>
#include <inttypes.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
@@ -79,7 +80,7 @@ static int readNetworkStatsDetail(JNIEnv* env, jclass clazz, jobject stats,
while (fgets(buffer, sizeof(buffer), fp) != NULL) { while (fgets(buffer, sizeof(buffer), fp) != NULL) {
stats_line s; stats_line s;
int64_t rawTag; int64_t rawTag;
if (sscanf(buffer, "%d %31s 0x%llx %u %u %llu %llu %llu %llu", &s.idx, if (sscanf(buffer, "%d %31s 0x%llx %u %u %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64, &s.idx,
s.iface, &rawTag, &s.uid, &s.set, &s.rxBytes, &s.rxPackets, s.iface, &rawTag, &s.uid, &s.set, &s.rxBytes, &s.rxPackets,
&s.txBytes, &s.txPackets) == 9) { &s.txBytes, &s.txPackets) == 9) {
if (s.idx != lastIdx + 1) { if (s.idx != lastIdx + 1) {