summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-04-28 22:15:39 +0200
committerGravatar Jonathan Beck2009-04-28 22:15:39 +0200
commit07b8041d44c6b43da1b0c55d140999cb3137d040 (patch)
tree4808d49c714036faff2104ad2c3a656618b9e035 /src/xplist.c
parent0d301b693a84db6f6a751722359e602172da94b3 (diff)
downloadlibplist-07b8041d44c6b43da1b0c55d140999cb3137d040.tar.gz
libplist-07b8041d44c6b43da1b0c55d140999cb3137d040.tar.bz2
Merge ascii and unicode handling in PLIST_STRING using UTF-8. Remove unicode related declaration in API (breaks API&ABI)
Diffstat (limited to 'src/xplist.c')
-rw-r--r--src/xplist.c27
1 files changed, 3 insertions, 24 deletions
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);