mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
Sync to latest upstream, including fixes for matching against multiple
2005-03-28 Matthias Clasen <mclasen@redhat.com> * xdgmimeglob.c: Sync to latest upstream, including fixes for matching against multiple extensions (eg .tar.gz) and for suffix patterns which don't start with a dot.
This commit is contained in:
parent
2b874b2438
commit
0e832d57fc
@ -1,3 +1,10 @@
|
|||||||
|
2005-03-28 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* xdgmimeglob.c: Sync to latest upstream,
|
||||||
|
including fixes for matching against multiple
|
||||||
|
extensions (eg .tar.gz) and for suffix
|
||||||
|
patterns which don't start with a dot.
|
||||||
|
|
||||||
Sat Mar 19 23:52:33 2005 Manish Singh <yosh@gimp.org>
|
Sat Mar 19 23:52:33 2005 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* xdgmimeglob.c (_xdg_glob_hash_insert_text): cast away the constness
|
* xdgmimeglob.c (_xdg_glob_hash_insert_text): cast away the constness
|
||||||
|
@ -241,7 +241,6 @@ _xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
|
|||||||
text = _xdg_utf8_next_char (text);
|
text = _xdg_utf8_next_char (text);
|
||||||
if (*text == '\000')
|
if (*text == '\000')
|
||||||
{
|
{
|
||||||
if (node->mime_type)
|
|
||||||
free ((void *) node->mime_type);
|
free ((void *) node->mime_type);
|
||||||
node->mime_type = mime_type;
|
node->mime_type = mime_type;
|
||||||
}
|
}
|
||||||
@ -290,6 +289,10 @@ _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
|
|||||||
XdgGlobList *list;
|
XdgGlobList *list;
|
||||||
const char *mime_type;
|
const char *mime_type;
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
|
char stopchars[128];
|
||||||
|
int i;
|
||||||
|
XdgGlobHashNode *node;
|
||||||
|
|
||||||
/* First, check the literals */
|
/* First, check the literals */
|
||||||
|
|
||||||
assert (file_name != NULL);
|
assert (file_name != NULL);
|
||||||
@ -298,8 +301,16 @@ _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
|
|||||||
if (strcmp ((const char *)list->data, file_name) == 0)
|
if (strcmp ((const char *)list->data, file_name) == 0)
|
||||||
return list->mime_type;
|
return list->mime_type;
|
||||||
|
|
||||||
ptr = strchr (file_name, '.');
|
i = 0;
|
||||||
if (ptr)
|
for (node = glob_hash->simple_node; node; node = node->next)
|
||||||
|
{
|
||||||
|
if (node->character < 128)
|
||||||
|
stopchars[i++] = (char)node->character;
|
||||||
|
}
|
||||||
|
stopchars[i] = '\0';
|
||||||
|
|
||||||
|
ptr = strpbrk (file_name, stopchars);
|
||||||
|
while (ptr)
|
||||||
{
|
{
|
||||||
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, FALSE));
|
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, FALSE));
|
||||||
if (mime_type != NULL)
|
if (mime_type != NULL)
|
||||||
@ -308,6 +319,8 @@ _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
|
|||||||
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, TRUE));
|
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, TRUE));
|
||||||
if (mime_type != NULL)
|
if (mime_type != NULL)
|
||||||
return mime_type;
|
return mime_type;
|
||||||
|
|
||||||
|
ptr = strpbrk (ptr + 1, stopchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Not UTF-8 safe */
|
/* FIXME: Not UTF-8 safe */
|
||||||
|
Loading…
Reference in New Issue
Block a user