From: <dg...@su...> - 2009-01-14 00:06:18
|
Author: dgollub Date: Tue Jan 13 23:02:19 2009 New Revision: 5132 URL: http://www.opensync.org/changeset/5132 Log: Link new child nodes insdie OSyncXMLField struct. Fixes #1021 TODO: write regression testcase also for OpenSync not only for xmlformat-plugin Modified: trunk/opensync/xmlformat/opensync_xmlfield.c Modified: trunk/opensync/xmlformat/opensync_xmlfield.c ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlfield.c Tue Jan 13 21:34:50 2009 (r5131) +++ trunk/opensync/xmlformat/opensync_xmlfield.c Tue Jan 13 23:02:19 2009 (r5132) @@ -110,6 +110,7 @@ while (node != NULL) { + /* TODO: error handing - could be NULL */ xmlfield = osync_xmlfield_new_xmlfield(parent, node, error); if (!xmlfield) goto error; @@ -236,6 +237,7 @@ osync_assert(xmlformat); osync_assert(name); + /* TODO: error handing - could be NULL */ node = xmlNewTextChild(xmlDocGetRootElement(xmlformat->doc), NULL, BAD_CAST name, NULL); xmlfield = osync_xmlfield_new_xmlformat(xmlformat, node, error); @@ -408,19 +410,28 @@ break; } } + + /* TODO: error handling - API breaking? */ if(cur == NULL) - xmlNewTextChild(xmlfield->node, NULL, BAD_CAST key, BAD_CAST value); + cur = xmlNewTextChild(xmlfield->node, NULL, BAD_CAST key, BAD_CAST value); + + /* TODO: error handing - could be NULL */ + osync_xmlfield_new_xmlfield(xmlfield, cur, NULL); xmlfield->sorted = FALSE; } void osync_xmlfield_add_key_value(OSyncXMLField *xmlfield, const char *key, const char *value) { + xmlNodePtr cur; + osync_assert(xmlfield); osync_assert(key); osync_assert(value); - xmlNewTextChild(xmlfield->node, NULL, BAD_CAST key, BAD_CAST value); + cur = xmlNewTextChild(xmlfield->node, NULL, BAD_CAST key, BAD_CAST value); + /* TODO: error handing - could be NULL */ + osync_xmlfield_new_xmlfield(xmlfield, cur, NULL); xmlfield->sorted = FALSE; } |