diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-09-29 21:48:59 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-09-29 14:01:22 -0700 |
commit | 41089b74a9b0acac484a188e2bf078b30e3f4c00 (patch) | |
tree | 22c94ac4443879a4e502c4ca030c00ec6ae6908c /desktop-widgets | |
parent | 3923f54e106247f5bf97dfe30f37a710c3f0f7f1 (diff) | |
download | subsurface-41089b74a9b0acac484a188e2bf078b30e3f4c00.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 3 |
1 files changed, 1 insertions, 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); |