diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-06-14 10:53:46 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-06-14 15:04:09 -0400 |
| commit | 5b92d5076a0be89945fa0fc722749dd5fbfcdf4c (patch) | |
| tree | b87080969dd47a01c3a7845d65ef2afdef90928d /Source/Core/Common/Network.cpp | |
| parent | 925afcae3b7b6ea8dde2cfd236288d924c42fa05 (diff) | |
Common: Use fmt where applicable
Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().
Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.
Diffstat (limited to 'Source/Core/Common/Network.cpp')
| -rw-r--r-- | Source/Core/Common/Network.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp index acfb60e55c..77d835a126 100644 --- a/Source/Core/Common/Network.cpp +++ b/Source/Core/Common/Network.cpp @@ -9,8 +9,9 @@ #include <cstring> #include <ctime> +#include <fmt/format.h> + #include "Common/Random.h" -#include "Common/StringUtil.h" namespace Common { @@ -38,8 +39,8 @@ MACAddress GenerateMacAddress(const MACConsumer type) std::string MacAddressToString(const MACAddress& mac) { - return StringFromFormat("%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], - mac[5]); + return fmt::format("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", mac[0], mac[1], mac[2], mac[3], + mac[4], mac[5]); } std::optional<MACAddress> StringToMacAddress(const std::string& mac_string) |
