--- libgig/trunk/src/gig.cpp 2021/06/19 08:35:48 3949 +++ libgig/trunk/src/gig.cpp 2021/06/19 10:38:45 3955 @@ -4855,7 +4855,7 @@ * @param index - number of the sought script (0..n) * @returns sought script or NULL if there's no such script */ - Script* ScriptGroup::GetScript(uint index) { + Script* ScriptGroup::GetScript(size_t index) { if (!pScripts) LoadScripts(); if (index >= pScripts->size()) return NULL; return (*pScripts)[index]; @@ -5539,7 +5539,7 @@ * @param index - instrument script slot index * @returns script or NULL if index is out of bounds */ - Script* Instrument::GetScriptOfSlot(uint index) { + Script* Instrument::GetScriptOfSlot(size_t index) { LoadScripts(); if (index >= pScriptRefs->size()) return NULL; return pScriptRefs->at(index).script; @@ -5600,7 +5600,7 @@ * @param index1 - index of the first script slot to swap * @param index2 - index of the second script slot to swap */ - void Instrument::SwapScriptSlots(uint index1, uint index2) { + void Instrument::SwapScriptSlots(size_t index1, size_t index2) { LoadScripts(); if (index1 >= pScriptRefs->size() || index2 >= pScriptRefs->size()) return; @@ -5615,7 +5615,7 @@ * * @param index - index of script slot to remove */ - void Instrument::RemoveScriptSlot(uint index) { + void Instrument::RemoveScriptSlot(size_t index) { LoadScripts(); if (index >= pScriptRefs->size()) return; pScriptRefs->erase( pScriptRefs->begin() + index ); @@ -5656,8 +5656,8 @@ * GigaStudio 4 software. It will currently only work with LinuxSampler and * gigedit. */ - uint Instrument::ScriptSlotCount() const { - return uint(pScriptRefs ? pScriptRefs->size() : scriptPoolFileOffsets.size()); + size_t Instrument::ScriptSlotCount() const { + return pScriptRefs ? pScriptRefs->size() : scriptPoolFileOffsets.size(); } /** @brief Whether script execution shall be skipped. @@ -5716,8 +5716,8 @@ * the @c Script identified by passed @p uuid. */ bool Instrument::ReferencesScriptWithUuid(const _UUID& uuid) { - const uint nSlots = ScriptSlotCount(); - for (uint iSlot = 0; iSlot < nSlots; ++iSlot) + const size_t nSlots = ScriptSlotCount(); + for (size_t iSlot = 0; iSlot < nSlots; ++iSlot) if (_UUIDFromCArray(&GetScriptOfSlot(iSlot)->Uuid[0]) == uuid) return true; return false; @@ -6303,8 +6303,8 @@ delete pGroups; } if (pScriptGroups) { - std::list::iterator iter = pScriptGroups->begin(); - std::list::iterator end = pScriptGroups->end(); + std::vector::iterator iter = pScriptGroups->begin(); + std::vector::iterator end = pScriptGroups->end(); while (iter != end) { delete *iter; ++iter; @@ -7105,10 +7105,8 @@ */ ScriptGroup* File::GetScriptGroup(size_t index) { if (!pScriptGroups) LoadScriptGroups(); - std::list::iterator it = pScriptGroups->begin(); - for (uint i = 0; it != pScriptGroups->end(); ++i, ++it) - if (i == index) return *it; - return NULL; + if (index >= pScriptGroups->size()) return NULL; + return (*pScriptGroups)[index]; } /** @brief Get instrument script group (by name). @@ -7121,9 +7119,10 @@ */ ScriptGroup* File::GetScriptGroup(const String& name) { if (!pScriptGroups) LoadScriptGroups(); - std::list::iterator it = pScriptGroups->begin(); - for (uint i = 0; it != pScriptGroups->end(); ++i, ++it) - if ((*it)->Name == name) return *it; + for (size_t i = 0; i < pScriptGroups->size(); ++i) { + ScriptGroup* pGroup = (*pScriptGroups)[i]; + if (pGroup->Name == name) return pGroup; + } return NULL; } @@ -7156,7 +7155,7 @@ */ void File::DeleteScriptGroup(ScriptGroup* pScriptGroup) { if (!pScriptGroups) LoadScriptGroups(); - std::list::iterator iter = + std::vector::iterator iter = find(pScriptGroups->begin(), pScriptGroups->end(), pScriptGroup); if (iter == pScriptGroups->end()) throw gig::Exception("Could not delete script group, could not find given script group"); @@ -7171,7 +7170,7 @@ void File::LoadScriptGroups() { if (pScriptGroups) return; - pScriptGroups = new std::list; + pScriptGroups = new std::vector; RIFF::List* lstLS = pRIFF->GetSubList(LIST_TYPE_3LS); if (lstLS) { size_t i = 0; @@ -7216,7 +7215,7 @@ // of the respective instrument script chunk as reference. if (pScriptGroups) { // Update instrument script (group) chunks. - for (std::list::iterator it = pScriptGroups->begin(); + for (std::vector::iterator it = pScriptGroups->begin(); it != pScriptGroups->end(); ++it) { (*it)->UpdateChunks(pProgress);