summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-02-18 12:11:40 -0800
committerYabin Cui <yabinc@google.com>2016-02-18 12:11:40 -0800
commit41e32ca272f474d35a84a6e7c7f0a28c3160abc3 (patch)
treee3de7f83c9dd314b3d76e6fb3c36673a090f8cef
parent88a0a38c86f34d1169fee5a66cc98bc3cc5ac30e (diff)
downloadextras-41e32ca272f474d35a84a6e7c7f0a28c3160abc3.tar.gz
simpleperf: fix build by removing off64_t.
Bug: 26962895 Change-Id: I211bacc22c2f6b6b24c639365c706e93d66ce4ac
-rw-r--r--simpleperf/read_apk.cpp8
-rw-r--r--simpleperf/read_apk.h12
2 files changed, 11 insertions, 9 deletions
diff --git a/simpleperf/read_apk.cpp b/simpleperf/read_apk.cpp
index 55de8446..8029dc53 100644
--- a/simpleperf/read_apk.cpp
+++ b/simpleperf/read_apk.cpp
@@ -56,7 +56,7 @@ class ArchiveHelper {
std::map<ApkInspector::ApkOffset, std::unique_ptr<EmbeddedElf>> ApkInspector::embedded_elf_cache_;
-EmbeddedElf* ApkInspector::FindElfInApkByOffset(const std::string& apk_path, off64_t file_offset) {
+EmbeddedElf* ApkInspector::FindElfInApkByOffset(const std::string& apk_path, uint64_t file_offset) {
// Already in cache?
ApkOffset ami(apk_path, file_offset);
auto it = embedded_elf_cache_.find(ami);
@@ -70,7 +70,7 @@ EmbeddedElf* ApkInspector::FindElfInApkByOffset(const std::string& apk_path, off
}
std::unique_ptr<EmbeddedElf> ApkInspector::FindElfInApkByOffsetWithoutCache(const std::string& apk_path,
- off64_t file_offset) {
+ uint64_t file_offset) {
// Crack open the apk(zip) file and take a look.
if (!IsValidApkPath(apk_path)) {
return nullptr;
@@ -99,8 +99,8 @@ std::unique_ptr<EmbeddedElf> ApkInspector::FindElfInApkByOffsetWithoutCache(cons
int zrc;
while ((zrc = Next(iteration_cookie, &zentry, &zname)) == 0) {
if (zentry.method == kCompressStored &&
- file_offset >= zentry.offset &&
- file_offset < zentry.offset + zentry.uncompressed_length) {
+ file_offset >= static_cast<uint64_t>(zentry.offset) &&
+ file_offset < static_cast<uint64_t>(zentry.offset + zentry.uncompressed_length)) {
// Found.
found = true;
break;
diff --git a/simpleperf/read_apk.h b/simpleperf/read_apk.h
index 89c051ae..82531f41 100644
--- a/simpleperf/read_apk.h
+++ b/simpleperf/read_apk.h
@@ -17,6 +17,8 @@
#ifndef SIMPLE_PERF_READ_APK_H_
#define SIMPLE_PERF_READ_APK_H_
+#include <stdint.h>
+
#include <map>
#include <memory>
#include <string>
@@ -51,7 +53,7 @@ class EmbeddedElf {
const std::string &entry_name() const { return entry_name_; }
// Offset of zip entry from start of containing APK file
- size_t entry_offset() const { return entry_offset_; }
+ uint64_t entry_offset() const { return entry_offset_; }
// Size of zip entry (length of embedded ELF)
uint32_t entry_size() const { return entry_size_; }
@@ -59,7 +61,7 @@ class EmbeddedElf {
private:
std::string filepath_; // containing APK path
std::string entry_name_; // name of entry in zip index of embedded elf file
- size_t entry_offset_; // offset of ELF from start of containing APK file
+ uint64_t entry_offset_; // offset of ELF from start of containing APK file
uint32_t entry_size_; // size of ELF file in zip
};
@@ -69,16 +71,16 @@ class ApkInspector {
// Given an APK/ZIP/JAR file and an offset into that file, if the
// corresponding region of the APK corresponds to an uncompressed
// ELF file, then return pertinent info on the ELF.
- static EmbeddedElf* FindElfInApkByOffset(const std::string& apk_path, off64_t file_offset);
+ static EmbeddedElf* FindElfInApkByOffset(const std::string& apk_path, uint64_t file_offset);
static std::unique_ptr<EmbeddedElf> FindElfInApkByName(const std::string& apk_path,
const std::string& elf_filename);
private:
static std::unique_ptr<EmbeddedElf> FindElfInApkByOffsetWithoutCache(const std::string& apk_path,
- off64_t file_offset);
+ uint64_t file_offset);
// First component of pair is APK file path, second is offset into APK.
- typedef std::pair<std::string, size_t> ApkOffset;
+ typedef std::pair<std::string, uint64_t> ApkOffset;
static std::map<ApkOffset, std::unique_ptr<EmbeddedElf>> embedded_elf_cache_;
};