[Spice-devel] [PATCH spice-common 2/4] Replace spice_* logging with g_*

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Jun 12 08:19:52 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

---
 common/canvas_base.c        | 148 ++++++++++++++++++++---------------------
 common/canvas_utils.c       |  18 ++---
 common/gdi_canvas.c         |  82 +++++++++++------------
 common/lz.c                 |  22 +++----
 common/lz_decompress_tmpl.c |  18 ++---
 common/marshaller.c         |   2 +-
 common/mem.c                |   2 +-
 common/pixman_utils.c       | 156 ++++++++++++++++++++++----------------------
 common/quic.c               |  88 ++++++++++++-------------
 common/quic_family_tmpl.c   |   6 +-
 common/quic_rgb_tmpl.c      |  32 ++++-----
 common/quic_tmpl.c          |  32 ++++-----
 common/rect.h               |   2 +-
 common/region.c             |   2 +-
 common/ring.h               |  26 ++++----
 common/rop3.c               |  10 +--
 common/snd_codec.c          |  18 ++---
 common/ssl_verify.c         |  72 ++++++++++----------
 common/sw_canvas.c          |  20 +++---
 19 files changed, 378 insertions(+), 378 deletions(-)

diff --git a/common/canvas_base.c b/common/canvas_base.c
index 8f653e0..c5cea60 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -99,7 +99,7 @@ static HDC create_compatible_dc()
 {
     HDC dc = CreateCompatibleDC(NULL);
 
-    spice_return_val_if_fail(dc != NULL, NULL);
+    g_return_val_if_fail(dc != NULL, NULL);
 
     return dc;
 }
@@ -381,7 +381,7 @@ static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceImage *image,
 
     if (setjmp(quic_data->jmp_env)) {
         pixman_image_unref(surface);
-        spice_warning("%s", quic_data->message_buf);
+        g_warning("%s", quic_data->message_buf);
         return NULL;
     }
 
@@ -392,7 +392,7 @@ static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceImage *image,
                           (uint32_t *)image->u.quic.data->chunk[0].data,
                           image->u.quic.data->chunk[0].len >> 2,
                           &type, &width, &height) == QUIC_ERROR) {
-        spice_warning("quic decode begin failed");
+        g_warning("quic decode begin failed");
         return NULL;
     }
 
@@ -420,12 +420,12 @@ static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceImage *image,
     case QUIC_IMAGE_TYPE_INVALID:
     case QUIC_IMAGE_TYPE_GRAY:
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 
-    spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL);
-    spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL);
+    g_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL);
+    g_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL);
 
     surface = surface_create(
 #ifdef WIN32
@@ -434,14 +434,14 @@ static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceImage *image,
                              pixman_format,
                              width, height, FALSE);
 
-    spice_return_val_if_fail(surface != NULL, NULL);
+    g_return_val_if_fail(surface != NULL, NULL);
 
     dest = (uint8_t *)pixman_image_get_data(surface);
     stride = pixman_image_get_stride(surface);
     if (quic_decode(quic_data->quic, as_type,
                     dest, stride) == QUIC_ERROR) {
         pixman_image_unref(surface);
-        spice_warning("quic decode failed");
+        g_warning("quic decode failed");
         return NULL;
     }
 
@@ -484,11 +484,11 @@ static pixman_image_t *canvas_get_jpeg(CanvasBase *canvas, SpiceImage *image)
     int height;
     uint8_t *dest;
 
-    spice_return_val_if_fail(image->u.jpeg.data->num_chunks == 1, NULL);
+    g_return_val_if_fail(image->u.jpeg.data->num_chunks == 1, NULL);
     canvas->jpeg->ops->begin_decode(canvas->jpeg, image->u.jpeg.data->chunk[0].data, image->u.jpeg.data->chunk[0].len,
                                     &width, &height);
-    spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL);
-    spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL);
+    g_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL);
+    g_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL);
 
     surface = surface_create(
 #ifdef WIN32
@@ -497,7 +497,7 @@ static pixman_image_t *canvas_get_jpeg(CanvasBase *canvas, SpiceImage *image)
                              PIXMAN_LE_x8r8g8b8,
                              width, height, FALSE);
     if (surface == NULL) {
-        spice_warning("create surface failed");
+        g_warning("create surface failed");
         return NULL;
     }
 
@@ -569,7 +569,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image)
             stride_encoded *= 4;
             break;
         default:
-            spice_warning("Unsupported bitmap format %d with LZ4\n", spice_format);
+            g_warning("Unsupported bitmap format %d with LZ4\n", spice_format);
             return NULL;
     }
 
@@ -580,7 +580,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image)
                              format,
                              width, height, top_down);
     if (surface == NULL) {
-        spice_warning("create surface failed");
+        g_warning("create surface failed");
         return NULL;
     }
 
