diff options
author | Nikias Bassen | 2023-05-21 00:12:57 +0200 |
---|---|---|
committer | Nikias Bassen | 2023-05-21 00:12:57 +0200 |
commit | f28cf0f1e51c7554d590cbec56abac46b4a44b4e (patch) | |
tree | 4e2e2038fe0b780dd9595deecbe887d89a3e3de8 /src/out-limd.c | |
parent | d772fd74d2a52646c34d558220533547725a2298 (diff) | |
download | libplist-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.c | 20 |
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) return len; } -static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uint32_t indent) +static plist_err_t node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uint32_t indent) { plist_data_t node_data = NULL; @@ -154,7 +154,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uin } size_t sl = sprintf(buf, "%u: ", cnt); str_buf_append(*outbuf, buf, sl); - int res = node_to_string(ch, outbuf, depth+1, indent); + plist_err_t res = node_to_string(ch, outbuf, depth+1, indent); if (res < 0) { return res; } @@ -171,7 +171,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth, uin str_buf_append(*outbuf, " ", 1); } } - int res = node_to_string(ch, outbuf, depth+1, indent); + plist_err_t res = node_to_string(ch, outbuf, depth+1, indent); if (res < 0) { return res; } @@ -278,7 +278,7 @@ static int num_digits_u(uint64_t i) return n; } -static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint32_t indent) +static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint32_t indent) { plist_data_t data; if (!node) { @@ -289,7 +289,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, uint3 node_t ch; unsigned int n_children = node_n_children(node); for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { - int res = node_estimate_size(ch, size, depth + 1, indent); + plist_err_t res = node_estimate_size(ch, size, depth + 1, indent); if (res < 0) { return res; } @@ -369,7 +369,7 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist for (i = 0; i < indent; i++) { str_buf_append(outbuf, " ", 1); } - int res = node_to_string(plist, &outbuf, 0, indent); + plist_err_t res = node_to_string((node_t)plist, &outbuf, 0, indent); if (res < 0) { return res; } @@ -382,7 +382,7 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* length, plist_write_options_t options) { uint64_t size = 0; - int res; + plist_err_t res; if (!plist || !output || !length) { 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 indent = (options >> 24) & 0xFF; } - res = node_estimate_size(plist, &size, 0, indent); + res = node_estimate_size((node_t)plist, &size, 0, indent); if (res < 0) { return res; } @@ -415,7 +415,7 @@ plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* l } str_buf_append(outbuf, "\0", 1); - *output = outbuf->data; + *output = (char*)outbuf->data; *length = outbuf->len - 1; outbuf->data = NULL; @@ -437,7 +437,7 @@ plist_err_t plist_write_to_stream_limd(plist_t plist, FILE *stream, plist_write_ return PLIST_ERR_NO_MEM; } - int res = _plist_write_to_strbuf(plist, outbuf, options); + plist_err_t res = _plist_write_to_strbuf(plist, outbuf, options); if (res < 0) { str_buf_free(outbuf); return res; |