mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
96b612941e
commit
921041163b
2 changed files with 3 additions and 3 deletions
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ void TestParse::testParseNewFormat()
|
|||
*/
|
||||
|
||||
f.open(QFile::ReadOnly);
|
||||
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"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue