[Spice-devel] [PATCH spice-server 2/5] red-stream: Propagate RedStreamSslStatus type

Frediano Ziglio fziglio at redhat.com
Tue Oct 9 08:30:03 UTC 2018


Do not convert RedStreamSslStatus enumeration type back to int.
This allows compilers to perform some more type safe checks.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-stream.c | 2 +-
 server/red-stream.h | 2 +-
 server/reds.c       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/red-stream.c b/server/red-stream.c
index 18c4a935..fd5b8cd1 100644
--- a/server/red-stream.c
+++ b/server/red-stream.c
@@ -506,7 +506,7 @@ RedStreamSslStatus red_stream_ssl_accept(RedStream *stream)
     return RED_STREAM_SSL_STATUS_ERROR;
 }
 
-int red_stream_enable_ssl(RedStream *stream, SSL_CTX *ctx)
+RedStreamSslStatus red_stream_enable_ssl(RedStream *stream, SSL_CTX *ctx)
 {
     BIO *sbio;
 
diff --git a/server/red-stream.h b/server/red-stream.h
index 15af0a59..9a7cc617 100644
--- a/server/red-stream.h
+++ b/server/red-stream.h
@@ -62,7 +62,7 @@ RedStream *red_stream_new(RedsState *reds, int socket);
 void red_stream_set_core_interface(RedStream *stream, SpiceCoreInterfaceInternal *core);
 bool red_stream_is_ssl(RedStream *stream);
 RedStreamSslStatus red_stream_ssl_accept(RedStream *stream);
-int red_stream_enable_ssl(RedStream *stream, SSL_CTX *ctx);
+RedStreamSslStatus red_stream_enable_ssl(RedStream *stream, SSL_CTX *ctx);
 int red_stream_get_family(const RedStream *stream);
 bool red_stream_is_plain_unix(const RedStream *stream);
 bool red_stream_set_no_delay(RedStream *stream, bool no_delay);
diff --git a/server/reds.c b/server/reds.c
index 80a1ae34..ec9f9258 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2354,7 +2354,7 @@ static void reds_handle_ssl_accept(int fd, int event, void *data)
 {
     RedLinkInfo *link = (RedLinkInfo *)data;
     RedsState *reds = link->reds;
-    int return_code = red_stream_ssl_accept(link->stream);
+    RedStreamSslStatus return_code = red_stream_ssl_accept(link->stream);
 
     switch (return_code) {
         case RED_STREAM_SSL_STATUS_ERROR:
@@ -2410,7 +2410,7 @@ error:
 static RedLinkInfo *reds_init_client_ssl_connection(RedsState *reds, int socket)
 {
     RedLinkInfo *link;
-    int ssl_status;
+    RedStreamSslStatus ssl_status;
 
     link = reds_init_client_connection(reds, socket);
     if (link == NULL) {
-- 
2.17.1



More information about the Spice-devel mailing list