[PATCH] tests: fix compiler warnings and remove trailing whitespace

Marek Ch mchqwerty at gmail.com
Wed Nov 20 07:25:39 PST 2013


Fix 'unused variable' and 'missing initializer' warnings and
remove trailing whitespaces in connection-test
---
 tests/connection-test.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tests/connection-test.c b/tests/connection-test.c
index e284ea0..066b5b5 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -217,10 +217,10 @@ expected_fail_marshal(int expected_error, const char *format, ...)
 {
 	struct wl_closure *closure;
 	static const uint32_t opcode = 4444;
-	static const struct wl_interface test_interface = { 
+	static const struct wl_interface test_interface = {
 		.name = "test_object"
 	};
-	static struct wl_object sender = { 0 };
+	static struct wl_object sender = { 0, 0, 0 };
 	struct wl_message message = { "test", format, NULL };
 
 	sender.interface = &test_interface;
@@ -278,6 +278,7 @@ static void
 validate_demarshal_u(struct marshal_data *data,
 		     struct wl_object *object, uint32_t u)
 {
+	assert(object && data);
 	assert(data->value.u == u);
 }
 
@@ -285,6 +286,7 @@ static void
 validate_demarshal_i(struct marshal_data *data,
 		     struct wl_object *object, int32_t i)
 {
+	assert(object && data);
 	assert(data->value.i == i);
 }
 
@@ -292,6 +294,8 @@ static void
 validate_demarshal_s(struct marshal_data *data,
 		     struct wl_object *object, const char *s)
 {
+	assert(object && data);
+
 	if (data->value.s != NULL)
 		assert(strcmp(data->value.s, s) == 0);
 	else
@@ -304,6 +308,7 @@ validate_demarshal_h(struct marshal_data *data,
 {
 	struct stat buf1, buf2;
 
+	assert(object && data);
 	assert(fd != data->value.h);
 	fstat(fd, &buf1);
 	fstat(data->value.h, &buf2);
@@ -317,6 +322,7 @@ static void
 validate_demarshal_f(struct marshal_data *data,
 		     struct wl_object *object, wl_fixed_t f)
 {
+	assert(object && data);
 	assert(data->value.i == f);
 }
 
@@ -385,13 +391,13 @@ TEST(connection_demarshal)
 	msg[0] = 400200;
 	msg[1] = 12;
 	msg[2] = 0;
-	demarshal(&data, "?s", msg, (void *) validate_demarshal_s);	
+	demarshal(&data, "?s", msg, (void *) validate_demarshal_s);
 
 	release_marshal_data(&data);
 }
 
 static void
-marshal_demarshal(struct marshal_data *data, 
+marshal_demarshal(struct marshal_data *data,
 		  void (*func)(void), int size, const char *format, ...)
 {
 	struct wl_closure *closure;
@@ -473,7 +479,7 @@ TEST(connection_marshal_alot)
 	int i;
 
 	setup_marshal_data(&data);
-	
+
 	/* We iterate enough to make sure we wrap the circular buffers
 	 * for both regular data an fds. */
 
@@ -517,6 +523,7 @@ suu_handler(void *data, struct wl_object *object,
 {
 	int *done = data;
 
+	assert(object && data && s);
 	assert(strcmp(s, "foo") == 0);
 	assert(u1 = 500);
 	assert(u2 = 404040);
-- 
1.8.4.2



More information about the wayland-devel mailing list