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

@ -530,7 +530,7 @@ void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
void ConfigureDiveComputer::setError(QString err)
{
lastError = err;
emit error(err);
emit error(std::move(err));
}
void ConfigureDiveComputer::readThreadFinished()

View file

@ -81,7 +81,7 @@ static int addDC(std::vector<device> &dcs, const std::string &m, const std::stri
return it - dcs.begin();
} else {
dev.deviceId = calculate_string_hash(s.c_str());
dcs.insert(it, dev);
it = dcs.insert(it, dev);
return it - dcs.begin();
}
}

View file

@ -275,7 +275,7 @@ FullTextResult FullText::find(const FullTextQuery &q, StringFilterMode mode) con
[&res2] (dive *d) { return std::find(res2.begin(), res2.end(), d) == res2.end(); }), res.end());
}
return { res };
return { std::move(res) };
}
FullTextQuery &FullTextQuery::operator=(const QString &s)

View file

@ -42,11 +42,11 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
QString filename = reply->request().attribute(QNetworkRequest::User).toString();
if (reply->error() != QNetworkReply::NoError) {
emit failed(filename);
emit failed(std::move(filename));
} else {
QByteArray imageData = reply->readAll();
if (imageData.isEmpty()) {
emit failed(filename);
emit failed(std::move(filename));
} else {
QString path = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first();
QDir dir(path);
@ -63,7 +63,7 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
imageFile.close();
learnPictureFilename(filename, imageFile.fileName());
}
emit loaded(filename);
emit loaded(std::move(filename));
}
}
@ -353,7 +353,7 @@ Thumbnailer::Thumbnail Thumbnailer::addUnknownThumbnailToCache(const QString &pi
void Thumbnailer::frameExtracted(QString filename, QImage thumbnail, duration_t duration, duration_t offset)
{
if (thumbnail.isNull()) {
frameExtractionFailed(filename, duration);
frameExtractionFailed(std::move(filename), duration);
return;
} else {
int size = maxThumbnailSize();

View file

@ -8,7 +8,7 @@
// Find the coordinates at the time specified in coords.start_dive
// by searching the gpx file "fileName". Here is a typical trkpt element in GPX:
// <trkpt lat="-26.84" lon="32.88"><ele>-53.7</ele><time>2017-08-06T04:56:42Z</time></trkpt>
int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName)
int getCoordsFromGPXFile(struct dive_coords *coords, const QString &fileName)
{
struct tm tm1;
time_t trkpt_time = 0;

View file

@ -15,6 +15,6 @@ struct dive_coords { // This structure holds important information after
int64_t timeZone_offset; // UTC international time zone offset of dive site
};
int getCoordsFromGPXFile(dive_coords *coords, QString fileName);
int getCoordsFromGPXFile(dive_coords *coords, const QString &fileName);
#endif

View file

@ -777,8 +777,8 @@ int parseDurationToSeconds(const QString &text)
seconds = numOnly.right(numOnly.length() - minutes.length() - 1);
}
} else {
hours = "0";
minutes = numOnly;
hours = QStringLiteral("0");
minutes = std::move(numOnly);
}
secs = lrint(hours.toDouble() * 3600 + minutes.toDouble() * 60 + seconds.toDouble());
return secs;

View file

@ -112,7 +112,7 @@ void VideoFrameExtractor::processItem(QString originalFilename, QString filename
return fail(originalFilename, duration, true);
}
emit extracted(originalFilename, img, duration, position);
emit extracted(originalFilename, std::move(img), duration, position);
QMutexLocker l(&lock);
workingOn.remove(originalFilename);
}