mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
6bff18e56a
commit
9c9867dec5
1 changed files with 11 additions and 11 deletions
|
@ -147,7 +147,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
if ((i == CylindersModel::REMOVE) || (i == CylindersModel::TYPE))
|
if ((i == CylindersModel::REMOVE) || (i == CylindersModel::TYPE))
|
||||||
continue;
|
continue;
|
||||||
bool checked = s.value(QString("column%1_hidden").arg(i)).toBool();
|
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->setCheckable(true);
|
||||||
action->setData(i);
|
action->setData(i);
|
||||||
action->setChecked(!checked);
|
action->setChecked(!checked);
|
||||||
|
@ -281,11 +281,11 @@ void MainTab::enableEdition(EditMode newEditMode)
|
||||||
notesBackup[mydive].tags = QString(buf);
|
notesBackup[mydive].tags = QString(buf);
|
||||||
|
|
||||||
// maybe this is a place for memset?
|
// maybe this is a place for memset?
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int j = 0; j < MAX_CYLINDERS; j++) {
|
||||||
notesBackup[mydive].cylinders[i] = mydive->cylinder[i];
|
notesBackup[mydive].cylinders[j] = mydive->cylinder[j];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
|
for (int j = 0; j < MAX_WEIGHTSYSTEMS; j++) {
|
||||||
notesBackup[mydive].weightsystem[i] = mydive->weightsystem[i];
|
notesBackup[mydive].weightsystem[j] = mydive->weightsystem[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,11 +767,11 @@ void MainTab::rejectChanges()
|
||||||
mydive->visibility = notesBackup[mydive].visibility;
|
mydive->visibility = notesBackup[mydive].visibility;
|
||||||
|
|
||||||
// maybe this is a place for memset?
|
// maybe this is a place for memset?
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int j = 0; j < MAX_CYLINDERS; j++) {
|
||||||
mydive->cylinder[i] = notesBackup[mydive].cylinders[i];
|
mydive->cylinder[j] = notesBackup[mydive].cylinders[j];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
|
for (int j = 0; j < MAX_WEIGHTSYSTEMS; j++) {
|
||||||
mydive->weightsystem[i] = notesBackup[mydive].weightsystem[i];
|
mydive->weightsystem[j] = notesBackup[mydive].weightsystem[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateGpsCoordinates(curr);
|
updateGpsCoordinates(curr);
|
||||||
|
@ -813,8 +813,8 @@ void MainTab::rejectChanges()
|
||||||
if (editMode == NONE) \
|
if (editMode == NONE) \
|
||||||
return; \
|
return; \
|
||||||
\
|
\
|
||||||
for (int i = 0; i < dive_table.nr; i++) { \
|
for (int _i = 0; _i < dive_table.nr; _i++) { \
|
||||||
struct dive *mydive = get_dive(i); \
|
struct dive *mydive = get_dive(_i); \
|
||||||
if (!mydive) \
|
if (!mydive) \
|
||||||
continue; \
|
continue; \
|
||||||
if (!mydive->selected) \
|
if (!mydive->selected) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue