diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-02-12 06:07:32 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-12 06:07:32 -0800 |
commit | 9c9867dec527e3d0231a71c043fd9dc9b894a339 (patch) | |
tree | d216162fdeb079f90e021f0f9e2d3e4336113a08 /qt-ui | |
parent | 6bff18e56a0412afa8b72d101a857e6ae852d49b (diff) | |
download | subsurface-9c9867dec527e3d0231a71c043fd9dc9b894a339.tar.gz |
More variable scope confusions
Don't have nested loops with the same loop variable. Really. Even if it is
legal C++.
And don't declare local variables more than once. This will only cause
issues later.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 85cf1b192..b65d572fd 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -147,7 +147,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), if ((i == CylindersModel::REMOVE) || (i == CylindersModel::TYPE)) continue; bool checked = s.value(QString("column%1_hidden").arg(i)).toBool(); - QAction *action = new QAction(cylindersModel->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString(), ui.cylinders->view()); + action = new QAction(cylindersModel->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString(), ui.cylinders->view()); action->setCheckable(true); action->setData(i); action->setChecked(!checked); @@ -281,11 +281,11 @@ void MainTab::enableEdition(EditMode newEditMode) notesBackup[mydive].tags = QString(buf); // maybe this is a place for memset? - for (int i = 0; i < MAX_CYLINDERS; i++) { - notesBackup[mydive].cylinders[i] = mydive->cylinder[i]; + for (int j = 0; j < MAX_CYLINDERS; j++) { + notesBackup[mydive].cylinders[j] = mydive->cylinder[j]; } - for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { - notesBackup[mydive].weightsystem[i] = mydive->weightsystem[i]; + for (int j = 0; j < MAX_WEIGHTSYSTEMS; j++) { + notesBackup[mydive].weightsystem[j] = mydive->weightsystem[j]; } } @@ -767,11 +767,11 @@ void MainTab::rejectChanges() mydive->visibility = notesBackup[mydive].visibility; // maybe this is a place for memset? - for (int i = 0; i < MAX_CYLINDERS; i++) { - mydive->cylinder[i] = notesBackup[mydive].cylinders[i]; + for (int j = 0; j < MAX_CYLINDERS; j++) { + mydive->cylinder[j] = notesBackup[mydive].cylinders[j]; } - for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { - mydive->weightsystem[i] = notesBackup[mydive].weightsystem[i]; + for (int j = 0; j < MAX_WEIGHTSYSTEMS; j++) { + mydive->weightsystem[j] = notesBackup[mydive].weightsystem[j]; } } updateGpsCoordinates(curr); @@ -813,8 +813,8 @@ void MainTab::rejectChanges() if (editMode == NONE) \ return; \ \ - for (int i = 0; i < dive_table.nr; i++) { \ - struct dive *mydive = get_dive(i); \ + for (int _i = 0; _i < dive_table.nr; _i++) { \ + struct dive *mydive = get_dive(_i); \ if (!mydive) \ continue; \ if (!mydive->selected) \ |