From 2affa0fc842013b7ed1fd86cb8bd68f71fa6555c Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 27 Jan 2024 01:23:07 +0100 Subject: write shorter unknown size elements --- matroska/src/write.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/matroska/src/write.rs b/matroska/src/write.rs index aaf11d9..7eb13f1 100644 --- a/matroska/src/write.rs +++ b/matroska/src/write.rs @@ -240,15 +240,14 @@ impl WriteValue for EbmlSize { fn write_to(&self, w: &mut impl Write) -> Result<()> { match self { EbmlSize::Exact(s) => write_vint(w, *s as u64)?, - EbmlSize::Unknown => w.write_all(&(u64::MAX >> 7).to_be_bytes())?, + EbmlSize::Unknown => w.write_all(&[0xff])?, } Ok(()) } - fn size(&self) -> usize { match self { EbmlSize::Exact(s) => vint_length(*s as u64), - EbmlSize::Unknown => 8, + EbmlSize::Unknown => 1, } } } -- cgit v1.2.3-70-g09d2