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
|
|
@ -267,7 +267,7 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
|
|||
settings.endGroup();
|
||||
}
|
||||
|
||||
OstcFirmwareCheck::OstcFirmwareCheck(QString product) : parent(0)
|
||||
OstcFirmwareCheck::OstcFirmwareCheck(const QString &product) : parent(0)
|
||||
{
|
||||
QUrl url;
|
||||
memset(&devData, 1, sizeof(devData));
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ private:
|
|||
class OstcFirmwareCheck : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OstcFirmwareCheck(QString product);
|
||||
explicit OstcFirmwareCheck(const QString &product);
|
||||
void checkLatest(QWidget *parent, device_data_t *data);
|
||||
public
|
||||
slots:
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ void DiveListView::loadImages()
|
|||
matchImagesToDives(fileNames);
|
||||
}
|
||||
|
||||
void DiveListView::matchImagesToDives(QStringList fileNames)
|
||||
void DiveListView::matchImagesToDives(const QStringList &fileNames)
|
||||
{
|
||||
ShiftImageTimesDialog shiftDialog(this, fileNames);
|
||||
shiftDialog.setOffset(lastImageTimeOffset());
|
||||
|
|
@ -843,9 +843,9 @@ void DiveListView::matchImagesToDives(QStringList fileNames)
|
|||
|
||||
auto it = std::find_if(pics.begin(), pics.end(), [d](const Command::PictureListForAddition &l) { return l.d == d; });
|
||||
if (it == pics.end())
|
||||
pics.push_back(Command::PictureListForAddition { d, { pObj } });
|
||||
pics.push_back(Command::PictureListForAddition { d, { std::move(pObj) } });
|
||||
else
|
||||
it->pics.push_back(pObj);
|
||||
it->pics.push_back(std::move(pObj));
|
||||
}
|
||||
|
||||
if (pics.empty())
|
||||
|
|
@ -862,7 +862,7 @@ void DiveListView::loadWebImages()
|
|||
loadImagesFromURLs(urlDialog.url());
|
||||
}
|
||||
|
||||
void DiveListView::loadImagesFromURLs(QString urls)
|
||||
void DiveListView::loadImagesFromURLs(const QString &urls)
|
||||
{
|
||||
QStringList validUrls;
|
||||
QStringList urlList = urls.split('\n');
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ private:
|
|||
void updateLastImageTimeOffset(int offset);
|
||||
int lastImageTimeOffset();
|
||||
void addToTrip(int delta);
|
||||
void matchImagesToDives(QStringList fileNames);
|
||||
void loadImagesFromURLs(QString urls);
|
||||
void matchImagesToDives(const QStringList &fileNames);
|
||||
void loadImagesFromURLs(const QString &urls);
|
||||
bool eventFilter(QObject *, QEvent *) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia
|
|||
ui(new Ui::DiveLogImportDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
fileNames = fn;
|
||||
fileNames = std::move(fn);
|
||||
column = 0;
|
||||
delta = "0";
|
||||
hw = "";
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ struct Dir {
|
|||
double progressFrom, progressTo;
|
||||
};
|
||||
|
||||
QVector<FindMovedImagesDialog::Match> FindMovedImagesDialog::learnImages(const QString &rootdir, int maxRecursions, QVector<QString> imagePathsIn)
|
||||
QVector<FindMovedImagesDialog::Match> FindMovedImagesDialog::learnImages(const QString &rootdir, int maxRecursions,
|
||||
QVector<QString> imagePathsIn)
|
||||
{
|
||||
QMap<QString, ImageMatch> matches;
|
||||
|
||||
|
|
@ -193,7 +194,7 @@ void FindMovedImagesDialog::on_scanButton_clicked()
|
|||
QFuture<QVector<Match>> future = QtConcurrent::run(
|
||||
// Note that we capture everything but "this" by copy to avoid dangling references.
|
||||
[this, dirName, imagePaths]()
|
||||
{ return learnImages(dirName, 20, imagePaths);}
|
||||
{ return learnImages(dirName, 20, std::move(imagePaths)); }
|
||||
);
|
||||
watcher.setFuture(future);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,7 @@ void MainWindow::setTitle()
|
|||
setWindowTitle("Subsurface: " + displayedFilename(existing_filename) + unsaved + shown);
|
||||
}
|
||||
|
||||
void MainWindow::importFiles(const QStringList fileNames)
|
||||
void MainWindow::importFiles(const QStringList &fileNames)
|
||||
{
|
||||
if (fileNames.isEmpty())
|
||||
return;
|
||||
|
|
@ -1289,7 +1289,7 @@ void MainWindow::importFiles(const QStringList fileNames)
|
|||
Command::importDives(&log, IMPORT_MERGE_ALL_TRIPS, source);
|
||||
}
|
||||
|
||||
void MainWindow::loadFiles(const QStringList fileNames)
|
||||
void MainWindow::loadFiles(const QStringList &fileNames)
|
||||
{
|
||||
if (fileNames.isEmpty()) {
|
||||
refreshDisplay();
|
||||
|
|
@ -1359,7 +1359,7 @@ void MainWindow::on_actionImportDiveLog_triggered()
|
|||
}
|
||||
|
||||
if (csvFiles.size()) {
|
||||
DiveLogImportDialog diveLogImport(csvFiles, this);
|
||||
DiveLogImportDialog diveLogImport(std::move(csvFiles), this);
|
||||
diveLogImport.exec();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ public:
|
|||
Count
|
||||
};
|
||||
|
||||
void loadFiles(const QStringList files);
|
||||
void importFiles(const QStringList importFiles);
|
||||
void loadFiles(const QStringList &files);
|
||||
void importFiles(const QStringList &importFiles);
|
||||
void setToolButtonsEnabled(bool enabled);
|
||||
void setApplicationState(ApplicationState state);
|
||||
void enterPreviousState();
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ QString TextHyperlinkEventFilter::tryToFormulateUrl(QTextCursor *cursor)
|
|||
maybeUrlStr = left + right;
|
||||
}
|
||||
|
||||
return stringMeetsOurUrlRequirements(maybeUrlStr) ? maybeUrlStr : QString();
|
||||
return stringMeetsOurUrlRequirements(maybeUrlStr) ? std::move(maybeUrlStr) : QString();
|
||||
}
|
||||
|
||||
QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void set_bundled_templates_as_read_only()
|
|||
QFile::setPermissions(pathUser + QDir::separator() + f, QFileDevice::ReadOwner | QFileDevice::ReadUser);
|
||||
}
|
||||
|
||||
void copy_bundled_templates(QString src, QString dst, QStringList *templateBackupList)
|
||||
void copy_bundled_templates(QString src, const QString &dst, QStringList *templateBackupList)
|
||||
{
|
||||
QDir dir(src);
|
||||
if (!dir.exists())
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class QTextStream;
|
|||
|
||||
void find_all_templates();
|
||||
void set_bundled_templates_as_read_only();
|
||||
void copy_bundled_templates(QString src, QString dst, QStringList *templateBackupList);
|
||||
void copy_bundled_templates(QString src, const QString &dst, QStringList *templateBackupList);
|
||||
|
||||
enum token_t {LITERAL, FORSTART, FORSTOP, BLOCKSTART, BLOCKSTOP, IFSTART, IFSTOP, PARSERERROR};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue