cleanup: more Coverity silencing

Mostly irrelevant std::move() stuff of copy-on-write Qt objects,
a few real bugs, a timestamp_t downconversion and some codingsyle
adaptation.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-16 17:39:19 +01:00 committed by Dirk Hohndel
parent 35ff6eea35
commit 91e4fb4769
27 changed files with 47 additions and 47 deletions

View file

@ -938,11 +938,12 @@ int DiveListView::lastImageTimeOffset()
return offset;
}
void DiveListView::updateLastImageTimeOffset(const int offset)
void DiveListView::updateLastImageTimeOffset(timestamp_t offset)
{
QSettings s;
s.beginGroup("MainWindow");
s.setValue("LastImageTimeOffset", offset);
// Can't create a QVariant from int64_t, for whatever reason.
s.setValue("LastImageTimeOffset", static_cast<long long>(offset));
}
void DiveListView::mouseDoubleClickEvent(QMouseEvent*)

View file

@ -73,7 +73,7 @@ private:
void restoreExpandedRows(const std::vector<int> &);
int lastVisibleColumn();
void selectTrip(dive_trip *trip);
void updateLastImageTimeOffset(int offset);
void updateLastImageTimeOffset(timestamp_t offset);
int lastImageTimeOffset();
void addToTrip(int delta);
void matchImagesToDives(const QStringList &fileNames);

View file

@ -326,7 +326,7 @@ void ColumnNameResult::setColumnValues(QList<QStringList> columns)
endInsertColumns();
beginInsertRows(QModelIndex(), 0, columns.count()-1);
columnValues = columns;
columnValues = std::move(columns);
endInsertRows();
}
@ -799,10 +799,11 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
}
if (rows > 0)
resultModel->setColumnValues(fileColumns);
for (int i = 0; i < headers.count(); i++)
resultModel->setColumnValues(std::move(fileColumns));
for (int i = 0; i < headers.count(); i++) {
if (!headers.at(i).isEmpty())
resultModel->setData(resultModel->index(0, i),headers.at(i),Qt::EditRole);
}
}
void DiveLogImportDialog::setup_csv_params(QStringList r, xml_params &params)

View file

@ -13,7 +13,7 @@
// Caller keeps ownership of "imported". The contents of "imported" will be consumed on execution of the dialog.
// On return, it will be empty.
DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent),
importedSource(source)
importedSource(std::move(source))
{
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);

View file

@ -1354,9 +1354,8 @@ void MainWindow::on_actionImportDiveLog_triggered()
logFiles.append(fn);
}
if (logFiles.size()) {
if (logFiles.size())
importFiles(logFiles);
}
if (csvFiles.size()) {
DiveLogImportDialog diveLogImport(std::move(csvFiles), this);
@ -1553,9 +1552,8 @@ void MainWindow::hideProgressBar()
}
}
void MainWindow::divesChanged(const QVector<dive *> &dives, DiveField field)
void MainWindow::divesChanged(const QVector<dive *> &dives, DiveField)
{
Q_UNUSED(field)
for (struct dive *d: dives) {
qDebug() << "dive #" << d->number << "changed, cache is" << (dive_cache_is_valid(d) ? "valid" : "invalidated");
// a brute force way to deal with that would of course be to call

View file

@ -155,7 +155,7 @@ void TabDiveInformation::updateProfile()
ui->diveTimeText->setText(get_dive_duration_string(currentDive->duration.seconds, tr("h"), tr("min"), tr("sec"),
" ", currentDive->dc.divemode == FREEDIVE));
ui->sacText->setText(currentDive->cylinders.nr > 0 && mean[0] && currentDive->dc.divemode != CCR ? SACs : QString());
ui->sacText->setText(currentDive->cylinders.nr > 0 && mean[0] && currentDive->dc.divemode != CCR ? std::move(SACs) : QString());
if (currentDive->surface_pressure.mbar == 0) {
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box

View file

@ -404,7 +404,7 @@ void TabDiveNotes::on_notes_editingFinished()
return;
QString html = ui.notes->toHtml();
QString notes = isHtml(html) ? html : ui.notes->toPlainText();
QString notes = isHtml(html) ? std::move(html) : ui.notes->toPlainText();
if (currentTrip)
Command::editTripNotes(currentTrip, notes);