From b0983d9d13d2d967d52a0fbbc1052f7f6eca840a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 9 Jun 2014 09:21:26 -0700 Subject: 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 --- parse-xml.c | 17 +++++++++++++---- 1 file 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; -- cgit v1.2.3-70-g09d2