diff options
Diffstat (limited to 'src/oplist.c')
| -rw-r--r-- | src/oplist.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/oplist.c b/src/oplist.c index 7597b3c..6ab6603 100644 --- a/src/oplist.c +++ b/src/oplist.c | |||
| @@ -139,7 +139,7 @@ static int str_needs_quotes(const char* str, size_t len) | |||
| 139 | return 0; | 139 | return 0; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static int node_to_openstep(node_t node, bytearray_t **outbuf, uint32_t depth, int prettify) | 142 | static plist_err_t node_to_openstep(node_t node, bytearray_t **outbuf, uint32_t depth, int prettify) |
| 143 | { | 143 | { |
| 144 | plist_data_t node_data = NULL; | 144 | plist_data_t node_data = NULL; |
| 145 | 145 | ||
| @@ -230,7 +230,7 @@ static int node_to_openstep(node_t node, bytearray_t **outbuf, uint32_t depth, i | |||
| 230 | str_buf_append(*outbuf, " ", 2); | 230 | str_buf_append(*outbuf, " ", 2); |
| 231 | } | 231 | } |
| 232 | } | 232 | } |
| 233 | int res = node_to_openstep(ch, outbuf, depth+1, prettify); | 233 | plist_err_t res = node_to_openstep(ch, outbuf, depth+1, prettify); |
| 234 | if (res < 0) { | 234 | if (res < 0) { |
| 235 | return res; | 235 | return res; |
| 236 | } | 236 | } |
| @@ -258,7 +258,7 @@ static int node_to_openstep(node_t node, bytearray_t **outbuf, uint32_t depth, i | |||
| 258 | str_buf_append(*outbuf, " ", 2); | 258 | str_buf_append(*outbuf, " ", 2); |
| 259 | } | 259 | } |
| 260 | } | 260 | } |
| 261 | int res = node_to_openstep(ch, outbuf, depth+1, prettify); | 261 | plist_err_t res = node_to_openstep(ch, outbuf, depth+1, prettify); |
| 262 | if (res < 0) { | 262 | if (res < 0) { |
| 263 | return res; | 263 | return res; |
| 264 | } | 264 | } |
| @@ -355,7 +355,7 @@ static int num_digits_u(uint64_t i) | |||
| 355 | return n; | 355 | return n; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int prettify) | 358 | static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int prettify) |
| 359 | { | 359 | { |
| 360 | plist_data_t data; | 360 | plist_data_t data; |
| 361 | if (!node) { | 361 | if (!node) { |
| @@ -366,7 +366,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int p | |||
| 366 | node_t ch; | 366 | node_t ch; |
| 367 | unsigned int n_children = node_n_children(node); | 367 | unsigned int n_children = node_n_children(node); |
| 368 | for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { | 368 | for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { |
| 369 | int res = node_estimate_size(ch, size, depth + 1, prettify); | 369 | plist_err_t res = node_estimate_size(ch, size, depth + 1, prettify); |
| 370 | if (res < 0) { | 370 | if (res < 0) { |
| 371 | return res; | 371 | return res; |
| 372 | } | 372 | } |
| @@ -445,13 +445,13 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int p | |||
| 445 | plist_err_t plist_to_openstep(plist_t plist, char **openstep, uint32_t* length, int prettify) | 445 | plist_err_t plist_to_openstep(plist_t plist, char **openstep, uint32_t* length, int prettify) |
| 446 | { | 446 | { |
| 447 | uint64_t size = 0; | 447 | uint64_t size = 0; |
| 448 | int res; | 448 | plist_err_t res; |
| 449 | 449 | ||
| 450 | if (!plist || !openstep || !length) { | 450 | if (!plist || !openstep || !length) { |
| 451 | return PLIST_ERR_INVALID_ARG; | 451 | return PLIST_ERR_INVALID_ARG; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | res = node_estimate_size(plist, &size, 0, prettify); | 454 | res = node_estimate_size((node_t)plist, &size, 0, prettify); |
| 455 | if (res < 0) { | 455 | if (res < 0) { |
| 456 | return res; | 456 | return res; |
| 457 | } | 457 | } |
| @@ -462,7 +462,7 @@ plist_err_t plist_to_openstep(plist_t plist, char **openstep, uint32_t* length, | |||
| 462 | return PLIST_ERR_NO_MEM; | 462 | return PLIST_ERR_NO_MEM; |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | res = node_to_openstep(plist, &outbuf, 0, prettify); | 465 | res = node_to_openstep((node_t)plist, &outbuf, 0, prettify); |
| 466 | if (res < 0) { | 466 | if (res < 0) { |
| 467 | str_buf_free(outbuf); | 467 | str_buf_free(outbuf); |
| 468 | *openstep = NULL; | 468 | *openstep = NULL; |
| @@ -475,7 +475,7 @@ plist_err_t plist_to_openstep(plist_t plist, char **openstep, uint32_t* length, | |||
| 475 | 475 | ||
| 476 | str_buf_append(outbuf, "\0", 1); | 476 | str_buf_append(outbuf, "\0", 1); |
| 477 | 477 | ||
| 478 | *openstep = outbuf->data; | 478 | *openstep = (char*)outbuf->data; |
| 479 | *length = outbuf->len - 1; | 479 | *length = outbuf->len - 1; |
| 480 | 480 | ||
| 481 | outbuf->data = NULL; | 481 | outbuf->data = NULL; |
| @@ -532,7 +532,7 @@ static void parse_skip_ws(parse_ctx ctx) | |||
| 532 | 532 | ||
| 533 | #define HEX_DIGIT(x) ((x <= '9') ? (x - '0') : ((x <= 'F') ? (x - 'A' + 10) : (x - 'a' + 10))) | 533 | #define HEX_DIGIT(x) ((x <= '9') ? (x - '0') : ((x <= 'F') ? (x - 'A' + 10) : (x - 'a' + 10))) |
| 534 | 534 | ||
| 535 | static int node_from_openstep(parse_ctx ctx, plist_t *plist); | 535 | static plist_err_t node_from_openstep(parse_ctx ctx, plist_t *plist); |
| 536 | 536 | ||
| 537 | static void parse_dict_data(parse_ctx ctx, plist_t dict) | 537 | static void parse_dict_data(parse_ctx ctx, plist_t dict) |
| 538 | { | 538 | { |
| @@ -603,7 +603,7 @@ static void parse_dict_data(parse_ctx ctx, plist_t dict) | |||
| 603 | plist_free(val); | 603 | plist_free(val); |
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | static int node_from_openstep(parse_ctx ctx, plist_t *plist) | 606 | static plist_err_t node_from_openstep(parse_ctx ctx, plist_t *plist) |
| 607 | { | 607 | { |
| 608 | plist_t subnode = NULL; | 608 | plist_t subnode = NULL; |
| 609 | const char *p = NULL; | 609 | const char *p = NULL; |
| @@ -746,7 +746,7 @@ static int node_from_openstep(parse_ctx ctx, plist_t *plist) | |||
| 746 | goto err_out; | 746 | goto err_out; |
| 747 | } | 747 | } |
| 748 | ctx->pos++; | 748 | ctx->pos++; |
| 749 | data->buff = bytes->data; | 749 | data->buff = (uint8_t*)bytes->data; |
| 750 | data->length = bytes->len; | 750 | data->length = bytes->len; |
| 751 | bytes->data = NULL; | 751 | bytes->data = NULL; |
| 752 | byte_array_free(bytes); | 752 | byte_array_free(bytes); |
| @@ -781,7 +781,7 @@ static int node_from_openstep(parse_ctx ctx, plist_t *plist) | |||
| 781 | } | 781 | } |
| 782 | size_t slen = ctx->pos - p; | 782 | size_t slen = ctx->pos - p; |
| 783 | ctx->pos++; // skip the closing quote | 783 | ctx->pos++; // skip the closing quote |
| 784 | char* strbuf = malloc(slen+1); | 784 | char* strbuf = (char*)malloc(slen+1); |
| 785 | if (num_escapes > 0) { | 785 | if (num_escapes > 0) { |
| 786 | size_t i = 0; | 786 | size_t i = 0; |
| 787 | size_t o = 0; | 787 | size_t o = 0; |
| @@ -907,7 +907,7 @@ plist_err_t plist_from_openstep(const char *plist_ostep, uint32_t length, plist_ | |||
| 907 | 907 | ||
| 908 | struct _parse_ctx ctx = { plist_ostep, plist_ostep, plist_ostep + length, 0 , 0 }; | 908 | struct _parse_ctx ctx = { plist_ostep, plist_ostep, plist_ostep + length, 0 , 0 }; |
| 909 | 909 | ||
| 910 | int err = node_from_openstep(&ctx, plist); | 910 | plist_err_t err = node_from_openstep(&ctx, plist); |
| 911 | if (err == 0) { | 911 | if (err == 0) { |
| 912 | if (!*plist) { | 912 | if (!*plist) { |
| 913 | /* whitespace only file is considered an empty dictionary */ | 913 | /* whitespace only file is considered an empty dictionary */ |
