Dear all,
The function demerge_xmlformat in xmlformat_merge.c is supposed to
remove the fields in the xml format which are not defined in the
capabilities.
This seems to work fine on the top level, if we have a <Name> in the
xmlformat, but not in the capabilities, osync_xmlfield_delete gets called.
However, on the second level, if we have a <LastName> inside a <Name> in
the xmlformat, but not in the capabilities, the field is *not* deleted,
instead the value of the field is set to blank.
This breaks the logic in xmlformat_compare, which will "Run out of list2
elements".
I will try to provide a patch for demerge_xmlformat.
However, before I get too carried away, two questions:
(1) Does anyone know, WHY the second level of demerge_xmlformat was
implemented like this? I.e. something that would break if we remove the
field instead of blanking it?
(2) The top-level loop in demerge_xmlformat efficiently runs through the
xml fileds with functions like osync_xmlfield_get_next. But the second
level inefficiently uses indexes into the lists with functions like
osync_xmlfield_get_nth_key_name. Is there any particular reason for this?
/Henrik
|