[Spice-commits] 9 commits - server/spice_bitmap_utils.c server/tests

Christophe Fergau teuf at kemper.freedesktop.org
Thu Sep 18 05:08:34 PDT 2014


 server/spice_bitmap_utils.c                    |    1 
 server/tests/basic_event_loop.c                |    2 
 server/tests/test_display_base.c               |   67 ++++++++++---------------
 server/tests/test_display_no_ssl.c             |    2 
 server/tests/test_display_resolution_changes.c |    7 +-
 server/tests/test_display_streaming.c          |    2 
 server/tests/test_display_width_stride.c       |   31 ++++++-----
 server/tests/test_empty_success.c              |   23 +++++---
 server/tests/test_playback.c                   |   16 ++---
 server/tests/test_vdagent.c                    |   63 ++---------------------
 10 files changed, 83 insertions(+), 131 deletions(-)

New commits:
commit 93b4f4050c57bd851292e4cee884888cee56fc31
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 15:06:54 2014 +0200

    Fix -Wunused-function

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 04dd1e8..1c909fb 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -793,28 +793,6 @@ void test_add_display_interface(Test* test)
     spice_server_add_interface(test->server, &test->qxl_instance.base);
 }
 
-static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
-                     SPICE_GNUC_UNUSED const uint8_t *buf,
-                     int len)
-{
-    printf("%s: %d\n", __func__, len);
-    return len;
-}
-
-static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
-                    SPICE_GNUC_UNUSED uint8_t *buf,
-                    int len)
-{
-    printf("%s: %d\n", __func__, len);
-    return 0;
-}
-
-static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
-                      int connected)
-{
-    printf("%s: %d\n", __func__, connected);
-}
-
 static SpiceBaseInterface base = {
     .type          = SPICE_INTERFACE_CHAR_DEVICE,
     .description   = "test spice virtual channel char device",
diff --git a/server/tests/test_vdagent.c b/server/tests/test_vdagent.c
index 191ad05..22153b6 100644
--- a/server/tests/test_vdagent.c
+++ b/server/tests/test_vdagent.c
@@ -28,57 +28,6 @@ void pinger(SPICE_GNUC_UNUSED void *opaque)
     core->timer_start(ping_timer, ping_ms);
 }
 
-
-static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
-                     SPICE_GNUC_UNUSED const uint8_t *buf,
-                     int len)
-{
-    return len;
-}
-
-static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
-                    uint8_t *buf,
-                    int len)
-{
-    static uint8_t c = 0;
-    static uint8_t message[2048];
-    static unsigned pos = 0;
-    static unsigned message_size;
-    int ret;
-
-    if (pos == 0) {
-        VDIChunkHeader *hdr = (VDIChunkHeader *)message;
-        VDAgentMessage *msg = (VDAgentMessage *)&hdr[1];
-        uint8_t *p = message;
-        int size = sizeof(message);
-        message_size = size;
-        /* fill in message */
-        hdr->port = VDP_SERVER_PORT;
-        hdr->size = message_size - sizeof(VDIChunkHeader);
-        msg->protocol = VD_AGENT_PROTOCOL;
-        msg->type = VD_AGENT_END_MESSAGE;
-        msg->opaque = 0;
-        msg->size = message_size - sizeof(VDIChunkHeader) - sizeof(VDAgentMessage);
-        size -= sizeof(VDIChunkHeader) + sizeof(VDAgentMessage);
-        p += sizeof(VDIChunkHeader) + sizeof(VDAgentMessage);
-        for (; size; --size, ++p, ++c)
-            *p = c;
-    }
-    ret = MIN(message_size - pos, len);
-    memcpy(buf, &message[pos], ret);
-    pos += ret;
-    if (pos == message_size) {
-        pos = 0;
-    }
-    //printf("vmc_read %d (ret %d)\n", len, ret);
-    return ret;
-}
-
-static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
-                      SPICE_GNUC_UNUSED int connected)
-{
-}
-
 static SpiceBaseInterface base = {
     .type          = SPICE_INTERFACE_CHAR_DEVICE,
     .description   = "test spice virtual channel char device",
commit b76e561d82796bd2bccc57be962fc5fba0141da6
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 14:19:52 2014 +0200

    Fix -Wmissing-field-initializers

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 02f3378..04dd1e8 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -815,19 +815,16 @@ static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
     printf("%s: %d\n", __func__, connected);
 }
 
