Skip to content

Commit

Permalink
mp4: Avoid mutable data
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Oct 16, 2023
1 parent 9597913 commit c5200cf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/mp4/atom_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,17 @@ impl AtomInfo {
err!(SizeMismatch);
}

let mut atom_ident = AtomIdent::Fourcc(identifier);

// Encountered a freeform identifier
if &identifier == b"----" {
reader_size -= ATOM_HEADER_LEN;
if reader_size < ATOM_HEADER_LEN {
err!(BadAtom("Found an incomplete freeform identifier"));
}

atom_ident = parse_freeform(data, reader_size, parse_mode)?;
}
let atom_ident = match &identifier {
b"----" => {
// Encountered a freeform identifier
reader_size -= ATOM_HEADER_LEN;
if reader_size < ATOM_HEADER_LEN {
err!(BadAtom("Found an incomplete freeform identifier"));
}
parse_freeform(data, reader_size, parse_mode)?
},
_ => AtomIdent::Fourcc(identifier),
};

Ok(Some(Self {
start,
Expand Down

0 comments on commit c5200cf

Please sign in to comment.