Skip to content

Commit

Permalink
Use FastWriter instead of StyledWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiascode authored and Seadragon91 committed May 16, 2017
1 parent f0a16e6 commit b02886a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Protocol/ProtocolRecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Protocol/ProtocolRecognizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down
2 changes: 1 addition & 1 deletion src/Protocol/Protocol_1_10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Protocol/Protocol_1_8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Protocol/Protocol_1_9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b02886a

Please sign in to comment.