[Spice-commits] 3 commits - server/char-device.h server/reds.c server/sound.c

Christophe Fergau teuf at kemper.freedesktop.org
Tue Apr 5 14:50:45 UTC 2016


 server/char-device.h |    3 +--
 server/reds.c        |    3 +++
 server/sound.c       |    7 +++----
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit bbee12d2b8494277f45fc545cfff90d954ae16a3
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Apr 5 15:05:05 2016 +0200

    audio: Improve snd_receive type-safety
    
    We can pass it a SndChannel rather than an opaque void* data pointer
    which we then blindly cast.
    This came to light through a -Wshadow warning as there was a local
    variable 'data' in addition to the 'data' parameter.

diff --git a/server/sound.c b/server/sound.c
index 7ec0c6a..46f2cb1 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -185,7 +185,7 @@ typedef struct RecordChannel {
 static SndWorker *workers;
 static uint32_t playback_compression = TRUE;
 
-static void snd_receive(void* data);
+static void snd_receive(SndChannel *channel);
 
 static SndChannel *snd_channel_ref(SndChannel *channel)
 {
@@ -420,9 +420,8 @@ static int snd_record_handle_message(SndChannel *channel, size_t size, uint32_t
     return TRUE;
 }
 
-static void snd_receive(void* data)
+static void snd_receive(SndChannel *channel)
 {
-    SndChannel *channel = (SndChannel*)data;
     SpiceDataHeaderOpaque *header;
 
     if (!channel) {
@@ -1364,7 +1363,7 @@ SPICE_GNUC_VISIBLE uint32_t spice_server_record_get_samples(SpiceRecordInstance
 
     if (len < bufsize) {
         SndWorker *worker = record_channel->base.worker;
-        snd_receive(record_channel);
+        snd_receive(&record_channel->base);
         if (!worker->connection) {
             return 0;
         }
commit 4d3c8bdb98ddd0fe1a4a914d310ae531676f618c
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Apr 5 14:58:43 2016 +0200

    char-device: Remove duplicate typedef

diff --git a/server/char-device.h b/server/char-device.h
index d92cbab..0a4ae5d 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -32,6 +32,7 @@
 #define RED_IS_CHAR_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE))
 #define RED_CHAR_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE, RedCharDeviceClass))
 
+/* SpiceCharDeviceState is public API, but internally we use RedCharDevice */
 typedef struct SpiceCharDeviceState RedCharDevice;
 typedef struct RedCharDeviceClass RedCharDeviceClass;
 typedef struct RedCharDevicePrivate RedCharDevicePrivate;
@@ -119,8 +120,6 @@ void red_char_device_set_callbacks(RedCharDevice *dev,
  * */
 
 struct RedsState;
-/* SpiceCharDeviceState is public API, but internally we use RedCharDevice */
-typedef struct SpiceCharDeviceState RedCharDevice;
 
 /* buffer that is used for writing to the device */
 typedef struct RedCharDeviceWriteBuffer {
commit eb58bc9ad035bda91c86761e2c982b4114e90e8b
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Apr 5 14:58:05 2016 +0200

    gobject: Add g_type_init() for older glibs
    
    Older glib versions require g_type_init() to be called before using
    GObject.

diff --git a/server/reds.c b/server/reds.c
index 23df51a..fdfb54a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3394,6 +3394,9 @@ static int do_spice_init(RedsState *reds, SpiceCoreInterface *core_interface)
 {
     spice_info("starting %s", VERSION);
 
+#if !GLIB_CHECK_VERSION(2,36,0)
+    g_type_init();
+#endif
     if (core_interface->base.major_version != SPICE_INTERFACE_CORE_MAJOR) {
         spice_warning("bad core interface version");
         goto err;


More information about the Spice-commits mailing list