From 909012812216e649ec4a8c7721ff7906de4ca32d Mon Sep 17 00:00:00 2001 From: dbera Date: Fri, 28 Jul 2006 05:49:17 +0000 Subject: [PATCH] Dont add null mimetypes. Fixes bgo# 337431. The patch hasnt been officially accepted upstream, so added it to upstream-changes directory. --- .../02_dont_add_null_mime_type.patch | 29 ++++++++++++++++++++++ glue/xdgmime/xdgmimeglob.c | 6 +++-- glue/xdgmime/xdgmimemagic.c | 2 ++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 glue/xdgmime/upstream-changes/02_dont_add_null_mime_type.patch diff --git a/glue/xdgmime/upstream-changes/02_dont_add_null_mime_type.patch b/glue/xdgmime/upstream-changes/02_dont_add_null_mime_type.patch new file mode 100644 index 00000000..7d641944 --- /dev/null +++ b/glue/xdgmime/upstream-changes/02_dont_add_null_mime_type.patch @@ -0,0 +1,29 @@ +From: Debajyoti Bera + +Fix for http://bugzilla.gnome.org/show_bug.cgi?id=337431 +Patch from https://bugs.freedesktop.org/show_bug.cgi?id=5241 attachment-1 +The patch doesn't add null mimetypes to its internal buffer. + +Index: xdgmimeglob.c +=================================================================== +RCS file: /cvs/gnome/beagle/glue/xdgmime/xdgmimeglob.c,v +retrieving revision 1.2 +diff -u -3 -p -r1.2 xdgmimeglob.c +--- xdgmimeglob.c 29 Mar 2006 21:46:06 -0000 1.2 ++++ xdgmimeglob.c 28 Jul 2006 05:42:18 -0000 +@@ -308,11 +308,13 @@ _xdg_glob_hash_node_lookup_file_name (Xd + if (*file_name == '\000') + { + n = 0; +- mime_types[n++] = node->mime_type; ++ if (node->mime_type) ++ mime_types[n++] = node->mime_type; + node = node->child; + while (n < n_mime_types && node && node->character == 0) + { +- mime_types[n++] = node->mime_type; ++ if (node->mime_type) ++ mime_types[n++] = node->mime_type; + node = node->next; + } + } diff --git a/glue/xdgmime/xdgmimeglob.c b/glue/xdgmime/xdgmimeglob.c index 3b8da8f6..91731452 100644 --- a/glue/xdgmime/xdgmimeglob.c +++ b/glue/xdgmime/xdgmimeglob.c @@ -308,11 +308,13 @@ _xdg_glob_hash_node_lookup_file_name (XdgGlobHashNode *glob_hash_node, if (*file_name == '\000') { n = 0; - mime_types[n++] = node->mime_type; + if (node->mime_type) + mime_types[n++] = node->mime_type; node = node->child; while (n < n_mime_types && node && node->character == 0) { - mime_types[n++] = node->mime_type; + if (node->mime_type) + mime_types[n++] = node->mime_type; node = node->next; } } diff --git a/glue/xdgmime/xdgmimemagic.c b/glue/xdgmime/xdgmimemagic.c index df551d78..53630b05 100644 --- a/glue/xdgmime/xdgmimemagic.c +++ b/glue/xdgmime/xdgmimemagic.c @@ -474,7 +474,9 @@ _xdg_mime_magic_parse_magic_line (FILE *magic_file, /* We clean up the matchlet, byte swapping if needed */ if (matchlet->word_size > 1) { +#if LITTLE_ENDIAN int i; +#endif if (matchlet->value_length % matchlet->word_size != 0) { _xdg_mime_magic_matchlet_free (matchlet); -- 2.11.4.GIT