[Spice-devel] [PATCH spice 02/12] Fix const-ness violations

Daniel P. Berrange berrange at redhat.com
Mon Apr 2 04:23:37 PDT 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

* server/red_worker.c: Add missing const for return type
* server/reds.c: Static strings must be declared const

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 server/red_worker.c |    2 +-
 server/reds.c       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index c17a7d0..30be5bb 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1202,7 +1202,7 @@ static inline void validate_surface(RedWorker *worker, uint32_t surface_id)
     }
 }
 
-static char *draw_type_to_str(uint8_t type)
+static const char *draw_type_to_str(uint8_t type)
 {
     switch (type) {
     case QXL_DRAW_FILL:
diff --git a/server/reds.c b/server/reds.c
index bf26864..53fc748 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -97,7 +97,7 @@ static int spice_secure_port = -1;
 static int spice_listen_socket_fd = -1;
 static char spice_addr[256];
 static int spice_family = PF_UNSPEC;
-static char *default_renderer = "sw";
+static const char *default_renderer = "sw";
 static int sasl_enabled = 0; // sasl disabled by default
 #if HAVE_SASL
 static char *sasl_appname = NULL; // default to "spice" if NULL
@@ -1730,7 +1730,7 @@ static void reds_channel_do_link(RedChannel *channel, RedClient *client,
     spice_assert(stream);
 
     if (link_msg->channel_type == SPICE_CHANNEL_INPUTS && !stream->ssl) {
-        char *mess = "keyboard channel is insecure";
+        const char *mess = "keyboard channel is insecure";
         const int mess_len = strlen(mess);
         main_channel_push_notify(reds->main_channel, (uint8_t*)mess, mess_len);
     }
-- 
1.7.7.6



More information about the Spice-devel mailing list