[PATCH wayland 5/7] Fill out dummy objects and fix wl_closure_invoke calls

Jason Ekstrand jason at jlekstrand.net
Mon Feb 18 08:03:26 PST 2013


Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 tests/connection-test.c  | 36 ++++++++++++++++++++++++++++++------
 tests/dispatcher-test.c  |  1 +
 tests/os-wrappers-test.c | 11 +++++++++--
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/tests/connection-test.c b/tests/connection-test.c
index 1ac88d2..94b8438 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -327,7 +327,14 @@ demarshal(struct marshal_data *data, const char *format,
 	struct wl_message message = { "test", format, NULL };
 	struct wl_closure *closure;
 	struct wl_map objects;
-	struct wl_object object;
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL, NULL
+	};
+	struct wl_object object = { &interface, &func, 1234 };
 	int size = msg[1];
 
 	assert(write(data->s[1], msg, size) == size);
@@ -338,7 +345,7 @@ demarshal(struct marshal_data *data, const char *format,
 	closure = wl_connection_demarshal(data->read_connection,
 					  size, &objects, &message);
 	assert(closure);
-	wl_closure_invoke(closure, &object, func, data);
+	wl_closure_invoke(closure, &object, 0, data, NULL);
 	wl_closure_destroy(closure);
 }
 
@@ -399,7 +406,15 @@ marshal_demarshal(struct marshal_data *data,
 	static struct wl_object sender = { NULL, NULL, 1234 };
 	struct wl_message message = { "test", format, NULL };
 	struct wl_map objects;
-	struct wl_object object;
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL, NULL
+	};
+	struct wl_object object = { &interface, &func, 1234 };
+
 	va_list ap;
 	uint32_t msg[1] = { 1234 };
 
@@ -418,7 +433,8 @@ marshal_demarshal(struct marshal_data *data,
 	object.id = msg[0];
 	closure = wl_connection_demarshal(data->read_connection,
 					  size, &objects, &message);
-	wl_closure_invoke(closure, &object, func, data);
+	assert(closure);
+	wl_closure_invoke(closure, &object, 0, data, NULL);
 	wl_closure_destroy(closure);
 }
 
@@ -493,9 +509,17 @@ static void
 marshal_helper(const char *format, void *handler, ...)
 {
 	struct wl_closure *closure;
-	static struct wl_object sender = { NULL, NULL, 1234 }, object;
+	struct wl_object sender = { NULL, NULL, 1234 };
 	static const int opcode = 4444;
 	struct wl_message message = { "test", format, NULL };
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL, NULL
+	};
+	struct wl_object object = { &interface, &handler, 1234 };
 	va_list ap;
 	int done;
 
@@ -505,7 +529,7 @@ marshal_helper(const char *format, void *handler, ...)
 
 	assert(closure);
 	done = 0;
-	wl_closure_invoke(closure, &object, handler, &done);
+	wl_closure_invoke(closure, &object, 0, &done, NULL);
 	wl_closure_destroy(closure);
 	assert(done);
 }
diff --git a/tests/dispatcher-test.c b/tests/dispatcher-test.c
index ef82d9f..709bce3 100644
--- a/tests/dispatcher-test.c
+++ b/tests/dispatcher-test.c
@@ -57,6 +57,7 @@ struct wl_interface test_interface = {
 	1,
 	1, &test_message,
 	1, &test_message,
+	NULL, NULL
 };
 
 void (* test_function_ptr)(void) = (void (*)(void))&test_function;
diff --git a/tests/os-wrappers-test.c b/tests/os-wrappers-test.c
index 515fd81..dcaeb63 100644
--- a/tests/os-wrappers-test.c
+++ b/tests/os-wrappers-test.c
@@ -233,7 +233,14 @@ marshal_demarshal(struct marshal_data *data,
 	static struct wl_object sender = { NULL, NULL, 1234 };
 	struct wl_message message = { "test", format, NULL };
 	struct wl_map objects;
-	struct wl_object object;
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL, NULL
+	};
+	struct wl_object object = { &interface, &func, 1234 };
 	va_list ap;
 	uint32_t msg[1] = { 1234 };
 
@@ -252,7 +259,7 @@ marshal_demarshal(struct marshal_data *data,
 	object.id = msg[0];
 	closure = wl_connection_demarshal(data->read_connection,
 					  size, &objects, &message);
-	wl_closure_invoke(closure, &object, func, data);
+	wl_closure_invoke(closure, &object, 0, data, NULL);
 	wl_closure_destroy(closure);
 }
 
-- 
1.8.1.2



More information about the wayland-devel mailing list