summaryrefslogtreecommitdiffstats
path: root/src/out-limd.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-limd.c
parentd772fd74d2a52646c34d558220533547725a2298 (diff)
downloadlibplist-f28cf0f1e51c7554d590cbec56abac46b4a44b4e.tar.gz
libplist-f28cf0f1e51c7554d590cbec56abac46b4a44b4e.tar.bz2
Add explicit casts and fix return type mismatches
Diffstat (limited to 'src/out-limd.c')
-rw-r--r--src/out-limd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/out-limd.c b/src/out-limd.c
index 433ae06..7d861f8 100644
--- a/src/out-limd.c
+++ b/src/out-limd.c
@@ -67,7 +67,7 @@ static size_t dtostr(char *buf, size_t bufsize, double realval)
67 return len; 67 return len;
68} 68}
69 69
70static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uint32_t indent) 70static plist_err_t node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uint32_t indent)
71{ 71{
72 plist_data_t node_data = NULL; 72 plist_data_t node_data = NULL;
73 73
@@ -154,7 +154,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uin
154 } 154 }
155 size_t sl = sprintf(buf, "%u: ", cnt); 155 size_t sl = sprintf(buf, "%u: ", cnt);
156 str_buf_append(*outbuf, buf, sl); 156 str_buf_append(*outbuf, buf, sl);
157 int res = node_to_string(ch, outbuf, depth+1, indent); 157 plist_err_t res = node_to_string(ch, outbuf, depth+1, indent);
158 if (res < 0) { 158 if (res < 0) {
159 return res; 159 return res;
160 } 160 }
@@ -171,7 +171,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uin
171 str_buf_append(*outbuf, " ", 1); 171 str_buf_append(*outbuf, " ", 1);
172 } 172 }
173 } 173 }
174 int res = node_to_string(ch, outbuf, depth+1, indent); 174 plist_err_t res = node_to_string(ch, outbuf, depth+1, indent);
175 if (res < 0) { 175 if (res < 0) {
176 return res; 176 return res;
177 } 177 }
@@ -278,7 +278,7 @@ static int num_digits_u(uint64_t i)
278 return n; 278 return n;
279} 279}
280 280
281static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint32_t indent) 281static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint32_t indent)
282{ 282{
283 plist_data_t data; 283 plist_data_t data;
284 if (!node) { 284 if (!node) {
@@ -289,7 +289,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint3
289 node_t ch; 289 node_t ch;
290 unsigned int n_children = node_n_children(node); 290 unsigned int n_children = node_n_children(node);
291 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 291 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
292 int res = node_estimate_size(ch, size, depth + 1, indent); 292 plist_err_t res = node_estimate_size(ch, size, depth + 1, indent);
293 if (res < 0) { 293 if (res < 0) {
294 return res; 294 return res;
295 } 295 }
@@ -369,7 +369,7 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist
369 for (i = 0; i < indent; i++) { 369 for (i = 0; i < indent; i++) {
370 str_buf_append(outbuf, " ", 1); 370 str_buf_append(outbuf, " ", 1);
371 } 371 }
372 int res = node_to_string(plist, &outbuf, 0, indent); 372 plist_err_t res = node_to_string((node_t)plist, &outbuf, 0, indent);
373 if (res < 0) { 373 if (res < 0) {
374 return res; 374 return res;
375 } 375 }
@@ -382,7 +382,7 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist
382plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* length, plist_write_options_t options) 382plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* length, plist_write_options_t options)
383{ 383{
384 uint64_t size = 0; 384 uint64_t size = 0;
385 int res; 385 plist_err_t res;
386 386
387 if (!plist || !output || !length) { 387 if (!plist || !output || !length) {
388 return PLIST_ERR_INVALID_ARG; 388 return PLIST_ERR_INVALID_ARG;
@@ -393,7 +393,7 @@ plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* l
393 indent = (options >> 24) & 0xFF; 393 indent = (options >> 24) & 0xFF;
394 } 394 }
395 395
396 res = node_estimate_size(plist, &size, 0, indent); 396 res = node_estimate_size((node_t)plist, &size, 0, indent);
397 if (res < 0) { 397 if (res < 0) {
398 return res; 398 return res;
399 } 399 }
@@ -415,7 +415,7 @@ plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* l
415 } 415 }
416 str_buf_append(outbuf, "\0", 1); 416 str_buf_append(outbuf, "\0", 1);
417 417
418 *output = outbuf->data; 418 *output = (char*)outbuf->data;
419 *length = outbuf->len - 1; 419 *length = outbuf->len - 1;
420 420
421 outbuf->data = NULL; 421 outbuf->data = NULL;
@@ -437,7 +437,7 @@ plist_err_t plist_write_to_stream_limd(plist_t plist, FILE *stream, plist_write_
437 return PLIST_ERR_NO_MEM; 437 return PLIST_ERR_NO_MEM;
438 } 438 }
439 439
440 int res = _plist_write_to_strbuf(plist, outbuf, options); 440 plist_err_t res = _plist_write_to_strbuf(plist, outbuf, options);
441 if (res < 0) { 441 if (res < 0) {
442 str_buf_free(outbuf); 442 str_buf_free(outbuf);
443 return res; 443 return res;