From 757231cc6e777b8f4717d1467ef7efa01c7fde15 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 3 Jan 2018 17:41:16 +0000 Subject: Add the fmt library (#4065) * Replaces AppendVPrintf with fmt::sprintf * fmt::ArgList now used as a type safe alternative to varargs. * Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu. * Adds FLOG functions to log with fmt's native formatting style. --- src/Protocol/ForgeHandshake.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Protocol/ForgeHandshake.cpp') diff --git a/src/Protocol/ForgeHandshake.cpp b/src/Protocol/ForgeHandshake.cpp index 48b89baf4..b6f7a7c94 100644 --- a/src/Protocol/ForgeHandshake.cpp +++ b/src/Protocol/ForgeHandshake.cpp @@ -146,7 +146,7 @@ AStringMap cForgeHandshake::ParseModList(const char * a_Data, size_t a_Size) if (a_Size < 4) { - SetError(Printf("ParseModList invalid packet, missing length (size = " SIZE_T_FMT ")", a_Size)); + SetError(Printf("ParseModList invalid packet, missing length (size = %zu)", a_Size)); return Mods; } @@ -194,7 +194,7 @@ void cForgeHandshake::HandleClientHello(cClientHandle * a_Client, const char * a } else { - SetError(Printf("Received unexpected length of ClientHello: " SIZE_T_FMT, a_Size)); + SetError(Printf("Received unexpected length of ClientHello: %zu", a_Size)); } } @@ -212,7 +212,7 @@ void cForgeHandshake::HandleModList(cClientHandle * a_Client, const char * a_Dat AppendPrintf(ClientModsString, "%s@%s, ", item.first.c_str(), item.second.c_str()); } - LOG("Client connected with " SIZE_T_FMT " mods: %s", ClientMods.size(), ClientModsString.c_str()); + LOG("Client connected with %zu mods: %s", ClientMods.size(), ClientModsString.c_str()); m_Client->m_ForgeMods = ClientMods; @@ -252,7 +252,7 @@ void cForgeHandshake::HandleHandshakeAck(cClientHandle * a_Client, const char * { if (a_Size != 2) { - SetError(Printf("Unexpected HandshakeAck packet length: " SIZE_T_FMT "", a_Size)); + SetError(Printf("Unexpected HandshakeAck packet length: %zu", a_Size)); return; } @@ -331,7 +331,7 @@ void cForgeHandshake::DataReceived(cClientHandle * a_Client, const char * a_Data { if (!m_IsForgeClient) { - SetError(Printf("Received unexpected Forge data from non-Forge client (" SIZE_T_FMT " bytes)", a_Size)); + SetError(Printf("Received unexpected Forge data from non-Forge client (%zu bytes)", a_Size)); return; } if (m_Errored) @@ -342,7 +342,7 @@ void cForgeHandshake::DataReceived(cClientHandle * a_Client, const char * a_Data if (a_Size <= 1) { - SetError(Printf("Received unexpectedly short Forge data (" SIZE_T_FMT " bytes)", a_Size)); + SetError(Printf("Received unexpectedly short Forge data (%zu bytes)", a_Size)); return; } -- cgit v1.2.3