summaryrefslogtreecommitdiff
path: root/src/wayland-client.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-07-23 19:54:41 +0100
committerKristian Høgsberg <krh@bitplanet.net>2012-07-23 20:16:57 -0400
commitdb0add6d5e23deac53c834f73d5e56180600cead (patch)
tree11b872eaaad1c99c168ebf26e8f0e0cbc6444c20 /src/wayland-client.c
parentefe23443d8bcdad0513d5dd9d027233b3d7dc968 (diff)
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 <daniel@fooishbar.org>
Diffstat (limited to 'src/wayland-client.c')
-rw-r--r--src/wayland-client.c20
1 files changed, 15 insertions, 5 deletions
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;
}
}