More consistent ID printing
authorDaniel Stone <daniel@fooishbar.org>
Mon, 23 Jul 2012 18:54:42 +0000 (19:54 +0100)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 24 Jul 2012 00:17:10 +0000 (20:17 -0400)
Use unsigned rather than signed for IDs, so they match up with what we
see in other prints.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/connection.c
src/wayland-client.c
src/wayland-server.c
tests/connection-test.c

index 4ba7f63..2733ac9 100644 (file)
@@ -738,7 +738,7 @@ wl_connection_demarshal(struct wl_connection *connection,
                                 * destroyed client side */
                                *object = NULL;
                        } else if (*object == NULL && *p != 0) {
-                               printf("unknown object (%d), message %s(%s)\n",
+                               printf("unknown object (%u), message %s(%s)\n",
                                       *p, message->name, message->signature);
                                *object = NULL;
                                errno = EINVAL;
@@ -747,7 +747,7 @@ wl_connection_demarshal(struct wl_connection *connection,
 
                        if (*object != NULL && message->types[i-2] != NULL &&
                            (*object)->interface != message->types[i-2]) {
-                               printf("invalid object (%d), type (%s), "
+                               printf("invalid object (%u), type (%s), "
                                        "message %s(%s)\n",
                                       *p, (*object)->interface->name,
                                       message->name, message->signature);
index 7130cb7..631ec5a 100644 (file)
@@ -203,14 +203,14 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
                abort();
        }
 
+       if (wl_debug)
+               wl_closure_print(closure, &proxy->object, true);
+
        if (wl_closure_send(closure, proxy->display->connection)) {
                fprintf(stderr, "Error sending request: %m\n");
                abort();
        }
 
-       if (wl_debug)
-               wl_closure_print(closure, &proxy->object, true);
-
        wl_closure_destroy(closure);
 }
 
@@ -235,7 +235,7 @@ display_handle_error(void *data,
                     struct wl_display *display, struct wl_object *object,
                     uint32_t code, const char *message)
 {
-       fprintf(stderr, "%s@%d: error %d: %s\n",
+       fprintf(stderr, "%s@%u: error %d: %s\n",
                object->interface->name, object->id, code, message);
        abort();
 }
@@ -531,14 +531,14 @@ handle_event(struct wl_display *display,
        closure = wl_connection_demarshal(display->connection, size,
                                          &display->objects, message);
 
+       if (wl_debug)
+               wl_closure_print(closure, &proxy->object, false);
+
        if (closure == NULL || create_proxies(display, closure) < 0) {
                fprintf(stderr, "Error demarshalling event\n");
                abort();
        }
 
-       if (wl_debug)
-               wl_closure_print(closure, &proxy->object, false);
-
        wl_closure_invoke(closure, &proxy->object,
                          proxy->object.implementation[opcode],
                          proxy->user_data);
index 3dc8416..88e8433 100644 (file)
@@ -243,7 +243,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
                if (resource == NULL) {
                        wl_resource_post_error(client->display_resource,
                                               WL_DISPLAY_ERROR_INVALID_OBJECT,
-                                              "invalid object %d", p[0]);
+                                              "invalid object %u", p[0]);
                        break;
                }
 
@@ -251,7 +251,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
                if (opcode >= object->interface->method_count) {
                        wl_resource_post_error(client->display_resource,
                                               WL_DISPLAY_ERROR_INVALID_METHOD,
-                                              "invalid method %d, object %s@%d",
+                                              "invalid method %d, object %s@%u",
                                               opcode,
                                               object->interface->name,
                                               object->id);
@@ -263,10 +263,13 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
                                                  &client->objects, message);
                len -= size;
 
+               if (wl_debug)
+                       wl_closure_print(closure, object, false);
+
                if (closure == NULL && errno == EINVAL) {
                        wl_resource_post_error(client->display_resource,
                                               WL_DISPLAY_ERROR_INVALID_METHOD,
-                                              "invalid arguments for %s@%d.%s",
+                                              "invalid arguments for %s@%u.%s",
                                               object->interface->name,
                                               object->id,
                                               message->name);
@@ -278,9 +281,6 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 
                deref_new_objects(closure);
 
-               if (wl_debug)
-                       wl_closure_print(closure, object, false);
-
                wl_closure_invoke(closure, object,
                                  object->implementation[opcode], client);
 
index a852c17..b6bcde1 100644 (file)
@@ -236,7 +236,7 @@ TEST(connection_marshal)
        marshal(&data, "n", 12, &object);
        assert(data.buffer[2] == object.id);
 
-       marshal(&data, "n", 12, NULL);
+       marshal(&data, "?n", 12, NULL);
        assert(data.buffer[2] == 0);
 
        array.data = (void *) text;