diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2013-03-05 07:10:39 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-03-04 22:08:03 -0800 |
commit | a94f7807f8eb99b5387d7f9cd973571d9f44f904 (patch) | |
tree | 851b2643648b0267b4b1d4ef8e9daf530815ec75 /file.c | |
parent | a6a487306e5606cb49351c23e3eb2527cd0a79d3 (diff) | |
download | subsurface-a94f7807f8eb99b5387d7f9cd973571d9f44f904.tar.gz |
Limited support for Suunto DM4 import
Basic functionality is implemented but at least support for multiple
cylinders is missing. Event/alarm support is only partial.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -100,6 +100,13 @@ static int try_to_open_zip(const char *filename, struct memblock *mem, GError ** return success; } +#ifdef SQLITE3 +static int try_to_open_db(const char *filename, struct memblock *mem, GError **error) +{ + return parse_dm4_buffer(filename, mem->buffer, mem->size, &dive_table, error); +} +#endif + static timestamp_t parse_date(const char *date) { int hour, min, sec; @@ -258,6 +265,9 @@ static void parse_file_buffer(const char *filename, struct memblock *mem, GError void parse_file(const char *filename, GError **error, gboolean possible_default_filename) { struct memblock mem; +#ifdef SQLITE3 + char *fmt; +#endif if (readfile(filename, &mem) < 0) { /* we don't want to display an error if this was the default file */ @@ -285,6 +295,16 @@ void parse_file(const char *filename, GError **error, gboolean possible_default_ if (possible_default_filename) set_filename(filename, TRUE); +#ifdef SQLITE3 + fmt = strrchr(filename, '.'); + if (fmt && !strcasecmp(fmt + 1, "DB")) { + if (!try_to_open_db(filename, &mem, error)) { + free(mem.buffer); + return; + } + } +#endif + parse_file_buffer(filename, &mem, error); free(mem.buffer); } |