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)
return len;
}
-static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth)
+static plist_err_t node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth)
{
plist_data_t node_data = NULL;
@@ -159,7 +159,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth)
char indexbuf[16];
int l = sprintf(indexbuf, "%u => ", cnt);
str_buf_append(*outbuf, indexbuf, l);
- int res = node_to_string(ch, outbuf, depth+1);
+ plist_err_t res = node_to_string(ch, outbuf, depth+1);
if (res < 0) {
return res;
}
@@ -184,7 +184,7 @@ static int node_to_string(node_t node, bytearray_t **outbuf, uint32_t depth)
str_buf_append(*outbuf, " ", 2);
}
}
- int res = node_to_string(ch, outbuf, depth+1);
+ plist_err_t res = node_to_string(ch, outbuf, depth+1);
if (res < 0) {
return res;
}
@@ -304,7 +304,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)
+static plist_err_t node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
{
plist_data_t data;
if (!node) {
@@ -315,7 +315,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
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);
+ plist_err_t res = node_estimate_size(ch, size, depth + 1);
if (res < 0) {
return res;
}
@@ -390,7 +390,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist_write_options_t options)
{
- int res = node_to_string(plist, &outbuf, 0);
+ plist_err_t res = node_to_string((node_t)plist, &outbuf, 0);
if (res < 0) {
return res;
}
@@ -403,13 +403,13 @@ static plist_err_t _plist_write_to_strbuf(plist_t plist, strbuf_t *outbuf, plist
plist_err_t plist_write_to_string_plutil(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;
}
- res = node_estimate_size(plist, &size, 0);
+ res = node_estimate_size((node_t)plist, &size, 0);
if (res < 0) {
return res;
}
@@ -431,7 +431,7 @@ plist_err_t plist_write_to_string_plutil(plist_t plist, char **output, uint32_t*
}
str_buf_append(outbuf, "\0", 1);
- *output = outbuf->data;
+ *output = (char*)outbuf->data;
*length = outbuf->len - 1;
outbuf->data = NULL;
@@ -453,7 +453,7 @@ plist_err_t plist_write_to_stream_plutil(plist_t plist, FILE *stream, plist_writ
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;