summaryrefslogtreecommitdiff
path: root/Source/Core/Common/DynamicLibrary.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-06-14 10:53:46 -0400
committerLioncash <mathew1800@gmail.com>2019-06-14 15:04:09 -0400
commit5b92d5076a0be89945fa0fc722749dd5fbfcdf4c (patch)
treeb87080969dd47a01c3a7845d65ef2afdef90928d /Source/Core/Common/DynamicLibrary.cpp
parent925afcae3b7b6ea8dde2cfd236288d924c42fa05 (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/DynamicLibrary.cpp')
-rw-r--r--Source/Core/Common/DynamicLibrary.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/Core/Common/DynamicLibrary.cpp b/Source/Core/Common/DynamicLibrary.cpp
index 1c32cc6708..6bfdb482c8 100644
--- a/Source/Core/Common/DynamicLibrary.cpp
+++ b/Source/Core/Common/DynamicLibrary.cpp
@@ -3,9 +3,12 @@
// Refer to the license.txt file included.
#include "Common/DynamicLibrary.h"
+
#include <cstring>
+
+#include <fmt/format.h>
+
#include "Common/Assert.h"
-#include "Common/StringUtil.h"
#ifdef _WIN32
#include <Windows.h>
@@ -42,27 +45,27 @@ std::string DynamicLibrary::GetVersionedFilename(const char* libname, int major,
{
#if defined(_WIN32)
if (major >= 0 && minor >= 0)
- return StringFromFormat("%s-%d-%d.dll", libname, major, minor);
+ return fmt::format("{}-{}-{}.dll", libname, major, minor);
else if (major >= 0)
- return StringFromFormat("%s-%d.dll", libname, major);
+ return fmt::format("{}-{}.dll", libname, major);
else
- return StringFromFormat("%s.dll", libname);
+ return fmt::format("{}.dll", libname);
#elif defined(__APPLE__)
const char* prefix = std::strncmp(libname, "lib", 3) ? "lib" : "";
if (major >= 0 && minor >= 0)
- return StringFromFormat("%s%s.%d.%d.dylib", prefix, libname, major, minor);
+ return fmt::format("{}{}.{}.{}.dylib", prefix, libname, major, minor);
else if (major >= 0)
- return StringFromFormat("%s%s.%d.dylib", prefix, libname, major);
+ return fmt::format("{}{}.{}.dylib", prefix, libname, major);
else
- return StringFromFormat("%s%s.dylib", prefix, libname);
+ return fmt::format("{}{}.dylib", prefix, libname);
#else
const char* prefix = std::strncmp(libname, "lib", 3) ? "lib" : "";
if (major >= 0 && minor >= 0)
- return StringFromFormat("%s%s.so.%d.%d", prefix, libname, major, minor);
+ return fmt::format("{}{}.so.{}.{}", prefix, libname, major, minor);
else if (major >= 0)
- return StringFromFormat("%s%s.so.%d", prefix, libname, major);
+ return fmt::format("{}{}.so.{}", prefix, libname, major);
else
- return StringFromFormat("%s%s.so", prefix, libname);
+ return fmt::format("{}{}.so", prefix, libname);
#endif
}