Skip to content

Commit

Permalink
riff: fix clippy nightly warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sscobici committed Dec 27, 2024
1 parent ceb7936 commit 941897b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions symphonia-format-isomp4/src/atoms/tkhd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ impl Atom for TkhdAtom {

match header.data_len() {
Some(len) if len >= 34 && len <= MAX_ATOM_SIZE => len as usize,
Some(_) => return decode_error("isomp4 (tfhd): atom size is greater than 1kb"),
None => return decode_error("isomp4 (tfhd): expected atom size to be known"),
Some(_) => return decode_error("isomp4 (tkhd): atom size is greater than 1kb"),
None => return decode_error("isomp4 (tkhd): expected atom size to be known"),
};

let mut tkhd = TkhdAtom {
Expand Down
2 changes: 1 addition & 1 deletion symphonia-format-isomp4/src/atoms/trex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Atom for TrexAtom {
let (_, _) = header.read_extended_header(reader)?;

if header.data_len() != Some(20) {
return decode_error("isomp4 (mdhd): atom size is not 32 bytes");
return decode_error("isomp4 (trex): atom size is not 32 bytes");
}

Ok(TrexAtom {
Expand Down
24 changes: 7 additions & 17 deletions symphonia-format-riff/src/aiff/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ impl ParseChunk for CommonChunk {
let sample_rate = Extended::from_be_bytes(sample_rate);
let sample_rate = sample_rate.to_f64() as u32;

let format_data = Self::read_pcm_fmt(sample_size as u16, n_channels as u16);

let format_data = match format_data {
Ok(data) => data,
Err(e) => return Err(e),
};
let format_data = Self::read_pcm_fmt(sample_size as u16, n_channels as u16)?;

Ok(CommonChunk { n_channels, n_sample_frames, sample_size, sample_rate, format_data })
}
Expand Down Expand Up @@ -237,20 +232,15 @@ impl CommonChunkParser for ChunkParser<CommonChunk> {
}

let format_data = match &compression_type {
b"none" | b"NONE" => CommonChunk::read_pcm_fmt(sample_size as u16, n_channels as u16),
b"alaw" | b"ALAW" => CommonChunk::read_alaw_pcm_fmt(n_channels as u16),
b"ulaw" | b"ULAW" => CommonChunk::read_mulaw_pcm_fmt(n_channels as u16),
b"fl32" | b"fl64" => CommonChunk::read_ieee_fmt(sample_size as u16, n_channels as u16),
b"sowt" | b"SOWT" => CommonChunk::read_sowt_fmt(sample_size as u16, n_channels as u16),
b"twos" | b"TWOS" => CommonChunk::read_twos_fmt(sample_size as u16, n_channels as u16),
b"none" | b"NONE" => CommonChunk::read_pcm_fmt(sample_size as u16, n_channels as u16)?,
b"alaw" | b"ALAW" => CommonChunk::read_alaw_pcm_fmt(n_channels as u16)?,
b"ulaw" | b"ULAW" => CommonChunk::read_mulaw_pcm_fmt(n_channels as u16)?,
b"fl32" | b"fl64" => CommonChunk::read_ieee_fmt(sample_size as u16, n_channels as u16)?,
b"sowt" | b"SOWT" => CommonChunk::read_sowt_fmt(sample_size as u16, n_channels as u16)?,
b"twos" | b"TWOS" => CommonChunk::read_twos_fmt(sample_size as u16, n_channels as u16)?,
_ => return unsupported_error("aifc: Compression type not implemented"),
};

let format_data = match format_data {
Ok(data) => data,
Err(e) => return Err(e),
};

Ok(CommonChunk { n_channels, n_sample_frames, sample_size, sample_rate, format_data })
}
}
Expand Down

0 comments on commit 941897b

Please sign in to comment.