From 41089b74a9b0acac484a188e2bf078b30e3f4c00 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 29 Sep 2018 21:48:59 +0200 Subject: Cleanup: don't use QByteArray::data() to create copy QByteArray::data() provides access to the underlying data for direct manipulation. Thus, the construct csv = fileNamePtr.data(); found in MainWindow::importTxtFiles() suggests that modifications to csv also affect fileNamePtr. This is *not* the case, because csv itself is a QByteArray. It is therefore constructed from the data. Replace this treacherous construct by a simple assignment. Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index e73ce2850..e6b3424e8 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1752,8 +1752,7 @@ void MainWindow::importTxtFiles(const QStringList fileNames) QByteArray fileNamePtr, csv; for (int i = 0; i < fileNames.size(); ++i) { - fileNamePtr = QFile::encodeName(fileNames.at(i)); - csv = fileNamePtr.data(); + csv = fileNamePtr = QFile::encodeName(fileNames.at(i)); csv.replace(csv.size() - 3, 3, "csv"); QFileInfo check_file(csv); -- cgit v1.2.3-70-g09d2