summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-07 15:53:35 +0300
committerGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-07 15:53:35 +0300
commit221f67206b847373aa768fb201aa88410aa59801 (patch)
treefb32982c4ce25d6e1e1119b5aacf4e20de863ea9 /core
parent6e1c00078dc440ca96745315455b731ca3a5fa09 (diff)
downloadsubsurface-221f67206b847373aa768fb201aa88410aa59801.tar.gz
Make parsing of Seabear header more robust
This should work even if some header line is missing from some DC. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/qthelper.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 41c9d310b..b597921b6 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1529,6 +1529,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
break;
}
}
+ f.seek(0);
/*
* Parse header - currently only interested in sample
@@ -1543,6 +1544,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
break;
}
}
+ f.seek(0);
/*
* Grab the sample interval
@@ -1555,6 +1557,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
break;
}
}
+ f.seek(0);
/*
* Dive mode, can be: OC, APNEA, BOTTOM TIMER, CCR, CCR SENSORBOARD
@@ -1568,6 +1571,10 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data());
}
}
+ f.seek(0);
+
+ while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ }
/*
* Parse CSV fields