glib r7501 - trunk/gio



Author: mitch
Date: Tue Sep 16 11:36:52 2008
New Revision: 7501
URL: http://svn.gnome.org/viewvc/glib?rev=7501&view=rev

Log:
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.



Modified:
   trunk/gio/ChangeLog
   trunk/gio/gcontenttype.c

Modified: trunk/gio/gcontenttype.c
==============================================================================
--- trunk/gio/gcontenttype.c	(original)
+++ trunk/gio/gcontenttype.c	Tue Sep 16 11:36:52 2008
@@ -896,17 +896,20 @@
   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. */



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