From 07b8041d44c6b43da1b0c55d140999cb3137d040 Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Tue, 28 Apr 2009 22:15:39 +0200 Subject: Merge ascii and unicode handling in PLIST_STRING using UTF-8. Remove unicode related declaration in API (breaks API&ABI) --- src/xplist.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/xplist.c') diff --git a/src/xplist.c b/src/xplist.c index 2bee7c7..38cc4fe 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -126,12 +126,6 @@ static void node_to_xml(GNode * node, gpointer xml_struct) //for base64 gchar *valtmp = NULL; - //for unicode - glong len = 0; - glong items_read = 0; - glong items_written = 0; - GError *error = NULL; - uint32_t i = 0; if (!node) @@ -165,12 +159,6 @@ static void node_to_xml(GNode * node, gpointer xml_struct) val = g_strdup(node_data->strval); break; - case PLIST_UNICODE: - tag = XPLIST_STRING; - len = node_data->length; - val = g_utf16_to_utf8(node_data->unicodeval, len, &items_read, &items_written, &error); - break; - case PLIST_KEY: tag = XPLIST_KEY; val = g_strdup((gchar *) node_data->strval); @@ -233,11 +221,7 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) plist_t subnode = NULL; //for string - unsigned char *tmp = NULL; glong len = 0; - glong items_read = 0; - glong items_written = 0; - GError *error = NULL; int type = 0; if (!xml_node) @@ -301,16 +285,11 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) if (!xmlStrcmp(node->name, XPLIST_STRING)) { xmlChar *strval = xmlNodeGetContent(node); len = strlen((char *) strval); - items_read = 0; - items_written = 0; - error = NULL; type = xmlDetectCharEncoding(strval, len); - if (XML_CHAR_ENCODING_UTF8 == type) { - data->unicodeval = g_utf8_to_utf16((char *) strval, len, &items_read, &items_written, &error); - data->type = PLIST_UNICODE; - data->length = items_written; - } else if (XML_CHAR_ENCODING_ASCII == type || XML_CHAR_ENCODING_NONE == type) { + if (XML_CHAR_ENCODING_UTF8 == type || + XML_CHAR_ENCODING_ASCII == type || + XML_CHAR_ENCODING_NONE == type) { data->strval = strdup((char *) strval); data->type = PLIST_STRING; data->length = strlen(data->strval); -- cgit v1.1-32-gdbae