diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-05 15:45:24 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-05 15:54:16 +0200 |
| commit | dc7d7bc45d9b6cb3a052d69fbdacbd33b9ff3796 (patch) | |
| tree | ab42a7e61784d97478e2b73f9e31ff400ccbbe09 /utils | |
| parent | upgrade winapi-common (diff) | |
| download | winapi-debug-dc7d7bc45d9b6cb3a052d69fbdacbd33b9ff3796.tar.gz winapi-debug-dc7d7bc45d9b6cb3a052d69fbdacbd33b9ff3796.zip | |
upgrade to std::format
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/addr2name.cpp | 14 | ||||
| -rw-r--r-- | utils/pdb_descr.hpp | 1 |
2 files changed, 6 insertions, 9 deletions
diff --git a/utils/addr2name.cpp b/utils/addr2name.cpp index 333ef29..4f1f686 100644 --- a/utils/addr2name.cpp +++ b/utils/addr2name.cpp @@ -11,6 +11,7 @@ #include <boost/program_options.hpp> #include <exception> +#include <format> #include <iostream> #include <sstream> #include <string> @@ -44,18 +45,15 @@ public: }; std::string format_symbol(const winapi::Module& module, const winapi::Symbol& symbol) { - std::ostringstream oss; - oss << module.get_name() << '!' << symbol.get_name(); + const auto symbol_str = std::format("{}!{}", module.get_name(), symbol.get_name()); const auto displacement = symbol.get_displacement(); - if (displacement) - oss << '+' << winapi::address::format(displacement); - return oss.str(); + if (!displacement) + return symbol_str; + return std::format("{}+{}", symbol_str, winapi::address::format(displacement)); } std::string format_line_info(const winapi::LineInfo& line_info) { - std::ostringstream oss; - oss << '[' << line_info.file_path << " @ " << line_info.line_number << ']'; - return oss.str(); + return std::format("[{} @ {}]", line_info.file_path, line_info.line_number); } void dump_error(const std::exception& e) { diff --git a/utils/pdb_descr.hpp b/utils/pdb_descr.hpp index e00020f..fbf0950 100644 --- a/utils/pdb_descr.hpp +++ b/utils/pdb_descr.hpp @@ -9,7 +9,6 @@ #include <boost/program_options.hpp> -#include <sstream> #include <string> #include <vector> |