@@ -601,7 +601,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image)
         dec_size = LZ4_decompress_safe_continue(stream, (const char *) data,
                                                 (char *) dest, enc_size, available);
         if (dec_size <= 0) {
-            spice_warning("Error decoding LZ4 block\n");
+            g_warning("Error decoding LZ4 block\n");
             pixman_image_unref(surface);
             surface = NULL;
             break;
@@ -633,13 +633,13 @@ static pixman_image_t *canvas_get_jpeg_alpha(CanvasBase *canvas, SpiceImage *ima
     int alpha_size;
     int lz_alpha_width, lz_alpha_height, n_comp_pixels, lz_alpha_top_down;
 
-    spice_return_val_if_fail(image->u.jpeg_alpha.data->num_chunks == 1, NULL);
+    g_return_val_if_fail(image->u.jpeg_alpha.data->num_chunks == 1, NULL);
     canvas->jpeg->ops->begin_decode(canvas->jpeg,
                                     image->u.jpeg_alpha.data->chunk[0].data,
                                     image->u.jpeg_alpha.jpeg_size,
                                     &width, &height);
-    spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL);
-    spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL);
+    g_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL);
+    g_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL);
 
     if (image->u.jpeg_alpha.flags & SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN) {
         alpha_top_down = TRUE;
@@ -652,7 +652,7 @@ static pixman_image_t *canvas_get_jpeg_alpha(CanvasBase *canvas, SpiceImage *ima
                                      width, height, width*height, alpha_top_down);
 
     if (surface == NULL) {
-        spice_warning("create surface failed");
+        g_warning("create surface failed");
         return NULL;
     }
 
@@ -667,11 +667,11 @@ static pixman_image_t *canvas_get_jpeg_alpha(CanvasBase *canvas, SpiceImage *ima
     lz_decode_begin(lz_data->lz, comp_alpha_buf, alpha_size, &lz_alpha_type,
                     &lz_alpha_width, &lz_alpha_height, &n_comp_pixels,
                     &lz_alpha_top_down, NULL);
-    spice_return_val_if_fail(lz_alpha_type == LZ_IMAGE_TYPE_XXXA, NULL);
-    spice_return_val_if_fail(!!lz_alpha_top_down == !!alpha_top_down, NULL);
-    spice_return_val_if_fail(lz_alpha_width == width, NULL);
-    spice_return_val_if_fail(lz_alpha_height == height, NULL);
-    spice_return_val_if_fail(n_comp_pixels == width * height, NULL);
+    g_return_val_if_fail(lz_alpha_type == LZ_IMAGE_TYPE_XXXA, NULL);
+    g_return_val_if_fail(!!lz_alpha_top_down == !!alpha_top_down, NULL);
+    g_return_val_if_fail(lz_alpha_width == width, NULL);
+    g_return_val_if_fail(lz_alpha_height == height, NULL);
+    g_return_val_if_fail(n_comp_pixels == width * height, NULL);
 
     if (!alpha_top_down) {
         decomp_alpha_buf = dest + stride * (height - 1);
@@ -711,7 +711,7 @@ static pixman_image_t *canvas_bitmap_to_surface(CanvasBase *canvas, SpiceBitmap*
                            format,
                            bitmap->x, bitmap->y, FALSE);
     if (image == NULL) {
-        spice_warning("create surface failed");
+        g_warning("create surface failed");
         return NULL;
     }
 
@@ -772,7 +772,7 @@ static inline SpicePalette *canvas_get_localized_palette(CanvasBase *canvas, Spi
         break;
     case SPICE_SURFACE_FMT_16_565:
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         free(copy);
         return NULL;
     }
@@ -800,23 +800,23 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image,
 
     if (setjmp(lz_data->jmp_env)) {
         free(decomp_buf);
-        spice_warning("%s", lz_data->message_buf);
+        g_warning("%s", lz_data->message_buf);
         return NULL;
     }
 
     free_palette = FALSE;
     if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB) {
-        spice_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
+        g_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
         comp_buf = image->u.lz_rgb.data->chunk[0].data;
         comp_size = image->u.lz_rgb.data->chunk[0].len;
         palette = NULL;
     } else if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) {
-        spice_return_val_if_fail(image->u.lz_plt.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
+        g_return_val_if_fail(image->u.lz_plt.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
         comp_buf = image->u.lz_plt.data->chunk[0].data;
         comp_size = image->u.lz_plt.data->chunk[0].len;
         palette = canvas_get_localized_palette(canvas, image->u.lz_plt.palette, image->u.lz_plt.palette_id, image->u.lz_plt.flags, &free_palette);
     } else {
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 
@@ -859,14 +859,14 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image,
         }
         break;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 
-    spice_return_val_if_fail((unsigned)width == image->descriptor.width, NULL);
-    spice_return_val_if_fail((unsigned)height == image->descriptor.height, NULL);
+    g_return_val_if_fail((unsigned)width == image->descriptor.width, NULL);
+    g_return_val_if_fail((unsigned)height == image->descriptor.height, NULL);
 
-    spice_return_val_if_fail((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height), NULL);
+    g_return_val_if_fail((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height), NULL);
 #ifdef WIN32
     lz_data->decode_data.dc = canvas->dc;
 #endif
@@ -897,7 +897,7 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image,
 static pixman_image_t *canvas_get_glz_rgb_common(CanvasBase *canvas, uint8_t *data,
                                                  int want_original)
 {
-    spice_return_val_if_fail(canvas->glz_data.decoder != NULL, NULL);
+    g_return_val_if_fail(canvas->glz_data.decoder != NULL, NULL);
 
     canvas->glz_data.decoder->ops->decode(canvas->glz_data.decoder,
                                           data, NULL,
@@ -912,12 +912,12 @@ static pixman_image_t *canvas_get_glz_rgb_common(CanvasBase *canvas, uint8_t *da
 static pixman_image_t *canvas_get_glz(CanvasBase *canvas, SpiceImage *image,
                                       int want_original)
 {
-    spice_return_val_if_fail(image->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB, NULL);
+    g_return_val_if_fail(image->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB, NULL);
 #ifdef WIN32
     canvas->glz_data.decode_data.dc = canvas->dc;
 #endif
 
-    spice_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
+    g_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
     return canvas_get_glz_rgb_common(canvas, image->u.lz_rgb.data->chunk[0].data, want_original);
 }
 
@@ -927,9 +927,9 @@ static pixman_image_t *canvas_get_zlib_glz_rgb(CanvasBase *canvas, SpiceImage *i
     uint8_t *glz_data;
     pixman_image_t *surface;
 
-    spice_return_val_if_fail(canvas->zlib != NULL, NULL);
+    g_return_val_if_fail(canvas->zlib != NULL, NULL);
 
-    spice_return_val_if_fail(image->u.zlib_glz.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
+    g_return_val_if_fail(image->u.zlib_glz.data->num_chunks == 1, NULL); /* TODO: Handle chunks */
     glz_data = (uint8_t*)spice_malloc(image->u.zlib_glz.glz_data_size);
     canvas->zlib->ops->decode(canvas->zlib, image->u.zlib_glz.data->chunk[0].data,
                               image->u.zlib_glz.data->chunk[0].len,
@@ -1142,7 +1142,7 @@ static pixman_image_t *get_surface_from_canvas(CanvasBase *canvas,
 #ifdef USE_LZ4
         return canvas_get_lz4(canvas, image);
 #else
-        spice_warning("Lz4 compression algorithm not supported.\n");
+        g_warning("Lz4 compression algorithm not supported.\n");
         return NULL;
 #endif
 
@@ -1154,7 +1154,7 @@ static pixman_image_t *get_surface_from_canvas(CanvasBase *canvas,
         return canvas_get_bits(canvas, &image->u.bitmap, want_original);
 
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 }
@@ -1200,8 +1200,8 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage
 
     surface = get_surface_from_canvas(canvas, image, want_original);
 
-    spice_return_val_if_fail(surface != NULL, NULL);
-    spice_return_val_if_fail(spice_pixman_image_get_format(surface, &surface_format), NULL);
+    g_return_val_if_fail(surface != NULL, NULL);
+    g_return_val_if_fail(spice_pixman_image_get_format(surface, &surface_format), NULL);
 
     if (descriptor->flags & SPICE_IMAGE_FLAGS_HIGH_BITS_SET &&
         descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE &&
@@ -1236,7 +1236,7 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage
 #ifdef SW_CANVAS_CACHE
     } else if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME) {
         if (spice_image_descriptor_is_lossy(descriptor)) {
-            spice_warning("invalid cache replace request: the image is lossy");
+            g_warning("invalid cache replace request: the image is lossy");
             return NULL;
         }
         canvas->bits_cache->ops->replace_lossy(canvas->bits_cache, descriptor->id, surface);
@@ -1335,13 +1335,13 @@ static pixman_image_t* canvas_get_image_from_self(SpiceCanvas *canvas,
         /* Set alpha bits of the format to 0 */
         format = (pixman_format_code_t)(((uint32_t)format) & ~(0xf << 12));
 
-        spice_return_val_if_fail (
+        g_return_val_if_fail (
             pixman_format_supported_destination (format), NULL);
     }
 
     surface = pixman_image_create_bits(spice_surface_format_to_pixman (canvas_base->format),
                                        width, height, NULL, 0);
-    spice_return_val_if_fail(surface != NULL, NULL);
+    g_return_val_if_fail(surface != NULL, NULL);
 
     dest = (uint8_t *)pixman_image_get_data(surface);
     dest_stride = pixman_image_get_stride(surface);
@@ -1427,7 +1427,7 @@ static pixman_image_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* b
             canvas->dc,
 #endif
             PIXMAN_a1, bitmap->x, bitmap->y, TRUE);
-    spice_return_val_if_fail(surface != NULL, NULL);
+    g_return_val_if_fail(surface != NULL, NULL);
 
     spice_chunks_linearize(bitmap->data);
     src_line = bitmap->data->chunk[0].data;
@@ -1438,7 +1438,7 @@ static pixman_image_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* b
     dest_stride = pixman_image_get_stride(surface);
     dest_line = (uint8_t *)pixman_image_get_data(surface);
     if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
-        spice_return_val_if_fail(bitmap->y > 0, NULL);
+        g_return_val_if_fail(bitmap->y > 0, NULL);
         dest_line += dest_stride * ((int)bitmap->y - 1);
         dest_stride = -dest_stride;
     }
@@ -1477,7 +1477,7 @@ static pixman_image_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* b
         default:
             pixman_image_unref(surface);
             surface = NULL;
-            spice_warn_if_reached();
+            g_warn_if_reached();
             return NULL;
         }
     } else {
@@ -1509,7 +1509,7 @@ static pixman_image_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* b
         default:
             pixman_image_unref(surface);
             surface = NULL;
-            spice_warn_if_reached();
+            g_warn_if_reached();
             return NULL;
         }
     }
@@ -1524,10 +1524,10 @@ static inline pixman_image_t *canvas_A1_invers(pixman_image_t *src_surf)
     uint8_t *src_line, *end_line,  *dest_line;
     int src_stride, line_size, dest_stride;
 
-    spice_return_val_if_fail(pixman_image_get_depth(src_surf) == 1, NULL);
+    g_return_val_if_fail(pixman_image_get_depth(src_surf) == 1, NULL);
 
     invers = pixman_image_create_bits(PIXMAN_a1, width, height, NULL, 0);
-    spice_return_val_if_fail(invers != NULL, NULL);
+    g_return_val_if_fail(invers != NULL, NULL);
 
     src_line = (uint8_t *)pixman_image_get_data(src_surf);
     src_stride = pixman_image_get_stride(src_surf);
@@ -1585,7 +1585,7 @@ static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int
         break;
 #endif
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 
@@ -1609,7 +1609,7 @@ static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int
 
 static inline void canvas_raster_glyph_box(const SpiceRasterGlyph *glyph, SpiceRect *r)
 {
-    spice_return_if_fail(r != NULL);
+    g_return_if_fail(r != NULL);
 
     r->top = glyph->render_pos.y + glyph->glyph_origin.y;
     r->bottom = r->top + glyph->height;
@@ -1661,8 +1661,8 @@ static void canvas_put_glyph_bits(SpiceRasterGlyph *glyph, int bpp, uint8_t *des
 
     //todo: support SPICE_STRING_FLAGS_RASTER_TOP_DOWN
     canvas_raster_glyph_box(glyph, &glyph_box);
-    spice_return_if_fail(glyph_box.top >= bounds->top && glyph_box.bottom <= bounds->bottom);
-    spice_return_if_fail(glyph_box.left >= bounds->left && glyph_box.right <= bounds->right);
+    g_return_if_fail(glyph_box.top >= bounds->top && glyph_box.bottom <= bounds->bottom);
+    g_return_if_fail(glyph_box.left >= bounds->left && glyph_box.right <= bounds->right);
     rect_offset(&glyph_box, -bounds->left, -bounds->top);
 
     dest += glyph_box.top * dest_stride;
@@ -1723,7 +1723,7 @@ static void canvas_put_glyph_bits(SpiceRasterGlyph *glyph, int bpp, uint8_t *des
         break;
     }
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return;
     }
 }
@@ -1737,7 +1737,7 @@ static pixman_image_t *canvas_get_str_mask(CanvasBase *canvas, SpiceString *str,
     int dest_stride;
     int i;
 
-    spice_return_val_if_fail(str->length > 0, NULL);
+    g_return_val_if_fail(str->length > 0, NULL);
 
     glyph = str->glyphs[0];
     canvas_raster_glyph_box(glyph, &bounds);
@@ -1752,7 +1752,7 @@ static pixman_image_t *canvas_get_str_mask(CanvasBase *canvas, SpiceString *str,
     str_mask = pixman_image_create_bits((bpp == 1) ? PIXMAN_a1 : PIXMAN_a8,
                                         bounds.right - bounds.left,
                                         bounds.bottom - bounds.top, NULL, 0);
-    spice_return_val_if_fail(str_mask != NULL, NULL);
+    g_return_val_if_fail(str_mask != NULL, NULL);
 
     dest = (uint8_t *)pixman_image_get_data(str_mask);
     dest_stride = pixman_image_get_stride(str_mask);
@@ -1774,10 +1774,10 @@ static pixman_image_t *canvas_scale_surface(pixman_image_t *src, const SpiceRect
     pixman_format_code_t format;
     double sx, sy;
 
-    spice_return_val_if_fail(spice_pixman_image_get_format (src, &format), NULL);
+    g_return_val_if_fail(spice_pixman_image_get_format (src, &format), NULL);
 
     surface = pixman_image_create_bits(format, width, height, NULL, 0);
-    spice_return_val_if_fail(surface != NULL, NULL);
+    g_return_val_if_fail(surface != NULL, NULL);
 
     sx = (double)(src_area->right - src_area->left) / width;
     sy = (double)(src_area->bottom - src_area->top) / height;
@@ -1786,7 +1786,7 @@ static pixman_image_t *canvas_scale_surface(pixman_image_t *src, const SpiceRect
 
     pixman_image_set_transform (src, &transform);
     pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE);
-    spice_return_val_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST, NULL);
+    g_return_val_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST, NULL);
     pixman_image_set_filter(src,
                             (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD,
                             NULL, 0);
@@ -1931,7 +1931,7 @@ static void canvas_clip_pixman(CanvasBase *canvas,
         break;
     }
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return;
     }
 }
@@ -2080,7 +2080,7 @@ static void draw_brush(SpiceCanvas *canvas,
             }
         } else {
             tile = canvas_get_image(canvas_base, pattern->pat, FALSE);
-            spice_return_if_fail(tile != NULL);
+            g_return_if_fail(tile != NULL);
 
             if (rop == SPICE_ROP_COPY) {
                 canvas->ops->fill_tiled_rects(canvas, rects, n_rects, tile, offset_x, offset_y);
@@ -2097,7 +2097,7 @@ static void draw_brush(SpiceCanvas *canvas,
         canvas->ops->fill_solid_rects_rop(canvas, rects, n_rects, 0, rop);
         break;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return;
     }
 }
@@ -2217,7 +2217,7 @@ static void canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceCl
         }
     } else {
         src_image = canvas_get_image(canvas, copy->src_bitmap, FALSE);
-        spice_return_if_fail(src_image != NULL);
+        g_return_if_fail(src_image != NULL);
 
         if (rect_is_same_size(bbox, &copy->src_area)) {
             if (rop == SPICE_ROP_COPY) {
@@ -2324,7 +2324,7 @@ static void canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox,
         }
     } else {
         src_image = canvas_get_image(canvas, transparent->src_bitmap, FALSE);
-        spice_return_if_fail(src_image != NULL);
+        g_return_if_fail(src_image != NULL);
 
         if (rect_is_same_size(bbox, &transparent->src_area)) {
             spice_canvas->ops->colorkey_image(spice_canvas, &dest_region,
@@ -2403,7 +2403,7 @@ static void canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox,
         }
      } else {
         src_image = canvas_get_image(canvas, alpha_blend->src_bitmap, TRUE);
-        spice_return_if_fail(src_image != NULL);
+        g_return_if_fail(src_image != NULL);
 
         if (rect_is_same_size(bbox, &alpha_blend->src_area)) {
             spice_canvas->ops->blend_image(spice_canvas, &dest_region,
@@ -2488,7 +2488,7 @@ static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spice
         }
     } else {
         src_image = canvas_get_image(canvas, opaque->src_bitmap, FALSE);
-        spice_return_if_fail(src_image != NULL);
+        g_return_if_fail(src_image != NULL);
 
         if (rect_is_same_size(bbox, &opaque->src_area)) {
             spice_canvas->ops->blit_image(spice_canvas, &dest_region,
@@ -2586,7 +2586,7 @@ static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceC
         }
     } else {
         src_image = canvas_get_image(canvas, blend->src_bitmap, FALSE);
-        spice_return_if_fail(src_image != NULL);
+        g_return_if_fail(src_image != NULL);
 
         if (rect_is_same_size(bbox, &blend->src_area)) {
             if (rop == SPICE_ROP_COPY)
@@ -3131,7 +3131,7 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox,
         gc.tile_offset_y = stroke->brush.u.pattern.pos.y;
         break;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return;
     }
 
@@ -3151,7 +3151,7 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox,
         }
 
         if (seg->flags & SPICE_PATH_BEZIER) {
-            spice_return_if_fail((point - end_point) % 3 == 0);
+            g_return_if_fail((point - end_point) % 3 == 0);
             for (; point + 2 < end_point; point += 3) {
                 stroke_lines_append_bezier(&lines,
                                            &point[0],
@@ -3232,7 +3232,7 @@ static void canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox,
     }
     if (pixman_image_get_width(s) - src_pos.x < width ||
         pixman_image_get_height(s) - src_pos.y < heigth) {
-        spice_critical("bad src bitmap size");
+        g_critical("bad src bitmap size");
         return;
     }
     if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
@@ -3438,7 +3438,7 @@ static void canvas_base_group_end(SpiceCanvas *spice_canvas)
 
 static void unimplemented_op(SpiceCanvas *canvas)
 {
-    spice_critical("unimplemented canvas operation");
+    g_critical("unimplemented canvas operation");
 }
 
 inline static void canvas_base_init_ops(SpiceCanvasOps *ops)
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 0be761a..c0ff7eb 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -53,7 +53,7 @@ pixman_image_add_data(pixman_image_t *image)
     if (data == NULL) {
         data = (PixmanData *)calloc(1, sizeof(PixmanData));
         if (data == NULL) {
-            spice_error("out of memory");
+            g_error("out of memory");
         }
         pixman_image_set_destroy_function(image,
                                           release_data,
@@ -78,7 +78,7 @@ int spice_pixman_image_get_format(pixman_image_t *image, pixman_format_code_t *f
 {
     PixmanData *data;
 
-    spice_return_val_if_fail(format != NULL, 0);
+    g_return_val_if_fail(format != NULL, 0);
 
     data = (PixmanData *)pixman_image_get_destroy_data(image);
     if (data != NULL && data->format != 0) {
@@ -86,7 +86,7 @@ int spice_pixman_image_get_format(pixman_image_t *image, pixman_format_code_t *f
         return 1;
     }
 
-    spice_warn_if_reached();
+    g_warn_if_reached();
     return 0;
 }
 
@@ -110,7 +110,7 @@ static inline pixman_image_t *__surface_create_stride(pixman_format_code_t forma
     if (surface == NULL) {
         free(data);
         data = NULL;
-        spice_error("create surface failed, out of memory");
+        g_error("create surface failed, out of memory");
     }
 
     pixman_data = pixman_image_add_data(surface);
@@ -186,7 +186,7 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
             nstride = SPICE_ALIGN(width, 32) / 8;
             break;
         default:
-            spice_error("invalid format");
+            g_error("invalid format");
             return NULL;
         }
 
@@ -194,13 +194,13 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
 
         mutex = CreateMutex(NULL, 0, NULL);
         if (!mutex) {
-            spice_error("Unable to CreateMutex");
+            g_error("Unable to CreateMutex");
         }
 
         bitmap = CreateDIBSection(dc, &bitmap_info.inf, 0, (VOID **)&data, NULL, 0);
         if (!bitmap) {
             CloseHandle(mutex);
-            spice_error("Unable to CreateDIBSection");
+            g_error("Unable to CreateDIBSection");
         }
 
         if (top_down) {
@@ -214,7 +214,7 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
         if (surface == NULL) {
             CloseHandle(mutex);
             DeleteObject(bitmap);
-            spice_error("create surface failed, out of memory");
+            g_error("create surface failed, out of memory");
         }
         pixman_data = pixman_image_add_data(surface);
         pixman_data->format = format;
@@ -262,7 +262,7 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
             stride = SPICE_ALIGN(width, 32) / 8;
             break;
         default:
-            spice_error("invalid format");
+            g_error("invalid format");
         }
         stride = -stride;
         return __surface_create_stride(format, width, height, stride);
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index fcc5fc9..3e50df2 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -327,14 +327,14 @@ static void set_path(GdiCanvas *canvas, SpicePath *s)
             BeginPath(canvas->dc);
             if (!MoveToEx(canvas->dc, (int)fix_to_double(point->x), (int)fix_to_double(point->y),
                           NULL)) {
-                spice_critical("MoveToEx failed");
+                g_critical("MoveToEx failed");
                 return;
             }
             point++;
         }
 
         if (seg->flags & SPICE_PATH_BEZIER) {
-            spice_return_if_fail((point - end_point) % 3 == 0);
+            g_return_if_fail((point - end_point) % 3 == 0);
             for (; point + 2 < end_point; point += 3) {
                 POINT points[3];
 
@@ -345,7 +345,7 @@ static void set_path(GdiCanvas *canvas, SpicePath *s)
                 points[2].x = (int)fix_to_double(point[2].x);
                 points[2].y = (int)fix_to_double(point[2].y);
                 if (!PolyBezierTo(canvas->dc, points, 3)) {
-                    spice_critical("PolyBezierTo failed");
+                    g_critical("PolyBezierTo failed");
                     return;
                 }
             }
@@ -353,7 +353,7 @@ static void set_path(GdiCanvas *canvas, SpicePath *s)
             for (; point < end_point; point++) {
                 if (!LineTo(canvas->dc, (int)fix_to_double(point->x),
                             (int)fix_to_double(point->y))) {
-                    spice_critical("LineTo failed");
+                    g_critical("LineTo failed");
                 }
             }
         }
@@ -362,12 +362,12 @@ static void set_path(GdiCanvas *canvas, SpicePath *s)
 
             if (seg->flags & SPICE_PATH_CLOSE) {
                 if (!CloseFigure(canvas->dc)) {
-                    spice_critical("CloseFigure failed");
+                    g_critical("CloseFigure failed");
                 }
             }
 
             if (!EndPath(canvas->dc)) {
-                spice_critical("EndPath failed");
+                g_critical("EndPath failed");
             }
         }
 
@@ -381,7 +381,7 @@ static void set_scale_mode(GdiCanvas *canvas, uint8_t scale_mode)
     } else if (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) {
         SetStretchBltMode(canvas->dc, COLORONCOLOR);
     } else {
-        spice_critical("Unknown ScaleMode");
+        g_critical("Unknown ScaleMode");
     }
 }
 
@@ -390,7 +390,7 @@ static void set_clip(GdiCanvas *canvas, SpiceClip *clip)
     switch (clip->type) {
     case SPICE_CLIP_TYPE_NONE:
         if (SelectClipRgn(canvas->dc, NULL) == ERROR) {
-            spice_critical("SelectClipRgn failed");
+            g_critical("SelectClipRgn failed");
         }
         break;
     case SPICE_CLIP_TYPE_RECTS: {
@@ -412,26 +412,26 @@ static void set_clip(GdiCanvas *canvas, SpiceClip *clip)
                 combaine_hrgn = CreateRectRgn(now->left, now->top, now->right,
                                               now->bottom);
                 if (!combaine_hrgn) {
-                    spice_critical("Unable to CreateRectRgn");
+                    g_critical("Unable to CreateRectRgn");
                     DeleteObject(main_hrgn);
                     return;
                 }
                 if (CombineRgn(main_hrgn, main_hrgn, combaine_hrgn, RGN_OR) == ERROR) {
-                    spice_critical("Unable to CombineRgn");
+                    g_critical("Unable to CombineRgn");
                     DeleteObject(combaine_hrgn);
                     return;
                 }
                 DeleteObject(combaine_hrgn);
             }
             if (SelectClipRgn(canvas->dc, main_hrgn) == ERROR) {
-                spice_critical("Unable to SelectClipRgn");
+                g_critical("Unable to SelectClipRgn");
             }
             DeleteObject(main_hrgn);
         }
         break;
     }
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return;
     }
 }
@@ -442,7 +442,7 @@ static void copy_bitmap(const uint8_t *src_image, int height, int src_stride,
     int copy_width = MIN(dest_stride, src_stride);
     int y = 0;
 
-    spice_return_if_fail(dest_stride >= 0 && src_stride >= 0);
+    g_return_if_fail(dest_stride >= 0 && src_stride >= 0);
 
     while (y < height) {
         memcpy(dest_bitmap, src_image, copy_width);
@@ -531,13 +531,13 @@ static uint8_t *create_bitmap(HBITMAP *bitmap, HBITMAP *prev_bitmap, HDC *dc,
 
     *dc = create_compatible_dc();
     if (!*dc) {
-        spice_critical("create_compatible_dc() failed");
+        g_critical("create_compatible_dc() failed");
         return NULL;
     }
 
     *bitmap = CreateDIBSection(*dc, &bitmap_info.inf, 0, (VOID **)&data, NULL, 0);
     if (!*bitmap) {
-        spice_critical("Unable to CreateDIBSection");
+        g_critical("Unable to CreateDIBSection");
         DeleteDC(*dc);
         return NULL;
     }
@@ -563,7 +563,7 @@ static uint8_t *create_bitmap(HBITMAP *bitmap, HBITMAP *prev_bitmap, HDC *dc,
         nstride = width * 4;
         break;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 
@@ -637,7 +637,7 @@ static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush, RecurciveMutex **b
     switch (brush->type) {
     case SPICE_BRUSH_TYPE_SOLID:
         if (!(hbrush = CreateSolidBrush(get_color_ref(canvas, brush->u.color)))) {
-            spice_critical("CreateSolidBrush failed");
+            g_critical("CreateSolidBrush failed");
             return NULL;
         }
         return hbrush;
@@ -653,20 +653,20 @@ static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush, RecurciveMutex **b
         if (gdi_surface) {
             bitmap = (HBITMAP)GetCurrentObject(gdi_surface->dc, OBJ_BITMAP);
             if (!bitmap) {
-                spice_critical("GetCurrentObject failed");
+                g_critical("GetCurrentObject failed");
                 return NULL;
             }
             *brush_lock = gdi_surface->lock;
         } else {
             surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE);
             if (!create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, surface, 0)) {
-                spice_critical("create_bitmap failed");
+                g_critical("create_bitmap failed");
                 return NULL;
             }
         }
 
         if (!(hbrush = CreatePatternBrush(bitmap))) {
-            spice_critical("CreatePatternBrush failed");
+            g_critical("CreatePatternBrush failed");
             return NULL;
         }
 
@@ -679,7 +679,7 @@ static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush, RecurciveMutex **b
     case SPICE_BRUSH_TYPE_NONE:
         return NULL;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 }
@@ -694,13 +694,13 @@ static HBRUSH set_brush(HDC dc, HBRUSH hbrush, SpiceBrush *brush)
         HBRUSH prev_hbrush;
         prev_hbrush = (HBRUSH)SelectObject(dc, hbrush);
         if (!SetBrushOrgEx(dc, brush->u.pattern.pos.x, brush->u.pattern.pos.y, NULL)) {
-            spice_critical("SetBrushOrgEx failed");
+            g_critical("SetBrushOrgEx failed");
             return NULL;
         }
         return prev_hbrush;
     }
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
 }
@@ -756,7 +756,7 @@ uint8_t calc_rop3(uint16_t rop3_bits, int brush)
 
     if (rop3_bits & SPICE_ROPD_OP_BLACKNESS || rop3_bits & SPICE_ROPD_OP_WHITENESS ||
         rop3_bits & SPICE_ROPD_OP_INVERS) {
-        spice_warning("invalid rop3 type");
+        g_warning("invalid rop3 type");
         return 0;
     }
     return rop3;
@@ -806,7 +806,7 @@ static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct SpiceQ
 
         _bitmap = (HBITMAP)GetCurrentObject(gdi_surface->dc, OBJ_BITMAP);
         if (!_bitmap) {
-            spice_critical("GetCurrentObject failed");
+            g_critical("GetCurrentObject failed");
             return bitmap;
         }
         bitmap.dc = gdi_surface->dc;
@@ -855,14 +855,14 @@ static void gdi_draw_bitmap(HDC dest_dc, const SpiceRect *src, const SpiceRect *
                                            (dest->bottom - dest->top) == (src->bottom - src->top)) {
             if (!BitBlt(dest_dc, dest->left, dest->top, dest->right - dest->left,
                         dest->bottom - dest->top, src_dc, src->left, src->top, rast_oper)) {
-                spice_critical("BitBlt failed");
+                g_critical("BitBlt failed");
                 return;
             }
         } else {
             if (!StretchBlt(dest_dc, dest->left, dest->top, dest->right - dest->left,
                             dest->bottom - dest->top, src_dc, src->left, src->top,
                             src->right - src->left, src->bottom - src->top, rast_oper)) {
-                spice_critical("StretchBlt failed");
+                g_critical("StretchBlt failed");
                 return;
             }
         }
@@ -873,7 +873,7 @@ static void gdi_draw_bitmap(HDC dest_dc, const SpiceRect *src, const SpiceRect *
                      dest->bottom - dest->top, src_dc, src->left, src->top,
                      bitmapmask->hbitmap, bitmapmask->pos.x, bitmapmask->pos.y,
                      rast_oper)) {
-            spice_critical("MaskBlt failed");
+            g_critical("MaskBlt failed");
             return;
         }
     }
@@ -913,7 +913,7 @@ static void draw_str_mask_bitmap(struct GdiCanvas *canvas,
 
     bitmap.hbitmap = (HBITMAP)1;
     if (!(surface = canvas_get_str_mask(&canvas->base, str, n, &pos))) {
-        spice_critical("unable to canvas_get_str_mask");
+        g_critical("unable to canvas_get_str_mask");
         return;
     }
 
@@ -954,7 +954,7 @@ static void draw_str_mask_bitmap(struct GdiCanvas *canvas,
         dest_stride = dest_stride * 4;
         break;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return;
     }
     dest_stride = dest_stride + 3;
@@ -1028,7 +1028,7 @@ static void gdi_canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spi
     RecurciveLock lock(*canvas->lock);
 
     brush = get_brush(canvas, &fill->brush, &brush_lock);
-    spice_return_if_fail(brush != NULL);
+    g_return_if_fail(brush != NULL);
 
     bitmapmask = get_mask_bitmap(canvas, &fill->mask);
 
@@ -1130,18 +1130,18 @@ static void gdi_canvas_put_image(SpiceCanvas *spice_canvas, HDC dc, const SpiceR
                                               rects[i].x2,
                                               rects[i].y2);
                 if (!combaine_hrgn) {
-                    spice_critical("CreateRectRgn failed");
+                    g_critical("CreateRectRgn failed");
                     DeleteObject(main_hrgn);
                     return;
                 }
                 if (!CombineRgn(main_hrgn, main_hrgn, combaine_hrgn, RGN_OR)) {
-                    spice_critical("CombineRgn failed in put_image");
+                    g_critical("CombineRgn failed in put_image");
                     return;
                 }
                 DeleteObject(combaine_hrgn);
             }
             if (SelectClipRgn(canvas->dc, main_hrgn) == ERROR) {
-                spice_critical("SelectClipRgn failed in put_image");
+                g_critical("SelectClipRgn failed in put_image");
                 DeleteObject(main_hrgn);
                 return;
             }
@@ -1245,7 +1245,7 @@ static void gdi_draw_bitmap_alpha(HDC dest_dc, const SpiceRect *src, const Spice
     if (!AlphaBlend(dest_dc, dest->left, dest->top, dest->right - dest->left,
                     dest->bottom - dest->top, src_dc, src->left, src->top,
                     src->right - src->left, src->bottom - src->top, bf)) {
-        spice_critical("AlphaBlend failed");
+        g_critical("AlphaBlend failed");
         return;
     }
 }
@@ -1590,7 +1590,7 @@ static void gdi_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spi
 
         draw_str_mask_bitmap(canvas, str, 4, &dest, &src, &text->fore_brush);
     } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
-        spice_warning("untested path A8 glyphs, doing nothing");
+        g_warning("untested path A8 glyphs, doing nothing");
         if (0) {
             SpiceRect dest;
             SpiceRect src;
@@ -1598,7 +1598,7 @@ static void gdi_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spi
             draw_str_mask_bitmap(canvas, str, 8, &dest, &src, &text->fore_brush);
         }
     } else {
-        spice_warning("untested path vector glyphs, doing nothing");
+        g_warning("untested path vector glyphs, doing nothing");
         if (0) {
         }
     }
@@ -1609,7 +1609,7 @@ static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_FIXED2
     uint32_t *local_style;
     int i;
 
-    spice_return_val_if_fail(nseg != 0, NULL);
+    g_return_val_if_fail(nseg != 0, NULL);
 
     local_style = spice_new(uint32_t , nseg);
 
@@ -1709,7 +1709,7 @@ static void gdi_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, S
         GdiImage image;
 #endif
 #if 0
-        spice_return_if_fail(surface != NULL)
+        g_return_if_fail(surface != NULL)
         surface_to_image(surface, &image);
 
         memset(&bitmap_info, 0, sizeof(bitmap_info));
@@ -1728,7 +1728,7 @@ static void gdi_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, S
             logbrush.lbHatch = (LONG)GlobalAlloc(GMEM_MOVEABLE,
                                                  image.height * -image.stride + sizeof(BITMAPINFO));
             if (!logbrush.lbHatch) {
-                spice_critical("GlobalAlloc failed");
+                g_critical("GlobalAlloc failed");
                 return;
             }
             copy_bitmap(image.pixels - (image.height - 1) * -image.stride,
@@ -1738,7 +1738,7 @@ static void gdi_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, S
             logbrush.lbHatch = (LONG)GlobalAlloc(GMEM_MOVEABLE,
                                                  image.height * image.stride + sizeof(BITMAPINFO));
             if (!logbrush.lbHatch) {
-                spice_critical("GlobalAlloc failed");
+                g_critical("GlobalAlloc failed");
                 return;
             }
             copy_bitmap(image.pixels, image.height, image.stride,
diff --git a/common/lz.c b/common/lz.c
index 2589223..a20ccbb 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -172,7 +172,7 @@ static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines,
     uint8_t* lines = first_lines;
     int row;
 
-    spice_return_val_if_fail(!encoder->head_image_segs, FALSE);
+    g_return_val_if_fail(!encoder->head_image_segs, FALSE);
 
     image_seg = lz_alloc_image_seg(encoder);
     if (!image_seg) {
@@ -228,10 +228,10 @@ static inline void encode(Encoder *encoder, uint8_t byte)
         if (more_io_bytes(encoder) <= 0) {
             encoder->usr->error(encoder->usr, "%s: no more bytes\n", __FUNCTION__);
         }
-        spice_return_if_fail(encoder->io_now);
+        g_return_if_fail(encoder->io_now);
     }
 
-    spice_return_if_fail(encoder->io_now < encoder->io_end);
+    g_return_if_fail(encoder->io_now < encoder->io_end);
     *(encoder->io_now++) = byte;
 }
 
@@ -251,7 +251,7 @@ static inline void encode_copy_count(Encoder *encoder, uint8_t copy_count)
 
 static inline void update_copy_count(Encoder *encoder, uint8_t copy_count)
 {
-    spice_return_if_fail(encoder->io_last_copy);
+    g_return_if_fail(encoder->io_last_copy);
     *(encoder->io_last_copy) = copy_count;
 }
 
@@ -266,12 +266,12 @@ static inline void compress_output_prev(Encoder *encoder)
     // io_now cannot be the first byte of the buffer
     encoder->io_now--;
     // the function should be called only when copy count is written unnecessarily by lz_compress
-    spice_return_if_fail(encoder->io_now == encoder->io_last_copy);
+    g_return_if_fail(encoder->io_now == encoder->io_last_copy);
 }
 
 static int encoder_reset(Encoder *encoder, uint8_t *io_ptr, uint8_t *io_ptr_end)
 {
-    spice_return_val_if_fail(io_ptr <= io_ptr_end, FALSE);
+    g_return_val_if_fail(io_ptr <= io_ptr_end, FALSE);
 
     encoder->io_bytes_count = io_ptr_end - io_ptr;
     encoder->io_start = io_ptr;
@@ -289,9 +289,9 @@ static inline uint8_t decode(Encoder *encoder)
         if (num_io_bytes <= 0) {
             encoder->usr->error(encoder->usr, "%s: no more bytes\n", __FUNCTION__);
         }
-        spice_assert(encoder->io_now);
+        g_assert(encoder->io_now);
     }
-    spice_assert(encoder->io_now < encoder->io_end);
+    g_assert(encoder->io_now < encoder->io_end);
     return *(encoder->io_now++);
 }
 
@@ -709,7 +709,7 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
             if (encoder->type == to_type) {
                 out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size);
                 alpha_size = lz_rgb_alpha_decompress(encoder, (rgb32_pixel_t *)buf, size);
-                spice_assert(alpha_size == size);
+                g_assert(alpha_size == size);
             } else {
                 encoder->usr->error(encoder->usr, "unsupported output format\n");
             }
@@ -744,8 +744,8 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
         }
     }
 
