1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Remove more uses of at(); use a std::vector of bare pointers, not wx array

This commit is contained in:
Paul Licameli 2016-02-16 09:35:03 -05:00
parent b0295c34df
commit 55d85f1b25
6 changed files with 7 additions and 7 deletions

View File

@ -75,7 +75,7 @@ static void GetAllSeqBlocks(AudacityProject *project,
BlockArray &blocks = sequence->GetBlockArray(); BlockArray &blocks = sequence->GetBlockArray();
int i; int i;
for (i = 0; i < (int)blocks.size(); i++) for (i = 0; i < (int)blocks.size(); i++)
outBlocks->push_back(&blocks.at(i)); outBlocks->push_back(&blocks[i]);
node = node->GetNext(); node = node->GetNext();
} }
} }

View File

@ -10,7 +10,7 @@
*******************************************************************//** *******************************************************************//**
\file Project.cpp \file Project.cpp
\brief Implements AudacityProject, DropTarget, and FileObject. \brief Implements AudacityProject, DropTarget, and FileObject.F
Includes Menus.cpp. Includes Menus.cpp.
*//****************************************************************//** *//****************************************************************//**
@ -3738,7 +3738,7 @@ void AudacityProject::AddImportedTracks(wxString fileName,
BlockArray &blocks = clip->GetSequence()->GetBlockArray(); BlockArray &blocks = clip->GetSequence()->GetBlockArray();
if (clip && blocks.size()) if (clip && blocks.size())
{ {
SeqBlock& block = blocks.at(0); SeqBlock& block = blocks[0];
if (block.f->IsAlias()) if (block.f->IsAlias())
{ {
mImportedDependencies = true; mImportedDependencies = true;

View File

@ -53,7 +53,7 @@ class SeqBlock {
} }
}; };
class BlockArray : public std::vector<SeqBlock> {}; class BlockArray : public std::vector<SeqBlock> {};
WX_DEFINE_ARRAY(SeqBlock *, BlockPtrArray); using BlockPtrArray = std::vector<SeqBlock*>; // non-owning pointers
class Sequence: public XMLTagHandler { class Sequence: public XMLTagHandler {
public: public:

View File

@ -82,7 +82,7 @@ void UndoManager::CalculateSpaceUsage()
BlockArray *blocks = it->GetData()->GetSequenceBlockArray(); BlockArray *blocks = it->GetData()->GetSequenceBlockArray();
for (size_t b = 0, cnt = blocks->size(); b < cnt; b++) for (size_t b = 0, cnt = blocks->size(); b < cnt; b++)
{ {
BlockFile *file = blocks->at(b).f; BlockFile *file = (*blocks)[b].f;
// Accumulate space used by the file if the file didn't exist // Accumulate space used by the file if the file didn't exist
// in the previous level // in the previous level

View File

@ -205,7 +205,7 @@ void ODComputeSummaryTask::Update()
for(i=0; i<(int)blocks->size(); i++) for(i=0; i<(int)blocks->size(); i++)
{ {
//if there is data but no summary, this blockfile needs summarizing. //if there is data but no summary, this blockfile needs summarizing.
SeqBlock &block = blocks->at(i); SeqBlock &block = (*blocks)[i];
BlockFile *const file = block.f; BlockFile *const file = block.f;
if(file->IsDataAvailable() && !file->IsSummaryAvailable()) if(file->IsDataAvailable() && !file->IsSummaryAvailable())
{ {

View File

@ -157,7 +157,7 @@ void ODDecodeTask::Update()
for (i = 0; i<(int)blocks->size(); i++) for (i = 0; i<(int)blocks->size(); i++)
{ {
//since we have more than one ODBlockFile, we will need type flags to cast. //since we have more than one ODBlockFile, we will need type flags to cast.
SeqBlock &block = blocks->at(i); SeqBlock &block = (*blocks)[i];
BlockFile *const file = block.f; BlockFile *const file = block.f;
ODDecodeBlockFile *oddbFile; ODDecodeBlockFile *oddbFile;
if (!file->IsDataAvailable() && if (!file->IsDataAvailable() &&