summaryrefslogtreecommitdiffstats
path: root/src/jplist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jplist.c')
-rw-r--r--src/jplist.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/jplist.c b/src/jplist.c
index f6c96ca..782d2b3 100644
--- a/src/jplist.c
+++ b/src/jplist.c
@@ -110,7 +110,7 @@ static size_t dtostr(char *buf, size_t bufsize, double realval)
110 return len; 110 return len;
111} 111}
112 112
113static int node_to_json(node_t node, bytearray_t **outbuf, uint32_t depth, int prettify) 113static plist_err_t node_to_json(node_t node, bytearray_t **outbuf, uint32_t depth, int prettify)
114{ 114{
115 plist_data_t node_data = NULL; 115 plist_data_t node_data = NULL;
116 116
@@ -206,7 +206,7 @@ static int node_to_json(node_t node, bytearray_t **outbuf, uint32_t depth, int p
206 str_buf_append(*outbuf, " ", 2); 206 str_buf_append(*outbuf, " ", 2);
207 } 207 }
208 } 208 }
209 int res = node_to_json(ch, outbuf, depth+1, prettify); 209 plist_err_t res = node_to_json(ch, outbuf, depth+1, prettify);
210 if (res < 0) { 210 if (res < 0) {
211 return res; 211 return res;
212 } 212 }
@@ -234,7 +234,7 @@ static int node_to_json(node_t node, bytearray_t **outbuf, uint32_t depth, int p
234 str_buf_append(*outbuf, " ", 2); 234 str_buf_append(*outbuf, " ", 2);
235 } 235 }
236 } 236 }
237 int res = node_to_json(ch, outbuf, depth+1, prettify); 237 plist_err_t res = node_to_json(ch, outbuf, depth+1, prettify);
238 if (res < 0) { 238 if (res < 0) {
239 return res; 239 return res;
240 } 240 }
@@ -311,7 +311,7 @@ static int num_digits_u(uint64_t i)
311 return n; 311 return n;
312} 312}
313 313
314static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int prettify) 314static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int prettify)
315{ 315{
316 plist_data_t data; 316 plist_data_t data;
317 if (!node) { 317 if (!node) {
@@ -322,7 +322,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int p
322 node_t ch; 322 node_t ch;
323 unsigned int n_children = node_n_children(node); 323 unsigned int n_children = node_n_children(node);
324 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 324 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
325 int res = node_estimate_size(ch, size, depth + 1, prettify); 325 plist_err_t res = node_estimate_size(ch, size, depth + 1, prettify);
326 if (res < 0) { 326 if (res < 0) {
327 return res; 327 return res;
328 } 328 }
@@ -401,7 +401,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int p
401plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, int prettify) 401plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, int prettify)
402{ 402{
403 uint64_t size = 0; 403 uint64_t size = 0;
404 int res; 404 plist_err_t res;
405 405
406 if (!plist || !plist_json || !length) { 406 if (!plist || !plist_json || !length) {
407 return PLIST_ERR_INVALID_ARG; 407 return PLIST_ERR_INVALID_ARG;
@@ -412,7 +412,7 @@ plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, in
412 return PLIST_ERR_FORMAT; 412 return PLIST_ERR_FORMAT;
413 } 413 }
414 414
415 res = node_estimate_size(plist, &size, 0, prettify); 415 res = node_estimate_size((node_t)plist, &size, 0, prettify);
416 if (res < 0) { 416 if (res < 0) {
417 return res; 417 return res;
418 } 418 }
@@ -423,7 +423,7 @@ plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, in
423 return PLIST_ERR_NO_MEM; 423 return PLIST_ERR_NO_MEM;
424 } 424 }
425 425
426 res = node_to_json(plist, &outbuf, 0, prettify); 426 res = node_to_json((node_t)plist, &outbuf, 0, prettify);
427 if (res < 0) { 427 if (res < 0) {
428 str_buf_free(outbuf); 428 str_buf_free(outbuf);
429 *plist_json = NULL; 429 *plist_json = NULL;
@@ -436,7 +436,7 @@ plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, in
436 436
437 str_buf_append(outbuf, "\0", 1); 437 str_buf_append(outbuf, "\0", 1);
438 438
439 *plist_json = outbuf->data; 439 *plist_json = (char*)outbuf->data;
440 *length = outbuf->len - 1; 440 *length = outbuf->len - 1;
441 441
442 outbuf->data = NULL; 442 outbuf->data = NULL;
@@ -800,7 +800,7 @@ plist_err_t plist_from_json(const char *json, uint32_t length, plist_t * plist)
800 jsmntok_t *tokens = NULL; 800 jsmntok_t *tokens = NULL;
801 801
802 do { 802 do {
803 jsmntok_t* newtokens = realloc(tokens, sizeof(jsmntok_t)*maxtoks); 803 jsmntok_t* newtokens = (jsmntok_t*)realloc(tokens, sizeof(jsmntok_t)*maxtoks);
804 if (!newtokens) { 804 if (!newtokens) {
805 PLIST_JSON_ERR("%s: Out of memory\n", __func__); 805 PLIST_JSON_ERR("%s: Out of memory\n", __func__);
806 return PLIST_ERR_NO_MEM; 806 return PLIST_ERR_NO_MEM;