Permalink
Browse files

Fix some warnings

  • Loading branch information...
JonathanBeck committed Jan 21, 2010
1 parent 874942e commit babec330acced3915332fa9a09b8252cfa99cf34
Showing with 15 additions and 52 deletions.
  1. +5 −4 plutil/plutil.c
  2. +2 −3 src/bplist.c
  3. +2 −34 src/plist.c
  4. +2 −1 src/xplist.c
  5. +1 −6 test/plist_cmp.c
  6. +3 −4 test/plist_test.c
View
@@ -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);
View
@@ -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);
View
@@ -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)
{
View
@@ -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:
View
@@ -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;
View
@@ -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);

0 comments on commit babec33

Please sign in to comment.