From: <svn...@op...> - 2010-08-16 18:52:14
|
Author: cdfrey Date: Mon Aug 16 20:52:03 2010 New Revision: 6095 URL: http://www.opensync.org/changeset/6095 Log: Split add_value() into add_value() and add_value_data() Allow adding of pure data, instead of just accessing through the XML tree Modified: format-plugins/vformat/src/xmlformat-common.c format-plugins/vformat/src/xmlformat-common.h Modified: format-plugins/vformat/src/xmlformat-common.c ============================================================================== --- format-plugins/vformat/src/xmlformat-common.c Mon Aug 16 20:45:08 2010 (r6094) +++ format-plugins/vformat/src/xmlformat-common.c Mon Aug 16 20:52:03 2010 (r6095) @@ -211,7 +211,17 @@ */ tmp = ""; } - + + add_value_data(attr, xmlfield, tmp, encoding); +} + +void add_value_data(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *data, const char *encoding) +{ + g_assert(xmlfield); + g_assert(data); + + const char *tmp = data; + if (needs_charset((unsigned char*)tmp)) if (!vformat_attribute_has_param (attr, "CHARSET")) vformat_attribute_add_param_with_value(attr, "CHARSET", "UTF-8"); Modified: format-plugins/vformat/src/xmlformat-common.h ============================================================================== --- format-plugins/vformat/src/xmlformat-common.h Mon Aug 16 20:45:08 2010 (r6094) +++ format-plugins/vformat/src/xmlformat-common.h Mon Aug 16 20:52:03 2010 (r6095) @@ -71,6 +71,7 @@ osync_bool needs_charset(const unsigned char *tmp); void add_value(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *name, const char *encoding); +void add_value_data(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *data, const char *encoding); void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding); void add_values(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding); void add_values_from_nth_field_on(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding, int nth); |