From: Kostya Shishkov Date: Thu, 28 Jul 2022 16:42:50 +0000 (+0200) Subject: vp8: use safer initialisation of partition BoolCoders X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=2954519d5e82d469d06c1adbcc9d3d8faad81aac;p=nihav.git vp8: use safer initialisation of partition BoolCoders --- diff --git a/nihav-duck/src/codecs/vp8.rs b/nihav-duck/src/codecs/vp8.rs index 9a9c4cc..de5d32a 100644 --- a/nihav-duck/src/codecs/vp8.rs +++ b/nihav-duck/src/codecs/vp8.rs @@ -1281,13 +1281,10 @@ impl NADecoder for VP8Decoder { for start in part_offs[num_partitions..].iter_mut() { *start = data_start; } - let mut bc_src = unsafe { - let mut arr: [BoolCoder; 8] = std::mem::MaybeUninit::uninit().assume_init(); - for (bc, &off) in arr.iter_mut().zip(part_offs.iter()) { - std::ptr::write(bc, BoolCoder::new(&src[off..]).unwrap()); - } - arr - }; + let mut bc_src = Vec::new(); + for &off in part_offs.iter() { + bc_src.push(BoolCoder::new(&src[off..]).unwrap()); + } let vinfo = NAVideoInfo::new(self.width, self.height, false, YUV420_FORMAT); let ret = supp.pool_u8.get_free();