This commit is contained in:
Lubos Dolezel 2018-08-22 22:29:52 +02:00
parent e5ffcf16ed
commit a3e012662c
3 changed files with 10 additions and 6 deletions

View File

@ -49,7 +49,7 @@ nv_release_entry(nvlist_t *nv, const char *key)
struct xpc_object *
nv2xpc(const nvlist_t *nv)
{
struct xpc_object *xo, *xotmp;
struct xpc_object *xo = NULL, *xotmp = NULL;
void *cookiep;
const char *key;
int type;
@ -207,10 +207,12 @@ xpc2nv(struct xpc_object *xo)
xpc2nv_primitive(nv, k, v);
return ((bool)true);
});
return nv;
}
if (xo->xo_xpc_type == _XPC_TYPE_ARRAY) {
char *key;
char *key = NULL;
nv = nvlist_create_array(0);
xpc_array_apply(xo, ^(size_t index, xpc_object_t v) {
asprintf(&key, "%ld", index);
@ -218,9 +220,12 @@ xpc2nv(struct xpc_object *xo)
free(key);
return ((bool)true);
});
return nv;
}
return (nv);
assert(0 && "xpc_object not array or dictionary");
return NULL;
}
xpc_object_t
@ -229,7 +234,7 @@ xpc_dictionary_create(const char * const *keys, const xpc_object_t *values,
{
struct xpc_object *xo;
size_t i;
xpc_u val;
xpc_u val = {0};
xo = _xpc_prim_create(_XPC_TYPE_DICTIONARY, val, count);

View File

@ -493,7 +493,6 @@ xpc_pipe_receive(mach_port_t local, mach_port_t *remote, xpc_object_t *result,
int data_size;
struct xpc_object *xo;
audit_token_t *auditp;
xpc_u val;
request = &message.header;
/* should be size - but what about arbitrary XPC data? */

View File

@ -143,7 +143,7 @@ _xpc_prim_create_flags(int type, xpc_u value, size_t size, uint16_t flags)
xpc_object_t
xpc_null_create(void)
{
xpc_u val;
xpc_u val = {0};
return _xpc_prim_create(_XPC_TYPE_NULL, val, 0);
}