From 2623f6fc0f6ae69a771ddc6d7bd474973555d442 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 16 Sep 2008 11:36:52 +0000 Subject: [PATCH] can't assign the return value of g_strdupv() to an array. Fill the array 2008-09-16 Michael Natterer * 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 | 7 +++++++ gio/gcontenttype.c | 25 ++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index e905c539f..048e9f552 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,10 @@ +2008-09-16 Michael Natterer + + * 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 * gdesktopappinfo.c (g_desktop_app_info_new_from_keyfile): diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c index 7f4780604..732373bd9 100644 --- a/gio/gcontenttype.c +++ b/gio/gcontenttype.c @@ -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. */