-    spice_assert(is_io_to_decode_end(encoder));
-    spice_assert(out_size == size);
+    g_assert(is_io_to_decode_end(encoder));
+    g_assert(out_size == size);
 
     if (out_size != size) {
         encoder->usr->error(encoder->usr, "bad decode size\n");
diff --git a/common/lz_decompress_tmpl.c b/common/lz_decompress_tmpl.c
index 04a5121..bc1ee96 100644
--- a/common/lz_decompress_tmpl.c
+++ b/common/lz_decompress_tmpl.c
@@ -270,9 +270,9 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
 #endif
             ref -= ofs;
 
-            spice_assert(op + len <= op_limit);
-            spice_assert(ref + len <= op_limit);
-            spice_assert(ref >= out_buf);
+            g_assert(op + len <= op_limit);
+            g_assert(ref + len <= op_limit);
+            g_assert(ref >= out_buf);
 
             // TODO: optimize by not calling loop at least 3 times when not PLT_TO_RGB32 (len is
             //       always >=3). in PLT_TO_RGB32 len >= 3*number_of_pixels_per_byte
@@ -286,29 +286,29 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
                 OUT_PIXEL b = *ref;
                 for (; len; --len) {
                     COPY_PIXEL(b, op);
-                    spice_assert(op <= op_limit);
+                    g_assert(op <= op_limit);
                 }
             } else {
                 for (; len; --len) {
                     COPY_REF_PIXEL(ref, op);
-                    spice_assert(op <= op_limit);
+                    g_assert(op <= op_limit);
                 }
             }
         } else { // copy
             ctrl++; // copy count is biased by 1
 #if defined(TO_RGB32) && (defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || \
                                                                                    defined(PLT1_LE))
