From c5200cf3b5544ff8f066c310bfb1b73d82d2c61a Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Mon, 16 Oct 2023 18:45:12 +0200 Subject: [PATCH] mp4: Avoid mutable data --- src/mp4/atom_info.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mp4/atom_info.rs b/src/mp4/atom_info.rs index ea57c010c..e53d1a9f6 100644 --- a/src/mp4/atom_info.rs +++ b/src/mp4/atom_info.rs @@ -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,