diff --git a/gtk/xdgmime/ChangeLog b/gtk/xdgmime/ChangeLog index b91725b933..d18b8969dd 100644 --- a/gtk/xdgmime/ChangeLog +++ b/gtk/xdgmime/ChangeLog @@ -1,3 +1,7 @@ +2005-04-29 Matthias Clasen + + * Sync to upstream. + 2005-04-12 Matthias Clasen * === Releases 2.6.7 ==== diff --git a/gtk/xdgmime/test-mime.c b/gtk/xdgmime/test-mime.c index 186271b75b..b0bcc875fe 100644 --- a/gtk/xdgmime/test-mime.c +++ b/gtk/xdgmime/test-mime.c @@ -112,7 +112,7 @@ main (int argc, char *argv[]) printf ("File \"%s\" has a mime-type of %s\n", file_name, result); } -#if 1 +#if 0 xdg_mime_dump (); #endif return 0; diff --git a/gtk/xdgmime/xdgmime.c b/gtk/xdgmime/xdgmime.c index 51a9c07f6a..6b400d9ebd 100644 --- a/gtk/xdgmime/xdgmime.c +++ b/gtk/xdgmime/xdgmime.c @@ -147,6 +147,7 @@ xdg_mime_init_from_directory (const char *directory) return FALSE; } } + free (file_name); file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1); strcpy (file_name, directory); strcat (file_name, "/mime/globs"); @@ -563,6 +564,12 @@ xdg_mime_shutdown (void) _xdg_mime_alias_list_free (alias_list); alias_list = NULL; } + + if (parent_list) + { + _xdg_mime_parent_list_free (parent_list); + parent_list = NULL; + } for (list = callback_list; list; list = list->next) (list->callback) (list->data); @@ -668,7 +675,7 @@ xdg_mime_mime_type_subclass (const char *mime, /* We really want to handle text/ * in GtkFileFilter, so we just * turn on the supertype matching */ -#if 1 +#if 1 /* Handle supertypes */ if (xdg_mime_is_super_type (ubase) && xdg_mime_media_type_equal (umime, ubase)) diff --git a/gtk/xdgmime/xdgmimeint.c b/gtk/xdgmime/xdgmimeint.c index c24f8194ec..4a0ac4cc39 100644 --- a/gtk/xdgmime/xdgmimeint.c +++ b/gtk/xdgmime/xdgmimeint.c @@ -41,7 +41,7 @@ #define TRUE (!FALSE) #endif -static const unsigned char _xdg_utf8_skip_data[256] = { +static const char _xdg_utf8_skip_data[256] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, diff --git a/gtk/xdgmime/xdgmimemagic.c b/gtk/xdgmime/xdgmimemagic.c index b98c1e7321..352886d0f6 100644 --- a/gtk/xdgmime/xdgmimemagic.c +++ b/gtk/xdgmime/xdgmimemagic.c @@ -268,7 +268,7 @@ _xdg_mime_magic_parse_header (FILE *magic_file, XdgMimeMagicMatch *match) if (c != ':') return XDG_MIME_MAGIC_ERROR; - buffer = _xdg_mime_magic_read_to_newline (magic_file, &end_of_file); + buffer = (char *)_xdg_mime_magic_read_to_newline (magic_file, &end_of_file); if (end_of_file) return XDG_MIME_MAGIC_EOF; @@ -520,8 +520,7 @@ _xdg_mime_magic_matchlet_compare_to_data (XdgMimeMagicMatchlet *matchlet, size_t len) { int i, j; - - for (i = matchlet->offset; i <= matchlet->offset + matchlet->range_length; i++) + for (i = matchlet->offset; i < matchlet->offset + matchlet->range_length; i++) { int valid_matchlet = TRUE; @@ -657,16 +656,20 @@ _xdg_mime_magic_lookup_data (XdgMimeMagic *mime_magic, size_t len) { XdgMimeMagicMatch *match; + const char *mime_type; + mime_type = NULL; for (match = mime_magic->match_list; match; match = match->next) { if (_xdg_mime_magic_match_compare_to_data (match, data, len)) { - return match->mime_type; + if ((mime_type == NULL) || (xdg_mime_mime_type_subclass (match->mime_type, mime_type))) { + mime_type = match->mime_type; + } } } - return NULL; + return mime_type; } static void