[virt-tools-list] [virt-viewer][PATCH 2/2] session-spice: Cast CA string to gunit8 pointer

Michal Privoznik mprivozn at redhat.com
Wed Dec 5 14:13:25 UTC 2012


SpiceSession has 'ca' property which is type of GByteArray*.
However, when we read the property from file, we read it as
string. For conversion g_byte_array_new_take() is used which
takes given pointer as guint8* so we need to do the cast.
---
 src/virt-viewer-session-spice.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index cdfbef8..468b8a7 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -291,7 +291,7 @@ fill_session(VirtViewerFile *file, SpiceSession *session)
         gchar *ca = virt_viewer_file_get_ca(file);
         g_return_if_fail(ca != NULL);
 
-        GByteArray *ba = g_byte_array_new_take(ca, strlen(ca) + 1);
+        GByteArray *ba = g_byte_array_new_take((guint8 *)ca, strlen(ca) + 1);
         g_object_set(G_OBJECT(session), "ca", ba, NULL);
         g_byte_array_unref(ba);
     }
-- 
1.7.8.6




More information about the virt-tools-list mailing list