mirror of
https://github.com/taglib/taglib.git
synced 2025-07-21 06:24:19 -04:00
ByteVector::toUInt() takes offset and length
This commit is contained in:
@ -148,17 +148,17 @@ void WavPack::Properties::read()
|
||||
if(!d->data.startsWith("wvpk"))
|
||||
return;
|
||||
|
||||
d->version = d->data.mid(8, 2).toShort(false);
|
||||
d->version = d->data.toShort(8, false);
|
||||
if(d->version < MIN_STREAM_VERS || d->version > MAX_STREAM_VERS)
|
||||
return;
|
||||
|
||||
unsigned int flags = d->data.mid(24, 4).toUInt(false);
|
||||
const unsigned int flags = d->data.toUInt(24, false);
|
||||
d->bitsPerSample = ((flags & BYTES_STORED) + 1) * 8 -
|
||||
((flags & SHIFT_MASK) >> SHIFT_LSB);
|
||||
d->sampleRate = sample_rates[(flags & SRATE_MASK) >> SRATE_LSB];
|
||||
d->channels = (flags & MONO_FLAG) ? 1 : 2;
|
||||
|
||||
unsigned int samples = d->data.mid(12, 4).toUInt(false);
|
||||
unsigned int samples = d->data.toUInt(12, false);
|
||||
if(samples == ~0u) {
|
||||
if(d->file && d->style != Fast) {
|
||||
samples = seekFinalIndex();
|
||||
@ -186,14 +186,14 @@ unsigned int WavPack::Properties::seekFinalIndex()
|
||||
ByteVector data = d->file->readBlock(32);
|
||||
if(data.size() != 32)
|
||||
return 0;
|
||||
int version = data.mid(8, 2).toShort(false);
|
||||
const int version = data.toShort(8, false);
|
||||
if(version < MIN_STREAM_VERS || version > MAX_STREAM_VERS)
|
||||
continue;
|
||||
unsigned int flags = data.mid(24, 4).toUInt(false);
|
||||
const unsigned int flags = data.toUInt(24, false);
|
||||
if(!(flags & FINAL_BLOCK))
|
||||
return 0;
|
||||
unsigned int blockIndex = data.mid(16, 4).toUInt(false);
|
||||
unsigned int blockSamples = data.mid(20, 4).toUInt(false);
|
||||
const unsigned int blockIndex = data.toUInt(16, false);
|
||||
const unsigned int blockSamples = data.toUInt(20, false);
|
||||
return blockIndex + blockSamples;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user