[Spice-commits] common/marshaller.c common/marshaller.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 8 13:05:38 UTC 2019


 common/marshaller.c |   10 ++++++++--
 common/marshaller.h |    4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 3e6dedaa51b3e19070b099d951962b6cb4571ff7
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sun Jun 24 09:07:50 2018 +0100

    marshaller: Provide spice_marshaller_fill_iovec for Windows
    
    An array of WSABUF can be used with WSASend.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/common/marshaller.c b/common/marshaller.c
index 0b45523..4379aa6 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -549,7 +549,14 @@ void spice_marshaller_flush(SpiceMarshaller *m)
     }
 }
 
-#ifndef WIN32
+#ifdef WIN32
+// this definition is ABI compatible with WSABUF
+struct iovec {
+    unsigned long iov_len;
+    void *iov_base;
+};
+#endif
+
 int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
                                 int n_vec, size_t skip_bytes)
 {
@@ -581,7 +588,6 @@ int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
 
     return v;
 }
-#endif
 
 void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v)
 {
diff --git a/common/marshaller.h b/common/marshaller.h
index 2aeeea1..041d16e 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -25,6 +25,8 @@
 #include "mem.h"
 #ifndef WIN32
 #include <sys/uio.h>
+#else
+struct iovec;
 #endif
 
 SPICE_BEGIN_DECLS
@@ -52,10 +54,8 @@ size_t spice_marshaller_get_size(SpiceMarshaller *m);
 size_t spice_marshaller_get_total_size(SpiceMarshaller *m);
 SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m);
 SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit);
-#ifndef WIN32
 int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
                                 int n_vec, size_t skip_bytes);
-#endif
 void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v);
 void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v);
 void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v);


More information about the Spice-commits mailing list