can't assign the return value of g_strdupv() to an array. Fill the array
authorMichael Natterer <mitch@imendio.com>
Tue, 16 Sep 2008 11:36:52 +0000 (11:36 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Tue, 16 Sep 2008 11:36:52 +0000 (11:36 +0000)
2008-09-16  Michael Natterer  <mitch@imendio.com>

* gcontenttype.c (g_content_type_guess): can't assign the return
value of g_strdupv() to an array. Fill the array manually with
const strings instead (it is never freed anyway). Fixes the
build. Also fixed indentation.

svn path=/trunk/; revision=7501

gio/ChangeLog
gio/gcontenttype.c

index e905c539fbabb8aa47df613d950a6c287e1e5673..048e9f552888a79dae66e3f5cfb0e38df8b7d6ee 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-16  Michael Natterer  <mitch@imendio.com>
+
+       * gcontenttype.c (g_content_type_guess): can't assign the return
+       value of g_strdupv() to an array. Fill the array manually with
+       const strings instead (it is never freed anyway). Fixes the
+       build. Also fixed indentation.
+
 2008-09-16  Wouter Bolsterlee  <wbolster@svn.gnome.org>
 
        * gdesktopappinfo.c (g_desktop_app_info_new_from_keyfile):
index 7f4780604b1aa2102647e2f4c7c7aa6c6c2877f9..732373bd9a55ea8bbff47d6f50843a9230de0761 100644 (file)
@@ -896,17 +896,20 @@ g_content_type_guess (const char   *filename,
   if (filename)
     {
       i = strlen (filename);
-      if (filename[i - 1] == '/') {
-        char *mimetypes[] = { "inode/directory", NULL };
-        name_mimetypes = g_strdupv (mimetypes);
-        n_name_mimetypes = 1;
-        if (result_uncertain)
-          *result_uncertain = TRUE;
-      } else {
-        basename = g_path_get_basename (filename);
-       n_name_mimetypes = xdg_mime_get_mime_types_from_file_name (basename, name_mimetypes, 10);
-       g_free (basename);
-      }
+      if (filename[i - 1] == '/')
+        {
+          name_mimetypes[0] = "inode/directory";
+          name_mimetypes[1] = NULL;
+          n_name_mimetypes = 1;
+          if (result_uncertain)
+            *result_uncertain = TRUE;
+        }
+      else
+        {
+          basename = g_path_get_basename (filename);
+          n_name_mimetypes = xdg_mime_get_mime_types_from_file_name (basename, name_mimetypes, 10);
+          g_free (basename);
+        }
     }
 
   /* Got an extension match, and no conflicts. This is it. */