Commit 21ac023d authored by Yabin Cui's avatar Yabin Cui Committed by Gerrit Code Review
Browse files

Merge "simpleperf: fix build by removing off64_t."

parents 88a0a38c 41e32ca2
......@@ -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;
......
......@@ -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_;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment