diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-09 09:21:26 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-09 09:21:26 -0700 |
commit | b0983d9d13d2d967d52a0fbbc1052f7f6eca840a (patch) | |
tree | e37f222c7983cec4f8af201388c135c186dff4bc /parse-xml.c | |
parent | bbe62f756a0c0fbfae58c40d9e1605382c0f65a6 (diff) | |
download | subsurface-b0983d9d13d2d967d52a0fbbc1052f7f6eca840a.tar.gz |
Picture handling: parse and convert old style picture events
Speacial case handling for event type '123' to instead add a picture to
the picture_list of the dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/parse-xml.c b/parse-xml.c index 22b11e7ea..1fad25bbb 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -1290,10 +1290,19 @@ static void event_end(void) { struct divecomputer *dc = get_dc(); if (cur_event.name) { - if (strcmp(cur_event.name, "surface") != 0) - add_event(dc, cur_event.time.seconds, - cur_event.type, cur_event.flags, - cur_event.value, cur_event.name); + if (strcmp(cur_event.name, "surface") != 0) { + /* 123 is a magic event that we used for a while to encode images in dives */ + if (cur_event.type == 123) { + struct picture *pic = alloc_picture(); + pic->filename = strdup(cur_event.name); + pic->offset = cur_event.time.seconds; + dive_add_picture(cur_dive, pic); + } else { + add_event(dc, cur_event.time.seconds, + cur_event.type, cur_event.flags, + cur_event.value, cur_event.name); + } + } free((void *)cur_event.name); } cur_event.active = 0; |