mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
FileStream: seek only when length exceeds buffer size
This commit is contained in:
parent
9914519d43
commit
2e90ec0ef0
@ -206,9 +206,12 @@ ByteVector FileStream::readBlock(unsigned long length)
|
||||
if(length == 0)
|
||||
return ByteVector();
|
||||
|
||||
const unsigned long streamLength = static_cast<unsigned long>(FileStream::length());
|
||||
if(length > bufferSize() && length > streamLength)
|
||||
length = streamLength;
|
||||
if(length > bufferSize()) {
|
||||
const unsigned long streamLength = static_cast<unsigned long>(FileStream::length());
|
||||
if(length > streamLength) {
|
||||
length = streamLength;
|
||||
}
|
||||
}
|
||||
|
||||
ByteVector buffer(static_cast<unsigned int>(length));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user