[spice-gtk v1 3/6] usbredir: use g_object_get() for socket access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Victor Toso <me@xxxxxxxxxxxxxx>

Instead of accessing Private of SpiceChannel.

Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
---
 src/channel-usbredir.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index e407bac..fed9bd4 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -511,7 +511,6 @@ static void usbredir_free_write_cb_data(uint8_t *data, void *user_data)
 #ifdef USE_LZ4
 static int try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t *data, int count)
 {
-    SpiceChannelPrivate *c;
     SpiceMsgOut *msg_out_compressed;
     int bound, compressed_data_count;
     uint8_t *compressed_buf;
@@ -520,11 +519,15 @@ static int try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t *data,
         .uncompressed_size = count
     };
 
-    c = SPICE_CHANNEL(channel)->priv;
-    if (g_socket_get_family(c->sock) == G_SOCKET_FAMILY_UNIX) {
+    GSocket *sock;
+    g_object_get(channel, "socket", &sock, NULL);
+    if (g_socket_get_family(sock) == G_SOCKET_FAMILY_UNIX) {
+        g_object_unref(sock);
         /* AF_LOCAL socket - data will not be compressed */
         return FALSE;
     }
+    g_object_unref(sock);
+
     if (count <= COMPRESS_THRESHOLD) {
         /* Not enough data to compress */
         return FALSE;
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]