|
From: Chris F. <cd...@fo...> - 2010-08-30 21:01:48
|
---
Just a quick patch to get the xsltformat plugin to compile
against latest opensync.
- Chris
src/xsltformat.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/xsltformat.c b/src/xsltformat.c
index b851b17..2b99e2d 100644
--- a/src/xsltformat.c
+++ b/src/xsltformat.c
@@ -45,7 +45,7 @@ static osync_bool conv_xslt_to_contact(char *input, unsigned int inpsize, char *
if ((result = xslt_transform(converter, input)))
goto exit;
- if (!(*output = strdup(converter->xml_str)))
+ if (!(*output = strdup((char*)converter->xml_str)))
goto exit;
*free_input = TRUE;
@@ -68,7 +68,7 @@ static osync_bool conv_contact_to_xslt(char *input, unsigned int inpsize, char *
if ((result = xslt_transform(converter, input)))
goto exit;
- if (!(*output = strdup(converter->xml_str)))
+ if (!(*output = strdup((char*)converter->xml_str)))
goto exit;
*free_input = TRUE;
@@ -83,13 +83,14 @@ exit:
}
+/*
static void destroy_format1(char *input, unsigned int inpsize, void *user_data)
{
- /*
- * Here you have to free the data allocated by your format
- *
- */
+ //
+ // Here you have to free the data allocated by your format
+ //
}
+*/
osync_bool get_format_info(OSyncFormatEnv *env, OSyncError **error)
{
@@ -97,7 +98,8 @@ osync_bool get_format_info(OSyncFormatEnv *env, OSyncError **error)
if (!format)
return FALSE;
- osync_format_env_register_objformat(env, format);
+ if( !osync_format_env_register_objformat(env, format, error) )
+ return FALSE;
osync_objformat_unref(format);
return TRUE;
@@ -118,15 +120,15 @@ void *initialize_xslt(const char* config, OSyncError **error)
}
-void finalize_xslt(void *userdata)
+static osync_bool finalize_xslt(void *userdata, OSyncError **error)
{
struct xslt_resources *converter = NULL;
if (!userdata)
- return;
+ return FALSE;
converter = (struct xslt_resources *)userdata;
xslt_delete(converter);
-
+ return TRUE;
}
static osync_bool reg_conv(OSyncFormatEnv *env,
@@ -140,15 +142,22 @@ static osync_bool reg_conv(OSyncFormatEnv *env,
from, to,
convert_func, &error);
if (!conv)
- return FALSE;
+ goto error;
osync_converter_set_initialize_func(conv, initialize_func);
osync_converter_set_finalize_func(conv, finalize_func);
- osync_format_env_register_converter(env, conv);
+ if( !osync_format_env_register_converter(env, conv, &error) )
+ goto error;
osync_converter_unref(conv);
return TRUE;
+error:
+ if( conv )
+ osync_converter_unref(conv);
+ osync_trace(TRACE_INTERNAL, "%s", osync_error_print(&error));
+ osync_error_unref(&error);
+ return FALSE;
}
osync_bool get_conversion_info(OSyncFormatEnv *env, OSyncError **error)
--
1.7.0.3
|