summaryrefslogtreecommitdiffstats
path: root/src/out-plutil.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-plutil.c
parentd772fd74d2a52646c34d558220533547725a2298 (diff)
downloadlibplist-f28cf0f1e51c7554d590cbec56abac46b4a44b4e.tar.gz
libplist-f28cf0f1e51c7554d590cbec56abac46b4a44b4e.tar.bz2
Add explicit casts and fix return type mismatches
Diffstat (limited to 'src/out-plutil.c')
-rw-r--r--src/out-plutil.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/out-plutil.c b/src/out-plutil.c
index ed71d8f..d85f22c 100644
--- a/src/out-plutil.c
+++ b/src/out-plutil.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) 68static plist_err_t node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth)
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)
159 char indexbuf[16]; 159 char indexbuf[16];
160 int l = sprintf(indexbuf, "%u => ", cnt); 160 int l = sprintf(indexbuf, "%u => ", cnt);
161 str_buf_append(*outbuf, indexbuf, l); 161 str_buf_append(*outbuf, indexbuf, l);
162 int res = node_to_string(ch, outbuf, depth+1); 162 plist_err_t res = node_to_string(ch, outbuf, depth+1);
163 if (res < 0) { 163 if (res < 0) {
164 return res; 164 return res;
165 } 165 }
@@ -184,7 +184,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth)
184 str_buf_append(*outbuf, " ", 2); 184 str_buf_append(*outbuf, " ", 2);
185 } 185 }
186 } 186 }
187 int res = node_to_string(ch, outbuf, depth+1); 187 plist_err_t res = node_to_string(ch, outbuf, depth+1);
188 if (res < 0) { 188 if (res < 0) {
189 return res; 189 return res;
190 } 190 }
@@ -304,7 +304,7 @@ static int num_digits_u(uint64_t i)
304 return n; 304 return n;
305} 305}
306 306
307static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth) 307static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
308{ 308{
309 plist_data_t data; 309 plist_data_t data;
310 if (!node) { 310 if (!node) {
@@ -315,7 +315,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
315 node_t ch; 315 node_t ch;
316 unsigned int n_children = node_n_children(node); 316 unsigned int n_children = node_n_children(node);
317 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 317 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
318 int res = node_estimate_size(ch, size, depth + 1); 318 plist_err_t res = node_estimate_size(ch, size, depth + 1);
319 if (res < 0) { 319 if (res < 0) {
320 return res; 320 return res;
321 } 321 }
@@ -390,7 +390,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
390 390
391static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist_write_options_t options) 391static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist_write_options_t options)
392{ 392{
393 int res = node_to_string(plist, &outbuf, 0); 393 plist_err_t res = node_to_string((node_t)plist, &outbuf, 0);
394 if (res < 0) { 394 if (res < 0) {
395 return res; 395 return res;
396 } 396 }
@@ -403,13 +403,13 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist
403plist_err_t plist_write_to_string_plutil(plist_t plist, char **output, uint32_t* length, plist_write_options_t options) 403plist_err_t plist_write_to_string_plutil(plist_t plist, char **output, uint32_t* length, plist_write_options_t options)
404{ 404{
405 uint64_t size = 0; 405 uint64_t size = 0;
406 int res; 406 plist_err_t res;
407 407
408 if (!plist || !output || !length) { 408 if (!plist || !output || !length) {
409 return PLIST_ERR_INVALID_ARG; 409 return PLIST_ERR_INVALID_ARG;
410 } 410 }
411 411
412 res = node_estimate_size(plist, &size, 0); 412 res = node_estimate_size((node_t)plist, &size, 0);
413 if (res < 0) { 413 if (res < 0) {
414 return res; 414 return res;
415 } 415 }
@@ -431,7 +431,7 @@ plist_err_t plist_write_to_string_plutil(plist_t plist, char **output, uint32_t*
431 } 431 }
432 str_buf_append(outbuf, "\0", 1); 432 str_buf_append(outbuf, "\0", 1);
433 433
434 *output = outbuf->data; 434 *output = (char*)outbuf->data;
435 *length = outbuf->len - 1; 435 *length = outbuf->len - 1;
436 436
437 outbuf->data = NULL; 437 outbuf->data = NULL;
@@ -453,7 +453,7 @@ plist_err_t plist_write_to_stream_plutil(plist_t plist, FILE *stream, plist_writ
453 return PLIST_ERR_NO_MEM; 453 return PLIST_ERR_NO_MEM;
454 } 454 }
455 455
456 int res = _plist_write_to_strbuf(plist, outbuf, options); 456 plist_err_t res = _plist_write_to_strbuf(plist, outbuf, options);
457 if (res < 0) { 457 if (res < 0) {
458 str_buf_free(outbuf); 458 str_buf_free(outbuf);
459 return res; 459 return res;