Loading cmds/idmap2/idmap2/Create.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -32,9 +32,12 @@ using android::ApkAssets; using android::idmap2::BinaryStreamVisitor; using android::idmap2::CommandLineOptions; using android::idmap2::Idmap; using android::idmap2::utils::kIdmapFilePermissionMask; bool Create(const std::vector<std::string>& args, std::ostream& out_error) { std::string target_apk_path, overlay_apk_path, idmap_path; std::string target_apk_path; std::string overlay_apk_path; std::string idmap_path; const CommandLineOptions opts = CommandLineOptions("idmap2 create") Loading Loading @@ -68,7 +71,7 @@ bool Create(const std::vector<std::string>& args, std::ostream& out_error) { return false; } umask(0133); // u=rw,g=r,o=r umask(kIdmapFilePermissionMask); std::ofstream fout(idmap_path); if (fout.fail()) { out_error << "failed to open idmap path " << idmap_path << std::endl; Loading cmds/idmap2/idmap2/Lookup.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -63,10 +63,12 @@ namespace { Result<ResourceId> WARN_UNUSED ParseResReference(const AssetManager2& am, const std::string& res, const std::string& fallback_package) { static constexpr const int kBaseHex = 16; // first, try to parse as a hex number char* endptr = nullptr; ResourceId resid; resid = strtol(res.c_str(), &endptr, 16); resid = strtol(res.c_str(), &endptr, kBaseHex); if (*endptr == '\0') { return {resid}; } Loading Loading @@ -155,7 +157,9 @@ Result<std::string> GetTargetPackageNameFromManifest(const std::string& apk_path bool Lookup(const std::vector<std::string>& args, std::ostream& out_error) { std::vector<std::string> idmap_paths; std::string config_str, resid_str; std::string config_str; std::string resid_str; const CommandLineOptions opts = CommandLineOptions("idmap2 lookup") .MandatoryOption("--idmap-path", "input: path to idmap file to load", &idmap_paths) Loading cmds/idmap2/idmap2/Main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ using android::idmap2::CommandLineOptions; typedef std::map<std::string, std::function<int(const std::vector<std::string>&, std::ostream&)>> typedef std::map<std::string, std::function<bool(const std::vector<std::string>&, std::ostream&)>> NameToFunctionMap; namespace { Loading cmds/idmap2/idmap2/Scan.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ std::unique_ptr<std::vector<std::string>> FindApkFiles(const std::vector<std::st const auto predicate = [](unsigned char type, const std::string& path) -> bool { static constexpr size_t kExtLen = 4; // strlen(".apk") return type == DT_REG && path.size() > kExtLen && !path.compare(path.size() - kExtLen, kExtLen, ".apk"); path.compare(path.size() - kExtLen, kExtLen, ".apk") == 0; }; // pass apk paths through a set to filter out duplicates std::set<std::string> paths; Loading @@ -63,7 +63,9 @@ std::unique_ptr<std::vector<std::string>> FindApkFiles(const std::vector<std::st bool Scan(const std::vector<std::string>& args, std::ostream& out_error) { std::vector<std::string> input_directories; std::string target_package_name, target_apk_path, output_directory; std::string target_package_name; std::string target_apk_path; std::string output_directory; bool recursive = false; const CommandLineOptions opts = Loading Loading @@ -112,7 +114,7 @@ bool Scan(const std::vector<std::string>& args, std::ostream& out_error) { } auto iter = tag->find("isStatic"); if (iter == tag->end() || std::stoul(iter->second) == 0u) { if (iter == tag->end() || std::stoul(iter->second) == 0U) { continue; } Loading cmds/idmap2/idmap2/Verify.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ using android::idmap2::IdmapHeader; bool Verify(const std::vector<std::string>& args, std::ostream& out_error) { std::string idmap_path; const CommandLineOptions opts = CommandLineOptions("idmap2 verify") .MandatoryOption("--idmap-path", "input: path to idmap file to verify", &idmap_path); Loading Loading
cmds/idmap2/idmap2/Create.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -32,9 +32,12 @@ using android::ApkAssets; using android::idmap2::BinaryStreamVisitor; using android::idmap2::CommandLineOptions; using android::idmap2::Idmap; using android::idmap2::utils::kIdmapFilePermissionMask; bool Create(const std::vector<std::string>& args, std::ostream& out_error) { std::string target_apk_path, overlay_apk_path, idmap_path; std::string target_apk_path; std::string overlay_apk_path; std::string idmap_path; const CommandLineOptions opts = CommandLineOptions("idmap2 create") Loading Loading @@ -68,7 +71,7 @@ bool Create(const std::vector<std::string>& args, std::ostream& out_error) { return false; } umask(0133); // u=rw,g=r,o=r umask(kIdmapFilePermissionMask); std::ofstream fout(idmap_path); if (fout.fail()) { out_error << "failed to open idmap path " << idmap_path << std::endl; Loading
cmds/idmap2/idmap2/Lookup.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -63,10 +63,12 @@ namespace { Result<ResourceId> WARN_UNUSED ParseResReference(const AssetManager2& am, const std::string& res, const std::string& fallback_package) { static constexpr const int kBaseHex = 16; // first, try to parse as a hex number char* endptr = nullptr; ResourceId resid; resid = strtol(res.c_str(), &endptr, 16); resid = strtol(res.c_str(), &endptr, kBaseHex); if (*endptr == '\0') { return {resid}; } Loading Loading @@ -155,7 +157,9 @@ Result<std::string> GetTargetPackageNameFromManifest(const std::string& apk_path bool Lookup(const std::vector<std::string>& args, std::ostream& out_error) { std::vector<std::string> idmap_paths; std::string config_str, resid_str; std::string config_str; std::string resid_str; const CommandLineOptions opts = CommandLineOptions("idmap2 lookup") .MandatoryOption("--idmap-path", "input: path to idmap file to load", &idmap_paths) Loading
cmds/idmap2/idmap2/Main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ using android::idmap2::CommandLineOptions; typedef std::map<std::string, std::function<int(const std::vector<std::string>&, std::ostream&)>> typedef std::map<std::string, std::function<bool(const std::vector<std::string>&, std::ostream&)>> NameToFunctionMap; namespace { Loading
cmds/idmap2/idmap2/Scan.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ std::unique_ptr<std::vector<std::string>> FindApkFiles(const std::vector<std::st const auto predicate = [](unsigned char type, const std::string& path) -> bool { static constexpr size_t kExtLen = 4; // strlen(".apk") return type == DT_REG && path.size() > kExtLen && !path.compare(path.size() - kExtLen, kExtLen, ".apk"); path.compare(path.size() - kExtLen, kExtLen, ".apk") == 0; }; // pass apk paths through a set to filter out duplicates std::set<std::string> paths; Loading @@ -63,7 +63,9 @@ std::unique_ptr<std::vector<std::string>> FindApkFiles(const std::vector<std::st bool Scan(const std::vector<std::string>& args, std::ostream& out_error) { std::vector<std::string> input_directories; std::string target_package_name, target_apk_path, output_directory; std::string target_package_name; std::string target_apk_path; std::string output_directory; bool recursive = false; const CommandLineOptions opts = Loading Loading @@ -112,7 +114,7 @@ bool Scan(const std::vector<std::string>& args, std::ostream& out_error) { } auto iter = tag->find("isStatic"); if (iter == tag->end() || std::stoul(iter->second) == 0u) { if (iter == tag->end() || std::stoul(iter->second) == 0U) { continue; } Loading
cmds/idmap2/idmap2/Verify.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ using android::idmap2::IdmapHeader; bool Verify(const std::vector<std::string>& args, std::ostream& out_error) { std::string idmap_path; const CommandLineOptions opts = CommandLineOptions("idmap2 verify") .MandatoryOption("--idmap-path", "input: path to idmap file to verify", &idmap_path); Loading