Skip to content

Commit 370e729

Browse files
committed
Fix warnings about uninitialized variables
1 parent 9975c6a commit 370e729

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/mainWindow.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ bool CalculateScoringTab::importResultsFromCSV(CSVFile* file, bool show_import_d
608608
raceTime = getCorrectedTime(time_text);
609609

610610
// Read state
611-
ResultList::ResultType resultType;
611+
auto resultType = ResultList::ResultOk;
612612
if (importDialog.colState)
613613
{
614614
int sportsoftwareResultId = file->getValue(importDialog.colState->at(0)).toInt();
@@ -623,9 +623,7 @@ bool CalculateScoringTab::importResultsFromCSV(CSVFile* file, bool show_import_d
623623
case 5: resultType = ResultList::ResultOvertime; break;
624624
}
625625
}
626-
else
627-
resultType = ResultList::ResultOk;
628-
626+
629627
// Add result list entry
630628
int row = results->addRow();
631629
results->setData(row, results->getCategoryColumn(), qVariantFromValue<void*>(category));

src/seriesScoring.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,12 @@ void SeriesScoring::recalculateResult()
465465

466466
void SeriesScoring::giveOrganizerBonus(int row, int column, int first_point_column, ResultList* result)
467467
{
468-
double bonus;
468+
double bonus = 0;
469469

470470
if (organizer_bonus_type == FixedOrganizerBonus)
471+
{
471472
bonus = organizer_bonus_fixed.toDouble();
473+
}
472474
else if (organizer_bonus_type == PercentageOrganizerBonus)
473475
{
474476
std::multiset<double, std::greater<double> > best_points;
@@ -497,7 +499,9 @@ void SeriesScoring::giveOrganizerBonus(int row, int column, int first_point_colu
497499
bonus = (bonus / num_results) * (organizer_bonus_percentage.toDouble() / 100);
498500
}
499501
else
502+
{
500503
assert(false);
504+
}
501505

502506
result->setData(row, column, -(static_cast<int>(bonus * result->getDecimalFactor() + 0.5)));
503507
}

0 commit comments

Comments
 (0)