mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: silence std::move()-related Coverity warnings
Unfortunately Coverity doesn't understand that most Qt data structures are copy-on-write. It's a mis-feature of Qt, but it is the way it is. Thus, passing by value is not an issue. Out of ca. 25 warnings only two were legit. Let's silence the others by either std::move()ing or passing by reference, as would be idiomatic C++, which Qt is not. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ac0d44bccf
commit
8a3a0edb83
22 changed files with 39 additions and 38 deletions
|
|
@ -65,7 +65,7 @@ static QString writeGasDetails(gas g)
|
|||
}).join(QLatin1Char(','));
|
||||
}
|
||||
|
||||
bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data)
|
||||
bool ConfigureDiveComputer::saveXMLBackup(const QString &fileName, DeviceDetails *details, device_data_t *data)
|
||||
{
|
||||
QString xml = "";
|
||||
QString vendor = data->vendor;
|
||||
|
|
@ -192,7 +192,7 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *details)
|
||||
bool ConfigureDiveComputer::restoreXMLBackup(const QString &fileName, DeviceDetails *details)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
|
|
@ -491,7 +491,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
|
|||
return true;
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data, bool forceUpdate)
|
||||
void ConfigureDiveComputer::startFirmwareUpdate(const QString &fileName, device_data_t *data, bool forceUpdate)
|
||||
{
|
||||
setState(FWUPDATE);
|
||||
if (firmwareThread)
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ public:
|
|||
states currentState;
|
||||
void saveDeviceDetails(DeviceDetails *details, device_data_t *data);
|
||||
void fetchDeviceDetails();
|
||||
bool saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data);
|
||||
bool restoreXMLBackup(QString fileName, DeviceDetails *details);
|
||||
void startFirmwareUpdate(QString fileName, device_data_t *data, bool forceUpdate);
|
||||
bool saveXMLBackup(const QString &fileName, DeviceDetails *details, device_data_t *data);
|
||||
bool restoreXMLBackup(const QString &fileName, DeviceDetails *details);
|
||||
void startFirmwareUpdate(const QString &fileName, device_data_t *data, bool forceUpdate);
|
||||
void resetSettings(device_data_t *data);
|
||||
|
||||
QString dc_open(device_data_t *data);
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@ bool DiveFilter::showDive(const struct dive *d) const
|
|||
void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
|
||||
{
|
||||
if (++diveSiteRefCount > 1) {
|
||||
setFilterDiveSite(ds);
|
||||
setFilterDiveSite(std::move(ds));
|
||||
} else {
|
||||
std::sort(ds.begin(), ds.end());
|
||||
dive_sites = ds;
|
||||
dive_sites = std::move(ds);
|
||||
// When switching into dive site mode, reload the dive sites.
|
||||
// TODO: why here? why not catch the filterReset signal in the map widget
|
||||
#ifdef MAP_SUPPORT
|
||||
|
|
@ -176,7 +176,7 @@ void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
|
|||
std::sort(ds.begin(), ds.end());
|
||||
if (ds == dive_sites)
|
||||
return;
|
||||
dive_sites = ds;
|
||||
dive_sites = std::move(ds);
|
||||
|
||||
emit diveListNotifier.filterReset();
|
||||
#ifdef MAP_SUPPORT
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ enum length_modifier_t {
|
|||
};
|
||||
|
||||
// Helper function to insert '+' or ' ' after last space
|
||||
static QString insert_sign(QString s, char sign)
|
||||
static QString insert_sign(const QString &s, char sign)
|
||||
{
|
||||
// For space we can take a shortcut: insert in front
|
||||
if (sign == ' ')
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ Thumbnailer::Thumbnail Thumbnailer::getPictureThumbnailFromStream(QDataStream &s
|
|||
{
|
||||
QImage res;
|
||||
stream >> res;
|
||||
return { res, MEDIATYPE_PICTURE, zero_duration };
|
||||
return { std::move(res), MEDIATYPE_PICTURE, zero_duration };
|
||||
}
|
||||
|
||||
void Thumbnailer::markVideoThumbnail(QImage &img)
|
||||
|
|
@ -362,7 +362,7 @@ void Thumbnailer::frameExtracted(QString filename, QImage thumbnail, duration_t
|
|||
addVideoThumbnailToCache(filename, duration, thumbnail, offset);
|
||||
QMutexLocker l(&lock);
|
||||
workingOn.remove(filename);
|
||||
emit thumbnailChanged(filename, thumbnail, duration);
|
||||
emit thumbnailChanged(filename, std::move(thumbnail), duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue