[PATCH spice-gtk 1/6] channel: return "unknown" in spice_channel_type_to_string()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

This fixes the following gcc warning:

spice-channel.c: In function ‘spice_channel_constructed’:
spice-channel.c:144:41: error: ‘%s’ directive output may be truncated writing likely 20 or more bytes into a region of size 16 [-Werror=format-truncation=]
     snprintf(c->name, sizeof(c->name), "%s-%d:%d",
                                         ^~
spice-channel.c:144:40: note: assuming directive output of 20 bytes
     snprintf(c->name, sizeof(c->name), "%s-%d:%d",

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 src/spice-channel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index 4c3db9d..7cd6251 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -2130,13 +2130,13 @@ static const char *to_string[] = {
  **/
 const gchar* spice_channel_type_to_string(gint type)
 {
-    const char *str = NULL;
+    const char *str = "unknown";
 
     if (type >= 0 && type < G_N_ELEMENTS(to_string)) {
         str = to_string[type];
     }
 
-    return str ? str : "unknown channel type";
+    return str;
 }
 
 /**
-- 
2.14.0.1.geff633fa0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]