summaryrefslogtreecommitdiffstats
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
parent874942ec1600773622238ae28544908d292ef339 (diff)
downloadlibplist-babec330acced3915332fa9a09b8252cfa99cf34.tar.gz
libplist-babec330acced3915332fa9a09b8252cfa99cf34.tar.bz2
Fix some warnings
-rw-r--r--plutil/plutil.c9
-rw-r--r--src/bplist.c5
-rw-r--r--src/plist.c36
-rw-r--r--src/xplist.c3
-rw-r--r--test/plist_cmp.c7
-rw-r--r--test/plist_test.c7
6 files changed, 15 insertions, 52 deletions
diff --git a/plutil/plutil.c b/plutil/plutil.c
index e9eaef1..88df080 100644
--- a/plutil/plutil.c
+++ b/plutil/plutil.c
@@ -38,7 +38,8 @@ int main(int argc, char *argv[])
FILE *iplist = NULL;
plist_t root_node = NULL;
char *plist_out = NULL;
- int size = 0;
+ uint32_t size = 0;
+ int read_size = 0;
char *plist_entire = NULL;
struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
Options *options = parse_arguments(argc, argv);
@@ -55,7 +56,7 @@ int main(int argc, char *argv[])
return 1;
stat(options->in_file, filestats);
plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1));
- fread(plist_entire, sizeof(char), filestats->st_size, iplist);
+ read_size = fread(plist_entire, sizeof(char), filestats->st_size, iplist);
fclose(iplist);
@@ -64,12 +65,12 @@ int main(int argc, char *argv[])
if (memcmp(plist_entire, "bplist00", 8) == 0)
{
- plist_from_bin(plist_entire, filestats->st_size, &root_node);
+ plist_from_bin(plist_entire, read_size, &root_node);
plist_to_xml(root_node, &plist_out, &size);
}
else
{
- plist_from_xml(plist_entire, filestats->st_size, &root_node);
+ plist_from_xml(plist_entire, read_size, &root_node);
plist_to_bin(root_node, &plist_out, &size);
}
plist_free(root_node);
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)
static uint32_t uint24_from_be(char *buff)
{
uint32_t ret = 0;
- char *tmp = (char *) &ret;
+ uint8_t *tmp = (uint8_t *) &ret;
memcpy(tmp + 1, buff, 3 * sizeof(char));
byte_convert(tmp, sizeof(uint32_t));
return ret;
@@ -192,7 +192,6 @@ static plist_t parse_unicode_node(char *bnode, uint64_t size)
uint64_t i = 0;
gunichar2 *unicodestr = NULL;
gchar *tmpstr = NULL;
- int type = 0;
glong items_read = 0;
glong items_written = 0;
GError *error = NULL;
@@ -858,7 +857,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
case PLIST_KEY:
case PLIST_STRING:
len = strlen(data->strval);
- type = xmlDetectCharEncoding(data->strval, len);
+ type = xmlDetectCharEncoding((const unsigned char *)data->strval, len);
if (XML_CHAR_ENCODING_UTF8 == type)
{
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)
return;
}
-static char compare_node_value(plist_type type, plist_data_t data, const void *value, uint64_t length)
-{
- char res = FALSE;
- switch (type)
- {
- case PLIST_BOOLEAN:
- res = data->boolval == *((char *) value) ? TRUE : FALSE;
- break;
- case PLIST_UINT:
- res = data->intval == *((uint64_t *) value) ? TRUE : FALSE;
- break;
- case PLIST_REAL:
- res = data->realval == *((double *) value) ? TRUE : FALSE;
- break;
- case PLIST_KEY:
- case PLIST_STRING:
- res = !strcmp(data->strval, ((char *) value));
- break;
- case PLIST_DATA:
- res = !memcmp(data->buff, (char *) value, length);
- break;
- case PLIST_DATE:
- res = !memcmp(&(data->timeval), value, sizeof(GTimeVal));
- break;
- case PLIST_ARRAY:
- case PLIST_DICT:
- default:
- break;
- }
- return res;
-}
-
plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
{
plist_t current = plist;
@@ -458,8 +426,8 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
if (type == PLIST_ARRAY)
{
- uint32_t index = va_arg(v, uint32_t);
- current = plist_array_get_item(current, index);
+ uint32_t n = va_arg(v, uint32_t);
+ current = plist_array_get_item(current, n);
}
else if (type == PLIST_DICT)
{
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 @@
#include <stdlib.h>
#include <stdio.h>
+#include <inttypes.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
@@ -149,7 +150,7 @@ static void node_to_xml(GNode * node, gpointer xml_struct)
case PLIST_UINT:
tag = XPLIST_INT;
- val = g_strdup_printf("%llu", node_data->intval);
+ val = g_strdup_printf("%"PRIu64, node_data->intval);
break;
case PLIST_REAL:
diff --git a/test/plist_cmp.c b/test/plist_cmp.c
index dcf961f..af54c4c 100644
--- a/test/plist_cmp.c
+++ b/test/plist_cmp.c
@@ -43,12 +43,7 @@ static plist_t plist_get_next_sibling(plist_t node)
return (plist_t) g_node_next_sibling((GNode *) node);
}
-static plist_t plist_get_prev_sibling(plist_t node)
-{
- return (plist_t) g_node_prev_sibling((GNode *) node);
-}
-
-char compare_plist(plist_t node_l, plist_t node_r)
+static char compare_plist(plist_t node_l, plist_t node_r)
{
plist_t cur_l = NULL;
plist_t cur_r = NULL;
diff --git a/test/plist_test.c b/test/plist_test.c
index a0344e9..17be11a 100644
--- a/test/plist_test.c
+++ b/test/plist_test.c
@@ -35,15 +35,14 @@
int main(int argc, char *argv[])
{
FILE *iplist = NULL;
- FILE *oplist = NULL;
plist_t root_node1 = NULL;
plist_t root_node2 = NULL;
char *plist_xml = NULL;
char *plist_xml2 = NULL;
char *plist_bin = NULL;
int size_in = 0;
- int size_out = 0;
- int size_out2 = 0;
+ uint32_t size_out = 0;
+ uint32_t size_out2 = 0;
char *file_in = NULL;
struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
if (argc!= 2)
@@ -123,7 +122,7 @@ int main(int argc, char *argv[])
free(plist_xml2);
free(filestats);
- if (size_in != size_out2)
+ if ((uint32_t)size_in != size_out2)
{
printf("Size of input and output is different\n");
printf("Input size : %i\n", size_in);