frameworks: 64 bit compile issues

ToDo: core/jni/com_android_internal_net_NetworkStatsFactory.cpp (merge issues)

Change-Id: I5cf0bbb868e6c18e86c97c6491b6ee983a8ee1a2
This commit is contained in:
Mark Salyzyn
2014-04-16 10:28:37 -07:00
parent 694f219c26
commit af9766d226

View File

@@ -19,6 +19,7 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.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; uint64_t rxBytes, rxPackets, txBytes, txPackets, tcpRxPackets, tcpTxPackets;
while (fgets(buffer, sizeof(buffer), fp) != NULL) { while (fgets(buffer, sizeof(buffer), fp) != NULL) {
int matched = sscanf(buffer, "%31s %llu %llu %llu %llu " int matched = sscanf(buffer, "%31s %" SCNu64 " %" SCNu64 " %" SCNu64
"%*u %llu %*u %*u %*u %*u " " %" SCNu64 " " "%*u %" SCNu64 " %*u %*u %*u %*u "
"%*u %llu %*u %*u %*u %*u", cur_iface, &rxBytes, "%*u %" SCNu64 " %*u %*u %*u %*u", cur_iface, &rxBytes,
&rxPackets, &txBytes, &txPackets, &tcpRxPackets, &tcpTxPackets); &rxPackets, &txBytes, &txPackets, &tcpRxPackets, &tcpTxPackets);
if (matched >= 5) { if (matched >= 5) {
if (matched == 7) { if (matched == 7) {
@@ -129,9 +130,11 @@ static int parseUidStats(const uint32_t uid, struct Stats* stats) {
uint64_t tag, rxBytes, rxPackets, txBytes, txPackets; uint64_t tag, rxBytes, rxPackets, txBytes, txPackets;
while (fgets(buffer, sizeof(buffer), fp) != NULL) { while (fgets(buffer, sizeof(buffer), fp) != NULL) {
if (sscanf(buffer, "%d %31s 0x%llx %u %u %llu %llu %llu %llu", &idx, if (sscanf(buffer,
iface, &tag, &cur_uid, &set, &rxBytes, &rxPackets, &txBytes, "%" SCNu32 " %31s 0x%" SCNx64 " %u %u %" SCNu64 " %" SCNu64
&txPackets) == 9) { " %" SCNu64 " %" SCNu64 "",
&idx, iface, &tag, &cur_uid, &set, &rxBytes, &rxPackets,
&txBytes, &txPackets) == 9) {
if (uid == cur_uid && tag == 0L) { if (uid == cur_uid && tag == 0L) {
stats->rxBytes += rxBytes; stats->rxBytes += rxBytes;
stats->rxPackets += rxPackets; stats->rxPackets += rxPackets;