Don't reuse a variable name with a different type inside the same function

Since the variable was inside of an inner scope this was technically legal,
but it's just too annoying for words.
(The diff in the commit doesn't make this obvious, but outside the for
loop in the same function there is a divedatapoint *dp, so we had a
pointer to divedatapoint and a divedatapoint with the same name...)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-02-12 05:41:45 -08:00
parent ffc61e1357
commit 11559f1704

View file

@ -500,11 +500,11 @@ void DivePlannerGraphics::drawProfile()
// Re-position the user generated dive handlers
int last = 0;
for (int i = 0; i < plannerModel->rowCount(); i++) {
divedatapoint dp = plannerModel->at(i);
if (dp.time == 0) // those are the magic entries for tanks
struct divedatapoint datapoint = plannerModel->at(i);
if (datapoint.time == 0) // those are the magic entries for tanks
continue;
DiveHandler *h = handles.at(i);
h->setPos(timeLine->posAtValue(dp.time / 60), depthLine->posAtValue(dp.depth));
h->setPos(timeLine->posAtValue(datapoint.time / 60), depthLine->posAtValue(datapoint.depth));
QPointF p1 = (last == i) ? QPointF(timeLine->posAtValue(0), depthLine->posAtValue(0)) : handles[last]->pos();
QPointF p2 = handles[i]->pos();
QLineF line(p1, p2);