mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-12 07:35:51 +01:00
Tidy up of code for removing obsolete import entries from config.
This commit is contained in:
@@ -281,19 +281,22 @@ void Importer::WriteImportItems()
|
|||||||
name.Printf (wxT("/ExtImportItems/Item%d"), i);
|
name.Printf (wxT("/ExtImportItems/Item%d"), i);
|
||||||
gPrefs->Write (name, val);
|
gPrefs->Write (name, val);
|
||||||
}
|
}
|
||||||
/* If we had more items than we have now, delete the excess */
|
/* If we used to have more items than we have now, delete the excess items.
|
||||||
// ANSWER-ME: Vigilant Sentry notes i is unsigned so (i >= 0) is always true.
|
We just keep deleting items and incrementing until we find there aren't any
|
||||||
// If that's what you want, why not make the condition just be "true"? Or should it be an int?
|
more to delete.*/
|
||||||
// But also, it looks like it's supposed to be a down-counting loop, so is i++ correct?
|
i = this->mExtImportItems->Count();
|
||||||
// Rather, shouldn't i be set to this->mExtImportItems->Count() each time?
|
do {
|
||||||
for (i = this->mExtImportItems->Count(); i >= 0; i++)
|
|
||||||
{
|
|
||||||
name.Printf (wxT("/ExtImportItems/Item%d"), i);
|
name.Printf (wxT("/ExtImportItems/Item%d"), i);
|
||||||
if (gPrefs->Read(name, &val))
|
// No item to delete? Then it's time to finish.
|
||||||
gPrefs->DeleteEntry (name, false);
|
if (!gPrefs->Read(name, &val))
|
||||||
else
|
break;
|
||||||
break;
|
// Failure to delete probably means a read-only config file.
|
||||||
}
|
// no point continuing.
|
||||||
|
// TODO: Possibly report (once).
|
||||||
|
if( !gPrefs->DeleteEntry (name, false))
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
} while( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtImportItem *Importer::CreateDefaultImportItem()
|
ExtImportItem *Importer::CreateDefaultImportItem()
|
||||||
|
|||||||
Reference in New Issue
Block a user