-            spice_assert(op + CAST_PLT_DISTANCE(ctrl) <= op_limit);
+            g_assert(op + CAST_PLT_DISTANCE(ctrl) <= op_limit);
 #else
-            spice_assert(op + ctrl <= op_limit);
+            g_assert(op + ctrl <= op_limit);
 #endif
             COPY_COMP_PIXEL(encoder, op);
 
-            spice_assert(op <= op_limit);
+            g_assert(op <= op_limit);
 
             for (--ctrl; ctrl; ctrl--) {
                 COPY_COMP_PIXEL(encoder, op);
-                spice_assert(op <= op_limit);
+                g_assert(op <= op_limit);
             }
         }
 
diff --git a/common/marshaller.c b/common/marshaller.c
index 2fccd52..13fee9a 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -626,7 +626,7 @@ void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v)
 
 void spice_marshaller_add_fd(SpiceMarshaller *m, int fd)
 {
-    spice_assert(m->has_fd == false);
+    g_assert(m->has_fd == false);
 
     m->has_fd = true;
     if (fd != -1) {
diff --git a/common/mem.c b/common/mem.c
index e430b5d..33d656d 100644
--- a/common/mem.c
+++ b/common/mem.c
@@ -26,7 +26,7 @@
 
 #ifndef MALLOC_ERROR
 #define MALLOC_ERROR(format, ...) SPICE_STMT_START {    \
-    spice_error(format, ## __VA_ARGS__);                \
+    g_error(format, ## __VA_ARGS__);                \
     abort();                                            \
 } SPICE_STMT_END
 #endif
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index 81806c9..bafb1ab 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -213,12 +213,12 @@ void spice_pixman_fill_rect(pixman_image_t *dest,
     depth = spice_pixman_image_get_bpp(dest);
     /* stride is in bytes, depth in bits */
 
-    spice_assert(x >= 0);
-    spice_assert(y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(x + width <= pixman_image_get_width(dest));
-    spice_assert(y + height <= pixman_image_get_height(dest));
+    g_assert(x >= 0);
+    g_assert(y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(x + width <= pixman_image_get_width(dest));
+    g_assert(y + height <= pixman_image_get_height(dest));
 
     if (pixman_fill(bits,
                     stride / 4,
@@ -238,7 +238,7 @@ void spice_pixman_fill_rect(pixman_image_t *dest,
         byte_width = 2 * width;
         value = (value & 0xffff) * 0x00010001;
     } else {
-        spice_assert (depth == 32);
+        g_assert (depth == 32);
         byte_line = ((uint8_t *)bits) + stride * y + x * 4;
         byte_width = 4 * width;
     }
@@ -305,13 +305,13 @@ void spice_pixman_fill_rect_rop(pixman_image_t *dest,
     depth = spice_pixman_image_get_bpp(dest);
     /* stride is in bytes, depth in bits */
 
-    spice_assert(x >= 0);
-    spice_assert(y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(x + width <= pixman_image_get_width(dest));
-    spice_assert(y + height <= pixman_image_get_height(dest));
-    spice_assert(rop < 16);
+    g_assert(x >= 0);
+    g_assert(y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(x + width <= pixman_image_get_width(dest));
+    g_assert(y + height <= pixman_image_get_height(dest));
+    g_assert(rop < 16);
 
     if (depth == 8) {
         solid_rop_8_func_t rop_func = solid_rops_8[rop];
@@ -365,13 +365,13 @@ void spice_pixman_tile_rect(pixman_image_t *dest,
     tile_width = pixman_image_get_width(tile);
     tile_height = pixman_image_get_height(tile);
 
-    spice_assert(x >= 0);
-    spice_assert(y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(x + width <= pixman_image_get_width(dest));
-    spice_assert(y + height <= pixman_image_get_height(dest));
-    spice_assert(depth == spice_pixman_image_get_bpp(tile));
+    g_assert(x >= 0);
+    g_assert(y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(x + width <= pixman_image_get_width(dest));
+    g_assert(y + height <= pixman_image_get_height(dest));
+    g_assert(depth == spice_pixman_image_get_bpp(tile));
 
     tile_start_x = (x - offset_x) % tile_width;
     if (tile_start_x < 0) {
@@ -413,7 +413,7 @@ void spice_pixman_tile_rect(pixman_image_t *dest,
             }
         }
     }  else {
-        spice_assert (depth == 32);
+        g_assert (depth == 32);
 
         byte_line = ((uint8_t *)bits) + stride * y + x * 4;
         tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 4;
@@ -456,14 +456,14 @@ void spice_pixman_tile_rect_rop(pixman_image_t *dest,
     tile_width = pixman_image_get_width(tile);
     tile_height = pixman_image_get_height(tile);
 
-    spice_assert(x >= 0);
-    spice_assert(y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(x + width <= pixman_image_get_width(dest));
-    spice_assert(y + height <= pixman_image_get_height(dest));
-    spice_assert(rop < 16);
-    spice_assert(depth == spice_pixman_image_get_bpp(tile));
+    g_assert(x >= 0);
+    g_assert(y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(x + width <= pixman_image_get_width(dest));
+    g_assert(y + height <= pixman_image_get_height(dest));
+    g_assert(rop < 16);
+    g_assert(depth == spice_pixman_image_get_bpp(tile));
 
     tile_start_x = (x - offset_x) % tile_width;
     if (tile_start_x < 0) {
@@ -511,7 +511,7 @@ void spice_pixman_tile_rect_rop(pixman_image_t *dest,
     }  else {
         tiled_rop_32_func_t rop_func = tiled_rops_32[rop];
 
-        spice_assert (depth == 32);
+        g_assert (depth == 32);
 
         byte_line = ((uint8_t *)bits) + stride * y + x * 4;
         tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 4;
@@ -581,17 +581,17 @@ void spice_pixman_blit(pixman_image_t *dest,
         return;
     }
 
-    spice_assert(src_x >= 0);
-    spice_assert(src_y >= 0);
-    spice_assert(dest_x >= 0);
-    spice_assert(dest_y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(dest_x + width <= pixman_image_get_width(dest));
-    spice_assert(dest_y + height <= pixman_image_get_height(dest));
-    spice_assert(src_x + width <= pixman_image_get_width(src));
-    spice_assert(src_y + height <= pixman_image_get_height(src));
-    spice_assert(depth == src_depth);
+    g_assert(src_x >= 0);
+    g_assert(src_y >= 0);
+    g_assert(dest_x >= 0);
+    g_assert(dest_y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(dest_x + width <= pixman_image_get_width(dest));
+    g_assert(dest_y + height <= pixman_image_get_height(dest));
+    g_assert(src_x + width <= pixman_image_get_width(src));
+    g_assert(src_y + height <= pixman_image_get_height(src));
+    g_assert(depth == src_depth);
 
     if (pixman_blt(src_bits,
                    bits,
@@ -613,7 +613,7 @@ void spice_pixman_blit(pixman_image_t *dest,
         byte_width = width * 2;
         src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2;
     }  else {
-        spice_assert (depth == 32);
+        g_assert (depth == 32);
         byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4;
         byte_width = width * 4;
         src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4;
@@ -672,17 +672,17 @@ void spice_pixman_blit_rop (pixman_image_t *dest,
         return;
     }
 
-    spice_assert(src_x >= 0);
-    spice_assert(src_y >= 0);
-    spice_assert(dest_x >= 0);
-    spice_assert(dest_y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(dest_x + width <= pixman_image_get_width(dest));
-    spice_assert(dest_y + height <= pixman_image_get_height(dest));
-    spice_assert(src_x + width <= pixman_image_get_width(src));
-    spice_assert(src_y + height <= pixman_image_get_height(src));
-    spice_assert(depth == src_depth);
+    g_assert(src_x >= 0);
+    g_assert(src_y >= 0);
+    g_assert(dest_x >= 0);
+    g_assert(dest_y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(dest_x + width <= pixman_image_get_width(dest));
+    g_assert(dest_y + height <= pixman_image_get_height(dest));
+    g_assert(src_x + width <= pixman_image_get_width(src));
+    g_assert(src_y + height <= pixman_image_get_height(src));
+    g_assert(depth == src_depth);
 
     if (depth == 8) {
         copy_rop_8_func_t rop_func = copy_rops_8[rop];
@@ -709,7 +709,7 @@ void spice_pixman_blit_rop (pixman_image_t *dest,
     }  else {
         copy_rop_32_func_t rop_func = copy_rops_32[rop];
 
-        spice_assert (depth == 32);
+        g_assert (depth == 32);
         byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4;
         src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4;
 
@@ -768,17 +768,17 @@ void spice_pixman_blit_colorkey (pixman_image_t *dest,
         return;
     }
 
-    spice_assert(src_x >= 0);
-    spice_assert(src_y >= 0);
-    spice_assert(dest_x >= 0);
-    spice_assert(dest_y >= 0);
-    spice_assert(width > 0);
-    spice_assert(height > 0);
-    spice_assert(dest_x + width <= pixman_image_get_width(dest));
-    spice_assert(dest_y + height <= pixman_image_get_height(dest));
-    spice_assert(src_x + width <= pixman_image_get_width(src));
-    spice_assert(src_y + height <= pixman_image_get_height(src));
-    spice_assert(depth == spice_pixman_image_get_bpp(src));
+    g_assert(src_x >= 0);
+    g_assert(src_y >= 0);
+    g_assert(dest_x >= 0);
+    g_assert(dest_y >= 0);
+    g_assert(width > 0);
+    g_assert(height > 0);
+    g_assert(dest_x + width <= pixman_image_get_width(dest));
+    g_assert(dest_y + height <= pixman_image_get_height(dest));
+    g_assert(src_x + width <= pixman_image_get_width(src));
+    g_assert(src_y + height <= pixman_image_get_height(src));
+    g_assert(depth == spice_pixman_image_get_bpp(src));
 
     if (depth == 8) {
         byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x;
@@ -818,7 +818,7 @@ void spice_pixman_blit_colorkey (pixman_image_t *dest,
             src_line += src_stride;
         }
     }  else {
-        spice_assert (depth == 32);
+        g_assert (depth == 32);
         byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4;
         src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4;
 
@@ -1143,7 +1143,7 @@ static void bitmap_8_32_to_32(uint8_t *dest, int dest_stride,
 #endif
 
     if (!palette) {
-        spice_error("No palette");
+        g_error("No palette");
         return;
     }
 
@@ -1189,7 +1189,7 @@ static void bitmap_8_16_to_16_555(uint8_t *dest, int dest_stride,
 #endif
 
     if (!palette) {
-        spice_error("No palette");
+        g_error("No palette");
         return;
     }
 
@@ -1235,7 +1235,7 @@ static void bitmap_4be_32_to_32(uint8_t* dest, int dest_stride,
 #endif
 
     if (!palette) {
-        spice_error("No palette");
+        g_error("No palette");
         return;
     }
 
@@ -1285,7 +1285,7 @@ static void bitmap_4be_16_to_16_555(uint8_t* dest, int dest_stride,
 #endif
 
     if (!palette) {
-        spice_error("No palette");
+        g_error("No palette");
         return;
     }
 
@@ -1335,7 +1335,7 @@ static void bitmap_1be_32_to_32(uint8_t* dest, int dest_stride,
     uint32_t fore_color;
     uint32_t back_color;
 
-    spice_assert(palette != NULL);
+    g_assert(palette != NULL);
 
     if (!palette) {
         return;
@@ -1367,7 +1367,7 @@ static void bitmap_1be_16_to_16_555(uint8_t* dest, int dest_stride,
     uint16_t fore_color;
     uint16_t back_color;
 
-    spice_assert(palette != NULL);
+    g_assert(palette != NULL);
 
     if (!palette) {
         return;
@@ -1473,7 +1473,7 @@ pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image,
     dest = (uint8_t *)pixman_image_get_data(dest_image);
     dest_stride = pixman_image_get_stride(dest_image);
     if (!(flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
-        spice_assert(height > 0);
+        g_assert(height > 0);
         dest += dest_stride * (height - 1);
         dest_stride = -dest_stride;
     }
@@ -1500,7 +1500,7 @@ pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image,
         } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) {
             bitmap_8_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette);
         } else {
-            spice_error("Unsupported palette format");
+            g_error("Unsupported palette format");
         }
         break;
     case SPICE_BITMAP_FMT_4BIT_BE:
@@ -1510,7 +1510,7 @@ pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image,
         } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) {
             bitmap_4be_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette);
         } else {
-            spice_error("Unsupported palette format");
+            g_error("Unsupported palette format");
         }
         break;
     case SPICE_BITMAP_FMT_1BIT_BE:
@@ -1520,11 +1520,11 @@ pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image,
         } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) {
             bitmap_1be_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette);
         } else {
-            spice_error("Unsupported palette format");
+            g_error("Unsupported palette format");
         }
         break;
     default:
-        spice_error("Unsupported bitmap format");
+        g_error("Unsupported bitmap format");
         break;
     }
 
diff --git a/common/quic.c b/common/quic.c
index 5b00d65..3f84608 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -237,8 +237,8 @@ static const unsigned int tabrand_chaos[TABRAND_TABSIZE] = {
 
 static unsigned int stabrand(void)
 {
-    //spice_assert( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
-    //spice_assert( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );
+    //g_assert( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
+    //g_assert( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );
 
     return TABRAND_SEEDMASK;
 }
@@ -263,19 +263,19 @@ static void set_wm_trigger(CommonState *state)
         wm = 10;
     }
 
-    spice_assert(evol < 6);
+    g_assert(evol < 6);
 
     state->wm_trigger = besttrigtab[evol / 2][wm];
 
-    spice_assert(state->wm_trigger <= 2000);
-    spice_assert(state->wm_trigger >= 1);
+    g_assert(state->wm_trigger <= 2000);
+    g_assert(state->wm_trigger >= 1);
 }
 
 static int ceil_log_2(int val) /* ceil(log_2(val)) */
 {
     int result;
 
-    //spice_assert(val>0);
+    //g_assert(val>0);
 
     if (val == 1) {
         return 0;
@@ -330,7 +330,7 @@ static void decorelate_init(QuicFamily *family, int bpc)
     const unsigned int pixelbitmaskshr = pixelbitmask >> 1;
     unsigned int s;
 
-    //spice_assert(bpc <= 8);
+    //g_assert(bpc <= 8);
 
     for (s = 0; s <= pixelbitmask; s++) {
         if (s <= pixelbitmaskshr) {
@@ -346,7 +346,7 @@ static void corelate_init(QuicFamily *family, int bpc)
     const unsigned long int pixelbitmask = bppmask[bpc];
     unsigned long int s;
 
-    //spice_assert(bpc <= 8);
+    //g_assert(bpc <= 8);
 
     for (s = 0; s <= pixelbitmask; s++) {
         if (s & 0x01) {
@@ -408,7 +408,7 @@ static void more_io_words(Encoder *encoder)
     if (num_io_words <= 0) {
         encoder->usr->error(encoder->usr, "%s: no more words\n", __FUNCTION__);
     }
-    spice_assert(io_ptr);
+    g_assert(io_ptr);
     encoder->io_words_count += num_io_words;
     encoder->io_now = io_ptr;
     encoder->io_end = encoder->io_now + num_io_words;
@@ -435,8 +435,8 @@ static inline void encode(Encoder *encoder, unsigned int word, unsigned int len)
 {
     int delta;
 
-    spice_assert(len > 0 && len < 32);
-    spice_assert(!(word & ~bppmask[len]));
+    g_assert(len > 0 && len < 32);
+    g_assert(!(word & ~bppmask[len]));
     if ((delta = ((int)encoder->io_available_bits - len)) >= 0) {
         encoder->io_available_bits = delta;
         encoder->io_word |= word << encoder->io_available_bits;
@@ -448,8 +448,8 @@ static inline void encode(Encoder *encoder, unsigned int word, unsigned int len)
     encoder->io_available_bits = 32 - delta;
     encoder->io_word = word << encoder->io_available_bits;
 
-    spice_assert(encoder->io_available_bits < 32);
-    spice_assert((encoder->io_word & bppmask[encoder->io_available_bits]) == 0);
+    g_assert(encoder->io_available_bits < 32);
+    g_assert((encoder->io_word & bppmask[encoder->io_available_bits]) == 0);
 }
 
 static inline void encode_32(Encoder *encoder, unsigned int word)
@@ -482,7 +482,7 @@ static inline void read_io_word(Encoder *encoder)
         __read_io_word_ptr(encoder); //disable inline optimizations
         return;
     }
-    spice_assert(encoder->io_now < encoder->io_end);
+    g_assert(encoder->io_now < encoder->io_end);
     encoder->io_next_word = GUINT32_FROM_LE(*(encoder->io_now++));
 }
 
@@ -490,7 +490,7 @@ static inline void decode_eatbits(Encoder *encoder, int len)
 {
     int delta;
 
-    spice_assert(len > 0 && len < 32);
+    g_assert(len > 0 && len < 32);
     encoder->io_word <<= len;
 
     if ((delta = ((int)encoder->io_available_bits - len)) >= 0) {
@@ -701,7 +701,7 @@ static inline void encode_run(Encoder *encoder, unsigned int len)
 
     while ((msb = spice_bit_find_msb(len))) {
         len &= ~(1 << (msb - 1));
-        spice_assert(msb < 32);
+        g_assert(msb < 32);
         encode(encoder, (1 << (msb)) - 1, msb);
         encode(encoder, 0, 1);
     }
@@ -723,7 +723,7 @@ static inline unsigned int decode_run(Encoder *encoder)
         while (encoder->io_word & (1U << 31)) {
             decode_eatbits(encoder, 1);
             count++;
-            spice_assert(count < 32);
+            g_assert(count < 32);
         }
         decode_eatbits(encoder, 1);
         len += (1U << count) >> 1;
@@ -855,10 +855,10 @@ static void fill_model_structures(SPICE_GNUC_UNUSED Encoder *encoder, FamilyStat
         family_stat->buckets_buf[bnumber].pcounters = free_counter;
         free_counter += ncounters;
 
-        spice_assert(bstart < n_buckets_ptrs);
+        g_assert(bstart < n_buckets_ptrs);
         {
             unsigned int i;
-            spice_assert(bend < n_buckets_ptrs);
+            g_assert(bend < n_buckets_ptrs);
             for (i = bstart; i <= bend; i++) {
                 family_stat->buckets_ptrs[i] = family_stat->buckets_buf + bnumber;
             }
@@ -867,7 +867,7 @@ static void fill_model_structures(SPICE_GNUC_UNUSED Encoder *encoder, FamilyStat
         bnumber++;
     } while (bend < levels - 1);
 
-    spice_assert(free_counter - family_stat->counters == nbuckets * ncounters);
+    g_assert(free_counter - family_stat->counters == nbuckets * ncounters);
 }
 
 static void find_model_params(Encoder *encoder,
@@ -888,8 +888,8 @@ static void find_model_params(Encoder *encoder,
     /* The only valid values are 1, 3 and 5.
        0, 2 and 4 are obsolete and the rest of the
        values are considered out of the range. */
-    spice_static_assert (evol == 1 || evol == 3 || evol == 5);
-    spice_assert(bpc <= 8 && bpc > 0);
+    G_STATIC_ASSERT (evol == 1 || evol == 3 || evol == 5);
+    g_assert(bpc <= 8 && bpc > 0);
 
     *ncounters = 8;
 
@@ -949,7 +949,7 @@ static void find_model_params(Encoder *encoder,
                 *n_buckets_ptrs = *levels;
             } else if (bsize >= 256) { /* this bucket is allowed to reside in the 2nd table */
                 b_lo_ptrs = bstart;
-                spice_assert(bstart);     /* previous bucket exists */
+                g_assert(bstart);     /* previous bucket exists */
             }
  #endif
         }
@@ -1073,8 +1073,8 @@ static int init_encoder(Encoder *encoder, QuicUsrContext *usr)
 
 static int encoder_reste(Encoder *encoder, uint32_t *io_ptr, uint32_t *io_ptr_end)
 {
-    spice_assert(((uintptr_t)io_ptr % 4) == ((uintptr_t)io_ptr_end % 4));
-    spice_assert(io_ptr <= io_ptr_end);
+    g_assert(((uintptr_t)io_ptr % 4) == ((uintptr_t)io_ptr_end % 4));
+    g_assert(io_ptr <= io_ptr_end);
 
     encoder->rgb_state.waitcnt = 0;
     encoder->rgb_state.tabrand_seed = stabrand();
@@ -1155,7 +1155,7 @@ static int encoder_reste_channels(Encoder *encoder, int channels, int width, int
 
 static void quic_image_params(Encoder *encoder, QuicImageType type, int *channels, int *bpc)
 {
-    spice_assert(channels && bpc);
+    g_assert(channels && bpc);
     switch (type) {
     case QUIC_IMAGE_TYPE_GRAY:
         *channels = 1;
@@ -1237,7 +1237,7 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
 
     lines_end = line + num_lines * stride;
     if (line == NULL && lines_end != line) {
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return QUIC_ERROR;
     }
 
@@ -1262,19 +1262,19 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
     switch (type) {
 #ifdef QUIC_RGB
     case QUIC_IMAGE_TYPE_RGB32:
-        spice_assert(ABS(stride) >= width * 4);
+        g_assert(ABS(stride) >= width * 4);
         QUIC_COMPRESS_RGB(32);
         break;
     case QUIC_IMAGE_TYPE_RGB24:
-        spice_assert(ABS(stride) >= width * 3);
+        g_assert(ABS(stride) >= width * 3);
         QUIC_COMPRESS_RGB(24);
         break;
     case QUIC_IMAGE_TYPE_RGB16:
-        spice_assert(ABS(stride) >= width * 2);
+        g_assert(ABS(stride) >= width * 2);
         QUIC_COMPRESS_RGB(16);
         break;
     case QUIC_IMAGE_TYPE_RGBA:
-        spice_assert(ABS(stride) >= width * 4);
+        g_assert(ABS(stride) >= width * 4);
 
         encoder->channels[0].correlate_row[-1] = 0;
         encoder->channels[1].correlate_row[-1] = 0;
@@ -1302,7 +1302,7 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
         break;
 #else
     case QUIC_IMAGE_TYPE_RGB24:
-        spice_assert(ABS(stride) >= width * 3);
+        g_assert(ABS(stride) >= width * 3);
         for (i = 0; i < 3; i++) {
             encoder->channels[i].correlate_row[-1] = 0;
             quic_three_compress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(line + i),
@@ -1322,7 +1322,7 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
         break;
     case QUIC_IMAGE_TYPE_RGB32:
     case QUIC_IMAGE_TYPE_RGBA:
-        spice_assert(ABS(stride) >= width * 4);
+        g_assert(ABS(stride) >= width * 4);
         for (i = 0; i < channels; i++) {
             encoder->channels[i].correlate_row[-1] = 0;
             quic_four_compress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(line + i),
@@ -1342,7 +1342,7 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
         break;
 #endif
     case QUIC_IMAGE_TYPE_GRAY:
-        spice_assert(ABS(stride) >= width);
+        g_assert(ABS(stride) >= width);
         encoder->channels[0].correlate_row[-1] = 0;
         quic_one_compress_row0(encoder, &encoder->channels[0], (one_byte_t *)line, width);
         encoder->rows_completed++;
@@ -1512,18 +1512,18 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
     int i;
 #endif
 
-    spice_assert(buf);
+    g_assert(buf);
 
     switch (encoder->type) {
 #ifdef QUIC_RGB
     case QUIC_IMAGE_TYPE_RGB32:
     case QUIC_IMAGE_TYPE_RGB24:
         if (type == QUIC_IMAGE_TYPE_RGB32) {
-            spice_assert(ABS(stride) >= (int)encoder->width * 4);
+            g_assert(ABS(stride) >= (int)encoder->width * 4);
             QUIC_UNCOMPRESS_RGB(32, rgb32_pixel_t);
             break;
         } else if (type == QUIC_IMAGE_TYPE_RGB24) {
-            spice_assert(ABS(stride) >= (int)encoder->width * 3);
+            g_assert(ABS(stride) >= (int)encoder->width * 3);
             QUIC_UNCOMPRESS_RGB(24, rgb24_pixel_t);
             break;
         }
@@ -1531,10 +1531,10 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
         return QUIC_ERROR;
     case QUIC_IMAGE_TYPE_RGB16:
         if (type == QUIC_IMAGE_TYPE_RGB16) {
-            spice_assert(ABS(stride) >= (int)encoder->width * 2);
+            g_assert(ABS(stride) >= (int)encoder->width * 2);
             QUIC_UNCOMPRESS_RGB(16, rgb16_pixel_t);
         } else if (type == QUIC_IMAGE_TYPE_RGB32) {
-            spice_assert(ABS(stride) >= (int)encoder->width * 4);
+            g_assert(ABS(stride) >= (int)encoder->width * 4);
             QUIC_UNCOMPRESS_RGB(16_to_32, rgb32_pixel_t);
         } else {
             encoder->usr->warn(encoder->usr, "unsupported output format\n");
@@ -1548,12 +1548,12 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
             encoder->usr->warn(encoder->usr, "unsupported output format\n");
             return QUIC_ERROR;
         }
-        spice_assert(ABS(stride) >= (int)encoder->width * 4);
+        g_assert(ABS(stride) >= (int)encoder->width * 4);
         uncompress_rgba(encoder, buf, stride);
         break;
 #else
     case QUIC_IMAGE_TYPE_RGB24:
-        spice_assert(ABS(stride) >= (int)encoder->width * 3);
+        g_assert(ABS(stride) >= (int)encoder->width * 3);
         for (i = 0; i < 3; i++) {
             encoder->channels[i].correlate_row[-1] = 0;
             quic_three_uncompress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(buf + i),
@@ -1574,7 +1574,7 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
         }
         break;
     case QUIC_IMAGE_TYPE_RGB32:
-        spice_assert(ABS(stride) >= encoder->width * 4);
+        g_assert(ABS(stride) >= encoder->width * 4);
         for (i = 0; i < 3; i++) {
             encoder->channels[i].correlate_row[-1] = 0;
             quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i),
@@ -1597,7 +1597,7 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
         }
         break;
     case QUIC_IMAGE_TYPE_RGBA:
-        spice_assert(ABS(stride) >= encoder->width * 4);
+        g_assert(ABS(stride) >= encoder->width * 4);
         for (i = 0; i < 4; i++) {
             encoder->channels[i].correlate_row[-1] = 0;
             quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i),
@@ -1624,7 +1624,7 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
             encoder->usr->warn(encoder->usr, "unsupported output format\n");
             return QUIC_ERROR;
         }
-        spice_assert(ABS(stride) >= (int)encoder->width);
+        g_assert(ABS(stride) >= (int)encoder->width);
         uncompress_gray(encoder, buf, stride);
         break;
     case QUIC_IMAGE_TYPE_INVALID:
diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c
index 9a434e0..26bf226 100644
--- a/common/quic_family_tmpl.c
+++ b/common/quic_family_tmpl.c
@@ -71,8 +71,8 @@ static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned
 static void FNAME(update_model)(CommonState *state, s_bucket * const bucket,
                                 const BYTE curval)
 {
-    spice_static_assert(BPC >= 1);
-    spice_return_if_fail (bucket != NULL);
+    G_STATIC_ASSERT(BPC >= 1);
+    g_return_if_fail (bucket != NULL);
 
     const unsigned int bpp = BPC;
     COUNTER * const pcounters = bucket->pcounters;
@@ -105,7 +105,7 @@ static void FNAME(update_model)(CommonState *state, s_bucket * const bucket,
 
 static s_bucket *FNAME(find_bucket)(Channel *channel, const unsigned int val)
 {
-    spice_assert(val < (0x1U << BPC));
+    g_assert(val < (0x1U << BPC));
 
     return channel->_buckets_ptrs[val];
 }
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index f807a0c..f50efb9 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -235,7 +235,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, int i,
     BYTE * const correlate_row_b = channel_b->correlate_row;
     int stopidx;
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (!i) {
         unsigned int codeword, codewordlen;
@@ -305,9 +305,9 @@ static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row,
         }
     }
 
-    spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
-    spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)encoder->rgb_state.wmidx <= wmimax);
+    g_assert(encoder->rgb_state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 #define COMPRESS_ONE_0(channel) \
@@ -347,7 +347,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, int i,
     int run_size;
 #endif
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (!i) {
         unsigned int codeword, codewordlen;
@@ -451,9 +451,9 @@ static void FNAME(compress_row)(Encoder *encoder,
         }
     }
 
-    spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
-    spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)encoder->rgb_state.wmidx <= wmimax);
+    g_assert(encoder->rgb_state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 #endif
@@ -490,7 +490,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, int i,
     BYTE * const correlate_row_b = channel_b->correlate_row;
     int stopidx;
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (!i) {
         unsigned int codewordlen;
@@ -567,9 +567,9 @@ static void FNAME(uncompress_row0)(Encoder *encoder,
         }
     }
 
-    spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
-    spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)encoder->rgb_state.wmidx <= wmimax);
+    g_assert(encoder->rgb_state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 #define UNCOMPRESS_ONE_0(channel) \
@@ -611,7 +611,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder,
     int run_end;
 #endif
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (!i) {
         unsigned int codewordlen;
@@ -721,9 +721,9 @@ static void FNAME(uncompress_row)(Encoder *encoder,
         }
     }
 
-    spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
-    spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)encoder->rgb_state.wmidx <= wmimax);
+    g_assert(encoder->rgb_state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 #undef PIXEL
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index e839346..26a87e1 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -158,7 +158,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i,
     BYTE * const decorelate_drow = channel->correlate_row;
     int stopidx;
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (i == 0) {
         unsigned int codeword, codewordlen;
@@ -233,9 +233,9 @@ static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL
         }
     }
 
-    spice_assert((int)channel->state.wmidx <= wmimax);
-    spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)channel->state.wmidx <= wmimax);
+    g_assert(channel->state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
@@ -253,7 +253,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
     int run_size;
 #endif
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (!i) {
         unsigned int codeword, codewordlen;
@@ -375,9 +375,9 @@ static void FNAME(compress_row)(Encoder *encoder, Channel *channel,
         }
     }
 
-    spice_assert((int)channel->state.wmidx <= wmimax);
-    spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)channel->state.wmidx <= wmimax);
+    g_assert(channel->state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i,
@@ -390,7 +390,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i
 {
     int stopidx;
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (i == 0) {
         unsigned int codewordlen;
@@ -475,9 +475,9 @@ static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel,
         }
     }
 
-    spice_assert((int)channel->state.wmidx <= wmimax);
-    spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)channel->state.wmidx <= wmimax);
+    g_assert(channel->state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
@@ -496,7 +496,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
     int run_end;
 #endif
 
-    spice_assert(end - i > 0);
+    g_assert(end - i > 0);
 
     if (i == 0) {
         unsigned int codewordlen;
@@ -613,9 +613,9 @@ static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel,
         }
     }
 
-    spice_assert((int)channel->state.wmidx <= wmimax);
-    spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    g_assert((int)channel->state.wmidx <= wmimax);
+    g_assert(channel->state.wmidx <= 32);
+    g_assert(wminext > 0);
 }
 
 #undef PIXEL
diff --git a/common/rect.h b/common/rect.h
index 8c9faed..a477d07 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -88,7 +88,7 @@ static inline int rect_get_area(const SpiceRect *r)
 
 static inline void rect_debug(const SpiceRect *r)
 {
-    spice_debug("(%d, %d) (%d, %d)", r->left, r->top, r->right, r->bottom);
+    g_debug("(%d, %d) (%d, %d)", r->left, r->top, r->right, r->bottom);
 }
 
 SPICE_END_DECLS
diff --git a/common/region.c b/common/region.c
index e9abb32..c5dea29 100644
--- a/common/region.c
+++ b/common/region.c
@@ -573,7 +573,7 @@ static void rect_set(SpiceRect *r, int32_t top, int32_t left, int32_t bottom, in
     r->left = left;
     r->bottom = bottom;
     r->right = right;
-    spice_assert(rect_is_valid(r));
+    g_assert(rect_is_valid(r));
 }
 
 static void random_region(QRegion *reg)
diff --git a/common/ring.h b/common/ring.h
index 4b0e313..a8c666f 100644
--- a/common/ring.h
+++ b/common/ring.h
@@ -46,14 +46,14 @@ static inline int ring_item_is_linked(RingItem *item)
 
 static inline int ring_is_empty(Ring *ring)
 {
-    spice_assert(ring->next != NULL && ring->prev != NULL);
+    g_assert(ring->next != NULL && ring->prev != NULL);
     return ring == ring->next;
 }
 
 static inline void ring_add(Ring *ring, RingItem *item)
 {
-    spice_assert(ring->next != NULL && ring->prev != NULL);
-    spice_assert(item->next == NULL && item->prev == NULL);
+    g_assert(ring->next != NULL && ring->prev != NULL);
+    g_assert(item->next == NULL && item->prev == NULL);
 
     item->next = ring->next;
     item->prev = ring;
@@ -79,8 +79,8 @@ static inline void __ring_remove(RingItem *item)
 
 static inline void ring_remove(RingItem *item)
 {
-    spice_assert(item->next != NULL && item->prev != NULL);
-    spice_assert(item->next != item);
+    g_assert(item->next != NULL && item->prev != NULL);
+    g_assert(item->next != item);
 
     __ring_remove(item);
 }
@@ -89,7 +89,7 @@ static inline RingItem *ring_get_head(Ring *ring)
 {
     RingItem *ret;
 
-    spice_assert(ring->next != NULL && ring->prev != NULL);
+    g_assert(ring->next != NULL && ring->prev != NULL);
 
     if (ring_is_empty(ring)) {
         return NULL;
@@ -102,7 +102,7 @@ static inline RingItem *ring_get_tail(Ring *ring)
 {
     RingItem *ret;
 
-    spice_assert(ring->next != NULL && ring->prev != NULL);
+    g_assert(ring->next != NULL && ring->prev != NULL);
 
     if (ring_is_empty(ring)) {
         return NULL;
@@ -115,9 +115,9 @@ static inline RingItem *ring_next(Ring *ring, RingItem *pos)
 {
     RingItem *ret;
 
-    spice_assert(ring->next != NULL && ring->prev != NULL);
-    spice_assert(pos);
-    spice_assert(pos->next != NULL && pos->prev != NULL);
+    g_assert(ring->next != NULL && ring->prev != NULL);
+    g_assert(pos);
+    g_assert(pos->next != NULL && pos->prev != NULL);
     ret = pos->next;
     return (ret == ring) ? NULL : ret;
 }
@@ -126,9 +126,9 @@ static inline RingItem *ring_prev(Ring *ring, RingItem *pos)
 {
     RingItem *ret;
 
-    spice_assert(ring->next != NULL && ring->prev != NULL);
-    spice_assert(pos);
-    spice_assert(pos->next != NULL && pos->prev != NULL);
+    g_assert(ring->next != NULL && ring->prev != NULL);
+    g_assert(pos);
+    g_assert(pos->next != NULL && pos->prev != NULL);
     ret = pos->prev;
     return (ret == ring) ? NULL : ret;
 }
diff --git a/common/rop3.c b/common/rop3.c
index 2a0a167..3bcc0a1 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -47,7 +47,7 @@ static void default_rop3_with_pattern_handler(SPICE_GNUC_UNUSED pixman_image_t *
                                               SPICE_GNUC_UNUSED pixman_image_t *p,
                                               SPICE_GNUC_UNUSED SpicePoint *pat_pos)
 {
-    spice_critical("not implemented");
+    g_critical("not implemented");
 }
 
 static void default_rop3_withe_color_handler(SPICE_GNUC_UNUSED pixman_image_t *d,
@@ -55,7 +55,7 @@ static void default_rop3_withe_color_handler(SPICE_GNUC_UNUSED pixman_image_t *d
                                              SPICE_GNUC_UNUSED SpicePoint *src_pos,
                                              SPICE_GNUC_UNUSED uint32_t rgb)
 {
-    spice_critical("not implemented");
+    g_critical("not implemented");
 }
 
 static void default_rop3_test_handler(void)
@@ -620,8 +620,8 @@ void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, Sp
     int bpp;
 
     bpp = spice_pixman_image_get_bpp(d);
-    spice_assert(bpp == spice_pixman_image_get_bpp(s));
-    spice_assert(bpp == spice_pixman_image_get_bpp(p));
+    g_assert(bpp == spice_pixman_image_get_bpp(s));
+    g_assert(bpp == spice_pixman_image_get_bpp(p));
 
     if (bpp == 32) {
         rop3_with_pattern_handlers_32[rop3](d, s, src_pos, p, pat_pos);
@@ -636,7 +636,7 @@ void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, Spic
     int bpp;
 
     bpp = spice_pixman_image_get_bpp(d);
-    spice_assert(bpp == spice_pixman_image_get_bpp(s));
+    g_assert(bpp == spice_pixman_image_get_bpp(s));
 
     if (bpp == 32) {
         rop3_with_color_handlers_32[rop3](d, s, src_pos, rgb);
diff --git a/common/snd_codec.c b/common/snd_codec.c
index 9738311..7b29413 100644
--- a/common/snd_codec.c
+++ b/common/snd_codec.c
@@ -85,14 +85,14 @@ static int snd_codec_create_celt051(SndCodecInternal *codec, int purpose)
                                            SND_CODEC_PLAYBACK_CHAN,
                                            SND_CODEC_CELT_FRAME_SIZE, &celt_error);
     if (! codec->celt_mode) {
-        spice_printerr("create celt mode failed %d", celt_error);
+        g_printerr("create celt mode failed %d", celt_error);
         return SND_CODEC_UNAVAILABLE;
     }
 
     if (purpose & SND_CODEC_ENCODE) {
         codec->celt_encoder = celt051_encoder_create(codec->celt_mode);
         if (! codec->celt_encoder) {
-            spice_printerr("create celt encoder failed");
+            g_printerr("create celt encoder failed");
             goto error;
         }
     }
@@ -100,7 +100,7 @@ static int snd_codec_create_celt051(SndCodecInternal *codec, int purpose)
     if (purpose & SND_CODEC_DECODE) {
         codec->celt_decoder = celt051_decoder_create(codec->celt_mode);
         if (! codec->celt_decoder) {
-            spice_printerr("create celt decoder failed");
+            g_printerr("create celt decoder failed");
             goto error;
         }
     }
@@ -120,7 +120,7 @@ static int snd_codec_encode_celt051(SndCodecInternal *codec, uint8_t *in_ptr, in
         return SND_CODEC_INVALID_ENCODE_SIZE;
     n = celt051_encode(codec->celt_encoder, (celt_int16_t *) in_ptr, NULL, out_ptr, *out_size);
     if (n < 0) {
-        spice_printerr("celt051_encode failed %d\n", n);
+        g_printerr("celt051_encode failed %d\n", n);
         return SND_CODEC_ENCODE_FAILED;
     }
     *out_size = n;
@@ -132,7 +132,7 @@ static int snd_codec_decode_celt051(SndCodecInternal *codec, uint8_t *in_ptr, in
     int n;
     n = celt051_decode(codec->celt_decoder, in_ptr, in_size, (celt_int16_t *) out_ptr);
     if (n < 0) {
-        spice_printerr("celt051_decode failed %d\n", n);
+        g_printerr("celt051_decode failed %d\n", n);
         return SND_CODEC_DECODE_FAILED;
     }
     *out_size = SND_CODEC_CELT_FRAME_SIZE * SND_CODEC_PLAYBACK_CHAN * 2 /* 16 fmt */;
@@ -166,7 +166,7 @@ static int snd_codec_create_opus(SndCodecInternal *codec, int purpose)
                                 SND_CODEC_PLAYBACK_CHAN,
                                 OPUS_APPLICATION_AUDIO, &opus_error);
         if (! codec->opus_encoder) {
-            spice_printerr("create opus encoder failed; error %d", opus_error);
+            g_printerr("create opus encoder failed; error %d", opus_error);
             goto error;
         }
     }
@@ -175,7 +175,7 @@ static int snd_codec_create_opus(SndCodecInternal *codec, int purpose)
         codec->opus_decoder = opus_decoder_create(codec->frequency,
                                 SND_CODEC_PLAYBACK_CHAN, &opus_error);
         if (! codec->opus_decoder) {
-            spice_printerr("create opus decoder failed; error %d", opus_error);
+            g_printerr("create opus decoder failed; error %d", opus_error);
             goto error;
         }
     }
@@ -195,7 +195,7 @@ static int snd_codec_encode_opus(SndCodecInternal *codec, uint8_t *in_ptr, int i
         return SND_CODEC_INVALID_ENCODE_SIZE;
     n = opus_encode(codec->opus_encoder, (opus_int16 *) in_ptr, SND_CODEC_OPUS_FRAME_SIZE, out_ptr, *out_size);
     if (n < 0) {
-        spice_printerr("opus_encode failed %d\n", n);
+        g_printerr("opus_encode failed %d\n", n);
         return SND_CODEC_ENCODE_FAILED;
     }
     *out_size = n;
@@ -208,7 +208,7 @@ static int snd_codec_decode_opus(SndCodecInternal *codec, uint8_t *in_ptr, int i
     n = opus_decode(codec->opus_decoder, in_ptr, in_size, (opus_int16 *) out_ptr,
                 *out_size / SND_CODEC_PLAYBACK_CHAN / 2, 0);
     if (n < 0) {
-        spice_printerr("opus_decode failed %d\n", n);
+        g_printerr("opus_decode failed %d\n", n);
         return SND_CODEC_DECODE_FAILED;
     }
     *out_size = n * SND_CODEC_PLAYBACK_CHAN * 2 /* 16 fmt */;
diff --git a/common/ssl_verify.c b/common/ssl_verify.c
index a9ed650..4b963bc 100644
--- a/common/ssl_verify.c
+++ b/common/ssl_verify.c
@@ -51,36 +51,36 @@ static int verify_pubkey(X509* cert, const char *key, size_t key_size)
         return 0;
 
     if (!cert) {
-        spice_debug("warning: no cert!");
+        g_debug("warning: no cert!");
         return 0;
     }
 
     cert_pubkey = X509_get_pubkey(cert);
     if (!cert_pubkey) {
-        spice_debug("warning: reading public key from certificate failed");
+        g_debug("warning: reading public key from certificate failed");
         goto finish;
     }
 
     bio = BIO_new_mem_buf((void*)key, key_size);
     if (!bio) {
-        spice_debug("creating BIO failed");
+        g_debug("creating BIO failed");
         goto finish;
     }
 
     orig_pubkey = d2i_PUBKEY_bio(bio, NULL);
     if (!orig_pubkey) {
-        spice_debug("reading pubkey from bio failed");
+        g_debug("reading pubkey from bio failed");
         goto finish;
     }
 
     ret = EVP_PKEY_cmp(orig_pubkey, cert_pubkey);
 
     if (ret == 1) {
-        spice_debug("public keys match");
+        g_debug("public keys match");
     } else if (ret == 0) {
-        spice_debug("public keys mismatch");
+        g_debug("public keys mismatch");
     } else {
-        spice_debug("public keys types mismatch");
+        g_debug("public keys types mismatch");
     }
 
 finish:
@@ -159,10 +159,10 @@ static int verify_hostname(X509* cert, const char *hostname)
     int cn_match = 0;
     X509_NAME* subject;
 
-    spice_return_val_if_fail(hostname != NULL, 0);
+    g_return_val_if_fail(hostname != NULL, 0);
 
     if (!cert) {
-        spice_debug("warning: no cert!");
+        g_debug("warning: no cert!");
         return 0;
     }
 
@@ -192,7 +192,7 @@ static int verify_hostname(X509* cert, const char *hostname)
                 if (_gnutls_hostname_compare((const char *)ASN1_STRING_get0_data(name->d.dNSName),
                                              ASN1_STRING_length(name->d.dNSName),
                                              hostname)) {
-                    spice_debug("alt name match=%s", ASN1_STRING_get0_data(name->d.dNSName));
+                    g_debug("alt name match=%s", ASN1_STRING_get0_data(name->d.dNSName));
                     GENERAL_NAMES_free(subject_alt_names);
                     return 1;
                 }
@@ -209,7 +209,7 @@ static int verify_hostname(X509* cert, const char *hostname)
                     ip_len = g_inet_address_get_native_size(ip);
                     ip_binary = g_inet_address_to_bytes(ip);
                 } else {
-                    spice_warning("Could not parse hostname: %s", hostname);
+                    g_warning("Could not parse hostname: %s", hostname);
                 }
 
                 alt_ip_len = ASN1_STRING_length(name->d.iPAddress);
@@ -222,7 +222,7 @@ static int verify_hostname(X509* cert, const char *hostname)
                     alt_ip = g_inet_address_new_from_bytes(ASN1_STRING_get0_data(name->d.iPAddress),
                                                            g_inet_address_get_family(ip));
                     alt_ip_string = g_inet_address_to_string(alt_ip);
-                    spice_debug("alt name IP match=%s", alt_ip_string);
+                    g_debug("alt name IP match=%s", alt_ip_string);
 
                     g_free(alt_ip_string);
                     g_object_unref(alt_ip);
@@ -239,7 +239,7 @@ static int verify_hostname(X509* cert, const char *hostname)
     }
 
     if (found_dns_name) {
-        spice_debug("warning: SubjectAltName mismatch");
+        g_debug("warning: SubjectAltName mismatch");
         return 0;
     }
 
@@ -263,7 +263,7 @@ static int verify_hostname(X509* cert, const char *hostname)
             if (_gnutls_hostname_compare((const char*)ASN1_STRING_get0_data(cn_asn1),
                                          ASN1_STRING_length(cn_asn1),
                                          hostname)) {
-                spice_debug("common name match=%s", (char*)ASN1_STRING_get0_data(cn_asn1));
+                g_debug("common name match=%s", (char*)ASN1_STRING_get0_data(cn_asn1));
                 cn_match = 1;
                 break;
             }
@@ -271,7 +271,7 @@ static int verify_hostname(X509* cert, const char *hostname)
     }
 
     if (!cn_match) {
-        spice_debug("warning: common name mismatch");
+        g_debug("warning: common name mismatch");
     }
 
     return cn_match;
@@ -287,15 +287,15 @@ static X509_NAME* subject_to_x509_name(const char *subject, int *nentries)
         VALUE
     } state;
 
-    spice_return_val_if_fail(subject != NULL, NULL);
-    spice_return_val_if_fail(nentries != NULL, NULL);
+    g_return_val_if_fail(subject != NULL, NULL);
+    g_return_val_if_fail(nentries != NULL, NULL);
 
     key = (char*)alloca(strlen(subject));
     val = (char*)alloca(strlen(subject));
     in_subject = X509_NAME_new();
 
     if (!in_subject || !key || !val) {
-        spice_debug("failed to allocate");
+        g_debug("failed to allocate");
         return NULL;
     }
 
@@ -308,7 +308,7 @@ static X509_NAME* subject_to_x509_name(const char *subject, int *nentries)
         if (*p == '\\') {
             ++p;
             if (*p != '\\' && *p != ',') {
-                spice_debug("Invalid character after \\");
+                g_debug("Invalid character after \\");
                 goto fail;
             }
             escape = 1;
@@ -342,7 +342,7 @@ static X509_NAME* subject_to_x509_name(const char *subject, int *nentries)
                                                 MBSTRING_UTF8,
                                                 (const unsigned char*)val,
                                                 -1, -1, 0)) {
-                    spice_debug("warning: failed to add entry %s=%s to X509_NAME",
+                    g_debug("warning: failed to add entry %s=%s to X509_NAME",
                                 key, val);
                     goto fail;
                 }
@@ -377,25 +377,25 @@ static int verify_subject(X509* cert, SpiceOpenSSLVerify* verify)
     int in_entries;
 
     if (!cert) {
-        spice_debug("warning: no cert!");
+        g_debug("warning: no cert!");
         return 0;
     }
 
     cert_subject = X509_get_subject_name(cert);
     if (!cert_subject) {
-        spice_debug("warning: reading certificate subject failed");
+        g_debug("warning: reading certificate subject failed");
         return 0;
     }
 
     in_subject = subject_to_x509_name(verify->subject, &in_entries);
     if (!in_subject) {
-        spice_debug("warning: no in_subject!");
+        g_debug("warning: no in_subject!");
         return 0;
     }
 
     /* Note: this check is redundant with the pre-condition in X509_NAME_cmp */
     if (X509_NAME_entry_count(cert_subject) != in_entries) {
-        spice_debug("subject mismatch: #entries cert=%d, input=%d",
+        g_debug("subject mismatch: #entries cert=%d, input=%d",
             X509_NAME_entry_count(cert_subject), in_entries);
         X509_NAME_free(in_subject);
         return 0;
@@ -404,17 +404,17 @@ static int verify_subject(X509* cert, SpiceOpenSSLVerify* verify)
     ret = X509_NAME_cmp(cert_subject, in_subject);
 
     if (ret == 0) {
-        spice_debug("subjects match");
+        g_debug("subjects match");
     } else {
         char *p;
-        spice_debug("subjects mismatch");
+        g_debug("subjects mismatch");
 
         p = X509_NAME_oneline(cert_subject, NULL, 0);
-        spice_debug("cert_subject: %s", p);
+        g_debug("cert_subject: %s", p);
         free(p);
 
         p = X509_NAME_oneline(in_subject, NULL, 0);
-        spice_debug("in_subject:   %s", p);
+        g_debug("in_subject:   %s", p);
         free(p);
     }
     X509_NAME_free(in_subject);
@@ -440,7 +440,7 @@ static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx)
     err = X509_STORE_CTX_get_error(ctx);
     if (depth > 0) {
         if (!preverify_ok) {
-            spice_warning("Error in certificate chain verification: %s (num=%d:depth%d:%s)",
+            g_warning("Error in certificate chain verification: %s (num=%d:depth%d:%s)",
                           X509_verify_cert_error_string(err), err, depth, buf);
             v->all_preverify_ok = 0;
 
@@ -451,7 +451,7 @@ static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx)
                 return 1;
 
             if (err == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN)
-                spice_debug("server certificate not being signed by the provided CA");
+                g_debug("server certificate not being signed by the provided CA");
 
             return 0;
         } else
@@ -460,7 +460,7 @@ static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx)
 
     /* depth == 0 */
     if (!cert) {
-        spice_debug("failed to get server certificate");
+        g_debug("failed to get server certificate");
         return 0;
     }
 
@@ -475,7 +475,7 @@ static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx)
     if (!preverify_ok) {
         err = X509_STORE_CTX_get_error(ctx);
         depth = X509_STORE_CTX_get_error_depth(ctx);
-        spice_warning("Error in server certificate verification: %s (num=%d:depth%d:%s)",
+        g_warning("Error in server certificate verification: %s (num=%d:depth%d:%s)",
                       X509_verify_cert_error_string(err), err, depth, buf);
         return 0;
     }
@@ -499,15 +499,15 @@ static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx)
      * verification failed
      */
     if (failed_verifications & SPICE_SSL_VERIFY_OP_PUBKEY)
-        spice_warning("ssl: pubkey verification failed");
+        g_warning("ssl: pubkey verification failed");
 
     if (failed_verifications & SPICE_SSL_VERIFY_OP_HOSTNAME)
-        spice_warning("ssl: hostname '%s' verification failed", v->hostname);
+        g_warning("ssl: hostname '%s' verification failed", v->hostname);
 
     if (failed_verifications & SPICE_SSL_VERIFY_OP_SUBJECT)
-        spice_warning("ssl: subject '%s' verification failed", v->subject);
+        g_warning("ssl: subject '%s' verification failed", v->subject);
 
-    spice_warning("ssl: verification failed");
+    g_warning("ssl: verification failed");
 
     return 0;
 }
diff --git a/common/sw_canvas.c b/common/sw_canvas.c
index 9dc11ca..f606de2 100644
--- a/common/sw_canvas.c
+++ b/common/sw_canvas.c
@@ -77,7 +77,7 @@ static pixman_image_t *canvas_get_pixman_brush(SwCanvas *canvas,
     case SPICE_BRUSH_TYPE_NONE:
         return NULL;
     default:
-        spice_warn_if_reached();
+        g_warn_if_reached();
         return NULL;
     }
     return NULL;
@@ -489,7 +489,7 @@ static void __scale_image(SpiceCanvas *spice_canvas,
 
     pixman_image_set_transform(src, &transform);
     pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE);
-    spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE ||
+    g_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE ||
                          scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
     pixman_image_set_filter(src,
                             (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
@@ -556,7 +556,7 @@ static void __scale_image_rop(SpiceCanvas *spice_canvas,
     fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width;
     fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height;
 
-    spice_return_if_fail(spice_pixman_image_get_format(src, &format));
+    g_return_if_fail(spice_pixman_image_get_format(src, &format));
     scaled = pixman_image_create_bits(format,
                                       dest_width,
                                       dest_height,
@@ -572,7 +572,7 @@ static void __scale_image_rop(SpiceCanvas *spice_canvas,
 
     pixman_image_set_transform(src, &transform);
     pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE);
-    spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE ||
+    g_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE ||
                          scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
     pixman_image_set_filter(src,
                             (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
@@ -773,7 +773,7 @@ static void __blend_scale_image(SpiceCanvas *spice_canvas,
 
     pixman_image_set_transform(src, &transform);
     pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE);
-    spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE ||
+    g_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE ||
                          scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
     pixman_image_set_filter(src,
                             (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
@@ -914,7 +914,7 @@ static void __colorkey_scale_image(SpiceCanvas *spice_canvas,
     fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width;
     fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height;
 
-    spice_return_if_fail(spice_pixman_image_get_format(src, &format));
+    g_return_if_fail(spice_pixman_image_get_format(src, &format));
     scaled = pixman_image_create_bits(format,
                                       dest_width,
                                       dest_height,
@@ -1080,7 +1080,7 @@ static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox,
 
         /* Nothing else makes sense for text and we should deprecate it
          * and actually it means OVER really */
-        spice_return_if_fail(text->fore_mode == SPICE_ROPD_OP_PUT);
+        g_return_if_fail(text->fore_mode == SPICE_ROPD_OP_PUT);
 
         pixman_region32_init_rect(&back_region,
                                   text->back_area.left,
@@ -1103,10 +1103,10 @@ static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox,
     } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
         depth = 4;
     } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
-        spice_warning("untested path A8 glyphs");
+        g_warning("untested path A8 glyphs");
         depth = 8;
     } else {
-        spice_warning("unsupported path vector glyphs");
+        g_warning("unsupported path vector glyphs");
         pixman_region32_fini (&dest_region);
         return;
     }
@@ -1149,7 +1149,7 @@ static void canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest,
     uint8_t *dest_end;
     int bpp;
 
-    spice_return_if_fail(canvas && area);
+    g_return_if_fail(canvas && area);
 
     surface = canvas->image;
 
-- 
2.13.0.91.g00982b8dd



More information about the Spice-devel mailing list