mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
bbe62f756a
commit
b0983d9d13
1 changed files with 13 additions and 4 deletions
17
parse-xml.c
17
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue