diff options
author | Henrik Brautaset Aronsen <subsurface@henrik.synth.no> | 2013-02-20 19:01:26 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-20 10:59:53 -0800 |
commit | 80539614b4e4125a71bfacdd65378a492d3f9c5a (patch) | |
tree | 38b0a4ab0d875692d19788413e691dbe3fd34d0f /file.c | |
parent | f6debdc1837e1b1d016cb095787f7af65ecbc42d (diff) | |
download | subsurface-80539614b4e4125a71bfacdd65378a492d3f9c5a.tar.gz |
Add unzip support to divelogs.de exports
Finalize divelog.de import, used with Miiko's divelog.de xslt transform
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -62,7 +62,7 @@ out: #ifdef LIBZIP #include <zip.h> -static void suunto_read(struct zip_file *file, GError **error) +static void zip_read(struct zip_file *file, GError **error) { int size = 1024, n, read = 0; char *mem = malloc(size); @@ -72,12 +72,12 @@ static void suunto_read(struct zip_file *file, GError **error) size = read * 3 / 2; mem = realloc(mem, size); } - parse_xml_buffer(_("SDE file"), mem, read, &dive_table, error); + parse_xml_buffer(_("ZIP file"), mem, read, &dive_table, error); free(mem); } #endif -static int try_to_open_suunto(const char *filename, struct memblock *mem, GError **error) +static int try_to_open_zip(const char *filename, struct memblock *mem, GError **error) { int success = 0; #ifdef LIBZIP @@ -90,7 +90,7 @@ static int try_to_open_suunto(const char *filename, struct memblock *mem, GError struct zip_file *file = zip_fopen_index(zip, index, 0); if (!file) break; - suunto_read(file, error); + zip_read(file, error); zip_fclose(file); success++; } @@ -225,7 +225,11 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo { /* Suunto Dive Manager files: SDE */ if (!strcasecmp(fmt, "SDE")) - return try_to_open_suunto(filename, mem, error); + return try_to_open_zip(filename, mem, error); + + /* divelogs.de files: divelogsData.zip */ + if (!strcasecmp(fmt, "ZIP")) + return try_to_open_zip(filename, mem, error); /* Truly nasty intentionally obfuscated Cochran Anal software */ if (!strcasecmp(fmt, "CAN")) |