When the size of the chunk is greater than 2GB, which makes the MSB be set, the resulting usize contains a value like 0xFFFFFFFF..., due to the sign extension.
This PR adds BinaryReader::read_u32 to prevent this. This PR also adds the type FourCC so BinaryReader::read_four_cc does not allocate a String redundantly.
Please refer to the following for more details in the numeric cast in Rust:
The current code fails to parse SoundFonts greater than 2GB, because of code like the following:
https://github.com/sinshu/rustysynth/blob/b87a7f2329c049eb22f6345fb8e6a88b8528f5f1/rustysynth/src/soundfont_sampledata.rs#L23
When the size of the chunk is greater than 2GB, which makes the MSB be set, the resulting
usize
contains a value like0xFFFFFFFF...
, due to the sign extension.This PR adds
BinaryReader::read_u32
to prevent this. This PR also adds the typeFourCC
soBinaryReader::read_four_cc
does not allocate aString
redundantly.Please refer to the following for more details in the numeric cast in Rust: