diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-07-28 19:20:27 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-28 09:32:53 -0700 |
commit | 921041163be940d22ecffa5dc544add97c0bc0e1 (patch) | |
tree | 4fe22e9aaeee9e9a698a1dcffabd7999b31a0372 /qt-ui/divelogimportdialog.cpp | |
parent | 96b612941efdd8b65cc954217d80fb6d3724cabb (diff) | |
download | subsurface-921041163be940d22ecffa5dc544add97c0bc0e1.tar.gz |
Seabear import: fix detection of empty lines
The old code trusted in Windows new lines with length of 3. The new code
strips out spaces and line ending chars resulting in empty line being
of length 0.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 29138da87..3a3402371 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -397,7 +397,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) * the interval value is missing from the header. */ - while ((firstLine = f.readLine()).length() > 3 && !f.atEnd()) { + while ((firstLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) { if (firstLine.contains("//Hardware Version: ")) { hw = firstLine.replace(QString::fromLatin1("//Hardware Version: "), QString::fromLatin1("\"Seabear ")).trimmed().append("\""); break; @@ -408,7 +408,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) * Note that we scan over the "Log interval" on purpose */ - while ((firstLine = f.readLine()).length() > 3 && !f.atEnd()) { + while ((firstLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) { if (firstLine.contains("//Log interval: ")) delta = firstLine.remove(QString::fromLatin1("//Log interval: ")).trimmed().remove(QString::fromLatin1(" s")); } |