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/Bindings/LuaTCPLink.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Bindings/LuaTCPLink.cpp') diff --git a/src/Bindings/LuaTCPLink.cpp b/src/Bindings/LuaTCPLink.cpp index 3933e9b36..498691806 100644 --- a/src/Bindings/LuaTCPLink.cpp +++ b/src/Bindings/LuaTCPLink.cpp @@ -179,7 +179,7 @@ AString cLuaTCPLink::StartTLSClient( auto res = ownCert->Parse(a_OwnCertData.data(), a_OwnCertData.size()); if (res != 0) { - return Printf("Cannot parse client certificate: -0x%x", res); + return fmt::format(FMT_STRING("Cannot parse client certificate: -0x{:x}"), -res); } } cCryptoKeyPtr ownPrivKey; @@ -189,7 +189,7 @@ AString cLuaTCPLink::StartTLSClient( auto res = ownPrivKey->ParsePrivate(a_OwnPrivKeyData.data(), a_OwnPrivKeyData.size(), a_OwnPrivKeyPassword); if (res != 0) { - return Printf("Cannot parse client private key: -0x%x", res); + return fmt::format(FMT_STRING("Cannot parse client private key: -0x{:x}"), -res); } } return link->StartTLSClient(ownCert, ownPrivKey); @@ -216,13 +216,13 @@ AString cLuaTCPLink::StartTLSServer( int res = OwnCert->Parse(a_OwnCertData.data(), a_OwnCertData.size()); if (res != 0) { - return Printf("Cannot parse server certificate: -0x%x", res); + return fmt::format(FMT_STRING("Cannot parse server certificate: -0x{:x}"), -res); } auto OwnPrivKey = std::make_shared(); res = OwnPrivKey->ParsePrivate(a_OwnPrivKeyData.data(), a_OwnPrivKeyData.size(), a_OwnPrivKeyPassword); if (res != 0) { - return Printf("Cannot parse server private key: -0x%x", res); + return fmt::format(FMT_STRING("Cannot parse server private key: -0x{:x}"), -res); } return link->StartTLSServer(OwnCert, OwnPrivKey, a_StartTLSData); -- cgit v1.2.3