From db0add6d5e23deac53c834f73d5e56180600cead Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 23 Jul 2012 19:54:41 +0100 Subject: Make NEW_IDs nullable The connection-handling code already allows this, so make it legal in the protocol definition too. Signed-off-by: Daniel Stone --- src/wayland-client.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/wayland-client.c') diff --git a/src/wayland-client.c b/src/wayland-client.c index b41fb9b..7130cb7 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -479,19 +479,29 @@ create_proxies(struct wl_display *display, struct wl_closure *closure) { struct wl_proxy *proxy; const char *signature; + struct argument_details arg; uint32_t id; int i; + int count; signature = closure->message->signature; - for (i = 0; signature[i]; i++) { - switch (signature[i]) { + count = arg_count_for_signature(signature) + 2; + for (i = 2; i < count; i++) { + signature = get_next_argument(signature, &arg); + switch (arg.type) { case 'n': - id = **(uint32_t **) closure->args[i + 2]; + id = **(uint32_t **) closure->args[i]; + if (id == 0) { + *(void **) closure->args[i] = NULL; + break; + } proxy = wl_proxy_create_for_id(&display->proxy, id, - closure->message->types[i]); + closure->message->types[i - 2]); if (proxy == NULL) return -1; - *(void **) closure->args[i + 2] = proxy; + *(void **) closure->args[i] = proxy; + break; + default: break; } } -- cgit v1.2.3