You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <dg...@su...> - 2009-01-19 20:57:19
|
Author: savago Date: Mon Jan 19 21:56:21 2009 New Revision: 5198 URL: http://www.opensync.org/changeset/5198 Log: Starting to implement initialize function for xslt plugin, for while I commented out some code just to make it compile. Modified: format-plugins/xsltformat/src/xsltformat.c Modified: format-plugins/xsltformat/src/xsltformat.c ============================================================================== --- format-plugins/xsltformat/src/xsltformat.c Mon Jan 19 21:45:20 2009 (r5197) +++ format-plugins/xsltformat/src/xsltformat.c Mon Jan 19 21:56:21 2009 (r5198) @@ -64,7 +64,7 @@ return OSYNC_CONV_DATA_MISMATCH; } -static osync_bool conv_format1_to_format2(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) +static osync_bool conv_xslt_to_contact(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) { /* * This function can be used to convert your format to another format. @@ -104,7 +104,7 @@ return TRUE; } -static osync_bool conv_format2_to_format1(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) +static osync_bool conv_contact_to_xslt(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) { /* * This function can be used to convert another format to your format. @@ -179,8 +179,9 @@ * If you return the converter specific data, it is passed * to the conversion and detector function as void *userdata */ - format_data *userdata = osync_try_malloc0(sizeof(format_data), error); +/* format_data *userdata = osync_try_malloc0(sizeof(format_data), error); return (void*)userdata; +*/ } void finalize(void *userdata) @@ -188,42 +189,43 @@ /* * Here you can free all your converter specific data. */ - format_data *formatdata =(format_data*)userdata; +/* format_data *formatdata =(format_data*)userdata; g_free(formatdata->data); g_free(formatdata); +*/ } osync_bool get_conversion_info(OSyncFormatEnv *env, OSyncError **error) { - /* - * Here you have to give opensync some information about your format - * This function will be called directly after the plugin has been loaded - * to get converters that convert between different formats - */ - - OSyncObjFormat *format1 = osync_format_env_find_objformat(env, "<your format name>"); - if (!format1) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find <your format name> format"); + /* Supported formats */ + OSyncObjFormat *xslt_contact = osync_format_env_find_objformat(env, "xslt-contact"); + if (!xslt_contact) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find xslt-contact" + " format"); return FALSE; } - OSyncObjFormat *format2 = osync_format_env_find_objformat(env, "xmlformat-contact"); - if (!format2) { + OSyncObjFormat *xml_contact = osync_format_env_find_objformat(env, "xmlformat-contact"); + if (!xml_contact) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find xmlformat-contact format"); return FALSE; } - OSyncFormatConverter *conv = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, conv_format1_to_format2, error); + /* XSLT to xml-contact */ + OSyncFormatConverter *conv = osync_converter_new(OSYNC_CONVERTER_CONV, + xslt_contact, xml_contact, + conv_xslt_to_contact, error); if (!conv) return FALSE; - /* set init and finalize functions */ osync_converter_set_initialize_func(conv, initialize); osync_converter_set_finalize_func(conv, finalize); - /* register converter */ osync_format_env_register_converter(env, conv); osync_converter_unref(conv); - conv = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format1, conv_format2_to_format1, error); + /* xml-contact to XSLT */ + conv = osync_converter_new(OSYNC_CONVERTER_CONV, + xml_contact, xslt_contact, + conv_contact_to_xslt, error); if (!conv) return FALSE; /* e.g. this converter doesn't need init and finalize functions therefore don't set them */ |
From: <dg...@su...> - 2009-01-19 20:46:25
|
Author: savago Date: Mon Jan 19 21:45:20 2009 New Revision: 5197 URL: http://www.opensync.org/changeset/5197 Log: Putting copyright notes and removing annoying empty spaces. Modified: format-plugins/xsltformat/src/xsltformat.c Modified: format-plugins/xsltformat/src/xsltformat.c ============================================================================== --- format-plugins/xsltformat/src/xsltformat.c Mon Jan 19 21:07:37 2009 (r5196) +++ format-plugins/xsltformat/src/xsltformat.c Mon Jan 19 21:45:20 2009 (r5197) @@ -1,13 +1,37 @@ /* - * Here you can specify a format plugin if you like. - * You should use a format plugin, if the format conversion - * is rather difficult or if other plugins might be able to reuse - * your conversion. A format plugin can create new formats in get_format_info - * and provide converters between different formats in get_conversion_info - * + * Copyright (C) 2009 Daniel Gollub <dg...@su...> + * Copyright (C) 2009 Instituto Nokia de Tecnologia + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * */ + +/** + * @file xsltformat.c + * @author Adenilson Cavalcanti da Silva <ade...@in...> + * + * @brief A generic xslt format plugin. + * + * \todo: + * - make the convertion (should be easy thanks to xslt_aux functions) + * + */ + #include <opensync/opensync.h> #include <opensync/opensync-format.h> +#include "xslt_aux.h" static OSyncConvCmpResult compare_format1(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize) { @@ -15,27 +39,27 @@ * This function can be used to compare two types of your formats. * This is optional. For example, you can only provide a conversion * from and to the xml format and let all the comparison be done there - * + * */ /* * Compare your objects here. You might need to cast the data of the change * objects to you own defined types. - * + * * The possible result of the comparison are: - * + * * return OSYNC_CONV_DATA_SAME; * The objects are exactly the same. (they might differ in some uid or * timestamp though, but ALL the "real" information is the same) - * + * * return OSYNC_CONV_DATA_SIMILAR; * The objects are not _exactly_ the same, but they look similar. This is used * to detect conflicts. It is up to you to decide what "similar" means for your * object - * + * * return OSYNC_CONV_DATA_MISMATCH; * This means the objects are not the same and not similar. - * + * */ return OSYNC_CONV_DATA_MISMATCH; } @@ -46,37 +70,37 @@ * This function can be used to convert your format to another format. * Return TRUE if the conversion was successful or return FALSE and set * the error if something bad has happend. - * + * */ - + /* The arguments mean: - * + * * - conv_data: * Pointer to the data you returned in your init function (if any) - * + * * - input: * The data you need to convert * - inpsize * The size of the input data - * + * * - output: * After converting you need to set this * to your result * - outpsize: * The size of the output - * + * * - free_input: * You need to set this to TRUE if opensync * can free the input after the conversion (so you dont * use any reference from or to the input). A example where * *free_input = FALSE; needs to be done would be a encapsulator * that stores the input reference somewhere in its struct - * + * * - error: * if something bad happens and you cannot convert, set the error! - * + * */ - + return TRUE; } @@ -86,9 +110,9 @@ * This function can be used to convert another format to your format. * Return TRUE if the conversion was successful or return FALSE and set * the error if something bad has happend. - * + * */ - + return TRUE; } @@ -96,7 +120,7 @@ { /* * Here you have to free the data allocated by your format - * + * */ } @@ -107,9 +131,9 @@ * Duplication does not mean to make 2 objects out of one, * but to change to uid of the object in such a way that it * differes from the original uid. - * + * * Most format will never need this. - * + * */ return TRUE; @@ -122,15 +146,15 @@ * you have to return a human readable string here describing the object * as closely as possible. This information will be used by the user to decide * which object to pick in a conflict. - * + * */ return NULL; } osync_bool get_format_info(OSyncFormatEnv *env, OSyncError **error) { - /* - * this function is called to register a new format + /* + * this function is called to register a new format */ OSyncObjFormat *format = osync_objformat_new("<your format name>", "<some object type>", error); if (!format) @@ -176,7 +200,7 @@ * This function will be called directly after the plugin has been loaded * to get converters that convert between different formats */ - + OSyncObjFormat *format1 = osync_format_env_find_objformat(env, "<your format name>"); if (!format1) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find <your format name> format"); @@ -198,7 +222,7 @@ /* register converter */ osync_format_env_register_converter(env, conv); osync_converter_unref(conv); - + conv = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format1, conv_format2_to_format1, error); if (!conv) return FALSE; |
From: <dg...@su...> - 2009-01-19 20:08:42
|
Author: savago Date: Mon Jan 19 21:07:37 2009 New Revision: 5196 URL: http://www.opensync.org/changeset/5196 Log: Fixing YASF (Yet Another SegFault): when retrieving the anchor, the osync_error need to point to a valid address. Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:54:25 2009 (r5195) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 21:07:37 2009 (r5196) @@ -211,7 +211,7 @@ int result = 0, i; char *timestamp = NULL, *msg, *raw_xml = NULL; gcal_event event; - OSyncError *anchor_error; + OSyncError *anchor_error = NULL; if (!(plgdata->gcal_sink = osync_plugin_info_get_sink(info))) goto error; @@ -361,7 +361,7 @@ int result = 0, i; char *timestamp = NULL, *msg, *raw_xml = NULL; gcal_contact contact; - OSyncError *anchor_error; + OSyncError *anchor_error = NULL; if (!(plgdata->gcont_sink = osync_plugin_info_get_sink(info))) goto error; |
From: <dg...@su...> - 2009-01-19 18:55:27
|
Author: savago Date: Mon Jan 19 19:54:25 2009 New Revision: 5195 URL: http://www.opensync.org/changeset/5195 Log: Reporting error properly when loading xslt stylesheets fails in connect. This stops sync process to proceed any further. Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:46:17 2009 (r5194) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:54:25 2009 (r5195) @@ -191,7 +191,9 @@ return; error: - osync_trace(TRACE_INTERNAL, "\nGood bye, cruel world...\n"); + osync_trace(TRACE_INTERNAL, "Failed to load xslt stylesheet!\n"); + osync_error_set(&error, OSYNC_ERROR_GENERIC, + "Unable load xslt stylesheet data."); osync_context_report_osyncerror(ctx, &error); } |
From: <dg...@su...> - 2009-01-19 18:47:17
|
Author: savago Date: Mon Jan 19 19:46:17 2009 New Revision: 5194 URL: http://www.opensync.org/changeset/5194 Log: Fixing memory leak (returned anchor needs to be cleaned up). Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:28:22 2009 (r5193) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:46:17 2009 (r5194) @@ -218,14 +218,15 @@ timestamp = osync_anchor_retrieve(osync_objtype_sink_get_anchor(plgdata->gcal_sink), &anchor_error); + if (!timestamp) { + msg = "gcalendar: Anchor returned is NULL!"; + goto error; + } + if (strlen(timestamp) > 0) osync_trace(TRACE_INTERNAL, "timestamp is: %s\n", timestamp); - else { - if (timestamp) - free(timestamp); - timestamp = NULL; + else osync_trace(TRACE_INTERNAL, "first sync!\n"); - } if (osync_objtype_sink_get_slowsync(plgdata->gcal_sink)) { osync_trace(TRACE_INTERNAL, "\n\t\tgcal: Client asked for slow syncing...\n"); @@ -328,11 +329,15 @@ osync_trace(TRACE_INTERNAL, "\ndone calendar: %s\n", buffer); exit: + /* osync_anchor_retrieve uses osync_strdup */ + osync_free(timestamp); osync_context_report_success(ctx); return; cleanup: osync_error_unref(&error); + /* osync_anchor_retrieve uses osync_strdup */ + osync_free(timestamp); error: osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); @@ -364,14 +369,15 @@ timestamp = osync_anchor_retrieve(osync_objtype_sink_get_anchor(plgdata->gcont_sink), &anchor_error); + if (!timestamp) { + msg = "gcontact: Anchor returned is NULL!"; + goto error; + } + if (strlen(timestamp) > 0) osync_trace(TRACE_INTERNAL, "timestamp is: %s\n", timestamp); - else { - if (timestamp) - free(timestamp); - timestamp = NULL; + else osync_trace(TRACE_INTERNAL, "first sync!\n"); - } if (osync_objtype_sink_get_slowsync(plgdata->gcont_sink)) { osync_trace(TRACE_INTERNAL, "\n\t\tgcont: Client asked for slow syncing...\n"); @@ -475,11 +481,15 @@ osync_trace(TRACE_INTERNAL, "\ndone contact: %s\n", buffer); exit: + /* osync_anchor_retrieve uses osync_strdup */ + osync_free(timestamp); osync_context_report_success(ctx); return; cleanup: osync_error_unref(&error); + /* osync_anchor_retrieve uses osync_strdup */ + osync_free(timestamp); error: osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); |
From: <dg...@su...> - 2009-01-19 18:29:30
|
Author: savago Date: Mon Jan 19 19:28:22 2009 New Revision: 5193 URL: http://www.opensync.org/changeset/5193 Log: Porting plugin functions to new set of parameter list introduced in r5158. Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:13:27 2009 (r5192) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:28:22 2009 (r5193) @@ -147,13 +147,13 @@ g_free(plgdata); } -static void gc_connect(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +static void gc_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); static int counter = 0; int result; struct gc_plgdata *plgdata = data; - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); + //OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); OSyncError *error = NULL; char buffer[512]; @@ -195,7 +195,8 @@ osync_context_report_osyncerror(ctx, &error); } -static void gc_get_changes_calendar(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +static void gc_get_changes_calendar(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, + osync_bool slow_sync, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); char buffer[512]; @@ -339,7 +340,8 @@ } -static void gc_get_changes_contact(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +static void gc_get_changes_contact(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, + osync_bool slow_sync, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); char buffer[512]; @@ -483,12 +485,12 @@ osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); } -static void gc_commit_change_calendar(void *data, OSyncPluginInfo *info, - OSyncContext *ctx, OSyncChange *change) +static void gc_commit_change_calendar(OSyncObjTypeSink *sink, OSyncPluginInfo *info, + OSyncContext *ctx, OSyncChange *change, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx, change); osync_trace(TRACE_INTERNAL, "hello, from calendar!\n"); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); + //OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); struct gc_plgdata *plgdata = data; gcal_event event = NULL; int size, result; @@ -698,11 +700,11 @@ osync_trace(TRACE_EXIT, "%s:%sHTTP code: %d", __func__, msg, result); } -static void gc_sync_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +static void gc_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); struct gc_plgdata *plgdata = data; - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); + //OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); OSyncError *anchor_error; if (plgdata->calendar && plgdata->cal_timestamp) { @@ -722,7 +724,7 @@ osync_context_report_success(ctx); } -static void gc_disconnect(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +static void gc_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); osync_context_report_success(ctx); |
From: <dg...@su...> - 2009-01-19 18:14:29
|
Author: savago Date: Mon Jan 19 19:13:27 2009 New Revision: 5192 URL: http://www.opensync.org/changeset/5192 Log: Removing commented code (trying to keep code clean and sane). Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:10:32 2009 (r5191) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:13:27 2009 (r5192) @@ -203,7 +203,6 @@ struct gc_plgdata *plgdata = data; char slow_sync_flag = 0; OSyncError *error = NULL; - /* OSyncXMLFormat *xmlformat; */ OSyncData *odata = NULL; OSyncChange *chg = NULL; int result = 0, i; @@ -287,22 +286,6 @@ goto error; raw_xml = plgdata->xslt_ctx_gcal->xml_str; - /* - xmlformat = osync_xmlformat_parse(raw_xml, - strlen(raw_xml), - &error); - if (!xmlformat) - goto error; - - osync_trace(TRACE_INTERNAL, "gevent: %s\nosync: %s\n", - gcal_event_get_xml(event), raw_xml); - - osync_xmlformat_sort(xmlformat); - odata = osync_data_new(xmlformat, - osync_xmlformat_size(), - plgdata->gcal_format, &error); - */ - odata = osync_data_new(raw_xml, strlen(raw_xml), plgdata->gcal_format, &error); @@ -349,7 +332,6 @@ cleanup: osync_error_unref(&error); - /* osync_xmlformat_unref(&xmlformat); */ error: osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); @@ -365,7 +347,6 @@ struct gc_plgdata *plgdata = data; char slow_sync_flag = 0; OSyncError *error = NULL; - /* OSyncXMLFormat *xmlformat; */ OSyncData *odata = NULL; OSyncChange *chg = NULL; int result = 0, i; @@ -451,23 +432,6 @@ goto error; raw_xml = plgdata->xslt_ctx_gcont->xml_str; - /* - xmlformat = osync_xmlformat_parse(raw_xml, - strlen(raw_xml), - &error); - if (!xmlformat) - goto error; - - osync_trace(TRACE_INTERNAL, "gcont: %s\nosync: %s\n", - gcal_contact_get_xml(contact), raw_xml); - - osync_xmlformat_sort(xmlformat); - - odata = osync_data_new(xmlformat, - osync_xmlformat_size(), - plgdata->gcont_format, &error); - */ - odata = osync_data_new(raw_xml, strlen(raw_xml), plgdata->gcont_format, &error); @@ -514,7 +478,6 @@ cleanup: osync_error_unref(&error); - /* osync_xmlformat_unref(&xmlformat); */ error: osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); @@ -531,28 +494,12 @@ int size, result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_event = NULL; OSyncData *odata = NULL; - /* OSyncXMLFormat *xmlformat = NULL; */ if (!(odata = osync_change_get_data(change))) { msg = "Cannot get raw data from change obj!\n"; goto error; } - //void osync_data_get_data(OSyncData *data, char **buffer, unsigned int *size) - /* - osync_data_get_data(odata, &xmlformat, &size); - if (!osync_xml) { - msg = "Failed getting xmlobj from change obj!\n"; - goto error; - } - - osync_xmlformat_assemble(xmlformat, &osync_xml, &size); - if (!osync_xml) { - msg = "Failed getting xml from xmlobj!\n"; - goto error; - } - */ - osync_data_get_data(odata, &osync_xml, &size); if (!osync_xml) { msg = "Failed getting xml from xmlobj!\n"; @@ -655,27 +602,12 @@ int size, result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_contact = NULL; OSyncData *odata = NULL; - /* OSyncXMLFormat *xmlformat = NULL; */ if (!(odata = osync_change_get_data(change))) { msg = "Cannot get raw data from change obj!\n"; goto error; } - /* - osync_data_get_data(odata, &xmlformat, &size); - if (!xmlformat) { - msg = "Failed getting xmlobj from change obj!\n"; - goto error; - } - - osync_xmlformat_assemble(xmlformat, &osync_xml, &size); - if (!osync_xml) { - msg = "Failed getting xml from xmlobj!\n"; - goto error; - } - */ - osync_data_get_data(odata, &osync_xml, &size); if (!osync_xml) { msg = "Failed getting xml from xmlobj!\n"; |
From: <dg...@su...> - 2009-01-19 18:11:33
|
Author: savago Date: Mon Jan 19 19:10:32 2009 New Revision: 5191 URL: http://www.opensync.org/changeset/5191 Log: Cleaning up some compiler warnings. This required to change the conversion order between formats from (change -> xmlobj -> string) to (change -> string), I'm not sure if the current logic is correct. Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 18:22:08 2009 (r5190) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 19:10:32 2009 (r5191) @@ -203,7 +203,7 @@ struct gc_plgdata *plgdata = data; char slow_sync_flag = 0; OSyncError *error = NULL; - OSyncXMLFormat *xmlformat; + /* OSyncXMLFormat *xmlformat; */ OSyncData *odata = NULL; OSyncChange *chg = NULL; int result = 0, i; @@ -287,6 +287,7 @@ goto error; raw_xml = plgdata->xslt_ctx_gcal->xml_str; + /* xmlformat = osync_xmlformat_parse(raw_xml, strlen(raw_xml), &error); @@ -300,6 +301,11 @@ odata = osync_data_new(xmlformat, osync_xmlformat_size(), plgdata->gcal_format, &error); + */ + + odata = osync_data_new(raw_xml, + strlen(raw_xml), + plgdata->gcal_format, &error); if (!odata) goto cleanup; @@ -343,7 +349,7 @@ cleanup: osync_error_unref(&error); - osync_xmlformat_unref(&xmlformat); + /* osync_xmlformat_unref(&xmlformat); */ error: osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); @@ -359,7 +365,7 @@ struct gc_plgdata *plgdata = data; char slow_sync_flag = 0; OSyncError *error = NULL; - OSyncXMLFormat *xmlformat; + /* OSyncXMLFormat *xmlformat; */ OSyncData *odata = NULL; OSyncChange *chg = NULL; int result = 0, i; @@ -443,7 +449,9 @@ if ((result = xslt_transform(plgdata->xslt_ctx_gcont, raw_xml))) goto error; + raw_xml = plgdata->xslt_ctx_gcont->xml_str; + /* xmlformat = osync_xmlformat_parse(raw_xml, strlen(raw_xml), &error); @@ -458,7 +466,11 @@ odata = osync_data_new(xmlformat, osync_xmlformat_size(), plgdata->gcont_format, &error); + */ + odata = osync_data_new(raw_xml, + strlen(raw_xml), + plgdata->gcont_format, &error); if (!odata) goto cleanup; @@ -502,7 +514,7 @@ cleanup: osync_error_unref(&error); - osync_xmlformat_unref(&xmlformat); + /* osync_xmlformat_unref(&xmlformat); */ error: osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); @@ -519,13 +531,15 @@ int size, result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_event = NULL; OSyncData *odata = NULL; - OSyncXMLFormat *xmlformat = NULL; + /* OSyncXMLFormat *xmlformat = NULL; */ if (!(odata = osync_change_get_data(change))) { msg = "Cannot get raw data from change obj!\n"; goto error; } + //void osync_data_get_data(OSyncData *data, char **buffer, unsigned int *size) + /* osync_data_get_data(odata, &xmlformat, &size); if (!osync_xml) { msg = "Failed getting xmlobj from change obj!\n"; @@ -537,6 +551,13 @@ msg = "Failed getting xml from xmlobj!\n"; goto error; } + */ + + osync_data_get_data(odata, &osync_xml, &size); + if (!osync_xml) { + msg = "Failed getting xml from xmlobj!\n"; + goto error; + } /* Convert to gdata format */ if ((result = xslt_transform(plgdata->xslt_ctx_gcal, osync_xml))) { @@ -634,13 +655,14 @@ int size, result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_contact = NULL; OSyncData *odata = NULL; - OSyncXMLFormat *xmlformat = NULL; + /* OSyncXMLFormat *xmlformat = NULL; */ if (!(odata = osync_change_get_data(change))) { msg = "Cannot get raw data from change obj!\n"; goto error; } + /* osync_data_get_data(odata, &xmlformat, &size); if (!xmlformat) { msg = "Failed getting xmlobj from change obj!\n"; @@ -651,6 +673,13 @@ if (!osync_xml) { msg = "Failed getting xml from xmlobj!\n"; goto error; + } + */ + + osync_data_get_data(odata, &osync_xml, &size); + if (!osync_xml) { + msg = "Failed getting xml from xmlobj!\n"; + goto error; } /* Convert to gdata format */ |
From: <dg...@su...> - 2009-01-19 17:40:35
|
Author: bellmich Date: Mon Jan 19 18:39:33 2009 New Revision: 173 URL: http://libwbxml.opensync.org/changeset/173 Log: fixed the datetime support for Wireless Village Modified: wbxml2/trunk/src/wbxml_encoder.c wbxml2/trunk/src/wbxml_parser.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Mon Jan 19 17:06:49 2009 (r172) +++ wbxml2/trunk/src/wbxml_encoder.c Mon Jan 19 18:39:33 2009 (r173) @@ -3155,9 +3155,9 @@ i++; } - WBXML_DEBUG((WBXML_CONV, "Starting WV datatime conversion ...")); + WBXML_DEBUG((WBXML_CONV, "Starting WV datetime conversion ...")); - /* Set Year - 10000000000 too long */ + /* Set Year */ component = wbxml_buffer_duplicate(tmp); if (!component) { error = WBXML_ERROR_NOT_ENOUGH_MEMORY; @@ -3166,7 +3166,7 @@ wbxml_buffer_delete(component, 4, 10); unsigned int year = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[5] = (WB_UTINY) (year & 0xfc0); /* 6 bits */ + octets[5] = (WB_UTINY) ((year & 0xfc0) >> 6); /* 6 bits */ octets[4] = (WB_UTINY) (year & 0x3f); /* 6 bits */ /* Set Month */ @@ -3180,7 +3180,7 @@ unsigned int month = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); octets[4] <<= 2; - octets[4] += (WB_UTINY) (month & 0xc); /* 2 bits */ + octets[4] += (WB_UTINY) ((month & 0xc) >> 2); /* 2 bits */ octets[3] = (WB_UTINY) (month & 0x3); /* 2 bits */ /* Set Day */ @@ -3207,8 +3207,8 @@ unsigned int hour = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); octets[3] <<=1; - octets[3] += (WB_UTINY) (hour & 0x1); /* 1 bit */ - octets[2] = (WB_UTINY) (hour & 0x1e); /* 4 bits */ + octets[3] += (WB_UTINY) ((hour & 0x10) >> 4); /* 1 bit */ + octets[2] = (WB_UTINY) (hour & 0xf); /* 4 bits */ /* Set Minute */ component = wbxml_buffer_duplicate(tmp); @@ -3221,7 +3221,7 @@ unsigned int minute = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); octets[2] <<=4; - octets[2] += (WB_UTINY) (minute & 0x3c); /* 4 bits */ + octets[2] += (WB_UTINY) ((minute & 0x3c) >> 2); /* 4 bits */ octets[1] = (WB_UTINY) (minute & 0x3); /* 2 bits */ /* Set Second */ @@ -3233,12 +3233,14 @@ wbxml_buffer_delete(component, 0, 12); unsigned int second = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[1] <<=4; + octets[1] <<=6; octets[1] += (WB_UTINY) (second & 0x3f); /* 6 bits */ /* Set Time Zone */ octets[0] = 0; + WBXML_DEBUG((WBXML_CONV, "WV datetime: %x %x %x %x %x %x", octets[5], octets[4], octets[3], octets[2], octets[1], octets[0])); + /* Encode it to Opaque */ ret = wbxml_encode_opaque_data(encoder, octets, 6); Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Mon Jan 19 17:06:49 2009 (r172) +++ wbxml2/trunk/src/wbxml_parser.c Mon Jan 19 18:39:33 2009 (r173) @@ -2771,39 +2771,39 @@ data_ptr = wbxml_buffer_get_cstr(*data); /* Get Year */ - the_value = (WB_ULONG) ((data_ptr[0] << 6) | ((data_ptr[1] >> 2) && 0x3F)); + the_value = (WB_ULONG) (((data_ptr[5] & 0x3F) << 6) + ((data_ptr[4] >> 2) & 0x3F)); sprintf(the_year, "%u", the_value); /* Get Month */ - the_value = (WB_ULONG) (((data_ptr[1] && 0x03) << 2) | ((data_ptr[2] >> 6) && 0x3F)); - sprintf(the_month, "%u", the_value); + the_value = (WB_ULONG) (((data_ptr[4] & 0x03) << 2) | ((data_ptr[3] >> 6) & 0x03)); + sprintf(the_month, "%02u", the_value); /* Get Day */ - the_value = (WB_ULONG) ((data_ptr[2] >> 1) && 0x1F); - sprintf(the_date, "%u", the_value); + the_value = (WB_ULONG) ((data_ptr[3] >> 1) & 0x1F); + sprintf(the_date, "%02u", the_value); /* Get Hour */ - the_value = (WB_ULONG) (((data_ptr[2] && 0x01) << 4) | ((data_ptr[3] >> 4) && 0x0F)); - sprintf(the_hour, "%u", the_value); + the_value = (WB_ULONG) (((data_ptr[3] & 0x01) << 4) | ((data_ptr[2] >> 4) & 0x0F)); + sprintf(the_hour, "%02u", the_value); /* Get Minute */ - the_value = (WB_ULONG) (((data_ptr[3] && 0x0F) << 2) | ((data_ptr[4] >> 6) && 0x03)); - sprintf(the_minute, "%u", the_value); + the_value = (WB_ULONG) (((data_ptr[2] & 0x0F) << 2) | ((data_ptr[1] >> 6) & 0x03)); + sprintf(the_minute, "%02u", the_value); /* Get Second */ - the_value = (WB_ULONG) (data_ptr[4] && 0x3F); - sprintf(the_second, "%u", the_value); + the_value = (WB_ULONG) (data_ptr[1] & 0x3F); + sprintf(the_second, "%02u", the_value); /* Get Time Zone */ - if (data_ptr[5] == 'Z') { + if (data_ptr[0] == 0) { sprintf((WB_TINY *) result, "%s%s%sT%s%s%sZ", - the_year, the_month, the_date, the_hour, the_minute, the_second); + the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : ""); } else { sprintf((WB_TINY *) result, "%s%s%sT%s%s%s", - the_year, the_month, the_date, the_hour, the_minute, the_second); + the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : ""); } /* Reset buffer */ |
From: <dg...@su...> - 2009-01-19 17:23:12
|
Author: savago Date: Mon Jan 19 18:22:08 2009 New Revision: 5190 URL: http://www.opensync.org/changeset/5190 Log: Fixing compiler error. Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jan 19 10:36:26 2009 (r5189) +++ plugins/google-calendar/src/gcalendar.c Mon Jan 19 18:22:08 2009 (r5190) @@ -211,7 +211,7 @@ gcal_event event; OSyncError *anchor_error; - if ((!plgdata->gcal_sink = osync_plugin_info_get_sink(info))) + if (!(plgdata->gcal_sink = osync_plugin_info_get_sink(info))) goto error; if (!(osync_objtype_sink_get_anchor(plgdata->gcal_sink))) goto error; |
From: <dg...@su...> - 2009-01-19 16:07:56
|
Author: bellmich Date: Mon Jan 19 17:06:49 2009 New Revision: 172 URL: http://libwbxml.opensync.org/changeset/172 Log: disabled DRMREL 1.0 tests because of the poor specification Modified: wbxml2/trunk/CMakeLists.txt Modified: wbxml2/trunk/CMakeLists.txt ============================================================================== --- wbxml2/trunk/CMakeLists.txt Mon Jan 19 17:05:27 2009 (r171) +++ wbxml2/trunk/CMakeLists.txt Mon Jan 19 17:06:49 2009 (r172) @@ -230,7 +230,13 @@ CONFIGURE_FILE( "tests/normalize_xml.pl" "${CMAKE_CURRENT_BINARY_DIR}/normalize_xml.pl" @ONLY) SET( airsync_tests 1 ) SET( ddf_tests 5 ) -SET( drmrel_tests 3 ) +# 2009-Jan-19 bellmich +# All DRMREL 1.0 tests are switched off. +# The background is the extremely bad specification. +# DRMREL 1.0 hardcodes the XML namespace translation. +# I never saw such a broken XML design before. +# +#SET( drmrel_tests 3 ) SET( emn_tests 17 ) SET( ota_tests 3 ) SET( prov_tests 8 ) @@ -238,8 +244,8 @@ SET( sl_tests 13 ) SET( syncml_tests 14 ) SET( wv_tests 105 ) -FOREACH( TESTDIR airsync ddf drmrel emn ota prov si sl syncml wv ) +FOREACH( TESTDIR airsync ddf emn ota prov si sl syncml wv ) FOREACH( ITEM RANGE 1 ${${TESTDIR}_tests} ) ADD_TEST( "${TESTDIR}_${ITEM}" launchTests.sh "${CMAKE_SOURCE_DIR}/tests" "${TESTDIR}" ${ITEM} ) ENDFOREACH( ITEM RANGE 1 ${${TESTDIR}_tests} ) -ENDFOREACH( TESTDIR airsync ddf drmrel emn ota prov si sl syncml wv ) +ENDFOREACH( TESTDIR airsync ddf emn ota prov si sl syncml wv ) |
From: <dg...@su...> - 2009-01-19 16:06:28
|
Author: bellmich Date: Mon Jan 19 17:05:27 2009 New Revision: 171 URL: http://libwbxml.opensync.org/changeset/171 Log: fixed CDATA handling Modified: wbxmlTestSuite/trunk/normalize_xml.pl Modified: wbxmlTestSuite/trunk/normalize_xml.pl ============================================================================== --- wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 17:04:57 2009 (r170) +++ wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 17:05:27 2009 (r171) @@ -158,6 +158,10 @@ $state = "COMMENT"; } elsif ($line =~ q{^\[CDATA\[}) { ## CDATA section detected + for (my $i = 0; $i < $indent; $i++) { + print $NEW_FD " "; + } + print $NEW_FD "<![CDATA["; $line =~ s{^\[CDATA\[}{}; $state = "CDATA"; } else { @@ -340,7 +344,7 @@ # handle CDATA if ($state eq "CDATA" and $char eq "]" and substr($line , 0, 2) eq "]>") { $line = substr($line, 2); - print $NEW_FD "]]>"; + print $NEW_FD "]]>\n"; $state = "NEUTRAL"; next; } |
From: <dg...@su...> - 2009-01-19 16:06:03
|
Author: bellmich Date: Mon Jan 19 17:04:57 2009 New Revision: 170 URL: http://libwbxml.opensync.org/changeset/170 Log: SyncML CDATA fix makes it sometimes impossible to check the result. Modified: wbxmlTestSuite/trunk/launchTests.sh Modified: wbxmlTestSuite/trunk/launchTests.sh ============================================================================== --- wbxmlTestSuite/trunk/launchTests.sh Mon Jan 19 15:14:02 2009 (r169) +++ wbxmlTestSuite/trunk/launchTests.sh Mon Jan 19 17:04:57 2009 (r170) @@ -158,6 +158,10 @@ if [ " $PERL_BIN" = " " -o " $DIFF_BIN" = " " ] then echo UNSUPPORTED + else if [ `basename $j` = "syncml-012.xml" -o `basename $j` = "syncml-013.xml" ] + then + # SyncML CDATA fix makes comparing sometimes impossible + echo IMPOSSIBLE else $PERL_BIN $NORMALIZE_SCRIPT --delete-attribute xmlns $j $OUT_XML.org $PERL_BIN $NORMALIZE_SCRIPT --delete-attribute xmlns $OUT_XML $OUT_XML.new @@ -169,7 +173,7 @@ else echo SUCCEEDED fi - fi + fi fi done fi |
From: <dg...@su...> - 2009-01-19 14:15:06
|
Author: bellmich Date: Mon Jan 19 15:14:02 2009 New Revision: 169 URL: http://libwbxml.opensync.org/changeset/169 Log: fixed typo Modified: wbxml2/trunk/src/wbxml_conv.c wbxml2/trunk/src/wbxml_conv.h wbxml2/trunk/src/wbxml_tree.c Modified: wbxml2/trunk/src/wbxml_conv.c ============================================================================== --- wbxml2/trunk/src/wbxml_conv.c Mon Jan 19 15:08:14 2009 (r168) +++ wbxml2/trunk/src/wbxml_conv.c Mon Jan 19 15:14:02 2009 (r169) @@ -62,7 +62,7 @@ /* Parse WBXML to WBXML Tree */ ret = wbxml_tree_from_wbxml(wbxml, wbxml_len, params ? params->lang : WBXML_LANG_UNKNOWN, &wbxml_tree); if (ret != WBXML_OK) { - WBXML_ERROR((WBXML_CONV, "wbxml2xml convertion failed - WBXML Parser Error: %s", + WBXML_ERROR((WBXML_CONV, "wbxml2xml conversion failed - WBXML Parser Error: %s", wbxml_errors_string(ret))); return ret; @@ -71,7 +71,7 @@ /* Convert Tree to XML */ ret = wbxml_tree_to_xml(wbxml_tree, xml, xml_len, params); if (ret != WBXML_OK) { - WBXML_ERROR((WBXML_CONV, "wbxml2xml convertion failed - WBXML Encoder Error: %s", + WBXML_ERROR((WBXML_CONV, "wbxml2xml conversion failed - WBXML Encoder Error: %s", wbxml_errors_string(ret))); } @@ -102,7 +102,7 @@ /* Parse XML to WBXML Tree */ ret = wbxml_tree_from_xml(xml, xml_len, &wbxml_tree); if (ret != WBXML_OK) { - WBXML_ERROR((WBXML_CONV, "xml2wbxml convertion failed - Error: %s", + WBXML_ERROR((WBXML_CONV, "xml2wbxml conversion failed - Error: %s", wbxml_errors_string(ret))); return ret; @@ -111,7 +111,7 @@ /* Convert Tree to WBXML */ ret = wbxml_tree_to_wbxml(wbxml_tree, wbxml, wbxml_len, params); if (ret != WBXML_OK) { - WBXML_ERROR((WBXML_CONV, "xml2wbxml convertion failed - WBXML Encoder Error: %s", + WBXML_ERROR((WBXML_CONV, "xml2wbxml conversion failed - WBXML Encoder Error: %s", wbxml_errors_string(ret))); } Modified: wbxml2/trunk/src/wbxml_conv.h ============================================================================== --- wbxml2/trunk/src/wbxml_conv.h Mon Jan 19 15:08:14 2009 (r168) +++ wbxml2/trunk/src/wbxml_conv.h Mon Jan 19 15:14:02 2009 (r169) @@ -62,7 +62,7 @@ * @param xml [out] Resulting XML Document * @param xml_len [out] XML Document length * @param params [in] Parameters (if NULL, default values are used) - * @return WBXML_OK if convertion succeeded, an Error Code otherwise + * @return WBXML_OK if conversion succeeded, an Error Code otherwise */ WBXML_DECLARE(WBXMLError) wbxml_conv_wbxml2xml_withlen(WB_UTINY *wbxml, WB_ULONG wbxml_len, @@ -88,7 +88,7 @@ * @param wbxml [out] Resulting WBXML Document * @param wbxml_len [out] Length of resulting WBXML Document * @param params [in] Parameters (if NULL, default values are used) - * @return WBXML_OK if convertion succeeded, an Error Code otherwise + * @return WBXML_OK if conversion succeeded, an Error Code otherwise */ WBXML_DECLARE(WBXMLError) wbxml_conv_xml2wbxml_withlen(WB_UTINY *xml, WB_ULONG xml_len, Modified: wbxml2/trunk/src/wbxml_tree.c ============================================================================== --- wbxml2/trunk/src/wbxml_tree.c Mon Jan 19 15:08:14 2009 (r168) +++ wbxml2/trunk/src/wbxml_tree.c Mon Jan 19 15:14:02 2009 (r169) @@ -235,7 +235,7 @@ /* Parse the XML Document to WBXML Tree */ if (XML_Parse(xml_parser, (WB_TINY*) xml, xml_len, TRUE) == 0) { - WBXML_ERROR((WBXML_CONV, "xml2wbxml convertion failed - expat error %i\n" + WBXML_ERROR((WBXML_CONV, "xml2wbxml conversion failed - expat error %i\n" "\tdescription: %s\n" "\tline: %i\n" "\tcolumn: %i\n" |
From: <dg...@su...> - 2009-01-19 14:09:18
|
Author: bellmich Date: Mon Jan 19 15:08:14 2009 New Revision: 168 URL: http://libwbxml.opensync.org/changeset/168 Log: disable string tables if they are not necessary Modified: wbxmlTestSuite/trunk/launchTests.sh Modified: wbxmlTestSuite/trunk/launchTests.sh ============================================================================== --- wbxmlTestSuite/trunk/launchTests.sh Mon Jan 19 15:03:54 2009 (r167) +++ wbxmlTestSuite/trunk/launchTests.sh Mon Jan 19 15:08:14 2009 (r168) @@ -129,7 +129,11 @@ # XML ==> WBXML echo Converting into: $OUT_WBXML - CMD="$XML2WBXML -n -o $OUT_WBXML $j" + if [ "$TESTDIR" != "ota" -a "$TESTDIR" != "airsync" ]; then + # disable string tables if they are not really necessary + NO_STR_TBL="-n"; + fi + CMD="$XML2WBXML $NO_STR_TBL -o $OUT_WBXML $j" $CMD if [ $? != 0 ]; then RESULT="FAILED"; fi |
From: <dg...@su...> - 2009-01-19 14:04:56
|
Author: bellmich Date: Mon Jan 19 15:03:54 2009 New Revision: 167 URL: http://libwbxml.opensync.org/changeset/167 Log: added support for CDATA Modified: wbxmlTestSuite/trunk/normalize_xml.pl Modified: wbxmlTestSuite/trunk/normalize_xml.pl ============================================================================== --- wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 15:02:52 2009 (r166) +++ wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 15:03:54 2009 (r167) @@ -151,12 +151,19 @@ $char = substr($line, 0, 1); $line = substr($line, 1); if ($char eq "!") { - ## this should be a comment - $char = substr($line, 0, 2); - die "A comment must always start with '<!--' and not with '<!${char}'." - if ($char ne "--"); - $line = substr($line, 2); - $state = "COMMENT"; + if ($line =~ q{^--}) { + ## this should be a comment + $char = substr($line, 0, 2); + $line = substr($line, 2); + $state = "COMMENT"; + } elsif ($line =~ q{^\[CDATA\[}) { + ## CDATA section detected + $line =~ s{^\[CDATA\[}{}; + $state = "CDATA"; + } else { + die "Only comments and CDATA sections are supported and not with '<!${line}'." + if ($char ne "--"); + } } elsif ($char =~ q{[a-zA-Z]}) { ## this is an element for (my $i = 0; $i < $indent; $i++) { @@ -330,6 +337,17 @@ next; } + # handle CDATA + if ($state eq "CDATA" and $char eq "]" and substr($line , 0, 2) eq "]>") { + $line = substr($line, 2); + print $NEW_FD "]]>"; + $state = "NEUTRAL"; + next; + } + if ($state eq "CDATA") { + print $NEW_FD $char; + next; + } }; # close files |
From: <dg...@su...> - 2009-01-19 14:03:53
|
Author: bellmich Date: Mon Jan 19 15:02:52 2009 New Revision: 166 URL: http://libwbxml.opensync.org/changeset/166 Log: A private DTD and a private PUBLIC ID are nearly useless. They are lost if WBXML is used for OTA. Modified: wbxmlTestSuite/trunk/ota/ota-003.xml Modified: wbxmlTestSuite/trunk/ota/ota-003.xml ============================================================================== --- wbxmlTestSuite/trunk/ota/ota-003.xml Mon Jan 19 14:58:40 2009 (r165) +++ wbxmlTestSuite/trunk/ota/ota-003.xml Mon Jan 19 15:02:52 2009 (r166) @@ -1,9 +1,16 @@ <?xml version="1.0"?> +<!-- + A DTD on localhost is nearly useless. + After a conversion to and from wbxml this information is completely lost. + I commented this DOCTYPE because the result is always a default DOCTYPE. + <!DOCTYPE CHARACTERISTIC-LIST PUBLIC "-//WAPFORUM//DTD NOKIA-OTA 1.0//EN" "http://localhost:8080/OMABootSendWEB/DTD/characteristic_list.dtd"> +--> +<!DOCTYPE CHARACTERISTIC-LIST SYSTEM "characteristic-list.dtd"> <CHARACTERISTIC-LIST> <CHARACTERISTIC TYPE="BOOKMARK"> <PARM NAME="NAME" VALUE="TV2"/> <PARM NAME="URL" VALUE="http://wap.tv2.dk"/> <PARM NAME="ICON" VALUE="R0lGODlhIAAgAPMAAP//AP8zAMwAAJkAAGYAAN0AAKoAAIgAAHcAAFUAAEQAACIAABEAALu7u8jIyP8AMyH5BAEAAA4ALAAAAAAgACAAQATh0MlJq704Z8bkucyiJARyHEM6HAjCNJw2hWNpnmdLJMrSyUBMICApAAqbhUiheDVgicQg8dPQSKaBQVAQGFaIXa8KDC2ZaCU5yL4QPe3yoXAIfDacfJVBZV9JNi16fWUiWChbAl5gBAxjMlclKFoGX4w8PkF/BJydO5hrbXp5caUYd6YycwVvqRY4R64goa4dMRKtGBxKaqNShIVMUSUcTwxTtCCGnC04LMWkkMtZlJbPMLdJNVlbXV8sYplW04iKi+Cg0tvUKixh6eqALfM64cnKwlH6PI+mu7y8sskaCMFFADs="/> </CHARACTERISTIC> -</CHARACTERISTIC-LIST> \ No newline at end of file +</CHARACTERISTIC-LIST> |
From: <dg...@su...> - 2009-01-19 13:59:41
|
Author: bellmich Date: Mon Jan 19 14:58:40 2009 New Revision: 165 URL: http://libwbxml.opensync.org/changeset/165 Log: If the is no PUBLIC ID then we can print SYSTEM or PUBLIC "" I used SYSTEM now to express the missing PUBLIC ID. Modified: wbxml2/trunk/src/wbxml_encoder.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Mon Jan 19 13:59:01 2009 (r164) +++ wbxml2/trunk/src/wbxml_encoder.c Mon Jan 19 14:58:40 2009 (r165) @@ -330,8 +330,10 @@ /* XML Header Macros */ #define WBXML_ENCODER_XML_HEADER "<?xml version=\"1.0\"?>" #define WBXML_ENCODER_XML_DOCTYPE "<!DOCTYPE " -#define WBXML_ENCODER_XML_PUBLIC " PUBLIC \"" -#define WBXML_ENCODER_XML_DTD "\" \"" +#define WBXML_ENCODER_XML_PUBLIC_START " PUBLIC \"" +#define WBXML_ENCODER_XML_PUBLIC_END "\"" +#define WBXML_ENCODER_XML_SYSTEM " SYSTEM" +#define WBXML_ENCODER_XML_DTD " \"" #define WBXML_ENCODER_XML_END_DTD "\">" /* Global vars for XML Normalization */ @@ -3957,13 +3959,25 @@ if (!wbxml_buffer_append_cstr(header, encoder->lang->publicID->xmlRootElt)) return WBXML_ERROR_ENCODER_APPEND_DATA; - /* PUBLIC " */ - if (!wbxml_buffer_append_cstr(header, WBXML_ENCODER_XML_PUBLIC)) - return WBXML_ERROR_ENCODER_APPEND_DATA; + if (encoder->lang->publicID->xmlPublicID && + WBXML_STRLEN(encoder->lang->publicID->xmlPublicID)) { - /* Public ID */ - if (!wbxml_buffer_append_cstr(header, encoder->lang->publicID->xmlPublicID)) - return WBXML_ERROR_ENCODER_APPEND_DATA; + /* PUBLIC " */ + if (!wbxml_buffer_append_cstr(header, WBXML_ENCODER_XML_PUBLIC_START)) + return WBXML_ERROR_ENCODER_APPEND_DATA; + + /* Public ID */ + if (!wbxml_buffer_append_cstr(header, encoder->lang->publicID->xmlPublicID)) + return WBXML_ERROR_ENCODER_APPEND_DATA; + + /* " */ + if (!wbxml_buffer_append_cstr(header, WBXML_ENCODER_XML_PUBLIC_END)) + return WBXML_ERROR_ENCODER_APPEND_DATA; + } else { + /* SYSTEM */ + if (!wbxml_buffer_append_cstr(header, WBXML_ENCODER_XML_SYSTEM)) + return WBXML_ERROR_ENCODER_APPEND_DATA; + } /* DTD */ if (!wbxml_buffer_append_cstr(header, WBXML_ENCODER_XML_DTD)) |
From: <dg...@su...> - 2009-01-19 13:04:08
|
Author: bellmich Date: Mon Jan 19 13:02:53 2009 New Revision: 159 URL: http://libwbxml.opensync.org/changeset/159 Log: Every CTType can only be configured once for SyncML 1.1. Modified: wbxmlTestSuite/trunk/syncml/syncml-004.xml Modified: wbxmlTestSuite/trunk/syncml/syncml-004.xml ============================================================================== --- wbxmlTestSuite/trunk/syncml/syncml-004.xml Fri Jan 16 13:58:40 2009 (r158) +++ wbxmlTestSuite/trunk/syncml/syncml-004.xml Mon Jan 19 13:02:53 2009 (r159) @@ -94,18 +94,6 @@ <ParamName>VOICE</ParamName> <ParamName>FAX</ParamName> <ParamName>CELL</ParamName> - <CTType>text/vcard</CTType> - <PropName>BEGIN</PropName> - <ValEnum>VCARD</ValEnum> - <PropName>END</PropName> - <ValEnum>VCARD</ValEnum> - <PropName>VERSION</PropName> - <ValEnum>3.0</ValEnum> - <PropName>N</PropName> - <PropName>TEL</PropName> - <ParamName>VOICE</ParamName> - <ParamName>FAX</ParamName> - <ParamName>CELL</ParamName> </CTCap> <SyncCap> <SyncType>01</SyncType> |
From: <dg...@su...> - 2009-01-19 13:00:04
|
Author: bellmich Date: Mon Jan 19 13:59:01 2009 New Revision: 164 URL: http://libwbxml.opensync.org/changeset/164 Log: normalize elements of the format <element_name/> Modified: wbxmlTestSuite/trunk/normalize_xml.pl Modified: wbxmlTestSuite/trunk/normalize_xml.pl ============================================================================== --- wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 13:40:30 2009 (r163) +++ wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 13:59:01 2009 (r164) @@ -164,6 +164,7 @@ } $indent++; print $NEW_FD "<".$char; + $element = $char; $state = "ELEMENT"; } elsif ($char eq "/") { ## this is a closing element @@ -237,6 +238,7 @@ # read element name if ($state eq "ELEMENT" and $char =~ q{[a-zA-Z0-9_]}) { print $NEW_FD $char; + $element .= $char; next; } @@ -306,8 +308,16 @@ if (($state eq "ELEMENT" or $state eq "POTENTIAL_ATTRIBUTE") and $char eq "/") { - print $NEW_FD "/"; + # consume the closing ">" and add the complete closing tag + $char = ">"; + $line =~ s{^\s*>}{}; $indent--; + print $NEW_FD ">\n"; + for (my $i = 0; $i < $indent; $i++) { + print $NEW_FD " "; + } + print $NEW_FD "</${element}>\n"; + $state = "NEUTRAL"; next; } |
From: <dg...@su...> - 2009-01-19 12:47:37
|
Author: bellmich Date: Mon Jan 19 13:27:43 2009 New Revision: 161 URL: http://libwbxml.opensync.org/changeset/161 Log: revert commit r160 Modified: wbxmlTestSuite/trunk/syncml/syncml-004.xml Modified: wbxmlTestSuite/trunk/syncml/syncml-004.xml ============================================================================== --- wbxmlTestSuite/trunk/syncml/syncml-004.xml Mon Jan 19 13:26:22 2009 (r160) +++ wbxmlTestSuite/trunk/syncml/syncml-004.xml Mon Jan 19 13:27:43 2009 (r161) @@ -55,15 +55,19 @@ <DisplayName>Addressbook</DisplayName> <Rx-Pref> <CTType>text/x-vcard </CTType> + <VerCT>2.1</VerCT> </Rx-Pref> <Rx> <CTType>text/vcard </CTType> + <VerCT>3.0</VerCT> </Rx> <Tx-Pref> <CTType>text/x-vcard</CTType> + <VerCT>2.1</VerCT> </Tx-Pref> <Tx> <CTType>text/vcard</CTType> + <VerCT>3.0</VerCT> </Tx> </DataStore> <CTCap> |
From: <dg...@su...> - 2009-01-19 12:47:35
|
Author: bellmich Date: Mon Jan 19 13:26:22 2009 New Revision: 160 URL: http://libwbxml.opensync.org/changeset/160 Log: SyncML 1.0 and 1.1 does not support VerCT in CTCap. Modified: wbxmlTestSuite/trunk/syncml/syncml-004.xml Modified: wbxmlTestSuite/trunk/syncml/syncml-004.xml ============================================================================== --- wbxmlTestSuite/trunk/syncml/syncml-004.xml Mon Jan 19 13:02:53 2009 (r159) +++ wbxmlTestSuite/trunk/syncml/syncml-004.xml Mon Jan 19 13:26:22 2009 (r160) @@ -55,19 +55,15 @@ <DisplayName>Addressbook</DisplayName> <Rx-Pref> <CTType>text/x-vcard </CTType> - <VerCT>2.1</VerCT> </Rx-Pref> <Rx> <CTType>text/vcard </CTType> - <VerCT>3.0</VerCT> </Rx> <Tx-Pref> <CTType>text/x-vcard</CTType> - <VerCT>2.1</VerCT> </Tx-Pref> <Tx> <CTType>text/vcard</CTType> - <VerCT>3.0</VerCT> </Tx> </DataStore> <CTCap> |
From: <dg...@su...> - 2009-01-19 12:41:31
|
Author: bellmich Date: Mon Jan 19 13:40:30 2009 New Revision: 163 URL: http://libwbxml.opensync.org/changeset/163 Log: normalize trailing spaces at the end of lines with character data (text) Modified: wbxmlTestSuite/trunk/normalize_xml.pl Modified: wbxmlTestSuite/trunk/normalize_xml.pl ============================================================================== --- wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 13:32:55 2009 (r162) +++ wbxmlTestSuite/trunk/normalize_xml.pl Mon Jan 19 13:40:30 2009 (r163) @@ -110,6 +110,8 @@ my $indent = 0; my $char = ""; +my $text = ""; +my $element = ""; $state = "NEUTRAL"; while (1) { ## $line works line oriented @@ -136,7 +138,8 @@ # handle comment or element which starts in a text line if ($state eq "TEXT" and $char eq "<") { - print $NEW_FD "\n"; + $text =~ s{\s*$}{}; + print $NEW_FD "${text}\n"; $state = "NEUTRAL"; } @@ -193,7 +196,7 @@ for (my $i = 0; $i < $indent; $i++) { print $NEW_FD " "; } - print $NEW_FD $char; + $text = $char; $state = "TEXT"; next; } @@ -201,30 +204,30 @@ next; } if ($state eq "TEXT" and $char eq "\n") { - print $NEW_FD "\n"; + $text =~ s{\s*$}{}; + print $NEW_FD "${text}\n"; $state = "TEXT_NEWLINE"; next; } # if & is not handled as & then this error cannot be recovered if ($state eq "TEXT" and $char eq '"') { - print $NEW_FD """; + $text .= """; next; } if ($state eq "TEXT" and $char eq "'") { - print $NEW_FD "'"; + $text .= "'"; next; } if ($state eq "TEXT" and $char eq '<') { - print $NEW_FD "<"; + $text .= "<"; next; } if ($state eq "TEXT" and $char eq '>') { - print $NEW_FD ">"; + $text .= ">"; next; } if ($state eq "TEXT") { - # - print $NEW_FD $char; + $text .= $char; next; } if ($state eq "TEXT_NEWLINE" and $char =~ q{\s\r\n}) { |
From: <dg...@su...> - 2009-01-19 12:33:57
|
Author: bellmich Date: Mon Jan 19 13:32:55 2009 New Revision: 162 URL: http://libwbxml.opensync.org/changeset/162 Log: String tables must be switched off to get usable results. Modified: wbxmlTestSuite/trunk/launchTests.sh Modified: wbxmlTestSuite/trunk/launchTests.sh ============================================================================== --- wbxmlTestSuite/trunk/launchTests.sh Mon Jan 19 13:27:43 2009 (r161) +++ wbxmlTestSuite/trunk/launchTests.sh Mon Jan 19 13:32:55 2009 (r162) @@ -129,7 +129,7 @@ # XML ==> WBXML echo Converting into: $OUT_WBXML - CMD="$XML2WBXML -o $OUT_WBXML $j" + CMD="$XML2WBXML -n -o $OUT_WBXML $j" $CMD if [ $? != 0 ]; then RESULT="FAILED"; fi |
From: <dg...@su...> - 2009-01-19 10:48:46
|
Author: bellmich Date: Mon Jan 19 11:47:43 2009 New Revision: 895 URL: http://libsyncml.opensync.org/changeset/895 Log: fixed build environment to build correctly if OpenOBEX or libsoup are missing ticket #211 Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/transports/http_client.c trunk/libsyncml/transports/http_server.c trunk/libsyncml/transports/obex_client.c trunk/libsyncml/transports/obex_server.c Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Tue Jan 13 10:50:36 2009 (r894) +++ trunk/libsyncml/CMakeLists.txt Mon Jan 19 11:47:43 2009 (r895) @@ -32,14 +32,26 @@ parser/sml_wbxml.c parser/sml_xml_assm.c parser/sml_xml_parse.c - transports/http_client.c - transports/http_server.c - transports/obex_client.c - transports/obex_server.c - transports/obex_client_samsung.c - transports/obex.c ) +IF ( ENABLE_OBEX ) + SET( libsyncml_LIB_SRCS + ${libsyncml_LIB_SRCS} + transports/obex_client.c + transports/obex_server.c + transports/obex_client_samsung.c + transports/obex.c + ) +ENDIF ( ENABLE_OBEX ) + +IF ( ENABLE_HTTP ) + SET( libsyncml_LIB_SRCS + ${libsyncml_LIB_SRCS} + transports/http_client.c + transports/http_server.c + ) +ENDIF ( ENABLE_HTTP ) + ADD_LIBRARY( syncml SHARED ${libsyncml_LIB_SRCS} ) SET_TARGET_PROPERTIES( syncml PROPERTIES SOVERSION ${LIBSYNCML_LIBVERSION_SOVERSION} ) Modified: trunk/libsyncml/transports/http_client.c ============================================================================== --- trunk/libsyncml/transports/http_client.c Tue Jan 13 10:50:36 2009 (r894) +++ trunk/libsyncml/transports/http_client.c Mon Jan 19 11:47:43 2009 (r895) @@ -23,7 +23,6 @@ #include <libsyncml/syncml_internals.h> #include <libsyncml/sml_error_internals.h> -#ifdef ENABLE_HTTP #include <libsyncml/sml_transport_internals.h> #include "http_client_internals.h" @@ -498,5 +497,3 @@ return TRUE; } -#endif //ENABLE_HTTP - Modified: trunk/libsyncml/transports/http_server.c ============================================================================== --- trunk/libsyncml/transports/http_server.c Tue Jan 13 10:50:36 2009 (r894) +++ trunk/libsyncml/transports/http_server.c Mon Jan 19 11:47:43 2009 (r895) @@ -23,7 +23,6 @@ #include <libsyncml/syncml.h> #include <libsyncml/syncml_internals.h> -#ifdef ENABLE_HTTP #include <libsyncml/sml_error_internals.h> #include <libsyncml/sml_transport_internals.h> @@ -818,5 +817,3 @@ return TRUE; } -#endif //ENABLE_HTTP - Modified: trunk/libsyncml/transports/obex_client.c ============================================================================== --- trunk/libsyncml/transports/obex_client.c Tue Jan 13 10:50:36 2009 (r894) +++ trunk/libsyncml/transports/obex_client.c Mon Jan 19 11:47:43 2009 (r895) @@ -22,7 +22,6 @@ #include <libsyncml/syncml.h> #include <libsyncml/syncml_internals.h> -#ifdef ENABLE_OBEX #include <libsyncml/sml_error_internals.h> #include <libsyncml/sml_transport_internals.h> @@ -1317,5 +1316,3 @@ return TRUE; } -#endif //ENABLE_OBEX - Modified: trunk/libsyncml/transports/obex_server.c ============================================================================== --- trunk/libsyncml/transports/obex_server.c Tue Jan 13 10:50:36 2009 (r894) +++ trunk/libsyncml/transports/obex_server.c Mon Jan 19 11:47:43 2009 (r895) @@ -23,7 +23,6 @@ #include <libsyncml/syncml_internals.h> #include <libsyncml/sml_error_internals.h> -#ifdef ENABLE_OBEX #include <libsyncml/sml_transport_internals.h> #include "obex_internals.h" @@ -853,5 +852,3 @@ return TRUE; } -#endif //ENABLE_OBEX - |