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 --- src/dbghelp.cpp | 6 +++--- src/error.cpp | 4 ++-- src/module.cpp | 4 ++-- src/process.cpp | 6 +++--- src/symbol.cpp | 7 +++---- src/utils/file.cpp | 6 +++--- 6 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index 78b8e88..254ad15 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include #include @@ -84,7 +84,7 @@ void enum_symbols(HANDLE id, const DbgHelp::OnSymbol& callback) { if (!SymEnumSymbolsW(id, module_base, - boost::nowide::widen(mask).c_str(), + winapi::widen(mask).c_str(), &enum_symbols_callback, const_cast(&callback))) throw error::windows(GetLastError(), "SymEnumSymbolsW"); @@ -190,7 +190,7 @@ SymbolInfo DbgHelp::resolve_symbol(Address offline) const { SymbolInfo DbgHelp::resolve_symbol(const std::string& name) const { SymbolInfo symbol; - if (!SymFromNameW(id, boost::nowide::widen(name).c_str(), &static_cast(symbol))) + if (!SymFromNameW(id, winapi::widen(name).c_str(), &static_cast(symbol))) throw error::windows(GetLastError(), "SymFromNameW"); return symbol; diff --git a/src/error.cpp b/src/error.cpp index 368feb7..00252e9 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include @@ -49,7 +49,7 @@ std::string format_message(int code) { std::wstring msg{buf, len}; LocalFree(buf); - return boost::nowide::narrow(trim_trailing_newline(msg)); + return winapi::narrow(trim_trailing_newline(msg)); } } // namespace diff --git a/src/module.cpp b/src/module.cpp index f05ef03..e43f942 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include #include @@ -30,7 +30,7 @@ ModuleInfo::Impl ModuleInfo::create_impl() { } std::string ModuleInfo::get_name() const { - return boost::nowide::narrow(impl.ModuleName); + return winapi::narrow(impl.ModuleName); } Address Module::translate_offline_address(Address offline) const { diff --git a/src/process.cpp b/src/process.cpp index adb4b96..022a1b3 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include @@ -70,7 +70,7 @@ std::string get_current_executable_path(PathBuffer& buffer) { return get_current_executable_path(buffer); } - return boost::nowide::narrow(buffer.get_data()); + return winapi::narrow(buffer.get_data()); } std::string get_current_executable_path() { @@ -84,7 +84,7 @@ std::string get_executable_path(const Handle& process, PathBuffer& buffer) { const auto ec = ::QueryFullProcessImageNameW(process.get(), 0, buffer.get_data(), &size); if (ec != 0) { - return boost::nowide::narrow(buffer.get_data()); + return winapi::narrow(buffer.get_data()); } if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { diff --git a/src/symbol.cpp b/src/symbol.cpp index 9f5e11d..eff9a03 100644 --- a/src/symbol.cpp +++ b/src/symbol.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include #include @@ -54,11 +54,10 @@ SymbolInfo::SymbolInfo(const Impl& impl) : SymbolInfo{} { std::string SymbolInfo::get_name() const { // SymFromAddrW, contrary to SymFromAddrA, seems to include the terminating // null character in NameLen. - return boost::nowide::narrow(get_impl().Name); + return winapi::narrow(get_impl().Name); } LineInfo::LineInfo(const Impl& impl) - : file_path{boost::nowide::narrow(impl.FileName)}, - line_number{cast_line_number(impl.LineNumber)} {} + : file_path{winapi::narrow(impl.FileName)}, line_number{cast_line_number(impl.LineNumber)} {} } // namespace pdb diff --git a/src/utils/file.cpp b/src/utils/file.cpp index 3f37cfc..9584de3 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include @@ -18,7 +18,7 @@ namespace pdb { namespace file { std::size_t get_size(const std::string& path) { - const Handle handle{CreateFileW(boost::nowide::widen(path).c_str(), + const Handle handle{CreateFileW(winapi::widen(path).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ, NULL, @@ -40,7 +40,7 @@ std::size_t get_size(const std::string& path) { } ID query_id(const std::string& path) { - const Handle handle{CreateFileW(boost::nowide::widen(path).c_str(), + const Handle handle{CreateFileW(winapi::widen(path).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, -- cgit v1.2.3