From c9522fb740200ccef6230cec452c48efb31e5394 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 11 May 2023 22:05:17 +0200 Subject: Removed all Printf-family functions from StringUtils. Replaced them with fmt::format calls, including changes to the format strings. Also changed the format strings to use FMT_STRING, so that the format is checked compile-time against the arguments. Also fixed code-style violations already present in the code. --- src/StringUtils.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'src/StringUtils.cpp') diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 436eeccbb..e6d5e3812 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -52,42 +52,6 @@ static unsigned char HexToDec(char a_HexChar) -AString & vPrintf(AString & a_String, const char * a_Format, fmt::printf_args a_ArgList) -{ - ASSERT(a_Format != nullptr); - fmt::memory_buffer Buffer; // Save a string allocation compared to vsprintf - fmt::vprintf(Buffer, fmt::to_string_view(a_Format), a_ArgList); - a_String.assign(Buffer.data(), Buffer.size()); - return a_String; -} - - - - - -AString vPrintf(const char * a_Format, fmt::printf_args a_ArgList) -{ - ASSERT(a_Format != nullptr); - return fmt::vsprintf(a_Format, a_ArgList); -} - - - - - -AString & vAppendPrintf(AString & a_String, const char * a_Format, fmt::printf_args a_ArgList) -{ - ASSERT(a_Format != nullptr); - fmt::memory_buffer Buffer; - fmt::vprintf(Buffer, fmt::to_string_view(a_Format), a_ArgList); - a_String.append(Buffer.data(), Buffer.size()); - return a_String; -} - - - - - AStringVector StringSplit(const AString & str, const AString & delim) { AStringVector results; -- cgit v1.2.3