[Spice-commits] 3 commits - m4/spice-compile-warnings.m4 src/channel-usbredir.c src/spice-glib-main.c

Christophe Fergau teuf at kemper.freedesktop.org
Fri May 4 18:16:10 UTC 2018


 m4/spice-compile-warnings.m4 |    5 +++++
 src/channel-usbredir.c       |    2 +-
 src/spice-glib-main.c        |    6 +++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 189bb5f17424dd85008c9e406d40760e3450d0ea
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu May 3 11:50:35 2018 +0200

    win32: Convert locale dir from UTF-8 to local encoding
    
    As indicated in gtk+ win32 gtk_get_localedir [1], bindtextdomain() is not
    UTF-8 aware on win32, so it needs a filename in locale encoding
    
    [1] https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/gtkwin32.c#L187
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/spice-glib-main.c b/src/spice-glib-main.c
index c2bd7ca..881015f 100644
--- a/src/spice-glib-main.c
+++ b/src/spice-glib-main.c
@@ -32,9 +32,13 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
     if (fdwReason == DLL_PROCESS_ATTACH) {
         char *basedir =
             g_win32_get_package_installation_directory_of_module(hinstDLL);
-        char *localedir = g_build_filename(basedir, "share", "locale", NULL);
+        char *utf8_localedir = g_build_filename(basedir, "share", "locale", NULL);
+        /* bindtextdomain's 2nd argument is not UTF-8 aware */
+        char *localedir = g_win32_locale_filename_from_utf8 (utf8_localedir);
+
         bindtextdomain(GETTEXT_PACKAGE, localedir);
         g_free(localedir);
+        g_free(utf8_localedir);
         g_free(basedir);
         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
     }
commit f54faed59846090fed0c3760ad30d11868836cf3
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu May 3 11:46:40 2018 +0200

    usb: Remove unused spice_marshaller_add_by_ref_full() user data
    
    g_free() only expects a single argument, so it won't make use of the
    extra 'channel' arg which will be passed as user data.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index f509e49..0cc5630 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -712,7 +712,7 @@ static int try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t *data,
                                          compressed_data_msg.compressed_data,
                                          compressed_data_count,
                                          (spice_marshaller_item_free_func)g_free,
-                                         channel);
+                                         NULL);
         spice_msg_out_send(msg_out_compressed);
         return TRUE;
     }
commit 8bb24c57209db1127678635a4dcffd73c9d790f5
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu May 3 11:09:40 2018 +0200

    build-sys: Disable -Wcast-function-type
    
    With gcc 8.0.1 from Fedora 28, I'm getting warnings related to
    -Wcast-function-type in a few places. Most of these could be solved
    by adding an intermediate wrapper with the right number of args, but the
    g_source_set_callback() warning cannot be solved this way as the
    callback signature will vary depending on the source it's called on.
    
    ../../src/spice-session.c: In function 'spice_session_init':
    ../../src/spice-session.c:293:33: warning: cast between incompatible function types from 'pixman_bool_t (*)(pixman_image_t *)' {aka 'int (*)(union pixman_image *)'} to 'void (*)(void *)' [-Wcast-function-type]
         s->images = cache_image_new((GDestroyNotify)pixman_image_unref);
                                     ^
    ../../src/gio-coroutine.c: In function 'g_coroutine_socket_wait':
    ../../src/gio-coroutine.c:59:32: warning: cast between incompatible function types from 'gboolean (*)(GSocket *, GIOCondition,  void *)' {aka 'int (*)(struct _GSocket *, enum <anonymous>,  void *)'} to 'gboolean (*)(void *)' {aka 'int (*)(void *)'} [-Wcast-function-type]
         g_source_set_callback(src, (GSourceFunc)g_io_wait_helper, self, NULL);
                                    ^
    (and a few more like these)
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/m4/spice-compile-warnings.m4 b/m4/spice-compile-warnings.m4
index dfa88fe..0ae3bd7 100644
--- a/m4/spice-compile-warnings.m4
+++ b/m4/spice-compile-warnings.m4
@@ -86,6 +86,11 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
     # We use some deprecated functions to avoid #ifdef hell while maintaining
     # compat with older gtk / glib versions
     gl_WARN_ADD([-Wno-error=deprecated-declarations])
+    # g_source_set_callback() can't be compatible with this warning. Its API
+    # doc states:
+    # "The exact type of func depends on the type of source; ie. you should
+    # not count on func being called with data as its first parameter."
+    gl_WARN_ADD([-Wno-cast-function-type])
 
 
 


More information about the Spice-commits mailing list