[glib] gio: Eliminate warnings in cstring conversion on OS X



commit 9bcd7800a122c22b7c2684fa50bd93ecd3c936f9
Author: Jiří Techet <techet gmail com>
Date:   Sun Oct 22 12:12:59 2017 +0200

    gio: Eliminate warnings in cstring conversion on OS X
    
    create_cstr_from_cfstring_with_fallback() is allowed to be called when str == NULL
    but create_cstr_from_cfstring() isn't which leads to warnings in the console.
    Fix this by adding NULL checks into create_cstr_from_cfstring_with_fallback().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788936

 gio/gosxcontenttype.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gio/gosxcontenttype.c b/gio/gosxcontenttype.c
index b646f6e..3474775 100644
--- a/gio/gosxcontenttype.c
+++ b/gio/gosxcontenttype.c
@@ -90,9 +90,10 @@ static gchar *
 create_cstr_from_cfstring_with_fallback (CFStringRef  str,
                                          const gchar *fallback)
 {
-  gchar *cstr;
+  gchar *cstr = NULL;
 
-  cstr = create_cstr_from_cfstring (str);
+  if (str)
+    cstr = create_cstr_from_cfstring (str);
   if (!cstr)
     return g_strdup (fallback);
 


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