aboutsummaryrefslogtreecommitdiff
path: root/azalea-buf/src/write.rs
diff options
context:
space:
mode:
authorEightFactorial <murphkev000@gmail.com>2023-01-25 09:51:27 -0800
committerGitHub <noreply@github.com>2023-01-25 11:51:27 -0600
commit9a66cb97a659ed1f0e52ba3d9438de1d9b78d64a (patch)
tree16405cec7c45fb952509a5f93f6970b511315046 /azalea-buf/src/write.rs
parent473c74175c3a8189616bded528e3e6e4785dd3c8 (diff)
downloadazalea-drasl-9a66cb97a659ed1f0e52ba3d9438de1d9b78d64a.tar.xz
Fix test and packets (#60)
* Fix test and packets * Fix bug, fix a couple more packets * add tests and fix stuff * fix warnings Co-authored-by: Ubuntu <github@matdoes.dev>
Diffstat (limited to 'azalea-buf/src/write.rs')
-rwxr-xr-xazalea-buf/src/write.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs
index e00ddce9..161f8645 100755
--- a/azalea-buf/src/write.rs
+++ b/azalea-buf/src/write.rs
@@ -132,15 +132,16 @@ impl McBufVarWritable for i64 {
fn var_write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
let mut buffer = [0];
let mut value = *self;
+ if value == 0 {
+ buf.write_all(&buffer).unwrap();
+ }
while value != 0 {
buffer[0] = (value & 0b0111_1111) as u8;
value = (value >> 7) & (i64::max_value() >> 6);
if value != 0 {
buffer[0] |= 0b1000_0000;
}
- // this only writes a single byte, so write_all isn't necessary
- // the let _ = is so clippy doesn't complain
- let _ = buf.write(&buffer)?;
+ buf.write_all(&buffer)?;
}
Ok(())
}