From: <dg...@su...> - 2009-01-05 03:06:48
|
Author: dgollub Date: Mon Jan 5 04:06:28 2009 New Revision: 5009 URL: http://www.opensync.org/changeset/5009 Log: Swap detect and decapuslation order in detect_full function. This avoids unwanted detection of inverse-detectors. Example: full_detect(vevent20) regular detect would find object-format "plain", du to the inverse-detector, vevent20_in_plain. The first decapsulation would be then with the object format "plain" and not "vevent20". Which is not prefered detection-path. Prefered would be to start decapsulating the format given as parameter. Modified: trunk/opensync/format/opensync_format_env.c trunk/opensync/format/opensync_format_env.h Modified: trunk/opensync/format/opensync_format_env.c ============================================================================== --- trunk/opensync/format/opensync_format_env.c Mon Jan 5 03:53:36 2009 (r5008) +++ trunk/opensync/format/opensync_format_env.c Mon Jan 5 04:06:28 2009 (r5009) @@ -958,7 +958,7 @@ osync_trace(TRACE_INTERNAL, "running detector %s for format %s", osync_objformat_get_name(osync_converter_get_targetformat(converter)), osync_objformat_get_name(osync_data_get_objformat(data))); if (osync_converter_detect(converter, data)) { OSyncObjFormat *detected_format = osync_converter_get_targetformat(converter); - osync_trace(TRACE_EXIT, "%s: %p", __func__, detected_format); + osync_trace(TRACE_EXIT, "%s: %p:%s", __func__, detected_format, osync_objformat_get_name(detected_format)); return detected_format; } } @@ -986,11 +986,7 @@ */ while (TRUE) { OSyncFormatConverter *converter = NULL; - if ((detected_format = osync_format_env_detect_objformat(env, new_data))) { - /* We detected the format. So we replace the original format. */ - osync_data_set_objformat(new_data, detected_format); - } else - detected_format = osync_data_get_objformat(new_data); + /* Try to decap the change */ for (d = env->converters; d; d = d->next) { converter = d->data; @@ -1005,10 +1001,17 @@ } else converter = NULL; } - + /* We couldnt find a decap, so we quit. */ if (!converter) break; + + if ((detected_format = osync_format_env_detect_objformat(env, new_data))) { + /* We detected the format. So we replace the original format. */ + osync_data_set_objformat(new_data, detected_format); + } else + detected_format = osync_data_get_objformat(new_data); + } osync_data_unref(new_data); Modified: trunk/opensync/format/opensync_format_env.h ============================================================================== --- trunk/opensync/format/opensync_format_env.h Mon Jan 5 03:53:36 2009 (r5008) +++ trunk/opensync/format/opensync_format_env.h Mon Jan 5 04:06:28 2009 (r5009) @@ -181,8 +181,8 @@ /** @brief Tries to detect the encapsulated format of the given data object * * This will try to detect the encapsulated format of the specified data object - * and return it, but not set it. It will try to detect the format of the data object, - * deencapsulate it, detect again etc until it cannot deencapsulate further. + * and return it, but not set it. It will try to deencapsulate it, detect it, + * deencapuslate it again etc until it cannot deencapsulate further. * * @param env The conversion environment to use * @param input The data object to detect |