From: <svn...@op...> - 2009-09-16 23:30:34
|
Author: dgollub Date: Thu Sep 17 01:30:03 2009 New Revision: 5771 URL: http://www.opensync.org/changeset/5771 Log: Quick and dirty port to latest xmlfield API changes for proper error handling. Modified: format-plugins/vformat/src/xmlformat-common.c format-plugins/vformat/src/xmlformat-common.h format-plugins/vformat/src/xmlformat-recurrence.c format-plugins/vformat/src/xmlformat-vcalendar.c format-plugins/vformat/src/xmlformat-vcard.c Modified: format-plugins/vformat/src/xmlformat-common.c ============================================================================== --- format-plugins/vformat/src/xmlformat-common.c Thu Sep 17 01:13:38 2009 (r5770) +++ format-plugins/vformat/src/xmlformat-common.c Thu Sep 17 01:30:03 2009 (r5771) @@ -28,57 +28,78 @@ { osync_trace(TRACE_INTERNAL, "Handling %s attribute with timestamp", name); OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, name, error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } + + if (!xmlfield) + goto error; + char *timestamp = osync_time_timestamp(vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "Content", timestamp); - free(timestamp); + if (!osync_xmlfield_set_key_value(xmlfield, "Content", timestamp, error)) + goto error; + + osync_free(timestamp); + return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; } OSyncXMLField *handle_attribute_simple_content(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, const char *name, OSyncError **error) { osync_trace(TRACE_INTERNAL, "Handling %s attribute", name); OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, name, error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + if (!xmlfield) + goto error; + + if (!osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0), error)) + goto error; + return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; + } OSyncXMLField *handle_categories_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error) { osync_trace(TRACE_INTERNAL, "Handling Categories attribute"); OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, "Categories", error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } + if (!xmlfield) + goto error; GList *values = vformat_attribute_get_values_decoded(attr); for (; values; values = values->next) { GString *retstr = (GString *)values->data; g_assert(retstr); - osync_xmlfield_add_key_value(xmlfield, "Category", retstr->str); + osync_xmlfield_add_key_value(xmlfield, "Category", retstr->str, error); } return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; } OSyncXMLField *handle_class_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error) { osync_trace(TRACE_INTERNAL, "Handling Class attribute"); OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, "Class", error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + + if (!xmlfield) + goto error; + + if (!osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0), error)) + goto error; + return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; } OSyncXMLField *handle_uid_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error) @@ -91,10 +112,27 @@ return handle_attribute_simple_content(xmlformat, attr, "Url", error); } -void handle_simple_xmlfield(OSyncXMLField *xmlfield, VFormatAttribute *attr, const char *name) + +/* TODO: changed prototype to: + * osync_bool handle_simple_xmlfield(OSyncXMLField *xmlfield, VFormatAttribute *attr, const char *name, OSyncError **error) + */ +osync_bool handle_simple_xmlfield(OSyncXMLField *xmlfield, VFormatAttribute *attr, const char *name) { osync_trace(TRACE_INTERNAL, "Handling %s component attribute", name); - osync_xmlfield_set_key_value(xmlfield, name, vformat_attribute_get_nth_value(attr, 0)); + + if (!osync_xmlfield_set_key_value(xmlfield, name, vformat_attribute_get_nth_value(attr, 0), NULL)) + goto error; + + return TRUE; + +error: + return FALSE; +} + +/* FIXME - replace all callers with proper error handling code! */ +osync_bool FIXME_xmlfield_set_key_value(OSyncXMLField *xmlfield, const char *key, const char *value) +{ + return osync_xmlfield_set_key_value(xmlfield, key, value, NULL /* ERROR */); } /* XML Attributes */ Modified: format-plugins/vformat/src/xmlformat-common.h ============================================================================== --- format-plugins/vformat/src/xmlformat-common.h Thu Sep 17 01:13:38 2009 (r5770) +++ format-plugins/vformat/src/xmlformat-common.h Thu Sep 17 01:30:03 2009 (r5771) @@ -55,7 +55,10 @@ OSyncXMLField *handle_class_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error); OSyncXMLField *handle_uid_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error); OSyncXMLField *handle_url_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error); -void handle_simple_xmlfield(OSyncXMLField *xmlfield, VFormatAttribute *attr, const char *name); +// TODO: osync_bool handle_simple_xmlfield(OSyncXMLField *xmlfield, VFormatAttribute *attr, const char *name, OSyncError **error); +osync_bool handle_simple_xmlfield(OSyncXMLField *xmlfield, VFormatAttribute *attr, const char *name); + +osync_bool FIXME_xmlfield_set_key_value(OSyncXMLField *xmlfield, const char *key, const char *value); /** XML Attributes **/ VFormatAttribute *handle_xml_attribute_simple_content(VFormat *vformat, OSyncXMLField *xmlfield, const char *name, const char *encoding); Modified: format-plugins/vformat/src/xmlformat-recurrence.c ============================================================================== --- format-plugins/vformat/src/xmlformat-recurrence.c Thu Sep 17 01:13:38 2009 (r5770) +++ format-plugins/vformat/src/xmlformat-recurrence.c Thu Sep 17 01:30:03 2009 (r5771) @@ -66,7 +66,7 @@ } /* set Frequency */ - osync_xmlfield_set_key_value(xmlfield, "Frequency", frequency); + FIXME_xmlfield_set_key_value(xmlfield, "Frequency", frequency); return frequency_state; } @@ -118,7 +118,7 @@ /* COUNT: #20 */ if (sscanf(duration_block, "#%d", &count) == 1) { - osync_xmlfield_set_key_value(xmlfield, "Count", duration_block+1); + FIXME_xmlfield_set_key_value(xmlfield, "Count", duration_block+1); return; } @@ -142,7 +142,7 @@ until = g_strdup(duration_block); } - osync_xmlfield_set_key_value(xmlfield, "Until", until); + FIXME_xmlfield_set_key_value(xmlfield, "Until", until); g_free(until); } @@ -183,7 +183,7 @@ frequency_block++; /* set Interval */ - osync_xmlfield_set_key_value(xmlfield, "Interval", frequency_block); + FIXME_xmlfield_set_key_value(xmlfield, "Interval", frequency_block); /* get Frequency modifier (ByDay, ByMonthDay, etc. */ if (counter > 2) @@ -194,16 +194,16 @@ switch(frequency_state) { case 2: case 3: - osync_xmlfield_set_key_value(xmlfield, "ByDay", freq_mod); + FIXME_xmlfield_set_key_value(xmlfield, "ByDay", freq_mod); break; case 4: - osync_xmlfield_set_key_value(xmlfield, "ByMonthDay", freq_mod); + FIXME_xmlfield_set_key_value(xmlfield, "ByMonthDay", freq_mod); break; case 5: - osync_xmlfield_set_key_value(xmlfield, "ByYearDay", freq_mod); + FIXME_xmlfield_set_key_value(xmlfield, "ByYearDay", freq_mod); break; case 6: - osync_xmlfield_set_key_value(xmlfield, "ByMonth", freq_mod); + FIXME_xmlfield_set_key_value(xmlfield, "ByMonth", freq_mod); break; default: break; @@ -406,10 +406,8 @@ OSyncXMLField *convert_ical_rrule_to_xml(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, const char *rulename, OSyncError **error) { OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, rulename, error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } + if (!xmlfield) + goto error; osync_bool extended = FALSE; @@ -497,10 +495,15 @@ int i; for (i = 0; i <= 13; i++) { if (rrules[i].value != NULL) - osync_xmlfield_add_key_value(xmlfield, rrules[i].name, rrules[i].value); + if (!osync_xmlfield_add_key_value(xmlfield, rrules[i].name, rrules[i].value, error)) + goto error; } return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; } Modified: format-plugins/vformat/src/xmlformat-vcalendar.c ============================================================================== --- format-plugins/vformat/src/xmlformat-vcalendar.c Thu Sep 17 01:13:38 2009 (r5770) +++ format-plugins/vformat/src/xmlformat-vcalendar.c Thu Sep 17 01:30:03 2009 (r5771) @@ -148,19 +148,19 @@ if (!strcasecmp(name, "AALARM")) { osync_trace(TRACE_INTERNAL, "Handling aalarm attribute"); xmlfield = osync_xmlfield_new(xmlformat, "AlarmAudio", error); - osync_xmlfield_set_key_value(xmlfield, "AlarmAction", "AUDIO"); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmAction", "AUDIO"); } else if (!strcasecmp(name, "DALARM")) { osync_trace(TRACE_INTERNAL, "Handling dalarm attribute"); xmlfield = osync_xmlfield_new(xmlformat, "AlarmDisplay", error); - osync_xmlfield_set_key_value(xmlfield, "AlarmAction", "DISPLAY"); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmAction", "DISPLAY"); } else if (!strcasecmp(name, "MALARM")) { osync_trace(TRACE_INTERNAL, "Handling malarm attribute"); xmlfield = osync_xmlfield_new(xmlformat, "AlarmEmail", error); - osync_xmlfield_set_key_value(xmlfield, "AlarmAction", "EMAIL"); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmAction", "EMAIL"); } else if (!strcasecmp(name, "PALARM")) { osync_trace(TRACE_INTERNAL, "Handling palarm attribute"); xmlfield = osync_xmlfield_new(xmlformat, "AlarmProcedure", error); - osync_xmlfield_set_key_value(xmlfield, "AlarmAction", "PROCEDURE"); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmAction", "PROCEDURE"); } if(!xmlfield) { @@ -169,14 +169,14 @@ } if (!strcasecmp(name, "AALARM") || !strcasecmp(name, "PALARM")) { - osync_xmlfield_set_key_value(xmlfield, "AlarmAttach", vformat_attribute_get_nth_value(attr, 3)); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmAttach", vformat_attribute_get_nth_value(attr, 3)); } else { - osync_xmlfield_set_key_value(xmlfield, "AlarmDescription", vformat_attribute_get_nth_value(attr, 3)); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmDescription", vformat_attribute_get_nth_value(attr, 3)); } - osync_xmlfield_set_key_value(xmlfield, "AlarmRepeat", vformat_attribute_get_nth_value(attr, 2)); - osync_xmlfield_set_key_value(xmlfield, "AlarmRepeatDuration", vformat_attribute_get_nth_value(attr, 1)); - osync_xmlfield_set_key_value(xmlfield, "AlarmTrigger", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmRepeat", vformat_attribute_get_nth_value(attr, 2)); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmRepeatDuration", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "AlarmTrigger", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -540,18 +540,19 @@ { osync_trace(TRACE_INTERNAL, "Handling Duration attribute"); OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, "Duration", error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } + + if (!xmlfield) + goto error; const char *duration = vformat_attribute_get_nth_value(attr, 0); // check if duration is positive or negative if (duration[0] == '-') { - osync_xmlfield_add_key_value(xmlfield, "InAdvance", "TRUE"); + if (!osync_xmlfield_add_key_value(xmlfield, "InAdvance", "TRUE", error)) + goto error; } else { - osync_xmlfield_add_key_value(xmlfield, "InAdvance", "FALSE"); + if (!osync_xmlfield_add_key_value(xmlfield, "InAdvance", "FALSE", error)) + goto error; } int i, end, digits; @@ -560,19 +561,24 @@ for (i = 1; i < end; i++) { switch (duration[i]) { case 'W': - osync_xmlfield_add_key_value(xmlfield, "Weeks", value); + if (!osync_xmlfield_add_key_value(xmlfield, "Weeks", value, error)) + goto error; break; case 'D': - osync_xmlfield_add_key_value(xmlfield, "Days", value); + if (!osync_xmlfield_add_key_value(xmlfield, "Days", value, error)) + goto error; break; case 'H': - osync_xmlfield_add_key_value(xmlfield, "Hours", value); + if (!osync_xmlfield_add_key_value(xmlfield, "Hours", value, error)) + goto error; break; case 'M': - osync_xmlfield_add_key_value(xmlfield, "Minutes", value); + if (!osync_xmlfield_add_key_value(xmlfield, "Minutes", value, error)) + goto error; break; case 'S': - osync_xmlfield_add_key_value(xmlfield, "Seconds", value); + if (!osync_xmlfield_add_key_value(xmlfield, "Seconds", value, error)) + goto error; break; case '0': case '1': @@ -599,6 +605,10 @@ g_free(value); return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; } OSyncXMLField *handle_priority_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error) @@ -624,8 +634,8 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Latitude", vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "Longitude", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "Latitude", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Longitude", vformat_attribute_get_nth_value(attr, 1)); return xmlfield; } @@ -680,10 +690,10 @@ return NULL; } - osync_xmlfield_set_key_value(xmlfield, "StatusCode", vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "StatusDescription", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "StatusCode", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "StatusDescription", vformat_attribute_get_nth_value(attr, 1)); if (vformat_attribute_get_nth_value(attr, 2) != NULL) - osync_xmlfield_set_key_value(xmlfield, "ExceptionData", vformat_attribute_get_nth_value(attr, 2)); + FIXME_xmlfield_set_key_value(xmlfield, "ExceptionData", vformat_attribute_get_nth_value(attr, 2)); return xmlfield; } @@ -713,9 +723,9 @@ const char *transp = vformat_attribute_get_nth_value(attr, 0); if (!strcmp(transp, "0") || !strcmp(transp, "OPAQUE")) { - osync_xmlfield_set_key_value(xmlfield, "Content", "OPAQUE"); + FIXME_xmlfield_set_key_value(xmlfield, "Content", "OPAQUE"); } else { - osync_xmlfield_set_key_value(xmlfield, "Content", "TRANSPARENT"); + FIXME_xmlfield_set_key_value(xmlfield, "Content", "TRANSPARENT"); } return xmlfield; @@ -1413,7 +1423,7 @@ *attributes = a->prev; // Sorting is required to have a valid XMLFormat. - osync_xmlfield_sort(xmlfield); + osync_xmlfield_sort(xmlfield, NULL /* FIXME error handling */); return; } else if (!strcmp(vformat_attribute_get_name(attr), "END")) { @@ -1421,7 +1431,7 @@ *attributes = a; // Sorting is required to have a valid XMLFormat. - osync_xmlfield_sort(xmlfield); + osync_xmlfield_sort(xmlfield, NULL /* FIXME error handling */); return; } else { @@ -1444,7 +1454,7 @@ *attributes = a->prev; // Sorting is required to have a valid XMLFormat. - osync_xmlfield_sort(xmlfield); + osync_xmlfield_sort(xmlfield, NULL /* FIXME error handling */); return; } else if (!strcmp(vformat_attribute_get_name(attr), "END")) { @@ -1452,7 +1462,7 @@ *attributes = a; // Sorting is required to have a valid XMLFormat. - osync_xmlfield_sort(xmlfield); + osync_xmlfield_sort(xmlfield, NULL /* FIXME error handling */); return; Modified: format-plugins/vformat/src/xmlformat-vcard.c ============================================================================== --- format-plugins/vformat/src/xmlformat-vcard.c Thu Sep 17 01:13:38 2009 (r5770) +++ format-plugins/vformat/src/xmlformat-vcard.c Thu Sep 17 01:30:03 2009 (r5771) @@ -153,13 +153,13 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "PostOfficeBox", vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "ExtendedAddress", vformat_attribute_get_nth_value(attr, 1)); - osync_xmlfield_set_key_value(xmlfield, "Street", vformat_attribute_get_nth_value(attr, 2)); - osync_xmlfield_set_key_value(xmlfield, "Locality", vformat_attribute_get_nth_value(attr, 3)); - osync_xmlfield_set_key_value(xmlfield, "Region", vformat_attribute_get_nth_value(attr, 4)); - osync_xmlfield_set_key_value(xmlfield, "PostalCode", vformat_attribute_get_nth_value(attr, 5)); - osync_xmlfield_set_key_value(xmlfield, "Country", vformat_attribute_get_nth_value(attr, 6)); + FIXME_xmlfield_set_key_value(xmlfield, "PostOfficeBox", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "ExtendedAddress", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "Street", vformat_attribute_get_nth_value(attr, 2)); + FIXME_xmlfield_set_key_value(xmlfield, "Locality", vformat_attribute_get_nth_value(attr, 3)); + FIXME_xmlfield_set_key_value(xmlfield, "Region", vformat_attribute_get_nth_value(attr, 4)); + FIXME_xmlfield_set_key_value(xmlfield, "PostalCode", vformat_attribute_get_nth_value(attr, 5)); + FIXME_xmlfield_set_key_value(xmlfield, "Country", vformat_attribute_get_nth_value(attr, 6)); return xmlfield; } @@ -171,7 +171,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -183,7 +183,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -195,7 +195,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", osync_time_datestamp(vformat_attribute_get_nth_value(attr, 0))); + FIXME_xmlfield_set_key_value(xmlfield, "Content", osync_time_datestamp(vformat_attribute_get_nth_value(attr, 0))); return xmlfield; } @@ -207,7 +207,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -220,7 +220,7 @@ return NULL; } char * datestamp = osync_time_datestamp(vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "Content", datestamp); + FIXME_xmlfield_set_key_value(xmlfield, "Content", datestamp); g_free(datestamp); return xmlfield; } @@ -233,7 +233,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -245,7 +245,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -265,7 +265,7 @@ if(!xmlfield) goto error; } - osync_xmlfield_set_key_value(xmlfield, "Department", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Department", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; error: @@ -282,7 +282,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -294,7 +294,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -306,7 +306,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -318,7 +318,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -330,7 +330,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -342,7 +342,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -354,7 +354,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -366,7 +366,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -378,7 +378,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -396,18 +396,19 @@ osync_xmlfieldlist_free(list); if(xmlfield == NULL) { xmlfield = osync_xmlfield_new(xmlformat, "Organization", error); - if(!xmlfield) + if (!xmlfield) goto error; } - osync_xmlfield_set_key_value(xmlfield, "Name", vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "Department", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "Name", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Department", vformat_attribute_get_nth_value(attr, 1)); GList *values = vformat_attribute_get_values_decoded(attr); values = g_list_nth(values, 2); for (; values; values = values->next) { GString *retstr = (GString *)values->data; g_assert(retstr); - osync_xmlfield_add_key_value(xmlfield, "Unit", retstr->str); + if (!osync_xmlfield_add_key_value(xmlfield, "Unit", retstr->str, error)) + goto error; } return xmlfield; @@ -424,7 +425,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -436,7 +437,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -448,8 +449,8 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Latitude", vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "Longitude", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "Latitude", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Longitude", vformat_attribute_get_nth_value(attr, 1)); return xmlfield; } @@ -461,7 +462,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -473,7 +474,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -485,7 +486,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -497,7 +498,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -509,11 +510,11 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "LastName", vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "FirstName", vformat_attribute_get_nth_value(attr, 1)); - osync_xmlfield_set_key_value(xmlfield, "Additional", vformat_attribute_get_nth_value(attr, 2)); - osync_xmlfield_set_key_value(xmlfield, "Prefix", vformat_attribute_get_nth_value(attr, 3)); - osync_xmlfield_set_key_value(xmlfield, "Suffix", vformat_attribute_get_nth_value(attr, 4)); + FIXME_xmlfield_set_key_value(xmlfield, "LastName", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "FirstName", vformat_attribute_get_nth_value(attr, 1)); + FIXME_xmlfield_set_key_value(xmlfield, "Additional", vformat_attribute_get_nth_value(attr, 2)); + FIXME_xmlfield_set_key_value(xmlfield, "Prefix", vformat_attribute_get_nth_value(attr, 3)); + FIXME_xmlfield_set_key_value(xmlfield, "Suffix", vformat_attribute_get_nth_value(attr, 4)); return xmlfield; } @@ -525,7 +526,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -537,7 +538,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -559,7 +560,7 @@ goto error; } - osync_xmlfield_set_key_value(xmlfield, "Unit", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Unit", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; error: @@ -571,20 +572,24 @@ { osync_trace(TRACE_INTERNAL, "Handling Organization attribute"); OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, "Organization", error); - if(!xmlfield) { - osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); - return NULL; - } - osync_xmlfield_set_key_value(xmlfield, "Name", vformat_attribute_get_nth_value(attr, 0)); + if (!xmlfield) + goto error; + + FIXME_xmlfield_set_key_value(xmlfield, "Name", vformat_attribute_get_nth_value(attr, 0)); GList *values = vformat_attribute_get_values_decoded(attr); values = g_list_nth(values, 1); for (; values; values = values->next) { GString *retstr = (GString *)values->data; g_assert(retstr); - osync_xmlfield_add_key_value(xmlfield, "Unit", retstr->str); + if (!osync_xmlfield_add_key_value(xmlfield, "Unit", retstr->str, error)) + goto error; } return xmlfield; + +error: + osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); + return NULL; } static OSyncXMLField *handle_photo_attribute(OSyncXMLFormat *xmlformat, VFormatAttribute *attr, OSyncError **error) @@ -595,7 +600,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -607,7 +612,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -620,7 +625,7 @@ return NULL; } char *revision = osync_time_timestamp(vformat_attribute_get_nth_value(attr, 0)); - osync_xmlfield_set_key_value(xmlfield, "Content", revision); + FIXME_xmlfield_set_key_value(xmlfield, "Content", revision); g_free(revision); return xmlfield; } @@ -633,7 +638,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -645,7 +650,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -657,7 +662,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -669,7 +674,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -681,7 +686,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -693,7 +698,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -705,7 +710,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -718,7 +723,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "NodeName", vformat_attribute_get_name(attr)); + FIXME_xmlfield_set_key_value(xmlfield, "NodeName", vformat_attribute_get_name(attr)); GList *values = vformat_attribute_get_values_decoded(attr); for (; values; values = values->next) { GString *retstr = (GString *)values->data; @@ -737,7 +742,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -749,7 +754,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -761,8 +766,8 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "ExtName", vformat_attribute_get_name(attr)); - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "ExtName", vformat_attribute_get_name(attr)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -774,7 +779,7 @@ osync_trace(TRACE_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } - osync_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); + FIXME_xmlfield_set_key_value(xmlfield, "Content", vformat_attribute_get_nth_value(attr, 0)); return xmlfield; } @@ -933,7 +938,7 @@ ////xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"FormattedName", NULL); ////osxml_node_add(current, "Content", fnentry->str); //OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, "FormattedName", error); -//osync_xmlfield_set_key_value(xmlfield, "Content", fnentry->str); +//FIXME_xmlfield_set_key_value(xmlfield, "Content", fnentry->str); // } else { // osync_trace(TRACE_INTERNAL, "FN is empty!"); // } @@ -961,7 +966,7 @@ ////xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"Name", NULL); //// osxml_node_add(current, "LastName", fn); //OSyncXMLField *xmlfield = osync_xmlfield_new(xmlformat, "Name", error); -//osync_xmlfield_set_key_value(xmlfield, "LastName", fn); +//FIXME_xmlfield_set_key_value(xmlfield, "LastName", fn); // } else { // osync_trace(TRACE_INTERNAL, "Name is empty"); // } |