summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-01-22 22:18:43 +0100
committerGravatar Jonathan Beck2009-01-22 22:18:43 +0100
commitbfd57eb1cf738ed62e17941e855347772ce48ef2 (patch)
tree45eda77468ff586bdd64fd6afcb5452cb0407bad /src/plist.c
parent8da4dac2e65778d1f562f4502c09b16590cfd8e1 (diff)
downloadlibplist-bfd57eb1cf738ed62e17941e855347772ce48ef2.tar.gz
libplist-bfd57eb1cf738ed62e17941e855347772ce48ef2.tar.bz2
Add Unicode support.
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plist.c b/src/plist.c
index e5cf2db..74868cc 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -24,7 +24,6 @@
24#include <assert.h> 24#include <assert.h>
25#include "utils.h" 25#include "utils.h"
26#include "plist.h" 26#include "plist.h"
27#include <wchar.h>
28#include <stdlib.h> 27#include <stdlib.h>
29#include <stdio.h> 28#include <stdio.h>
30 29
@@ -99,7 +98,8 @@ plist_t plist_add_sub_element(plist_t node, plist_type type, void *value, uint64
99 data->strval = strdup((char *) value); 98 data->strval = strdup((char *) value);
100 break; 99 break;
101 case PLIST_UNICODE: 100 case PLIST_UNICODE:
102 data->unicodeval = wcsdup((wchar_t *) value); 101 data->unicodeval = (gunichar2*) malloc(length * sizeof(gunichar2));
102 memcpy(data->unicodeval, value, length * sizeof(gunichar2));
103 break; 103 break;
104 case PLIST_DATA: 104 case PLIST_DATA:
105 memcpy(data->buff, value, length); 105 memcpy(data->buff, value, length);
@@ -158,7 +158,7 @@ static char compare_node_value(plist_type type, plist_data_t data, void *value,
158 res = !strcmp(data->strval, ((char *) value)); 158 res = !strcmp(data->strval, ((char *) value));
159 break; 159 break;
160 case PLIST_UNICODE: 160 case PLIST_UNICODE:
161 res = !wcscmp(data->unicodeval, ((wchar_t *) value)); 161 res = !memcpy(data->unicodeval, value, length);
162 break; 162 break;
163 case PLIST_DATA: 163 case PLIST_DATA:
164 res = memcmp(data->buff, (char *) value, length); 164 res = memcmp(data->buff, (char *) value, length);
@@ -229,7 +229,8 @@ void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint
229 *((char **) value) = strdup(data->strval); 229 *((char **) value) = strdup(data->strval);
230 break; 230 break;
231 case PLIST_UNICODE: 231 case PLIST_UNICODE:
232 *((wchar_t **) value) = wcsdup(data->unicodeval); 232 *((gunichar2 **) value) = malloc (*length * sizeof(gunichar2));
233 memcpy(*((gunichar2 **) value), data->unicodeval, *length * sizeof(gunichar2));
233 break; 234 break;
234 case PLIST_DATA: 235 case PLIST_DATA:
235 case PLIST_ARRAY: 236 case PLIST_ARRAY: