diff options
-rw-r--r-- | include/pdb/address.hpp | 8 | ||||
-rw-r--r-- | utils/addr2name.cpp | 1 | ||||
-rw-r--r-- | utils/name2addr.cpp | 1 | ||||
-rw-r--r-- | utils/pdb_descr.hpp | 20 |
4 files changed, 13 insertions, 17 deletions
diff --git a/include/pdb/address.hpp b/include/pdb/address.hpp index 33e0ac3..4a62249 100644 --- a/include/pdb/address.hpp +++ b/include/pdb/address.hpp @@ -20,4 +20,12 @@ namespace pdb oss << std::hex << std::showbase << address; return oss.str(); } + + inline bool parse_address(Address& dest, const std::string& src) + { + std::istringstream iss{src}; + iss >> std::hex; + char c; + return iss >> dest && !iss.get(c); + } } diff --git a/utils/addr2name.cpp b/utils/addr2name.cpp index a564e42..5342705 100644 --- a/utils/addr2name.cpp +++ b/utils/addr2name.cpp @@ -33,7 +33,6 @@ namespace } std::vector<PDB> pdbs; - std::vector<pdb::Address> addresses; private: diff --git a/utils/name2addr.cpp b/utils/name2addr.cpp index c6602c9..543cd7b 100644 --- a/utils/name2addr.cpp +++ b/utils/name2addr.cpp @@ -32,7 +32,6 @@ namespace } std::vector<PDB> pdbs; - std::vector<std::string> names; private: diff --git a/utils/pdb_descr.hpp b/utils/pdb_descr.hpp index c57a0e9..c8a6112 100644 --- a/utils/pdb_descr.hpp +++ b/utils/pdb_descr.hpp @@ -17,38 +17,28 @@ namespace { struct PDB { - PDB(pdb::Address online_base, const std::string& path) - : online_base{online_base} - , path{path} - { } - pdb::Address online_base; std::string path; static PDB parse(std::string src) { static constexpr auto sep = ','; + const auto sep_pos = src.find(sep); if (sep_pos == std::string::npos) boost::throw_exception(boost::program_options::invalid_option_value{src}); + pdb::Address online_base; - if (!parse_address(online_base, src.substr(0, sep_pos))) + if (!pdb::parse_address(online_base, src.substr(0, sep_pos))) boost::throw_exception(boost::program_options::invalid_option_value{src}); - return {online_base, src.substr(sep_pos + 1)}; - } - static bool parse_address(pdb::Address& dest, const std::string& src) - { - std::istringstream iss{src}; - iss >> std::hex; - char c; - return iss >> dest && !iss.get(c); + return {online_base, src.substr(sep_pos + 1)}; } static pdb::Address parse_address(const std::string& src) { pdb::Address dest; - if (!parse_address(dest, src)) + if (!pdb::parse_address(dest, src)) boost::throw_exception(boost::program_options::invalid_option_value{src}); return dest; } |