summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2010-01-21 21:19:41 +0100
committerGravatar Jonathan Beck2010-01-21 21:19:41 +0100
commitbabec330acced3915332fa9a09b8252cfa99cf34 (patch)
treee5fdbcde4e3296b55f441012ec8f66b74ef286d1 /src
parent874942ec1600773622238ae28544908d292ef339 (diff)
downloadlibplist-babec330acced3915332fa9a09b8252cfa99cf34.tar.gz
libplist-babec330acced3915332fa9a09b8252cfa99cf34.tar.bz2
Fix some warnings
Diffstat (limited to 'src')
-rw-r--r--src/bplist.c5
-rw-r--r--src/plist.c36
-rw-r--r--src/xplist.c3
3 files changed, 6 insertions, 38 deletions
diff --git a/src/bplist.c b/src/bplist.c
index d37ed7a..a9e2638 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -82,7 +82,7 @@ static void byte_convert(uint8_t * address, size_t size)
82static uint32_t uint24_from_be(char *buff) 82static uint32_t uint24_from_be(char *buff)
83{ 83{
84 uint32_t ret = 0; 84 uint32_t ret = 0;
85 char *tmp = (char *) &ret; 85 uint8_t *tmp = (uint8_t *) &ret;
86 memcpy(tmp + 1, buff, 3 * sizeof(char)); 86 memcpy(tmp + 1, buff, 3 * sizeof(char));
87 byte_convert(tmp, sizeof(uint32_t)); 87 byte_convert(tmp, sizeof(uint32_t));
88 return ret; 88 return ret;
@@ -192,7 +192,6 @@ static plist_t parse_unicode_node(char *bnode, uint64_t size)
192 uint64_t i = 0; 192 uint64_t i = 0;
193 gunichar2 *unicodestr = NULL; 193 gunichar2 *unicodestr = NULL;
194 gchar *tmpstr = NULL; 194 gchar *tmpstr = NULL;
195 int type = 0;
196 glong items_read = 0; 195 glong items_read = 0;
197 glong items_written = 0; 196 glong items_written = 0;
198 GError *error = NULL; 197 GError *error = NULL;
@@ -858,7 +857,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
858 case PLIST_KEY: 857 case PLIST_KEY:
859 case PLIST_STRING: 858 case PLIST_STRING:
860 len = strlen(data->strval); 859 len = strlen(data->strval);
861 type = xmlDetectCharEncoding(data->strval, len); 860 type = xmlDetectCharEncoding((const unsigned char *)data->strval, len);
862 if (XML_CHAR_ENCODING_UTF8 == type) 861 if (XML_CHAR_ENCODING_UTF8 == type)
863 { 862 {
864 unicodestr = g_utf8_to_utf16(data->strval, len, &items_read, &items_written, &error); 863 unicodestr = g_utf8_to_utf16(data->strval, len, &items_read, &items_written, &error);
diff --git a/src/plist.c b/src/plist.c
index 1abd0f9..7028d81 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -414,38 +414,6 @@ void plist_dict_remove_item(plist_t node, const char* key)
414 return; 414 return;
415} 415}
416 416
417static char compare_node_value(plist_type type, plist_data_t data, const void *value, uint64_t length)
418{
419 char res = FALSE;
420 switch (type)
421 {
422 case PLIST_BOOLEAN:
423 res = data->boolval == *((char *) value) ? TRUE : FALSE;
424 break;
425 case PLIST_UINT:
426 res = data->intval == *((uint64_t *) value) ? TRUE : FALSE;
427 break;
428 case PLIST_REAL:
429 res = data->realval == *((double *) value) ? TRUE : FALSE;
430 break;
431 case PLIST_KEY:
432 case PLIST_STRING:
433 res = !strcmp(data->strval, ((char *) value));
434 break;
435 case PLIST_DATA:
436 res = !memcmp(data->buff, (char *) value, length);
437 break;
438 case PLIST_DATE:
439 res = !memcmp(&(data->timeval), value, sizeof(GTimeVal));
440 break;
441 case PLIST_ARRAY:
442 case PLIST_DICT:
443 default:
444 break;
445 }
446 return res;
447}
448
449plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) 417plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
450{ 418{
451 plist_t current = plist; 419 plist_t current = plist;
@@ -458,8 +426,8 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
458 426
459 if (type == PLIST_ARRAY) 427 if (type == PLIST_ARRAY)
460 { 428 {
461 uint32_t index = va_arg(v, uint32_t); 429 uint32_t n = va_arg(v, uint32_t);
462 current = plist_array_get_item(current, index); 430 current = plist_array_get_item(current, n);
463 } 431 }
464 else if (type == PLIST_DICT) 432 else if (type == PLIST_DICT)
465 { 433 {
diff --git a/src/xplist.c b/src/xplist.c
index ce8dec1..8b6a632 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -25,6 +25,7 @@
25#include <stdlib.h> 25#include <stdlib.h>
26#include <stdio.h> 26#include <stdio.h>
27 27
28#include <inttypes.h>
28 29
29#include <libxml/parser.h> 30#include <libxml/parser.h>
30#include <libxml/tree.h> 31#include <libxml/tree.h>
@@ -149,7 +150,7 @@ static void node_to_xml(GNode * node, gpointer xml_struct)
149 150
150 case PLIST_UINT: 151 case PLIST_UINT:
151 tag = XPLIST_INT; 152 tag = XPLIST_INT;
152 val = g_strdup_printf("%llu", node_data->intval); 153 val = g_strdup_printf("%"PRIu64, node_data->intval);
153 break; 154 break;
154 155
155 case PLIST_REAL: 156 case PLIST_REAL: