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>
This commit is contained in:
Miika Turkia 2017-05-07 15:53:35 +03:00
parent 6e1c00078d
commit 221f67206b

View file

@ -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