[Spice-devel] [PATCH spice-server 11/30] Make websocket function more ABI compatibles with RedsStream

Frediano Ziglio fziglio at redhat.com
Mon Nov 21 12:51:58 UTC 2016


---
 server/websocket.c | 8 ++++----
 server/websocket.h | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/server/websocket.c b/server/websocket.c
index 533fc06..771b72d 100644
--- a/server/websocket.c
+++ b/server/websocket.c
@@ -216,7 +216,7 @@ static int relay_data(guint8* buf, size_t size, websocket_frame_t *frame)
     return n;
 }
 
-int websocket_read(RedsWebSocket *ws, guchar *buf, int size)
+int websocket_read(RedsWebSocket *ws, guchar *buf, size_t size)
 {
     int n = 0;
     int rc;
@@ -336,7 +336,7 @@ static void constrain_iov(struct iovec *iov, int iovcnt,
 
 
 /* Write a WebSocket frame with the enclosed data out. */
-int websocket_writev(RedsWebSocket *ws, struct iovec *iov, int iovcnt)
+int websocket_writev(RedsWebSocket *ws, const struct iovec *iov, int iovcnt)
 {
     guint8 header[WEBSOCKET_MAX_HEADER_SIZE];
     guint64 len;
@@ -354,7 +354,7 @@ int websocket_writev(RedsWebSocket *ws, struct iovec *iov, int iovcnt)
         return -1;
     }
     if (*remainder > 0) {
-        constrain_iov(iov, iovcnt, &iov_out, &iov_out_cnt, *remainder);
+        constrain_iov((struct iovec *) iov, iovcnt, &iov_out, &iov_out_cnt, *remainder);
         rc = writev_cb(opaque, iov_out, iov_out_cnt);
         if (iov_out != iov)
             free(iov_out);
@@ -395,7 +395,7 @@ int websocket_writev(RedsWebSocket *ws, struct iovec *iov, int iovcnt)
     return rc;
 }
 
-int websocket_write(RedsWebSocket *ws, const guchar *buf, int len)
+int websocket_write(RedsWebSocket *ws, const void *buf, size_t len)
 {
     guint8 header[WEBSOCKET_MAX_HEADER_SIZE];
     int rc;
diff --git a/server/websocket.h b/server/websocket.h
index 2eb3431..6523e22 100644
--- a/server/websocket.h
+++ b/server/websocket.h
@@ -48,8 +48,8 @@ typedef struct {
 
 bool websocket_is_start(gchar *buf);
 void websocket_create_reply(gchar *buf, gchar *outbuf);
-int websocket_read(RedsWebSocket *ws, guchar *buf, int len);
-int websocket_write(RedsWebSocket *ws, const guchar *buf, int len);
-int websocket_writev(RedsWebSocket *ws, struct iovec *iov, int iovcnt);
+int websocket_read(RedsWebSocket *ws, guchar *buf, size_t len);
+int websocket_write(RedsWebSocket *ws, const void *buf, size_t len);
+int websocket_writev(RedsWebSocket *ws, const struct iovec *iov, int iovcnt);
 void websocket_ack_close(void *opaque, websocket_write_cb_t write_cb);
 
-- 
2.7.4



More information about the Spice-devel mailing list