From bc3aa9467ae1e2d0ea1727093af9b0af14965e69 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Fri, 7 Oct 2022 20:12:36 -0500 Subject: Replace impl Read with Cursor<&[u8]> (#26) * Start getting rid of Cursor * try to make the tests pass and fail * make the tests pass * remove unused uses * fix clippy warnings * fix potential OOM exploits * fix OOM in az-nbt * fix nbt benchmark * fix a test * start replacing it with Cursor> * wip * fix all the issues * fix all tests * fix nbt benchmark * fix warnings --- azalea-client/src/client.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'azalea-client/src') diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index d3363ff2..ed0a75e7 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -31,7 +31,11 @@ use azalea_world::{ }; use log::{debug, error, warn}; use parking_lot::Mutex; -use std::{fmt::Debug, io, sync::Arc}; +use std::{ + fmt::Debug, + io::{self, Cursor}, + sync::Arc, +}; use thiserror::Error; use tokio::{ io::AsyncWriteExt, @@ -509,7 +513,7 @@ impl Client { client .dimension .lock() - .replace_with_packet_data(&pos, &mut p.chunk_data.data.as_slice()) + .replace_with_packet_data(&pos, &mut Cursor::new(&p.chunk_data.data)) .unwrap(); } ClientboundGamePacket::LightUpdate(p) => { -- cgit v1.2.3