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/HTTP/TransferEncodingParser.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/HTTP/TransferEncodingParser.cpp') diff --git a/src/HTTP/TransferEncodingParser.cpp b/src/HTTP/TransferEncodingParser.cpp index 98d870460..925c919d3 100644 --- a/src/HTTP/TransferEncodingParser.cpp +++ b/src/HTTP/TransferEncodingParser.cpp @@ -120,7 +120,7 @@ protected: } default: { - Error(Printf("Invalid character in chunk length line: 0x%x", a_Data[i])); + Error(fmt::format(FMT_STRING("Invalid character in chunk length line: 0x{:02x}"), a_Data[i])); return AString::npos; } } // switch (a_Data[i]) @@ -150,7 +150,7 @@ protected: if (a_Data[i] < 32) { // Only printable characters are allowed in the trailer - Error(Printf("Invalid character in chunk length line: 0x%x", a_Data[i])); + Error(fmt::format(FMT_STRING("Invalid character in chunk length line: 0x{:02x}"), a_Data[i])); return AString::npos; } } @@ -183,7 +183,7 @@ protected: } return 1; } - Error(Printf("Invalid character past chunk length's CR: 0x%x", a_Data[0])); + Error(fmt::format(FMT_STRING("Invalid character past chunk length's CR: 0x{:02x}"), a_Data[0])); return AString::npos; } @@ -219,7 +219,7 @@ protected: m_State = psChunkDataLF; return 1; } - Error(Printf("Invalid character past chunk data: 0x%x", a_Data[0])); + Error(fmt::format(FMT_STRING("Invalid character past chunk data: 0x{:02x}"), a_Data[0])); return AString::npos; } @@ -241,7 +241,7 @@ protected: m_State = psChunkLength; return 1; } - Error(Printf("Invalid character past chunk data's CR: 0x%x", a_Data[0])); + Error(fmt::format(FMT_STRING("Invalid character past chunk data's CR: 0x{:02x}"), a_Data[0])); return AString::npos; } @@ -292,11 +292,11 @@ protected: return a_Size; } - virtual void Finish(void) override + virtual void Finish() override { if (m_State != psFinished) { - Error(Printf("ChunkedTransferEncoding: Finish signal received before the data stream ended (state: %d)", m_State)); + Error(fmt::format(FMT_STRING("ChunkedTransferEncoding: Finish signal received before the data stream ended (state: {})"), m_State)); } m_State = psFinished; } -- cgit v1.2.3