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>
This commit is contained in:
Dirk Hohndel 2014-06-09 09:21:26 -07:00
parent bbe62f756a
commit b0983d9d13

View file

@ -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;