summaryrefslogtreecommitdiff
path: root/simpleperf/read_apk.h
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/read_apk.h')
-rw-r--r--simpleperf/read_apk.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/simpleperf/read_apk.h b/simpleperf/read_apk.h
index baee2874..c37366b9 100644
--- a/simpleperf/read_apk.h
+++ b/simpleperf/read_apk.h
@@ -26,25 +26,31 @@
#include "read_elf.h"
-namespace simpleperf {
-
// Container for info an on ELF file embedded into an APK file
class EmbeddedElf {
public:
- EmbeddedElf() : entry_offset_(0), entry_size_(0) {}
-
- EmbeddedElf(const std::string& filepath, const std::string& entry_name, uint64_t entry_offset,
+ EmbeddedElf()
+ : entry_offset_(0)
+ , entry_size_(0)
+ {
+ }
+
+ EmbeddedElf(const std::string& filepath,
+ const std::string& entry_name,
+ uint64_t entry_offset,
size_t entry_size)
- : filepath_(filepath),
- entry_name_(entry_name),
- entry_offset_(entry_offset),
- entry_size_(entry_size) {}
+ : filepath_(filepath)
+ , entry_name_(entry_name)
+ , entry_offset_(entry_offset)
+ , entry_size_(entry_size)
+ {
+ }
// Path to APK file
- const std::string& filepath() const { return filepath_; }
+ const std::string &filepath() const { return filepath_; }
// Entry name within zip archive
- const std::string& entry_name() const { return entry_name_; }
+ const std::string &entry_name() const { return entry_name_; }
// Offset of zip entry from start of containing APK file
uint64_t entry_offset() const { return entry_offset_; }
@@ -53,10 +59,10 @@ class EmbeddedElf {
uint32_t entry_size() const { return entry_size_; }
private:
- std::string filepath_; // containing APK path
- std::string entry_name_; // name of entry in zip index of embedded elf file
- uint64_t entry_offset_; // offset of ELF from start of containing APK file
- uint32_t entry_size_; // size of ELF file in zip
+ std::string filepath_; // containing APK path
+ std::string entry_name_; // name of entry in zip index of embedded elf file
+ uint64_t entry_offset_; // offset of ELF from start of containing APK file
+ uint32_t entry_size_; // size of ELF file in zip
};
// APK inspector helper class
@@ -69,8 +75,8 @@ class ApkInspector {
private:
static std::unique_ptr<EmbeddedElf> FindElfInApkByOffsetWithoutCache(const std::string& apk_path,
uint64_t file_offset);
- static std::unique_ptr<EmbeddedElf> FindElfInApkByNameWithoutCache(const std::string& apk_path,
- const std::string& entry_name);
+ static std::unique_ptr<EmbeddedElf> FindElfInApkByNameWithoutCache(
+ const std::string& apk_path, const std::string& entry_name);
struct ApkNode {
// Map from entry_offset to EmbeddedElf.
@@ -89,6 +95,4 @@ std::tuple<bool, std::string, std::string> SplitUrlInApk(const std::string& path
bool ParseExtractedInMemoryPath(const std::string& path, std::string* zip_path,
std::string* entry_name);
-} // namespace simpleperf
-
#endif // SIMPLE_PERF_READ_APK_H_