bug in g_content_type_guess



from http://git.gnome.org/browse/glib/tree/gio/gcontenttype.c
we have the definition for this function as below, where
*result_uncertain is never assigned.

char *
g_content_type_guess (const char   *filename,
		      const guchar *data,
		      gsize         data_size,
		      gboolean     *result_uncertain)
{
  char *basename;
  char *type;
  char *dot;

  type = NULL;

  if (filename)
    {
      basename = g_path_get_basename (filename);
      dot = strrchr (basename, '.');
      if (dot)
	type = g_strdup (dot);
      g_free (basename);
    }

  if (type)
    return type;

  if (data && looks_like_text (data, data_size))
    return g_strdup (".txt");

  return g_strdup ("*");
}


Best Regards

Shixin Zeng


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