Hi, there were complaints that bailout events get converted to generic events upon saving (to git) and I tracked this down to the following: The bailout event results in a line like
event 40:00 type=8 divemode="OC" name="modechange"
in the Divecomputer file in the repository.
When that is loaded, however, the parsing thinks „OC“ is the event->name and
not „modechange“. Looking at the code in load-git.c, I am a bit lost with the
clever combination of macros and jump tables in the parser. I see in
parse_event_keyvalue()
if (!strcmp(key, "type")) {
event->type = val;
} else if (!strcmp(key, "flags")) {
event->flags = val;
} else if (!strcmp(key, "value")) {
event->value = val;
} else if (!strcmp(key, "name")) {
/* We get the name from the string handling */
} else if (!strcmp(key,"divemode")) {
So parsing the key is a NOP at this point. It seems to get parsed however in
parse_dc_event() where the code reads
name = "";
if (str->len)
name = mb_cstring(str);
ev = add_event(state->active_dc, event.time.seconds, event.type,
event.flags, event.value, name);
printf reveals that after these lines name is „OC“ and not „modechange“.
Maybe somebody with a better understanding of the code (Linus?) can help me out
with this.
Thanks
Robert
signature.asc
Description: Message signed with OpenPGP
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
