Bläddra i källkod

read_bundle_element → read_bundle_element_content

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.
master
Andreas Linz 4 månader sedan
förälder
incheckning
b2608e35c8
Signerad av: alinz GPG-nyckel ID: 9BF39809C9DA580C
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. +2
    -2
      src/decoder.rs

+ 2
- 2
src/decoder.rs Visa fil

@ -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<OscPacket> {
fn read_bundle_element_content(cursor: &mut io::Cursor<&[u8]>, elem_size: usize) -> Result<OscPacket> {
let mut buf: Vec<u8> = Vec::with_capacity(elem_size);
let mut handle = cursor.take(elem_size as u64);

Laddar…
Avbryt
Spara