[Spice-commits] 3 commits - common/pixman_utils.c server/tests

Christophe Fergau teuf at kemper.freedesktop.org
Fri Apr 8 03:19:14 PDT 2011


 common/pixman_utils.c             |   10 +++-------
 server/tests/basic_event_loop.c   |    3 +--
 server/tests/test_display_base.c  |    5 +++--
 server/tests/test_empty_success.c |    3 +++
 4 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 40316816383650cf9a4b33b43b4373aafe516d33
Author: Christophe Fergeau <cfergeau at gmail.com>
Date:   Tue Mar 22 12:58:27 2011 +0100

    server/tests remove useless assignment
    
    This was detected by clang-static-analyzer.

diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index 2fe1b69..8db4426 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -302,7 +302,6 @@ void basic_event_loop_mainloop(void)
     while (1) {
         FD_ZERO(&rfds);
         FD_ZERO(&wfds);
-        watch = (SpiceWatch*)watches.next;
         i = 0;
         RING_FOREACH_SAFE(link, next, &watches) {
             watch = (SpiceWatch*)link;
commit 086d6fded69b323af0a14276f4b5e9454094dad0
Author: Christophe Fergeau <cfergeau at gmail.com>
Date:   Tue Mar 22 11:48:54 2011 +0100

    common/pixman: remove dead assignments
    
    They were detected using clang-static-analyzer. Don't initialize
    the variable to a value to override it with a different value
    a few lines after.

diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index bdc18c9..5daee27 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -785,9 +785,7 @@ void spice_pixman_blit_colorkey (pixman_image_t *dest,
 
         while (height--) {
             uint8_t *d = (uint8_t *)byte_line;
-            uint8_t *s = (uint8_t *)byte_line;
-
-            s = (uint8_t *)src_line;
+            uint8_t *s = (uint8_t *)src_line;
             for (x = 0; x < width; x++) {
                 uint8_t val = *s;
                 if (val != (uint8_t)transparent_color) {
@@ -805,9 +803,8 @@ void spice_pixman_blit_colorkey (pixman_image_t *dest,
 
         while (height--) {
             uint16_t *d = (uint16_t *)byte_line;
-            uint16_t *s = (uint16_t *)byte_line;
+            uint16_t *s = (uint16_t *)src_line;
 
-            s = (uint16_t *)src_line;
             for (x = 0; x < width; x++) {
                 uint16_t val = *s;
                 if (val != (uint16_t)transparent_color) {
@@ -826,10 +823,9 @@ void spice_pixman_blit_colorkey (pixman_image_t *dest,
 
         while (height--) {
             uint32_t *d = (uint32_t *)byte_line;
-            uint32_t *s = (uint32_t *)byte_line;
+            uint32_t *s = (uint32_t *)src_line;
 
             transparent_color &= 0xffffff;
-            s = (uint32_t *)src_line;
             for (x = 0; x < width; x++) {
                 uint32_t val = *s;
                 if ((0xffffff & val) != transparent_color) {
commit 3ba093a57e5283b3b630a30182cb770e62fc93a9
Author: Christophe Fergeau <cfergeau at gmail.com>
Date:   Mon Mar 21 13:38:19 2011 +0100

    tests: fix compilation with -Wall -Werror
    
    When compiling spice with make CFLAGS="-g3 -ggdb3 -O0 -Wall -Werror",
    the build broken because of a few unused variables/missing returns.
    This patch fixes these warnings.

diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index 7e8a1df..2fe1b69 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -319,7 +319,7 @@ void basic_event_loop_mainloop(void)
         if ((next_timer = get_next_timer()) != NULL) {
             calc_next_timeout(next_timer, &next_timer_timeout);
             timeout = &next_timer_timeout;
-            DPRINTF(1, "timeout of %d.%06d",
+            DPRINTF(1, "timeout of %zd.%06zd",
                     timeout->tv_sec, timeout->tv_usec);
         } else {
             timeout = NULL;
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index c87d2c7..104ab37 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -40,7 +40,6 @@ static void test_spice_destroy_update(SimpleSpiceUpdate *update)
 
 #define SINGLE_PART 8
 static const int angle_parts = 64 / SINGLE_PART;
-static int angle = 0;
 static int unique = 1;
 static int color = -1;
 static int c_i = 0;
@@ -354,7 +353,6 @@ static int num_simple_commands = 0;
 static void produce_command()
 {
     static int target_surface = 0;
-    static int simple_command_index = 0;
     static int cmd_index = 0;
 
     ASSERT(num_simple_commands);
@@ -449,6 +447,7 @@ static struct {
     uint8_t data[CURSOR_WIDTH * CURSOR_HEIGHT * 4]; // 32bit per pixel
 } cursor;
 
+#if 0
 static void init_cursor()
 {
     cursor.cursor.header.unique = 0; // TODO ??
@@ -461,6 +460,7 @@ static void init_cursor()
     cursor.cursor.chunk.data_size = cursor.cursor.data_size;
     cursor.cursor.chunk.prev_chunk = cursor.cursor.chunk.next_chunk = 0;
 }
+#endif
 
 static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
 {
@@ -515,6 +515,7 @@ static void notify_update(QXLInstance *qin, uint32_t update_id)
 static int flush_resources(QXLInstance *qin)
 {
     printf("%s\n", __func__);
+    return TRUE;
 }
 
 QXLInterface display_sif = {
diff --git a/server/tests/test_empty_success.c b/server/tests/test_empty_success.c
index e747e40..97aa772 100644
--- a/server/tests/test_empty_success.c
+++ b/server/tests/test_empty_success.c
@@ -1,8 +1,10 @@
+#include <stdlib.h>
 #include <strings.h>
 #include <spice.h>
 
 SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
 {
+    return NULL;
 }
 
 void timer_start(SpiceTimer *timer, uint32_t ms)
@@ -19,6 +21,7 @@ void timer_remove(SpiceTimer *timer)
 
 SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
 {
+    return NULL;
 }
 
 void watch_update_mask(SpiceWatch *watch, int event_mask)


More information about the Spice-commits mailing list