summaryrefslogtreecommitdiffstats
path: root/libbacktrace/GetPss.cpp
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2016-04-18 14:45:46 -0700
committerChih-Hung Hsieh <chh@google.com>2016-04-18 14:45:46 -0700
commitec2ff8c176d795656e69aecfce9650db40bef60b (patch)
treec9674877458c79fb870f48c790d7fb9b9b1dbdb1 /libbacktrace/GetPss.cpp
parent1607ea64cbdeea766c05d033afe0c65ea978b399 (diff)
downloadsystem_core-ec2ff8c176d795656e69aecfce9650db40bef60b.tar.gz
system_core-ec2ff8c176d795656e69aecfce9650db40bef60b.tar.bz2
system_core-ec2ff8c176d795656e69aecfce9650db40bef60b.zip
Fix google-runtime-int warnings.
Bug: 28220065 Change-Id: I6b8e121ddf98355d1c1ac034c2e3522b2b49e14b
Diffstat (limited to 'libbacktrace/GetPss.cpp')
-rw-r--r--libbacktrace/GetPss.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libbacktrace/GetPss.cpp b/libbacktrace/GetPss.cpp
index 09a721dee..b4dc48d56 100644
--- a/libbacktrace/GetPss.cpp
+++ b/libbacktrace/GetPss.cpp
@@ -33,7 +33,7 @@
#define PAGEMAP_SWAP_OFFSET(x) (_BITS(x, 5, 50))
#define PAGEMAP_SWAP_TYPE(x) (_BITS(x, 0, 5))
-static bool ReadData(int fd, unsigned long place, uint64_t *data) {
+static bool ReadData(int fd, off_t place, uint64_t *data) {
if (lseek(fd, place * sizeof(uint64_t), SEEK_SET) < 0) {
return false;
}
@@ -71,12 +71,13 @@ size_t GetPssBytes() {
total_pss = 0;
break;
}
- for (size_t page = start/pagesize; page < end/pagesize; page++) {
+ for (off_t page = static_cast<off_t>(start/pagesize);
+ page < static_cast<off_t>(end/pagesize); page++) {
uint64_t data;
if (ReadData(pagemap_fd, page, &data)) {
if (PAGEMAP_PRESENT(data) && !PAGEMAP_SWAPPED(data)) {
uint64_t count;
- if (ReadData(pagecount_fd, PAGEMAP_PFN(data), &count)) {
+ if (ReadData(pagecount_fd, static_cast<off_t>(PAGEMAP_PFN(data)), &count)) {
total_pss += (count >= 1) ? pagesize / count : 0;
}
}