summaryrefslogtreecommitdiffstats
path: root/src/out-default.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-05-21 00:12:57 +0200
committerGravatar Nikias Bassen2023-05-21 00:12:57 +0200
commitf28cf0f1e51c7554d590cbec56abac46b4a44b4e (patch)
tree4e2e2038fe0b780dd9595deecbe887d89a3e3de8 /src/out-default.c
parentd772fd74d2a52646c34d558220533547725a2298 (diff)
downloadlibplist-f28cf0f1e51c7554d590cbec56abac46b4a44b4e.tar.gz
libplist-f28cf0f1e51c7554d590cbec56abac46b4a44b4e.tar.bz2
Add explicit casts and fix return type mismatches
Diffstat (limited to 'src/out-default.c')
-rw-r--r--src/out-default.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/out-default.c b/src/out-default.c
index 3ee9b3a..266070b 100644
--- a/src/out-default.c
+++ b/src/out-default.c
@@ -65,7 +65,7 @@ static size_t dtostr(char *buf, size_t bufsize, double realval)
65 return len; 65 return len;
66} 66}
67 67
68static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uint32_t indent, int partial_data) 68static plist_err_t node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uint32_t indent, int partial_data)
69{ 69{
70 plist_data_t node_data = NULL; 70 plist_data_t node_data = NULL;
71 71
@@ -159,7 +159,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uin
159 for (i = 0; i <= depth+indent; i++) { 159 for (i = 0; i <= depth+indent; i++) {
160 str_buf_append(*outbuf, " ", 2); 160 str_buf_append(*outbuf, " ", 2);
161 } 161 }
162 int res = node_to_string(ch, outbuf, depth+1, indent, partial_data); 162 plist_err_t res = node_to_string(ch, outbuf, depth+1, indent, partial_data);
163 if (res < 0) { 163 if (res < 0) {
164 return res; 164 return res;
165 } 165 }
@@ -187,7 +187,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uin
187 str_buf_append(*outbuf, " ", 2); 187 str_buf_append(*outbuf, " ", 2);
188 } 188 }
189 } 189 }
190 int res = node_to_string(ch, outbuf, depth+1, indent, partial_data); 190 plist_err_t res = node_to_string(ch, outbuf, depth+1, indent, partial_data);
191 if (res < 0) { 191 if (res < 0) {
192 return res; 192 return res;
193 } 193 }
@@ -310,7 +310,7 @@ static int num_digits_u(uint64_t i)
310 return n; 310 return n;
311} 311}
312 312
313static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint32_t indent, int partial_data) 313static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint32_t indent, int partial_data)
314{ 314{
315 plist_data_t data; 315 plist_data_t data;
316 if (!node) { 316 if (!node) {
@@ -321,7 +321,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint3
321 node_t ch; 321 node_t ch;
322 unsigned int n_children = node_n_children(node); 322 unsigned int n_children = node_n_children(node);
323 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 323 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
324 int res = node_estimate_size(ch, size, depth + 1, indent, partial_data); 324 plist_err_t res = node_estimate_size(ch, size, depth + 1, indent, partial_data);
325 if (res < 0) { 325 if (res < 0) {
326 return res; 326 return res;
327 } 327 }
@@ -411,7 +411,7 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist
411 for (i = 0; i < indent; i++) { 411 for (i = 0; i < indent; i++) {
412 str_buf_append(outbuf, " ", 2); 412 str_buf_append(outbuf, " ", 2);
413 } 413 }
414 int res = node_to_string(plist, &outbuf, 0, indent, options & PLIST_OPT_PARTIAL_DATA); 414 plist_err_t res = node_to_string((node_t)plist, &outbuf, 0, indent, options & PLIST_OPT_PARTIAL_DATA);
415 if (res < 0) { 415 if (res < 0) {
416 return res; 416 return res;
417 } 417 }
@@ -424,7 +424,7 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist
424plist_err_t plist_write_to_string_default(plist_t plist, char **output, uint32_t* length, plist_write_options_t options) 424plist_err_t plist_write_to_string_default(plist_t plist, char **output, uint32_t* length, plist_write_options_t options)
425{ 425{
426 uint64_t size = 0; 426 uint64_t size = 0;
427 int res; 427 plist_err_t res;
428 428
429 if (!plist || !output || !length) { 429 if (!plist || !output || !length) {
430 return PLIST_ERR_INVALID_ARG; 430 return PLIST_ERR_INVALID_ARG;
@@ -435,7 +435,7 @@ plist_err_t plist_write_to_string_default(plist_t plist, char **output, uint32_t
435 indent = (options >> 24) & 0xFF; 435 indent = (options >> 24) & 0xFF;
436 } 436 }
437 437
438 res = node_estimate_size(plist, &size, 0, indent, options & PLIST_OPT_PARTIAL_DATA); 438 res = node_estimate_size((node_t)plist, &size, 0, indent, options & PLIST_OPT_PARTIAL_DATA);
439 if (res < 0) { 439 if (res < 0) {
440 return res; 440 return res;
441 } 441 }
@@ -457,7 +457,7 @@ plist_err_t plist_write_to_string_default(plist_t plist, char **output, uint32_t
457 } 457 }
458 str_buf_append(outbuf, "\0", 1); 458 str_buf_append(outbuf, "\0", 1);
459 459
460 *output = outbuf->data; 460 *output = (char*)outbuf->data;
461 *length = outbuf->len - 1; 461 *length = outbuf->len - 1;
462 462
463 outbuf->data = NULL; 463 outbuf->data = NULL;
@@ -479,7 +479,7 @@ plist_err_t plist_write_to_stream_default(plist_t plist, FILE *stream, plist_wri
479 return PLIST_ERR_NO_MEM; 479 return PLIST_ERR_NO_MEM;
480 } 480 }
481 481
482 int res = _plist_write_to_strbuf(plist, outbuf, options); 482 plist_err_t res = _plist_write_to_strbuf(plist, outbuf, options);
483 if (res < 0) { 483 if (res < 0) {
484 str_buf_free(outbuf); 484 str_buf_free(outbuf);
485 return res; 485 return res;