zlib -> libdeflate (#5085)
+ Use libdeflate + Use std::byte * Fix passing temporary to string_view + Emulate make_unique_for_overwrite
This commit is contained in:
@@ -298,13 +298,14 @@ void cProtocol_1_13::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
|
||||
m_Client->SetClientBrand(Brand);
|
||||
|
||||
// Send back our brand, including the length:
|
||||
SendPluginMessage("minecraft:brand", "\x08""Cuberite");
|
||||
m_Client->SendPluginMessage("minecraft:brand", "\x08""Cuberite");
|
||||
return;
|
||||
}
|
||||
|
||||
ContiguousByteBuffer Data;
|
||||
|
||||
// Read the plugin message and relay to clienthandle:
|
||||
AString Data;
|
||||
VERIFY(a_ByteBuffer.ReadString(Data, a_ByteBuffer.GetReadableSpace() - 1)); // Always succeeds
|
||||
VERIFY(a_ByteBuffer.ReadSome(Data, a_ByteBuffer.GetReadableSpace())); // Always succeeds
|
||||
m_Client->HandlePluginMessage(Channel, Data);
|
||||
}
|
||||
|
||||
@@ -694,8 +695,8 @@ bool cProtocol_1_13::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t
|
||||
a_Item.Empty();
|
||||
}
|
||||
|
||||
AString Metadata;
|
||||
if (!a_ByteBuffer.ReadString(Metadata, a_ByteBuffer.GetReadableSpace() - a_KeepRemainingBytes - 1) || (Metadata.size() == 0) || (Metadata[0] == 0))
|
||||
ContiguousByteBuffer Metadata;
|
||||
if (!a_ByteBuffer.ReadSome(Metadata, a_ByteBuffer.GetReadableSpace() - a_KeepRemainingBytes) || Metadata.empty() || (Metadata[0] == std::byte(0)))
|
||||
{
|
||||
// No metadata
|
||||
return true;
|
||||
@@ -1423,8 +1424,8 @@ bool cProtocol_1_13_2::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size
|
||||
a_Item.Empty();
|
||||
}
|
||||
|
||||
AString Metadata;
|
||||
if (!a_ByteBuffer.ReadString(Metadata, a_ByteBuffer.GetReadableSpace() - a_KeepRemainingBytes - 1) || (Metadata.size() == 0) || (Metadata[0] == 0))
|
||||
ContiguousByteBuffer Metadata;
|
||||
if (!a_ByteBuffer.ReadSome(Metadata, a_ByteBuffer.GetReadableSpace() - a_KeepRemainingBytes) || Metadata.empty() || (Metadata[0] == std::byte(0)))
|
||||
{
|
||||
// No metadata
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user