From b02886a9010950e1bb320598568b7f5adafdd3ca Mon Sep 17 00:00:00 2001 From: mathiascode Date: Sat, 13 May 2017 13:08:40 +0300 Subject: Use FastWriter instead of StyledWriter --- src/Protocol/ProtocolRecognizer.cpp | 4 ++-- src/Protocol/ProtocolRecognizer.h | 1 + src/Protocol/Protocol_1_10.cpp | 2 +- src/Protocol/Protocol_1_8.cpp | 2 +- src/Protocol/Protocol_1_9.cpp | 8 ++++---- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 79270644f..011070998 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -1157,7 +1157,7 @@ void cProtocolRecognizer::SendPingStatusResponse(void) // Version: Json::Value Version; Version["name"] = "Cuberite " MCS_CLIENT_VERSIONS; - Version["protocol"] = 0; // Force client to think this is an invalid version (no other good default) + Version["protocol"] = MCS_LATEST_PROTOCOL_VERSION; // Players: Json::Value Players; @@ -1179,7 +1179,7 @@ void cProtocolRecognizer::SendPingStatusResponse(void) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index b48717563..dd681afda 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -20,6 +20,7 @@ // Adjust these if a new protocol is added or an old one is removed: #define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x, 1.11.x" #define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315, 316" +#define MCS_LATEST_PROTOCOL_VERSION 316 diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp index c1ddebce1..4301b0310 100644 --- a/src/Protocol/Protocol_1_10.cpp +++ b/src/Protocol/Protocol_1_10.cpp @@ -343,7 +343,7 @@ void cProtocol_1_10_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index d55855c41..ee2172eaf 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2140,7 +2140,7 @@ void cProtocol_1_8_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index 0b369f865..2a6c924b0 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -2162,7 +2162,7 @@ void cProtocol_1_9_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet @@ -4156,7 +4156,7 @@ void cProtocol_1_9_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet @@ -4213,7 +4213,7 @@ void cProtocol_1_9_2::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet @@ -4270,7 +4270,7 @@ void cProtocol_1_9_4::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - Json::StyledWriter Writer; + Json::FastWriter Writer; AString Response = Writer.write(ResponseValue); cPacketizer Pkt(*this, 0x00); // Response packet -- cgit v1.2.3