Changeset 281
- Timestamp:
- 02/23/05 15:45:50 (4 years ago)
- Files:
-
- trunk/Doxyfile (modified) (1 diff)
- trunk/configure.in (modified) (1 diff)
- trunk/formats/vformats-xml/xml-vcard.c (modified) (1 diff)
- trunk/opensync/opensync_convert.c (modified) (7 diffs)
- trunk/opensync/opensync_format_internals.h (modified) (1 diff)
- trunk/opensync/opensync_member.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Doxyfile
r245 r281 24 24 # if some version control system is used. 25 25 26 PROJECT_NUMBER = 0.1 026 PROJECT_NUMBER = 0.11 27 27 28 28 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) trunk/configure.in
r257 r281 3 3 AC_PREREQ(2.58) 4 4 AC_INIT(configure.in) 5 AM_INIT_AUTOMAKE(opensync, 0.1 0)5 AM_INIT_AUTOMAKE(opensync, 0.11) 6 6 AM_CONFIG_HEADER(config.h) 7 7 trunk/formats/vformats-xml/xml-vcard.c
r279 r281 401 401 EVCardAttribute *attr = NULL; 402 402 xmlNode *root = osxml_node_get_root((xmlDoc *)input, "contact", error); 403 if (!root) 403 if (!root) { 404 osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to get root element of xml-contact"); 405 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 404 406 return FALSE; 407 } 405 408 406 409 g_type_init(); trunk/opensync/opensync_convert.c
r279 r281 135 135 osync_bool osync_converter_invoke(OSyncFormatConverter *converter, OSyncChange *change, OSyncError **error) 136 136 { 137 osync_trace(TRACE_ENTRY, "osync_converter_invoke(%p, %p, %p) %i", converter, change, error);137 osync_trace(TRACE_ENTRY, "osync_converter_invoke(%p, %p, %p)", converter, change, error); 138 138 osync_trace(TRACE_INTERNAL, "converter: Type: %i, source: %s, target %s", converter->type, converter->source_format->name, converter->target_format->name); 139 139 char *data = NULL; … … 149 149 //Invoke the converter and all extensions 150 150 osync_conv_invoke_extensions(converter->source_format, FALSE, change); 151 osync_bool free_input; 152 ret = converter->convert_func(change->data, change->size, &data, &datasize, &free_input, error); 153 154 if (converter->type == CONVERTER_DECAP) { 155 if (!free_input) { 156 /* Duplicate the returned data, as the original data will be destroyed */ 157 if (!converter->target_format->copy_func) { 158 /* There is nothing we can do, here. The returned data is a reference, but 159 * we can't copy the data before destroying it 160 */ 161 osync_debug("OSYNC", 0, "Format %s don't have a copy function, but a no-copy converter was registered", converter->target_format->name); 162 osync_error_set(error, OSYNC_ERROR_GENERIC, "Format %s don't have a copy function, but a no-copy converter was registered", converter->target_format->name); 163 osync_trace(TRACE_EXIT_ERROR, "osync_converter_invoke: %s", osync_error_print(error)); 164 return FALSE; 151 osync_bool free_input = FALSE; 152 if ((ret = converter->convert_func(change->data, change->size, &data, &datasize, &free_input, error))) { 153 154 if (converter->type == CONVERTER_DECAP) { 155 if (!free_input) { 156 /* Duplicate the returned data, as the original data will be destroyed */ 157 if (!converter->target_format->copy_func) { 158 /* There is nothing we can do, here. The returned data is a reference, but 159 * we can't copy the data before destroying it 160 */ 161 osync_debug("OSYNC", 0, "Format %s don't have a copy function, but a no-copy converter was registered", converter->target_format->name); 162 osync_error_set(error, OSYNC_ERROR_GENERIC, "Format %s don't have a copy function, but a no-copy converter was registered", converter->target_format->name); 163 osync_trace(TRACE_EXIT_ERROR, "osync_converter_invoke: %s", osync_error_print(error)); 164 return FALSE; 165 } 166 converter->target_format->copy_func(data, datasize, &data, &datasize); 165 167 } 166 converter->target_format->copy_func(data, datasize, &data, &datasize);167 168 } 169 /* Free the data, unless the converter took the ownership of the data */ 170 if (free_input) { 171 if (converter->source_format->destroy_func) { 172 converter->source_format->destroy_func(change->data, change->size); 173 } else 174 osync_debug("OSYNC", 1, "Format %s don't have a destroy function. Possible memory leak", converter->source_format->name); 175 } 176 change->data = data; 177 change->size = datasize; 178 179 osync_conv_invoke_extensions(converter->target_format, TRUE, change); 168 180 } 169 /* Free the data, unless the converter took the ownership of the data */ 170 if (free_input) { 171 if (converter->source_format->destroy_func) { 172 converter->source_format->destroy_func(change->data, change->size); 173 } else 174 osync_debug("OSYNC", 1, "Format %s don't have a destroy function. Possible memory leak", converter->source_format->name); 175 } 176 change->data = data; 177 change->size = datasize; 178 179 osync_conv_invoke_extensions(converter->target_format, TRUE, change); 180 } 181 osync_debug("OSYNC", 3, "Converting! replacing format %s with %s", converter->source_format->name, converter->target_format->name); 182 change->format = converter->target_format; 183 change->objtype = change->format->objtype; 184 185 if (ret) 181 } 182 183 if (ret) { 184 osync_debug("OSYNC", 3, "Converting! replacing format %s with %s", converter->source_format->name, converter->target_format->name); 185 change->format = converter->target_format; 186 change->objtype = change->format->objtype; 186 187 osync_trace(TRACE_EXIT, "osync_converter_invoke: TRUE"); 187 else188 } else 188 189 osync_trace(TRACE_EXIT_ERROR, "osync_converter_invoke: %s", osync_error_print(error)); 189 190 return ret; … … 467 468 468 469 free_tree: 469 osync_trace(TRACE_INTERNAL, "Invoked detector for converter from TRUE1");470 470 g_list_free(tree->unused); 471 osync_trace(TRACE_INTERNAL, "Invoked detector for converter from TRUE2");472 471 g_list_free(tree->search); 473 osync_trace(TRACE_INTERNAL, "Invoked detector for converter from TRUE3 %p", tree);474 472 g_free(tree); 475 osync_trace(TRACE_INTERNAL, "Invoked detector for converter from TRUE4");476 473 if (ret) 477 474 osync_trace(TRACE_EXIT, "osync_conv_find_path_fn: TRUE"); … … 617 614 /** Convert a change to the nearest format sink on a member 618 615 */ 619 osync_bool osync_change_convert_member_sink(OSyncFormatEnv *env, OSyncChange *change, OSyncMember *memb )620 { 621 return osync_conv_convert_fn(env, change, target_fn_membersink, memb, NULL);616 osync_bool osync_change_convert_member_sink(OSyncFormatEnv *env, OSyncChange *change, OSyncMember *memb, OSyncError **error) 617 { 618 return osync_conv_convert_fn(env, change, target_fn_membersink, memb, error); 622 619 } 623 620 … … 871 868 872 869 OSyncError *error = NULL; 873 osync_change_convert_to_common(leftchange, &error); 874 if (error) { 870 if (!osync_change_convert_to_common(leftchange, &error)) { 875 871 osync_trace(TRACE_INTERNAL, "osync_change_compare: %s", osync_error_print(&error)); 876 872 osync_error_free(&error); … … 878 874 return CONV_DATA_MISMATCH; 879 875 } 880 osync_change_convert_to_common(rightchange, &error); 881 if (error) { 876 if (!osync_change_convert_to_common(rightchange, &error)) { 882 877 osync_trace(TRACE_INTERNAL, "osync_change_compare: %s", osync_error_print(&error)); 883 878 osync_error_free(&error); … … 947 942 osync_error_set(error, OSYNC_ERROR_GENERIC, "The change has no objtype"); 948 943 osync_trace(TRACE_EXIT_ERROR, "osync_change_convert_to_common: %s", osync_error_print(error)); 944 return FALSE; 949 945 } 950 946 OSyncFormatEnv *env = change->objtype->env; trunk/opensync/opensync_format_internals.h
r279 r281 105 105 osync_bool osync_conv_convert_fn(OSyncFormatEnv *env, OSyncChange *change, OSyncPathTargetFn target_fn, const void *fndata, OSyncError **error); 106 106 osync_bool osync_conv_convert_fmtlist(OSyncFormatEnv *env, OSyncChange *change, GList/*OSyncObjFormat * */ *targets); 107 osync_bool osync_change_convert_member_sink(OSyncFormatEnv *env, OSyncChange *change, OSyncMember *memb );107 osync_bool osync_change_convert_member_sink(OSyncFormatEnv *env, OSyncChange *change, OSyncMember *memb, OSyncError **error); 108 108 OSyncDataDetector *osync_env_find_detector(OSyncEnv *env, const char *sourcename, const char *targetname); 109 109 osync_bool osync_conv_objtype_is_any(const char *objstr); trunk/opensync/opensync_member.c
r279 r281 517 517 * because not detection/conversion will be run 518 518 */ 519 if (!osync_change_convert_member_sink(env, change, member)) { 519 OSyncError *error = NULL; 520 if (!osync_change_convert_member_sink(env, change, member, &error)) { 520 521 osync_debug("OSYNC", 0, "Unable to convert to any format on the plugin"); 521 522 osync_context_report_error(context, OSYNC_ERROR_CONVERT, "Unable to convert change"); 523 osync_error_free(&error); 522 524 return; 523 525 }