-static SpiceCharDeviceInterface vdagent_sif = {
-    .base.type          = SPICE_INTERFACE_CHAR_DEVICE,
-    .base.description   = "test spice virtual channel char device",
-    .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
-    .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
-    .state              = vmc_state,
-    .write              = vmc_write,
-    .read               = vmc_read,
+static SpiceBaseInterface base = {
+    .type          = SPICE_INTERFACE_CHAR_DEVICE,
+    .description   = "test spice virtual channel char device",
+    .major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
+    .minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
 };
 
 SpiceCharDeviceInstance vdagent_sin = {
     .base = {
-        .sif = &vdagent_sif.base,
+        .sif = &base,
     },
     .subtype = "vdagent",
 };
diff --git a/server/tests/test_display_resolution_changes.c b/server/tests/test_display_resolution_changes.c
index c492653..e351e99 100644
--- a/server/tests/test_display_resolution_changes.c
+++ b/server/tests/test_display_resolution_changes.c
@@ -45,8 +45,8 @@ void set_primary_params(SPICE_GNUC_UNUSED Test *test,
 }
 
 static Command commands[] = {
-    {DESTROY_PRIMARY, NULL},
-    {CREATE_PRIMARY, set_primary_params},
+    {DESTROY_PRIMARY, NULL, .cb_opaque = NULL,},
+    {CREATE_PRIMARY, set_primary_params, .cb_opaque = NULL},
 };
 
 int main(void)
diff --git a/server/tests/test_display_width_stride.c b/server/tests/test_display_width_stride.c
index a071e74..77d3c12 100644
--- a/server/tests/test_display_width_stride.c
+++ b/server/tests/test_display_width_stride.c
@@ -66,17 +66,17 @@ void set_destroy_parameters(SPICE_GNUC_UNUSED Test *test,
 }
 
 static Command commands[] = {
-    {SIMPLE_CREATE_SURFACE, set_surface_params},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DRAW_SOLID, set_draw_parameters},
-    {SIMPLE_DESTROY_SURFACE, set_destroy_parameters},
+    {SIMPLE_CREATE_SURFACE, set_surface_params, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DRAW_SOLID, set_draw_parameters, .cb_opaque = NULL},
+    {SIMPLE_DESTROY_SURFACE, set_destroy_parameters, .cb_opaque = NULL},
 };
 
 void on_client_connected(Test *test)
diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c
index b31f92d..d1742de 100644
--- a/server/tests/test_playback.c
+++ b/server/tests/test_playback.c
@@ -21,11 +21,11 @@
 
 SpicePlaybackInstance playback_instance;
 
