mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-03 11:36:35 +00:00
Address remaining review feedback on buffer reads
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include "../../IO/Streams/InputOutputStream.h"
|
||||
#include "PacketListener.h"
|
||||
@@ -123,8 +122,7 @@ void TextureAndGeometryPacket::handle(PacketListener *listener)
|
||||
void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
textureName = dis->readUTF();
|
||||
int skinId = dis->readInt();
|
||||
std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID));
|
||||
dwSkinID = static_cast<std::uint32_t>(dis->readInt());
|
||||
dwTextureBytes = (std::uint32_t)dis->readShort();
|
||||
|
||||
if(dwTextureBytes>0)
|
||||
@@ -162,9 +160,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
|
||||
void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
dos->writeUTF(textureName);
|
||||
int skinId = 0;
|
||||
std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID));
|
||||
dos->writeInt(skinId);
|
||||
dos->writeInt(static_cast<int>(dwSkinID));
|
||||
dos->writeShort((short)dwTextureBytes);
|
||||
for(std::uint32_t i=0;i<dwTextureBytes;i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user