From 79c19c6a1c400b28f27ca6f44dd11e07ac43ec85 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 15 May 2021 22:18:00 +0300 Subject: switch from Boost.Nowide to winapi-utf8 --- utils/CMakeLists.txt | 2 +- utils/addr2name.cpp | 7 +++---- utils/command_line.hpp | 26 ++++---------------------- utils/enum_symbols.cpp | 5 ++--- utils/name2addr.cpp | 7 +++---- 5 files changed, 13 insertions(+), 34 deletions(-) (limited to 'utils') diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 6a345c9..70b3c82 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -3,7 +3,7 @@ find_package(Boost REQUIRED COMPONENTS filesystem program_options) function(add_util name src) add_executable("${name}" ${src}) target_link_libraries("${name}" PRIVATE pdb_repo) - target_link_libraries("${name}" PRIVATE Boost::disable_autolinking Boost::filesystem Boost::nowide Boost::program_options) + target_link_libraries("${name}" PRIVATE Boost::disable_autolinking Boost::filesystem Boost::program_options) install(TARGETS "${name}" RUNTIME DESTINATION bin) install_pdbs(TARGETS "${name}" DESTINATION bin) endfunction() diff --git a/utils/addr2name.cpp b/utils/addr2name.cpp index 710a2ff..acb992c 100644 --- a/utils/addr2name.cpp +++ b/utils/addr2name.cpp @@ -7,7 +7,6 @@ #include "pdb/all.hpp" #include "pdb_descr.hpp" -#include #include #include @@ -58,7 +57,7 @@ std::string format_line_info(const pdb::LineInfo& line_info) { } void dump_error(const std::exception& e) { - boost::nowide::cerr << "error: " << e.what() << '\n'; + std::cerr << "error: " << e.what() << '\n'; } void resolve_symbol(const pdb::Repo& repo, pdb::Address address, bool lines = false) { @@ -78,10 +77,10 @@ void resolve_symbol(const pdb::Repo& repo, pdb::Address address, bool lines = fa } } - boost::nowide::cout << msg.str() << '\n'; + std::cout << msg.str() << '\n'; } catch (const std::exception& e) { dump_error(e); - boost::nowide::cout << pdb::format_address(address) << '\n'; + std::cout << pdb::format_address(address) << '\n'; } } diff --git a/utils/command_line.hpp b/utils/command_line.hpp index 9fe6b98..d1f6e2e 100644 --- a/utils/command_line.hpp +++ b/utils/command_line.hpp @@ -6,9 +6,6 @@ #pragma once #include -#include -#include -#include #include #include @@ -16,23 +13,9 @@ #include #include -class Args { -public: - Args(int argc, char** argv) : argc{argc}, argv{argv}, impl{this->argc, this->argv} { - boost::nowide::nowide_filesystem(); - } - - int argc; - char** argv; - -private: - const boost::nowide::args impl; -}; - class SettingsParser { public: - explicit SettingsParser(int argc, char** argv) - : args{argc, argv}, prog_name{extract_filename(args.argv[0])} { + explicit SettingsParser(int, char** argv) : prog_name{extract_filename(argv[0])} { visible.add_options()("help,h", "show this message and exit"); } @@ -57,11 +40,11 @@ public: bool exit_with_usage = false; - void usage() const { boost::nowide::cout << *this; } + void usage() const { std::cout << *this; } void usage_error(const std::exception& e) const { - boost::nowide::cerr << "usage error: " << e.what() << '\n'; - boost::nowide::cerr << *this; + std::cerr << "usage error: " << e.what() << '\n'; + std::cerr << *this; } protected: @@ -74,7 +57,6 @@ private: return boost::filesystem::path{path}.filename().string(); } - const Args args; const std::string prog_name; friend std::ostream& operator<<(std::ostream& os, const SettingsParser& parser) { diff --git a/utils/enum_symbols.cpp b/utils/enum_symbols.cpp index 49dbfed..626816e 100644 --- a/utils/enum_symbols.cpp +++ b/utils/enum_symbols.cpp @@ -6,7 +6,6 @@ #include "command_line.hpp" #include "pdb/all.hpp" -#include #include #include @@ -80,11 +79,11 @@ int main(int argc, char* argv[]) { dbghelp.enum_symbols(id, settings.get_mask(), [&](const pdb::SymbolInfo& symbol) { if (!settings.type_specified() || settings.get_type() == symbol.get_type()) - boost::nowide::cout << symbol.get_name() << '\n'; + std::cout << symbol.get_name() << '\n'; }); } } catch (const std::exception& e) { - boost::nowide::cerr << "error: " << e.what() << '\n'; + std::cerr << "error: " << e.what() << '\n'; return 1; } return 0; diff --git a/utils/name2addr.cpp b/utils/name2addr.cpp index 4b83757..d0c4293 100644 --- a/utils/name2addr.cpp +++ b/utils/name2addr.cpp @@ -7,7 +7,6 @@ #include "pdb/all.hpp" #include "pdb_descr.hpp" -#include #include #include @@ -39,16 +38,16 @@ public: }; void dump_error(const std::exception& e) { - boost::nowide::cerr << "error: " << e.what() << '\n'; + std::cerr << "error: " << e.what() << '\n'; } void resolve_symbol(const pdb::Repo& repo, const std::string& name) { try { const auto address = repo.resolve_symbol(name).get_online_address(); - boost::nowide::cout << pdb::format_address(address) << '\n'; + std::cout << pdb::format_address(address) << '\n'; } catch (const std::exception& e) { dump_error(e); - boost::nowide::cout << name << '\n'; + std::cout << name << '\n'; } } -- cgit v1.2.3