[Spice-devel] [PATCH spice-gtk 00/15] Expand usage of compiler warnings

Daniel P. Berrange berrange at redhat.com
Wed Mar 14 01:40:57 PDT 2012


On Wed, Mar 14, 2012 at 01:44:48AM +0100, Marc-André Lureau wrote:
> From 360809ac7fa66e244743aa3d14233ccfb817abd2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at redhat.com>
> Date: Wed, 14 Mar 2012 01:04:17 +0100
> Subject: [PATCH spice-gtk 1/4] Remove deprecation warnings
> 
> ---
>  gtk/channel-usbredir.c   |   10 ++++++++--
>  gtk/spice-channel-priv.h |    2 +-
>  gtk/spice-channel.c      |   22 ++++++++++++----------
>  gtk/spicy.c              |    2 ++
>  gtk/usb-device-manager.c |   11 ++++++++---
>  5 files changed, 31 insertions(+), 16 deletions(-)


ACK


> From f569bcde37d771a7bfd1b0190bd7b486c5e1e10d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at redhat.com>
> Date: Wed, 14 Mar 2012 01:16:44 +0100
> Subject: [PATCH spice-gtk 2/4] Fix -Werror=format with mingw
> 
> spice-util.c:88:28: error: unknown conversion type character 'h' in format [-Werror=format]
> ---
>  gtk/spice-util.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/gtk/spice-util.c b/gtk/spice-util.c
> index 6092a80..3f98d44 100644
> --- a/gtk/spice-util.c
> +++ b/gtk/spice-util.c
> @@ -20,6 +20,7 @@
>  # include "config.h"
>  #endif
>  #include <glib-object.h>
> +#include <stdio.h>
>  #include "spice-util-priv.h"
>  #include "spice-util.h"
>  #include "spice-util-priv.h"
> @@ -81,11 +82,15 @@ gboolean spice_strv_contains(const GStrv strv, const gchar *str)
>  G_GNUC_INTERNAL
>  gchar* spice_uuid_to_string(const guint8 uuid[16])
>  {
> -    return g_strdup_printf(UUID_FMT, uuid[0], uuid[1],
> -                           uuid[2], uuid[3], uuid[4], uuid[5],
> -                           uuid[6], uuid[7], uuid[8], uuid[9],
> -                           uuid[10], uuid[11], uuid[12], uuid[13],
> -                           uuid[14], uuid[15]);
> +    gchar* uuidstr = g_malloc0(64);
> +
> +    snprintf(uuidstr, 64, UUID_FMT, uuid[0], uuid[1],
> +             uuid[2], uuid[3], uuid[4], uuid[5],
> +             uuid[6], uuid[7], uuid[8], uuid[9],
> +             uuid[10], uuid[11], uuid[12], uuid[13],
> +             uuid[14], uuid[15]);
> +
> +    return uuidstr;
>  }
>  
>  typedef struct {

I don't think this is a good way to fix it - instead I would suggest
this:

commit 69406f7330d9fd0b36a2aefd479636cc8738127c
Author: Daniel P. Berrange <berrange at redhat.com>
Date:   Tue Mar 13 18:10:23 2012 +0000

    Replace %02hhx with %02x in UUID format
    
    Use of 'hh' in the UUID format string is not required. Furthermore
    it causes errors on Mingw32, where the 'hh' modifier is not supported

diff --git a/gtk/spice-util-priv.h b/gtk/spice-util-priv.h
index ee70f64..4d52100 100644
--- a/gtk/spice-util-priv.h
+++ b/gtk/spice-util-priv.h
@@ -22,7 +22,7 @@
 
 G_BEGIN_DECLS
 
-#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+#define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
 
 gboolean spice_strv_contains(const GStrv strv, const gchar *str);
 gchar* spice_uuid_to_string(const guint8 uuid[16]);


> From 4a8d79b0876e9aa4274d94082041177dd07f0590 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at redhat.com>
> Date: Wed, 14 Mar 2012 01:22:46 +0100
> Subject: [PATCH spice-gtk 3/4] Fix 'libintl_printf' is an unrecognized format
>  function
> 
> ../common/lz.h:18:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
> ---
>  gtk/usb-device-manager.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

ACK



> From 06c2bc71e8cc51f19119ac25afdd08e79cc69fd6 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at redhat.com>
> Date: Wed, 14 Mar 2012 01:30:24 +0100
> Subject: [PATCH spice-gtk 4/4] Use GTK_DISABLE_DEPRECATED to avoid inclusion
>  of problematic headers
> 
> /usr/i686-w64-mingw32/sys-root/mingw/include/gtk-2.0/gtk/gtkitemfactory.h:47:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
> ---
>  gtk/Makefile.am         |    1 +
>  gtk/spicy.c             |    8 ++++++++
>  gtk/usb-device-widget.c |   10 ++++++++++
>  gtk/usb-device-widget.h |    8 ++++++++
>  4 files changed, 27 insertions(+), 0 deletions(-)

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


More information about the Spice-devel mailing list