--- libgig/trunk/src/DLS.cpp 2020/01/22 15:48:32 3723 +++ libgig/trunk/src/DLS.cpp 2021/06/14 10:33:29 3922 @@ -2,7 +2,7 @@ * * * libgig - C++ cross-platform Gigasampler format file access library * * * - * Copyright (C) 2003-2020 by Christian Schoenebeck * + * Copyright (C) 2003-2021 by Christian Schoenebeck * * * * * * This library is free software; you can redistribute it and/or modify * @@ -209,13 +209,14 @@ if (lart) { uint32_t artCkType = (lart->GetListType() == LIST_TYPE_LAR2) ? CHUNK_ID_ART2 : CHUNK_ID_ARTL; - RIFF::Chunk* art = lart->GetFirstSubChunk(); - while (art) { + size_t i = 0; + for (RIFF::Chunk* art = lart->GetSubChunkAt(i); art; + art = lart->GetSubChunkAt(++i)) + { if (art->GetChunkID() == artCkType) { if (!pArticulations) pArticulations = new ArticulationList; pArticulations->push_back(new Articulation(art)); } - art = lart->GetNextSubChunk(); } } } @@ -1375,12 +1376,13 @@ RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN); if (lrgn) { uint32_t regionCkType = (lrgn->GetSubList(LIST_TYPE_RGN2)) ? LIST_TYPE_RGN2 : LIST_TYPE_RGN; // prefer regions level 2 - RIFF::List* rgn = lrgn->GetFirstSubList(); - while (rgn) { + size_t i = 0; + for (RIFF::List* rgn = lrgn->GetSubListAt(i); rgn; + rgn = lrgn->GetSubListAt(++i)) + { if (rgn->GetListType() == regionCkType) { pRegions->push_back(new Region(this, rgn)); } - rgn = lrgn->GetNextSubList(); } } } @@ -1679,14 +1681,15 @@ if (wvpl) { file_offset_t wvplFileOffset = wvpl->GetFilePos() - wvpl->GetPos(); // should be zero, but just to be sure - RIFF::List* wave = wvpl->GetFirstSubList(); - while (wave) { + size_t i = 0; + for (RIFF::List* wave = wvpl->GetSubListAt(i); wave; + wave = wvpl->GetSubListAt(++i)) + { if (wave->GetListType() == LIST_TYPE_WAVE) { file_offset_t waveFileOffset = wave->GetFilePos() - wave->GetPos(); // should be zero, but just to be sure pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset)); } - wave = wvpl->GetNextSubList(); } } else { // Seen a dwpl list chunk instead of a wvpl list chunk in some file (officially not DLS compliant) @@ -1694,14 +1697,15 @@ if (dwpl) { file_offset_t dwplFileOffset = dwpl->GetFilePos() - dwpl->GetPos(); // should be zero, but just to be sure - RIFF::List* wave = dwpl->GetFirstSubList(); - while (wave) { + size_t i = 0; + for (RIFF::List* wave = dwpl->GetSubListAt(i); wave; + wave = dwpl->GetSubListAt(++i)) + { if (wave->GetListType() == LIST_TYPE_WAVE) { file_offset_t waveFileOffset = wave->GetFilePos() - wave->GetPos(); // should be zero, but just to be sure pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset)); } - wave = dwpl->GetNextSubList(); } } } @@ -1758,12 +1762,13 @@ if (!pInstruments) pInstruments = new InstrumentList; RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); if (lstInstruments) { - RIFF::List* lstInstr = lstInstruments->GetFirstSubList(); - while (lstInstr) { + size_t i = 0; + for (RIFF::List* lstInstr = lstInstruments->GetSubListAt(i); + lstInstr; lstInstr = lstInstruments->GetSubListAt(++i)) + { if (lstInstr->GetListType() == LIST_TYPE_INS) { pInstruments->push_back(new Instrument(this, lstInstr)); } - lstInstr = lstInstruments->GetNextSubList(); } } }