diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2018-01-07 08:50:23 +0200 |
---|---|---|
committer | mturkia <miika.turkia@gmail.com> | 2018-01-08 06:06:12 +0200 |
commit | 62d9728ebe624b8dffd6976064f225a4c78762e4 (patch) | |
tree | 9b242553b6ba66b98815a2ae104349a3566fbb4a /core/import-csv.c | |
parent | e2197a56a4600c8651a95c4ce9b4f3a0e300b125 (diff) | |
download | subsurface-62d9728ebe624b8dffd6976064f225a4c78762e4.tar.gz |
Ignore empty dives
This is first step towards parsing "empty" dives properly. I.e. now the
updated test dive parses properly.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core/import-csv.c')
-rw-r--r-- | core/import-csv.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/import-csv.c b/core/import-csv.c index c5b4ff8f3..7d46fdb76 100644 --- a/core/import-csv.c +++ b/core/import-csv.c @@ -125,6 +125,21 @@ int parse_dan_format(const char *filename, char **params, int pnr) params[pnr + 5] = strdup(tmpbuf); params[pnr + 6] = NULL; + /* Search for the next line */ + if (iter) + iter = strstr(iter, NL); + if (iter) { + iter += strlen(NL); + } else { + fprintf(stderr, "DEBUG: No new line found"); + return -1; + } + /* We got a trailer, no samples on this dive */ + if (strncmp(iter, "ZDT", 3) == 0) { + end_ptr = iter - (char *)mem.buffer; + continue; + } + ptr = strstr(ptr, "ZDP{"); if (ptr && ptr[4] == '}') { end_ptr += ptr - (char *)mem_csv.buffer; |