[Spice-commits] server/display-channel.c server/red-worker.c server/sound.c

Christophe Fergau teuf at kemper.freedesktop.org
Tue Jan 19 08:16:12 PST 2016


 server/display-channel.c |    6 +++---
 server/red-worker.c      |   10 +++++-----
 server/sound.c           |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 4b8607c40cfc5f99642439f5bb54e282302dfa55
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Mon Nov 30 13:04:26 2015 +0100

    Remove use of spice_warn_if()
    
    spice_warn_if_fail() is doing the same thing except for the inverted
    condition. spice_warn_if() is being removed from spice-common to avoid
    having potentially confusing redundancy.

diff --git a/server/display-channel.c b/server/display-channel.c
index 3bf065c..f0d133a 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -270,7 +270,7 @@ void display_channel_surface_unref(DisplayChannel *display, uint32_t surface_id)
         dcc_destroy_surface(dcc, surface_id);
     }
 
-    spice_warn_if(!ring_is_empty(&surface->depend_on_me));
+    spice_warn_if_fail(ring_is_empty(&surface->depend_on_me));
 }
 
 /* TODO: perhaps rename to "ready" or "realized" ? */
@@ -325,7 +325,7 @@ static void pipes_add_drawable(DisplayChannel *display, Drawable *drawable)
     DisplayChannelClient *dcc;
     RingItem *dcc_ring_item, *next;
 
-    spice_warn_if(!ring_is_empty(&drawable->pipes));
+    spice_warn_if_fail(ring_is_empty(&drawable->pipes));
     FOREACH_DCC(display, dcc_ring_item, next, dcc) {
         dcc_prepend_drawable(dcc, drawable);
     }
@@ -1886,7 +1886,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
 {
     RedSurface *surface = &display->surfaces[surface_id];
 
-    spice_warn_if(surface->context.canvas);
+    spice_warn_if_fail(!surface->context.canvas);
 
     surface->context.canvas_draws_on_surface = FALSE;
     surface->context.width = width;
diff --git a/server/red-worker.c b/server/red-worker.c
index 7d3cce3..ad8ba1a 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -835,9 +835,9 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
     int error;
 
     spice_debug(NULL);
-    spice_warn_if(surface_id != 0);
-    spice_warn_if(surface.height == 0);
-    spice_warn_if(((uint64_t)abs(surface.stride) * (uint64_t)surface.height) !=
+    spice_warn_if_fail(surface_id == 0);
+    spice_warn_if_fail(surface.height != 0);
+    spice_warn_if_fail(((uint64_t)abs(surface.stride) * (uint64_t)surface.height) ==
              abs(surface.stride) * surface.height);
 
     line_0 = (uint8_t*)memslot_get_virt(&worker->mem_slots, surface.mem,
@@ -887,7 +887,7 @@ static void destroy_primary_surface(RedWorker *worker, uint32_t surface_id)
 
     if (!validate_surface(display, surface_id))
         return;
-    spice_warn_if(surface_id != 0);
+    spice_warn_if_fail(surface_id == 0);
 
     spice_debug(NULL);
     if (!display->surfaces[surface_id].context.canvas) {
@@ -1593,7 +1593,7 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
                       init_info.memslot_id_bits,
                       init_info.internal_groupslot_id);
 
-    spice_warn_if(init_info.n_surfaces > NUM_SURFACES);
+    spice_warn_if_fail(init_info.n_surfaces <= NUM_SURFACES);
 
     worker->event_timeout = INF_EVENT_WAIT;
 
diff --git a/server/sound.c b/server/sound.c
index 17968e0..b785652 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -421,7 +421,7 @@ static void snd_receive(void* data)
     for (;;) {
         ssize_t n;
         n = channel->receive_data.end - channel->receive_data.now;
-        spice_warn_if(n <= 0);
+        spice_warn_if_fail(n > 0);
         n = reds_stream_read(channel->stream, channel->receive_data.now, n);
         if (n <= 0) {
             if (n == 0) {


More information about the Spice-commits mailing list