-static const SpicePlaybackInterface playback_sif = {
-    .base.type          = SPICE_INTERFACE_PLAYBACK,
-    .base.description   = "test playback",
-    .base.major_version = SPICE_INTERFACE_PLAYBACK_MAJOR,
-    .base.minor_version = SPICE_INTERFACE_PLAYBACK_MINOR,
+static const SpiceBaseInterface base = {
+    .type          = SPICE_INTERFACE_PLAYBACK,
+    .description   = "test playback",
+    .major_version = SPICE_INTERFACE_PLAYBACK_MAJOR,
+    .minor_version = SPICE_INTERFACE_PLAYBACK_MINOR,
 };
 
 uint32_t *frame;
@@ -97,7 +97,7 @@ int main(void)
     spice_server_set_noauth(server);
     spice_server_init(server, core);
 
-    playback_instance.base.sif = &playback_sif.base;
+    playback_instance.base.sif = &base;
     spice_server_add_interface(server, &playback_instance.base);
     spice_server_playback_start(&playback_instance);
 
diff --git a/server/tests/test_vdagent.c b/server/tests/test_vdagent.c
index 7a56c2a..191ad05 100644
--- a/server/tests/test_vdagent.c
+++ b/server/tests/test_vdagent.c
@@ -79,14 +79,11 @@ static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
 {
 }
 
-static SpiceCharDeviceInterface vmc_interface = {
-    .base.type          = SPICE_INTERFACE_CHAR_DEVICE,
-    .base.description   = "test spice virtual channel char device",
-    .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
-    .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
-    .state              = vmc_state,
-    .write              = vmc_write,
-    .read               = vmc_read,
+static SpiceBaseInterface base = {
+    .type          = SPICE_INTERFACE_CHAR_DEVICE,
+    .description   = "test spice virtual channel char device",
+    .major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
+    .minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
 };
 
 SpiceCharDeviceInstance vmc_instance = {
@@ -100,7 +97,7 @@ int main(void)
     core = basic_event_loop_init();
     test = test_new(core);
 
-    vmc_instance.base.sif = &vmc_interface.base;
+    vmc_instance.base.sif = &base;
     spice_server_add_interface(test->server, &vmc_instance.base);
 
     ping_timer = core->timer_add(pinger, NULL);
commit fb938c210ac507acb747c4c5126db7e6b12889fa
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 13:55:56 2014 +0200

    Fix -Wnonnull

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index b197d1b..02f3378 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -88,10 +88,11 @@ static void regression_test(void)
     pid = fork();
     if (pid == 0) {
         char buf[PATH_MAX];
+        char *argv[] = { NULL };
         char *envp[] = {buf, NULL};
 
         snprintf(buf, sizeof(buf), "PATH=%s", getenv("PATH"));
-        execve("regression_test.py", NULL, envp);
+        execve("regression_test.py", argv, envp);
     } else if (pid > 0) {
         return;
     }
commit 63180f6ce3266d3b9b6c7319a0aec1f0d4ee7fe3
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 13:52:16 2014 +0200

    Fix -Wformat

diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index c6f6698..79a4523 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -115,7 +115,7 @@ static void watch_remove(SpiceWatch *watch)
 
 static void channel_event(int event, SpiceChannelEventInfo *info)
 {
-    DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d",
+    DPRINTF(0, "channel event con, type, id, event: %d, %d, %d, %d",
             info->connection_id, info->type, info->id, event);
 }
 
commit 4bf5fd35c4ece8a9100e5cec18b4b75fbaf82d35
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 13:45:49 2014 +0200

    Fix -Wswitch

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index bdac680..b197d1b 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -551,6 +551,8 @@ static void produce_command(Test *test)
                 update = test_spice_create_update_solid(command->solid.surface_id,
                         command->solid.bbox, command->solid.color);
                 break;
+            default: /* Just to shut up GCC warning (-Wswitch) */
+                break;
             }
             push_command(&update->ext);
             break;
commit 08b3e1d8f187fb371d9ade2f69670378e3e409f5
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 13:42:48 2014 +0200

    Fix -Wsign

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 9bb29b7..bdac680 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -215,7 +215,7 @@ static SimpleSpiceUpdate *test_spice_create_update_solid(uint32_t surface_id, QX
     uint32_t *dst;
     uint32_t bw;
     uint32_t bh;
-    int i;
+    uint32_t i;
 
     bw = bbox.right - bbox.left;
     bh = bbox.bottom - bbox.top;
@@ -450,7 +450,7 @@ struct QXLCommandExt* commands[1024];
 
 static void push_command(QXLCommandExt *ext)
 {
-    ASSERT(commands_end - commands_start < COMMANDS_SIZE);
+    ASSERT(commands_end - commands_start < (int) COMMANDS_SIZE);
     commands[commands_end % COMMANDS_SIZE] = ext;
     commands_end++;
 }
diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c
index 2941d4b..b31f92d 100644
--- a/server/tests/test_playback.c
+++ b/server/tests/test_playback.c
@@ -50,7 +50,7 @@ void playback_timer_cb(SPICE_GNUC_UNUSED void *opaque)
     static int t = 0;
     static uint64_t last_sent_usec = 0;
     static uint64_t samples_to_send;
-    int i;
+    uint32_t i;
     struct timeval cur;
     uint64_t cur_usec;
 
commit 79e5a52d0553b07c0e8ca5a894c5d371a07a8964
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 13:34:42 2014 +0200

    Fix -Wunused-value

diff --git a/server/tests/test_display_streaming.c b/server/tests/test_display_streaming.c
index 01c7e7a..4515051 100644
--- a/server/tests/test_display_streaming.c
+++ b/server/tests/test_display_streaming.c
@@ -107,7 +107,7 @@ static void create_clipped_frame(Test *test, Command *command, int clipping_fact
     cmd->bitmap = g_malloc(width*height*4);
     memset(cmd->bitmap, 0xff, width*height*4);
     dst = (uint32_t *)(cmd->bitmap + cur_line*width*4);
-    for (cur_line; cur_line < end_line; cur_line++) {
+    for (; cur_line < end_line; cur_line++) {
         int col;
         for (col = 0; col < width; col++, dst++) {
             *dst = 0x00FF00;
commit 5ea7de3bccafa21963548abcb5b7061de4c59910
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 13:24:55 2014 +0200

    Fix -Wunused-parameter

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 03798ac..9bb29b7 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -64,7 +64,7 @@ static int rects = 16; //number of rects that will be draw
 static int has_automated_tests = 0; //automated test flag
 
 __attribute__((noreturn))
-static void sigchld_handler(int signal_num) // wait for the child process and exit
+static void sigchld_handler(SPICE_GNUC_UNUSED int signal_num) // wait for the child process and exit
 {
     int status;
     wait(&status);
@@ -411,19 +411,22 @@ static void attache_worker(QXLInstance *qin, QXLWorker *_qxl_worker)
     spice_server_vm_start(test->server);
 }
 
-static void set_compression_level(QXLInstance *qin, int level)
+static void set_compression_level(SPICE_GNUC_UNUSED QXLInstance *qin,
+                                  SPICE_GNUC_UNUSED int level)
 {
     printf("%s\n", __func__);
 }
 
-static void set_mm_time(QXLInstance *qin, uint32_t mm_time)
+static void set_mm_time(SPICE_GNUC_UNUSED QXLInstance *qin,
+                        SPICE_GNUC_UNUSED uint32_t mm_time)
 {
 }
 
 // we now have a secondary surface
 #define MAX_SURFACE_NUM 2
 
-static void get_init_info(QXLInstance *qin, QXLDevInitInfo *info)
+static void get_init_info(SPICE_GNUC_UNUSED QXLInstance *qin,
+                          QXLDevInitInfo *info)
 {
     memset(info, 0, sizeof(*info));
     info->num_memslots = 1;
@@ -466,7 +469,8 @@ static int get_num_commands(void)
 }
 
 // called from spice_server thread (i.e. red_worker thread)
-static int get_command(QXLInstance *qin, struct QXLCommandExt *ext)
+static int get_command(SPICE_GNUC_UNUSED QXLInstance *qin,
+                       struct QXLCommandExt *ext)
 {
     if (get_num_commands() == 0) {
         return FALSE;
@@ -616,7 +620,8 @@ static void do_wakeup(void *opaque)
     spice_qxl_wakeup(&test->qxl_instance);
 }
 
-static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_info)
+static void release_resource(SPICE_GNUC_UNUSED QXLInstance *qin,
+                             struct QXLReleaseInfoExt release_info)
 {
     QXLCommandExt *ext = (QXLCommandExt*)(unsigned long)release_info.info->id;
     //printf("%s\n", __func__);
@@ -711,24 +716,25 @@ static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
     return TRUE;
 }
 
-static int req_cursor_notification(QXLInstance *qin)
+static int req_cursor_notification(SPICE_GNUC_UNUSED QXLInstance *qin)
 {
     printf("%s\n", __func__);
     return TRUE;
 }
 
-static void notify_update(QXLInstance *qin, uint32_t update_id)
+static void notify_update(SPICE_GNUC_UNUSED QXLInstance *qin,
+                          SPICE_GNUC_UNUSED uint32_t update_id)
 {
     printf("%s\n", __func__);
 }
 
-static int flush_resources(QXLInstance *qin)
+static int flush_resources(SPICE_GNUC_UNUSED QXLInstance *qin)
 {
     printf("%s\n", __func__);
     return TRUE;
 }
 
-static int client_monitors_config(QXLInstance *qin,
+static int client_monitors_config(SPICE_GNUC_UNUSED QXLInstance *qin,
                                   VDAgentMonitorsConfig *monitors_config)
 {
     if (!monitors_config) {
@@ -784,19 +790,24 @@ void test_add_display_interface(Test* test)
     spice_server_add_interface(test->server, &test->qxl_instance.base);
 }
 
-static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
+static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
+                     SPICE_GNUC_UNUSED const uint8_t *buf,
+                     int len)
 {
     printf("%s: %d\n", __func__, len);
     return len;
 }
 
-static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
+static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
+                    SPICE_GNUC_UNUSED uint8_t *buf,
+                    int len)
 {
     printf("%s: %d\n", __func__, len);
     return 0;
 }
 
-static void vmc_state(SpiceCharDeviceInstance *sin, int connected)
+static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
+                      int connected)
 {
     printf("%s: %d\n", __func__, connected);
 }
diff --git a/server/tests/test_display_no_ssl.c b/server/tests/test_display_no_ssl.c
index 83ab3dc..89b4796 100644
--- a/server/tests/test_display_no_ssl.c
+++ b/server/tests/test_display_no_ssl.c
@@ -17,7 +17,7 @@ void show_channels(SpiceServer *server);
 
 int ping_ms = 100;
 
-void pinger(void *opaque)
+void pinger(SPICE_GNUC_UNUSED void *opaque)
 {
     // show_channels is not thread safe - fails if disconnections / connections occur
     //show_channels(server);
diff --git a/server/tests/test_display_resolution_changes.c b/server/tests/test_display_resolution_changes.c
index 4767ea9..c492653 100644
--- a/server/tests/test_display_resolution_changes.c
+++ b/server/tests/test_display_resolution_changes.c
@@ -22,7 +22,8 @@ void pinger(void *opaque)
     test->core->timer_start(ping_timer, ping_ms);
 }
 
-void set_primary_params(Test *test, Command *command)
+void set_primary_params(SPICE_GNUC_UNUSED Test *test,
+                        Command *command)
 {
 #if 0
     static int toggle = 0;
diff --git a/server/tests/test_display_width_stride.c b/server/tests/test_display_width_stride.c
index f938373..a071e74 100644
--- a/server/tests/test_display_width_stride.c
+++ b/server/tests/test_display_width_stride.c
@@ -25,7 +25,8 @@ void pinger(void *opaque)
 static int g_surface_id = 1;
 static uint8_t *g_surface_data;
 
-void set_draw_parameters(Test *test, Command *command)
+void set_draw_parameters(SPICE_GNUC_UNUSED Test *test,
+                         Command *command)
 {
     static int count = 17;
     CommandDrawSolid *solid = &command->solid;
@@ -38,7 +39,8 @@ void set_draw_parameters(Test *test, Command *command)
     count++;
 }
 
-void set_surface_params(Test *test, Command *command)
+void set_surface_params(SPICE_GNUC_UNUSED Test *test,
+                        Command *command)
 {
     CommandCreateSurface *create = &command->create_surface;
 
@@ -54,7 +56,8 @@ void set_surface_params(Test *test, Command *command)
     create->data = g_surface_data;
 }
 
-void set_destroy_parameters(Test *test, Command *command)
+void set_destroy_parameters(SPICE_GNUC_UNUSED Test *test,
+                            SPICE_GNUC_UNUSED Command *command)
 {
     if (g_surface_data) {
         free(g_surface_data);
diff --git a/server/tests/test_empty_success.c b/server/tests/test_empty_success.c
index 0176a52..82436dc 100644
--- a/server/tests/test_empty_success.c
+++ b/server/tests/test_empty_success.c
@@ -8,39 +8,46 @@ struct SpiceTimer {
     int a,b;
 };
 
-SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
+SpiceTimer* timer_add(SPICE_GNUC_UNUSED SpiceTimerFunc func,
+                      SPICE_GNUC_UNUSED void *opaque)
 {
     static struct SpiceTimer t = {0,};
 
     return &t;
 }
 
-void timer_start(SpiceTimer *timer, uint32_t ms)
+void timer_start(SPICE_GNUC_UNUSED SpiceTimer *timer,
+                 SPICE_GNUC_UNUSED uint32_t ms)
 {
 }
 
-void timer_cancel(SpiceTimer *timer)
+void timer_cancel(SPICE_GNUC_UNUSED SpiceTimer *timer)
 {
 }
 
-void timer_remove(SpiceTimer *timer)
+void timer_remove(SPICE_GNUC_UNUSED SpiceTimer *timer)
 {
 }
 
-SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
+SpiceWatch *watch_add(SPICE_GNUC_UNUSED int fd,
+                      SPICE_GNUC_UNUSED int event_mask,
+                      SPICE_GNUC_UNUSED SpiceWatchFunc func,
+                      SPICE_GNUC_UNUSED void *opaque)
 {
     return NULL;
 }
 
-void watch_update_mask(SpiceWatch *watch, int event_mask)
+void watch_update_mask(SPICE_GNUC_UNUSED SpiceWatch *watch,
+                       SPICE_GNUC_UNUSED int event_mask)
 {
 }
 
-void watch_remove(SpiceWatch *watch)
+void watch_remove(SPICE_GNUC_UNUSED SpiceWatch *watch)
 {
 }
 
-void channel_event(int event, SpiceChannelEventInfo *info)
+void channel_event(SPICE_GNUC_UNUSED int event,
+                   SPICE_GNUC_UNUSED SpiceChannelEventInfo *info)
 {
 }
 
diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c
index cc7b120..2941d4b 100644
--- a/server/tests/test_playback.c
+++ b/server/tests/test_playback.c
@@ -45,7 +45,7 @@ static void get_frame(void)
                         : 100;
 }
 
-void playback_timer_cb(void *opaque)
+void playback_timer_cb(SPICE_GNUC_UNUSED void *opaque)
 {
     static int t = 0;
     static uint64_t last_sent_usec = 0;
diff --git a/server/tests/test_vdagent.c b/server/tests/test_vdagent.c
index af33145..7a56c2a 100644
--- a/server/tests/test_vdagent.c
+++ b/server/tests/test_vdagent.c
@@ -20,7 +20,7 @@ int ping_ms = 100;
 #define MIN(a, b) ((a) > (b) ? (b) : (a))
 #endif
 
-void pinger(void *opaque)
+void pinger(SPICE_GNUC_UNUSED void *opaque)
 {
     // show_channels is not thread safe - fails if disconnections / connections occur
     //show_channels(server);
@@ -29,12 +29,16 @@ void pinger(void *opaque)
 }
 
 
-static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
+static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
+                     SPICE_GNUC_UNUSED const uint8_t *buf,
+                     int len)
 {
     return len;
 }
 
-static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
+static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
+                    uint8_t *buf,
+                    int len)
 {
     static uint8_t c = 0;
     static uint8_t message[2048];
@@ -70,7 +74,8 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
     return ret;
 }
 
-static void vmc_state(SpiceCharDeviceInstance *sin, int connected)
+static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin,
+                      SPICE_GNUC_UNUSED int connected)
 {
 }
 
commit 94edda22553ba351c869b58cd984a79cfc6c2180
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Sep 1 00:38:36 2014 +0200

    server: Don't dump the bitmap when the format is invalid
    
    Caught by covscan:
    spice/server/spice_bitmap_utils.c:54: var_decl: Declaring variable "n_pixel_bits" without initializer.
    spice/server/spice_bitmap_utils.c:106: uninit_use: Using uninitialized value "n_pixel_bits".

diff --git a/server/spice_bitmap_utils.c b/server/spice_bitmap_utils.c
index 7b370a0..aa7d71b 100644
--- a/server/spice_bitmap_utils.c
+++ b/server/spice_bitmap_utils.c
@@ -95,6 +95,7 @@ void dump_bitmap(SpiceBitmap *bitmap)
         break;
     default:
         spice_error("invalid bitmap format  %u", bitmap->format);
+        return;
     }
 
     if (!rgb) {


More information about the Spice-commits mailing list