From ed2bdcd95043c7fb9860c67a4e32466acbb61124 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 5 Dec 2020 10:25:05 +0100 Subject: [PATCH] codec_support/data: fix GenericCache internal size --- nihav-codec-support/src/data/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nihav-codec-support/src/data/mod.rs b/nihav-codec-support/src/data/mod.rs index b8980f2..2ad6b8c 100644 --- a/nihav-codec-support/src/data/mod.rs +++ b/nihav-codec-support/src/data/mod.rs @@ -44,14 +44,14 @@ impl GenericCache { stride, height, xpos: 0, - data: Vec::with_capacity((height + 1) * stride), + data: Vec::with_capacity((height + 1) * stride + 1), default, }; ret.reset(); ret } /// Reports the total amount of elements stored. - pub fn full_size(&self) -> usize { self.stride * (self.height + 1) } + pub fn full_size(&self) -> usize { self.stride * (self.height + 1) + 1 } /// Resets the cache state. pub fn reset(&mut self) { self.data.truncate(0); -- 2.30.2