change two loops to while (#1147)

and one to for range.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-09-16 04:28:12 -07:00 committed by GitHub
parent bdf50eda99
commit 48c4bf9c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -269,8 +269,8 @@ void Ogg::File::writePacket(unsigned int i, const ByteVector &packet)
// Write the pages.
ByteVector data;
for(it = pages.begin(); it != pages.end(); ++it)
data.append((*it)->render());
for(const auto &page : pages)
data.append(page->render());
const offset_t originalOffset = firstPage->fileOffset();
const offset_t originalLength = lastPage->fileOffset() + lastPage->size() - originalOffset;

View File

@ -167,8 +167,11 @@ void RIFF::File::setChunkData(unsigned int i, const ByteVector &data)
// Now update the internal offsets
for(++it; it != d->chunks.end(); ++it)
it = std::next(it);
while(it != d->chunks.end()) {
it->offset += static_cast<int>(diff);
++it;
}
// Update the global size.
@ -254,8 +257,10 @@ void RIFF::File::removeChunk(unsigned int i)
removeBlock(it->offset - 8, removeSize);
it = d->chunks.erase(it);
for(; it != d->chunks.end(); ++it)
while(it != d->chunks.end()) {
it->offset -= removeSize;
++it;
}
// Update the global size.