diff main/MainWindow.cpp @ 2022:2ec57b30fffe

Minor tidy
author Chris Cannam
date Mon, 01 Oct 2018 14:38:30 +0100
parents 5d3ef2c450cc
children 262c656ec78f c669b40a8d56
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Sep 17 13:23:06 2018 +0100
+++ b/main/MainWindow.cpp	Mon Oct 01 14:38:30 2018 +0100
@@ -1283,6 +1283,8 @@
         LayerFactory::PeakFrequencySpectrogram,
         LayerFactory::Spectrum
     };
+    int backgroundTypeCount = int(sizeof(backgroundTypes) /
+                                  sizeof(backgroundTypes[0]));
 
     std::vector<Model *> models;
     if (m_document) models = m_document->getTransformInputModels();
@@ -1291,8 +1293,7 @@
         models.push_back(getMainModel()); // probably 0
     }
 
-    for (unsigned int i = 0;
-         i < sizeof(backgroundTypes)/sizeof(backgroundTypes[0]); ++i) {
+    for (int i = 0; i < backgroundTypeCount; ++i) {
 
         const int paneMenuType = 0, layerMenuType = 1;
 
@@ -1764,7 +1765,7 @@
     // .so names -- that won't happen often I hope
     std::map<QString, QString> idNameSonameMap;
     std::set<QString> seenNames, duplicateNames;
-    for (unsigned int i = 0; i < transforms.size(); ++i) {
+    for (int i = 0; in_range_for(transforms, i); ++i) {
         QString name = transforms[i].name;
         if (seenNames.find(name) != seenNames.end()) {
             duplicateNames.insert(name);
@@ -1773,7 +1774,7 @@
         }
     }
 
-    for (unsigned int i = 0; i < transforms.size(); ++i) {
+    for (int i = 0; in_range_for(transforms, i); ++i) {
         
         QString name = transforms[i].name;
         if (name == "") name = transforms[i].identifier;