Sync to upstream.
2005-04-29 Matthias Clasen <mclasen@redhat.com> * Sync to upstream.
This commit is contained in:
committed by
Matthias Clasen
parent
eb92e0784a
commit
2464763a22
@ -1,3 +1,7 @@
|
|||||||
|
2005-04-29 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* Sync to upstream.
|
||||||
|
|
||||||
2005-04-08 Matthias Clasen <mclasen@redhat.com>
|
2005-04-08 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* xdgmimecache.c (cache_magic_matchlet_compare_to_data)
|
* xdgmimecache.c (cache_magic_matchlet_compare_to_data)
|
||||||
|
|||||||
@ -147,6 +147,7 @@ xdg_mime_init_from_directory (const char *directory)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free (file_name);
|
||||||
|
|
||||||
file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1);
|
file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1);
|
||||||
strcpy (file_name, directory); strcat (file_name, "/mime/globs");
|
strcpy (file_name, directory); strcat (file_name, "/mime/globs");
|
||||||
@ -564,6 +565,12 @@ xdg_mime_shutdown (void)
|
|||||||
alias_list = NULL;
|
alias_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parent_list)
|
||||||
|
{
|
||||||
|
_xdg_mime_parent_list_free (parent_list);
|
||||||
|
parent_list = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (list = callback_list; list; list = list->next)
|
for (list = callback_list; list; list = list->next)
|
||||||
(list->callback) (list->data);
|
(list->callback) (list->data);
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,7 @@ typedef void (*XdgMimeDestroy) (void *user_data);
|
|||||||
#define xdg_mime_media_type_equal XDG_ENTRY(media_type_equal)
|
#define xdg_mime_media_type_equal XDG_ENTRY(media_type_equal)
|
||||||
#define xdg_mime_mime_type_subclass XDG_ENTRY(mime_type_subclass)
|
#define xdg_mime_mime_type_subclass XDG_ENTRY(mime_type_subclass)
|
||||||
#define xdg_mime_get_mime_parents XDG_ENTRY(get_mime_parents)
|
#define xdg_mime_get_mime_parents XDG_ENTRY(get_mime_parents)
|
||||||
|
#define xdg_mime_list_mime_parents XDG_ENTRY(list_mime_parents)
|
||||||
#define xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type)
|
#define xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type)
|
||||||
#define xdg_mime_get_max_buffer_extents XDG_ENTRY(get_max_buffer_extents)
|
#define xdg_mime_get_max_buffer_extents XDG_ENTRY(get_max_buffer_extents)
|
||||||
#define xdg_mime_shutdown XDG_ENTRY(shutdown)
|
#define xdg_mime_shutdown XDG_ENTRY(shutdown)
|
||||||
@ -77,7 +78,13 @@ int xdg_mime_media_type_equal (const char *mime_a,
|
|||||||
const char *mime_b);
|
const char *mime_b);
|
||||||
int xdg_mime_mime_type_subclass (const char *mime_a,
|
int xdg_mime_mime_type_subclass (const char *mime_a,
|
||||||
const char *mime_b);
|
const char *mime_b);
|
||||||
|
/* xdg_mime_get_mime_parents() is deprecated since it does
|
||||||
|
* not work correctly with caches. Use xdg_mime_list_parents()
|
||||||
|
* instead, but notice that that function expects you to free
|
||||||
|
* the array it returns.
|
||||||
|
*/
|
||||||
const char **xdg_mime_get_mime_parents (const char *mime);
|
const char **xdg_mime_get_mime_parents (const char *mime);
|
||||||
|
char ** xdg_mime_list_mime_parents (const char *mime);
|
||||||
const char *xdg_mime_unalias_mime_type (const char *mime);
|
const char *xdg_mime_unalias_mime_type (const char *mime);
|
||||||
int xdg_mime_get_max_buffer_extents (void);
|
int xdg_mime_get_max_buffer_extents (void);
|
||||||
void xdg_mime_shutdown (void);
|
void xdg_mime_shutdown (void);
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
#define TRUE (!FALSE)
|
#define TRUE (!FALSE)
|
||||||
#endif
|
#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,
|
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,
|
||||||
|
|||||||
@ -268,7 +268,7 @@ _xdg_mime_magic_parse_header (FILE *magic_file, XdgMimeMagicMatch *match)
|
|||||||
if (c != ':')
|
if (c != ':')
|
||||||
return XDG_MIME_MAGIC_ERROR;
|
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)
|
if (end_of_file)
|
||||||
return XDG_MIME_MAGIC_EOF;
|
return XDG_MIME_MAGIC_EOF;
|
||||||
|
|
||||||
@ -520,8 +520,7 @@ _xdg_mime_magic_matchlet_compare_to_data (XdgMimeMagicMatchlet *matchlet,
|
|||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
int i, j;
|
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;
|
int valid_matchlet = TRUE;
|
||||||
|
|
||||||
@ -657,16 +656,20 @@ _xdg_mime_magic_lookup_data (XdgMimeMagic *mime_magic,
|
|||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
XdgMimeMagicMatch *match;
|
XdgMimeMagicMatch *match;
|
||||||
|
const char *mime_type;
|
||||||
|
|
||||||
|
mime_type = NULL;
|
||||||
for (match = mime_magic->match_list; match; match = match->next)
|
for (match = mime_magic->match_list; match; match = match->next)
|
||||||
{
|
{
|
||||||
if (_xdg_mime_magic_match_compare_to_data (match, data, len))
|
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
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user