From b2608e35c82f58273b2e882b7ac12ef1649af05d Mon Sep 17 00:00:00 2001 From: Andreas Linz Date: Wed, 9 Sep 2020 10:31:06 +0200 Subject: [PATCH] =?UTF-8?q?read=5Fbundle=5Felement=20=E2=86=92=20read=5Fbu?= =?UTF-8?q?ndle=5Felement=5Fcontent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to @glindstedt for mentioning this inconsistency. Previously there was `read_bundle_element` and `read_bundle_element_size` where the first one was confusing since a bundle element consists of its size and contents but the method only read the contents. --- src/decoder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decoder.rs b/src/decoder.rs index faab1d6..b513033 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -67,7 +67,7 @@ fn decode_bundle(msg: &[u8]) -> Result { let mut elem_size = read_bundle_element_size(&mut cursor)?; while msg.len() >= (cursor.position() as usize) + elem_size { - let packet = read_bundle_element(&mut cursor, elem_size)?; + let packet = read_bundle_element_content(&mut cursor, elem_size)?; bundle.push(packet); if msg.len() == cursor.position() as usize { @@ -90,7 +90,7 @@ fn read_bundle_element_size(cursor: &mut io::Cursor<&[u8]>) -> Result { .map_err(OscError::ReadError) } -fn read_bundle_element(cursor: &mut io::Cursor<&[u8]>, elem_size: usize) -> Result { +fn read_bundle_element_content(cursor: &mut io::Cursor<&[u8]>, elem_size: usize) -> Result { let mut buf: Vec = Vec::with_capacity(elem_size); let mut handle = cursor.take(elem_size as u64);