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

Marek Ch mchqwerty at gmail.com
Thu Nov 21 04:06:04 PST 2013


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

diff --git a/tests/connection-test.c b/tests/connection-test.c
index e284ea0..9f9a544 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,8 @@ static void
 validate_demarshal_u(struct marshal_data *data,
 		     struct wl_object *object, uint32_t u)
 {
+	assert(object);
+	assert(data);
 	assert(data->value.u == u);
 }
 
@@ -285,6 +287,8 @@ static void
 validate_demarshal_i(struct marshal_data *data,
 		     struct wl_object *object, int32_t i)
 {
+	assert(object);
+	assert(data);
 	assert(data->value.i == i);
 }
 
@@ -292,6 +296,9 @@ static void
 validate_demarshal_s(struct marshal_data *data,
 		     struct wl_object *object, const char *s)
 {
+	assert(object);
+	assert(data);
+
 	if (data->value.s != NULL)
 		assert(strcmp(data->value.s, s) == 0);
 	else
@@ -304,6 +311,8 @@ validate_demarshal_h(struct marshal_data *data,
 {
 	struct stat buf1, buf2;
 
+	assert(object);
+	assert(data);
 	assert(fd != data->value.h);
 	fstat(fd, &buf1);
 	fstat(data->value.h, &buf2);
@@ -317,6 +326,8 @@ static void
 validate_demarshal_f(struct marshal_data *data,
 		     struct wl_object *object, wl_fixed_t f)
 {
+	assert(object);
+	assert(data);
 	assert(data->value.i == f);
 }
 
@@ -385,13 +396,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 +484,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 +528,9 @@ suu_handler(void *data, struct wl_object *object,
 {
 	int *done = data;
 
+	assert(object);
+	assert(data);
+	assert(s);
 	assert(strcmp(s, "foo") == 0);
 	assert(u1 = 500);
 	assert(u2 = 404040);
-- 
1.8.4.2



More information about the wayland-devel mailing list