Convert tail-recursion to loop to avoid stack exhaustion.

This commit is contained in:
Kevin Backhouse 2023-03-11 23:17:49 +00:00 committed by Rosen Penev
parent a783320520
commit 244799f480

View File

@ -456,17 +456,14 @@ void RiffVideo::readChunk(HeaderReader& header_) {
}
void RiffVideo::decodeBlocks() {
do {
HeaderReader header(io_);
if (equal(header.getId(), CHUNK_ID_LIST)) {
readList(header);
} else {
readChunk(header);
}
if (!io_->eof() && io_->tell() < io_->size()) {
decodeBlocks();
}
} while (!io_->eof() && io_->tell() < io_->size());
} // RiffVideo::decodeBlock
void RiffVideo::readAviHeader() {