diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-15 22:18:00 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-15 22:40:36 +0300 |
commit | 79c19c6a1c400b28f27ca6f44dd11e07ac43ec85 (patch) | |
tree | c934d0c0e2e2abd4fc85324a37d2e402d01a1200 /src | |
parent | get rid of SafeInt (diff) | |
download | winapi-debug-79c19c6a1c400b28f27ca6f44dd11e07ac43ec85.tar.gz winapi-debug-79c19c6a1c400b28f27ca6f44dd11e07ac43ec85.zip |
switch from Boost.Nowide to winapi-utf8
Diffstat (limited to 'src')
-rw-r--r-- | src/dbghelp.cpp | 6 | ||||
-rw-r--r-- | src/error.cpp | 4 | ||||
-rw-r--r-- | src/module.cpp | 4 | ||||
-rw-r--r-- | src/process.cpp | 6 | ||||
-rw-r--r-- | src/symbol.cpp | 7 | ||||
-rw-r--r-- | src/utils/file.cpp | 6 |
6 files changed, 16 insertions, 17 deletions
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 <pdb/all.hpp> -#include <boost/nowide/convert.hpp> +#include <winapi/utf8.hpp> #include <dbghelp.h> #include <windows.h> @@ -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<DbgHelp::OnSymbol*>(&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_INFOW&>(symbol))) + if (!SymFromNameW(id, winapi::widen(name).c_str(), &static_cast<SYMBOL_INFOW&>(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 <pdb/all.hpp> -#include <boost/nowide/convert.hpp> +#include <winapi/utf8.hpp> #include <windows.h> @@ -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 <pdb/all.hpp> -#include <boost/nowide/convert.hpp> +#include <winapi/utf8.hpp> #include <cstring> #include <limits> @@ -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 <pdb/all.hpp> -#include <boost/nowide/convert.hpp> +#include <winapi/utf8.hpp> #include <windows.h> @@ -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 <pdb/all.hpp> -#include <boost/nowide/convert.hpp> +#include <winapi/utf8.hpp> #include <dbghelp.h> #include <windows.h> @@ -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 <pdb/all.hpp> -#include <boost/nowide/convert.hpp> +#include <winapi/utf8.hpp> #include <windows.h> @@ -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, |