diff options
Diffstat (limited to 'src/Protocol')
-rw-r--r-- | src/Protocol/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Protocol/ForgeHandshake.cpp | 12 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 10 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 12 |
4 files changed, 18 insertions, 17 deletions
diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt index ff1a98e6b..5cc7654ba 100644 --- a/src/Protocol/CMakeLists.txt +++ b/src/Protocol/CMakeLists.txt @@ -34,4 +34,5 @@ SET (HDRS if (NOT MSVC) add_library(Protocol ${SRCS} ${HDRS}) + target_link_libraries(Protocol fmt::fmt) endif() 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; } diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index ec5a9440b..4568ad8cb 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -1867,7 +1867,7 @@ void cProtocol_1_8_0::AddReceivedData(const char * a_Data, size_t a_Size) ASSERT(m_ReceivedData.GetReadableSpace() == OldReadableSpace); AString Hex; CreateHexDump(Hex, AllData.data(), AllData.size(), 16); - m_CommLogFile.Printf("Incoming data, " SIZE_T_FMT " (0x" SIZE_T_FMT_HEX ") unparsed bytes already present in buffer:\n%s\n", + m_CommLogFile.Printf("Incoming data, %zu (0x%zx) unparsed bytes already present in buffer:\n%s\n", AllData.size(), AllData.size(), Hex.c_str() ); } @@ -2008,14 +2008,14 @@ void cProtocol_1_8_0::AddReceivedData(const char * a_Data, size_t a_Size) if (bb.GetReadableSpace() != 1) { // Read more or less than packet length, report as error - LOGWARNING("Protocol 1.8: Wrong number of bytes read for packet 0x%x, state %d. Read " SIZE_T_FMT " bytes, packet contained %u bytes", + LOGWARNING("Protocol 1.8: Wrong number of bytes read for packet 0x%x, state %d. Read %zu bytes, packet contained %u bytes", PacketType, m_State, bb.GetUsedSpace() - bb.GetReadableSpace(), PacketLen ); // Put a message in the comm log: if (g_ShouldLogCommIn && m_CommLogFile.IsOpen()) { - m_CommLogFile.Printf("^^^^^^ Wrong number of bytes read for this packet (exp %d left, got " SIZE_T_FMT " left) ^^^^^^\n\n\n", + m_CommLogFile.Printf("^^^^^^ Wrong number of bytes read for this packet (exp %d left, got %zu left) ^^^^^^\n\n\n", 1, bb.GetReadableSpace() ); m_CommLogFile.Flush(); @@ -2037,7 +2037,7 @@ void cProtocol_1_8_0::AddReceivedData(const char * a_Data, size_t a_Size) ASSERT(m_ReceivedData.GetReadableSpace() == OldReadableSpace); AString Hex; CreateHexDump(Hex, AllData.data(), AllData.size(), 16); - m_CommLogFile.Printf("There are " SIZE_T_FMT " (0x" SIZE_T_FMT_HEX ") bytes of non-parse-able data left in the buffer:\n%s", + m_CommLogFile.Printf("There are %zu (0x%zx) bytes of non-parse-able data left in the buffer:\n%s", m_ReceivedData.GetReadableSpace(), m_ReceivedData.GetReadableSpace(), Hex.c_str() ); m_CommLogFile.Flush(); @@ -2893,7 +2893,7 @@ void cProtocol_1_8_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metada { AString HexDump; CreateHexDump(HexDump, a_Metadata.data(), std::max<size_t>(a_Metadata.size(), 1024), 16); - LOGWARNING("Cannot parse NBT item metadata: %s at (" SIZE_T_FMT " / " SIZE_T_FMT " bytes)\n%s", + LOGWARNING("Cannot parse NBT item metadata: %s at (%zu / %zu bytes)\n%s", NBT.GetErrorCode().message().c_str(), NBT.GetErrorPos(), a_Metadata.size(), HexDump.c_str() ); return; diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index 7b61100d0..2b66cc7fa 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -162,7 +162,7 @@ cProtocol_1_9_0::cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_Ser } else { - LOG("Unknown additional data sent in server address (BungeeCord/FML?): " SIZE_T_FMT " parameters", Params.size()); + LOG("Unknown additional data sent in server address (BungeeCord/FML?): %zu parameters", Params.size()); // TODO: support FML + BungeeCord? (what parameters does it send in that case?) https://github.com/SpigotMC/BungeeCord/issues/899 } } @@ -1912,7 +1912,7 @@ void cProtocol_1_9_0::AddReceivedData(const char * a_Data, size_t a_Size) ASSERT(m_ReceivedData.GetReadableSpace() == OldReadableSpace); AString Hex; CreateHexDump(Hex, AllData.data(), AllData.size(), 16); - m_CommLogFile.Printf("Incoming data, " SIZE_T_FMT " (0x" SIZE_T_FMT_HEX ") unparsed bytes already present in buffer:\n%s\n", + m_CommLogFile.Printf("Incoming data, %zu (0x%zx) unparsed bytes already present in buffer:\n%s\n", AllData.size(), AllData.size(), Hex.c_str() ); } @@ -2053,14 +2053,14 @@ void cProtocol_1_9_0::AddReceivedData(const char * a_Data, size_t a_Size) if (bb.GetReadableSpace() != 1) { // Read more or less than packet length, report as error - LOGWARNING("Protocol 1.9: Wrong number of bytes read for packet 0x%x, state %d. Read " SIZE_T_FMT " bytes, packet contained %u bytes", + LOGWARNING("Protocol 1.9: Wrong number of bytes read for packet 0x%x, state %d. Read %zu bytes, packet contained %u bytes", PacketType, m_State, bb.GetUsedSpace() - bb.GetReadableSpace(), PacketLen ); // Put a message in the comm log: if (g_ShouldLogCommIn && m_CommLogFile.IsOpen()) { - m_CommLogFile.Printf("^^^^^^ Wrong number of bytes read for this packet (exp %d left, got " SIZE_T_FMT " left) ^^^^^^\n\n\n", + m_CommLogFile.Printf("^^^^^^ Wrong number of bytes read for this packet (exp %d left, got %zu left) ^^^^^^\n\n\n", 1, bb.GetReadableSpace() ); m_CommLogFile.Flush(); @@ -2082,7 +2082,7 @@ void cProtocol_1_9_0::AddReceivedData(const char * a_Data, size_t a_Size) ASSERT(m_ReceivedData.GetReadableSpace() == OldReadableSpace); AString Hex; CreateHexDump(Hex, AllData.data(), AllData.size(), 16); - m_CommLogFile.Printf("Protocol 1.9: There are " SIZE_T_FMT " (0x" SIZE_T_FMT_HEX ") bytes of non-parse-able data left in the buffer:\n%s", + m_CommLogFile.Printf("Protocol 1.9: There are %zu (0x%zx) bytes of non-parse-able data left in the buffer:\n%s", m_ReceivedData.GetReadableSpace(), m_ReceivedData.GetReadableSpace(), Hex.c_str() ); m_CommLogFile.Flush(); @@ -3029,7 +3029,7 @@ void cProtocol_1_9_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metada { AString HexDump; CreateHexDump(HexDump, a_Metadata.data(), std::max<size_t>(a_Metadata.size(), 1024), 16); - LOGWARNING("Cannot parse NBT item metadata: %s at (" SIZE_T_FMT " / " SIZE_T_FMT " bytes)\n%s", + LOGWARNING("Cannot parse NBT item metadata: %s at (%zu / %zu bytes)\n%s", NBT.GetErrorCode().message().c_str(), NBT.GetErrorPos(), a_Metadata.size(), HexDump.c_str() ); return; |