Whitespace changes, to make it easier to diff against f.d.o. repository
parent
6fe9428fc0
commit
38bb0c03ac
|
@ -2,13 +2,13 @@
|
|||
/* xdgmime.c: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
|
||||
*
|
||||
* More info can be found at http://www.freedesktop.org/standards/
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2003,2004 Red Hat, Inc.
|
||||
* Copyright (C) 2003,2004 Jonathan Blandford <jrb@alum.mit.edu>
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.0
|
||||
* Or under the following terms:
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
|
@ -563,7 +563,7 @@ xdg_mime_get_mime_type_for_file (const char *file_name,
|
|||
data = malloc (max_extent);
|
||||
if (data == NULL)
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
|
||||
|
||||
file = fopen (file_name, "r");
|
||||
if (file == NULL)
|
||||
{
|
||||
|
@ -626,7 +626,7 @@ xdg_mime_shutdown (void)
|
|||
xdg_dir_time_list_free (dir_time_list);
|
||||
dir_time_list = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (global_hash)
|
||||
{
|
||||
_xdg_glob_hash_free (global_hash);
|
||||
|
@ -719,7 +719,7 @@ xdg_mime_media_type_equal (const char *mime_a,
|
|||
xdg_mime_init ();
|
||||
|
||||
sep = strchr (mime_a, '/');
|
||||
|
||||
|
||||
if (sep && strncmp (mime_a, mime_b, sep - mime_a + 1) == 0)
|
||||
return 1;
|
||||
|
||||
|
@ -802,7 +802,7 @@ xdg_mime_list_mime_parents (const char *mime)
|
|||
return NULL;
|
||||
|
||||
for (i = 0; parents[i]; i++) ;
|
||||
|
||||
|
||||
n = (i + 1) * sizeof (char *);
|
||||
result = (char **) malloc (n);
|
||||
memcpy (result, parents, n);
|
||||
|
@ -822,7 +822,7 @@ xdg_mime_get_mime_parents (const char *mime)
|
|||
return _xdg_mime_parent_list_lookup (parent_list, umime);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
xdg_mime_dump (void)
|
||||
{
|
||||
printf ("*** ALIASES ***\n\n");
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
/* xdgmime.h: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
|
||||
*
|
||||
* More info can be found at http://www.freedesktop.org/standards/
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2003 Red Hat, Inc.
|
||||
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.0
|
||||
* Or under the following terms:
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
|
@ -45,7 +45,7 @@ extern "C" {
|
|||
typedef void (*XdgMimeCallback) (void *user_data);
|
||||
typedef void (*XdgMimeDestroy) (void *user_data);
|
||||
|
||||
|
||||
|
||||
#ifdef XDG_PREFIX
|
||||
#define xdg_mime_get_mime_type_for_data XDG_ENTRY(get_mime_type_for_data)
|
||||
#define xdg_mime_get_mime_type_for_file XDG_ENTRY(get_mime_type_for_file)
|
||||
|
@ -84,9 +84,9 @@ int xdg_mime_media_type_equal (const char *mime_a,
|
|||
int xdg_mime_mime_type_subclass (const char *mime_a,
|
||||
const char *mime_b);
|
||||
/* xdg_mime_get_mime_parents() is deprecated since it does
|
||||
* not work correctly with caches. Use xdg_mime_list_parents()
|
||||
* not work correctly with caches. Use xdg_mime_list_parents()
|
||||
* instead, but notice that that function expects you to free
|
||||
* the array it returns.
|
||||
* the array it returns.
|
||||
*/
|
||||
const char **xdg_mime_get_mime_parents (const char *mime);
|
||||
char ** xdg_mime_list_mime_parents (const char *mime);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <fnmatch.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -137,7 +138,7 @@ _xdg_mime_cache_new_from_file (const char *file_name)
|
|||
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (fstat (fd, &st) < 0 || st.st_size < 4)
|
||||
goto done;
|
||||
|
||||
|
@ -154,7 +155,7 @@ _xdg_mime_cache_new_from_file (const char *file_name)
|
|||
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
cache = (XdgMimeCache *) malloc (sizeof (XdgMimeCache));
|
||||
cache->ref_count = 1;
|
||||
cache->buffer = buffer;
|
||||
|
@ -201,7 +202,7 @@ _xdg_mime_cache_new_from_file (const char *file_name)
|
|||
}
|
||||
|
||||
static int
|
||||
cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
|
||||
cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
|
||||
xdg_uint32_t offset,
|
||||
const void *data,
|
||||
size_t len)
|
||||
|
@ -211,13 +212,13 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
|
|||
xdg_uint32_t data_length = GET_UINT32 (cache->buffer, offset + 12);
|
||||
xdg_uint32_t data_offset = GET_UINT32 (cache->buffer, offset + 16);
|
||||
xdg_uint32_t mask_offset = GET_UINT32 (cache->buffer, offset + 20);
|
||||
|
||||
|
||||
int i, j;
|
||||
|
||||
for (i = range_start; i <= range_start + range_length; i++)
|
||||
{
|
||||
int valid_matchlet = TRUE;
|
||||
|
||||
|
||||
if (i + data_length > len)
|
||||
return FALSE;
|
||||
|
||||
|
@ -244,16 +245,16 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (valid_matchlet)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
cache_magic_matchlet_compare (XdgMimeCache *cache,
|
||||
cache_magic_matchlet_compare (XdgMimeCache *cache,
|
||||
xdg_uint32_t offset,
|
||||
const void *data,
|
||||
size_t len)
|
||||
|
@ -262,12 +263,12 @@ cache_magic_matchlet_compare (XdgMimeCache *cache,
|
|||
xdg_uint32_t child_offset = GET_UINT32 (cache->buffer, offset + 28);
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
if (cache_magic_matchlet_compare_to_data (cache, offset, data, len))
|
||||
{
|
||||
if (n_children == 0)
|
||||
return TRUE;
|
||||
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
{
|
||||
if (cache_magic_matchlet_compare (cache, child_offset + 32 * i,
|
||||
|
@ -275,15 +276,15 @@ cache_magic_matchlet_compare (XdgMimeCache *cache,
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
cache_magic_compare_to_data (XdgMimeCache *cache,
|
||||
cache_magic_compare_to_data (XdgMimeCache *cache,
|
||||
xdg_uint32_t offset,
|
||||
const void *data,
|
||||
size_t len,
|
||||
const void *data,
|
||||
size_t len,
|
||||
int *prio)
|
||||
{
|
||||
xdg_uint32_t priority = GET_UINT32 (cache->buffer, offset);
|
||||
|
@ -299,6 +300,7 @@ cache_magic_compare_to_data (XdgMimeCache *cache,
|
|||
cache->buffer[mimetype_offset])
|
||||
{
|
||||
*prio = priority;
|
||||
|
||||
return cache->buffer + mimetype_offset;
|
||||
}
|
||||
}
|
||||
|
@ -307,9 +309,9 @@ cache_magic_compare_to_data (XdgMimeCache *cache,
|
|||
}
|
||||
|
||||
static const char *
|
||||
cache_magic_lookup_data (XdgMimeCache *cache,
|
||||
const void *data,
|
||||
size_t len,
|
||||
cache_magic_lookup_data (XdgMimeCache *cache,
|
||||
const void *data,
|
||||
size_t len,
|
||||
int *prio,
|
||||
const char *mime_types[],
|
||||
int n_mime_types)
|
||||
|
@ -325,12 +327,12 @@ cache_magic_lookup_data (XdgMimeCache *cache,
|
|||
list_offset = GET_UINT32 (cache->buffer, 24);
|
||||
n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
offset = GET_UINT32 (cache->buffer, list_offset + 8);
|
||||
|
||||
|
||||
for (j = 0; j < n_entries; j++)
|
||||
{
|
||||
const char *match;
|
||||
|
||||
match = cache_magic_compare_to_data (cache, offset + 16 * j,
|
||||
match = cache_magic_compare_to_data (cache, offset + 16 * j,
|
||||
data, len, prio);
|
||||
if (match)
|
||||
return match;
|
||||
|
@ -338,13 +340,13 @@ cache_magic_lookup_data (XdgMimeCache *cache,
|
|||
{
|
||||
xdg_uint32_t mimetype_offset;
|
||||
const char *non_match;
|
||||
|
||||
|
||||
mimetype_offset = GET_UINT32 (cache->buffer, offset + 16 * j + 4);
|
||||
non_match = cache->buffer + mimetype_offset;
|
||||
|
||||
for (n = 0; n < n_mime_types; n++)
|
||||
{
|
||||
if (mime_types[n] &&
|
||||
if (mime_types[n] &&
|
||||
xdg_mime_mime_type_equal (mime_types[n], non_match))
|
||||
mime_types[n] = NULL;
|
||||
}
|
||||
|
@ -367,16 +369,16 @@ cache_alias_lookup (const char *alias)
|
|||
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
xdg_uint32_t offset;
|
||||
|
||||
min = 0;
|
||||
min = 0;
|
||||
max = n_entries - 1;
|
||||
while (max >= min)
|
||||
while (max >= min)
|
||||
{
|
||||
mid = (min + max) / 2;
|
||||
|
||||
offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * mid);
|
||||
ptr = cache->buffer + offset;
|
||||
cmp = strcmp (ptr, alias);
|
||||
|
||||
|
||||
if (cmp < 0)
|
||||
min = mid + 1;
|
||||
else if (cmp > 0)
|
||||
|
@ -407,16 +409,16 @@ cache_glob_lookup_literal (const char *file_name,
|
|||
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
xdg_uint32_t offset;
|
||||
|
||||
min = 0;
|
||||
min = 0;
|
||||
max = n_entries - 1;
|
||||
while (max >= min)
|
||||
while (max >= min)
|
||||
{
|
||||
mid = (min + max) / 2;
|
||||
|
||||
offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * mid);
|
||||
ptr = cache->buffer + offset;
|
||||
cmp = strcmp (ptr, file_name);
|
||||
|
||||
|
||||
if (cmp < 0)
|
||||
min = mid + 1;
|
||||
else if (cmp > 0)
|
||||
|
@ -471,7 +473,7 @@ cache_glob_lookup_fnmatch (const char *file_name,
|
|||
if (n > 0)
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -479,7 +481,7 @@ static int
|
|||
cache_glob_node_lookup_suffix (XdgMimeCache *cache,
|
||||
xdg_uint32_t n_entries,
|
||||
xdg_uint32_t offset,
|
||||
const char *suffix,
|
||||
const char *suffix,
|
||||
int ignore_case,
|
||||
const char *mime_types[],
|
||||
int n_mime_types)
|
||||
|
@ -488,7 +490,7 @@ cache_glob_node_lookup_suffix (XdgMimeCache *cache,
|
|||
xdg_unichar_t match_char;
|
||||
xdg_uint32_t mimetype_offset;
|
||||
xdg_uint32_t n_children;
|
||||
xdg_uint32_t child_offset;
|
||||
xdg_uint32_t child_offset;
|
||||
|
||||
int min, max, mid, n, i;
|
||||
|
||||
|
@ -508,7 +510,7 @@ cache_glob_node_lookup_suffix (XdgMimeCache *cache,
|
|||
min = mid + 1;
|
||||
else if (match_char > character)
|
||||
max = mid - 1;
|
||||
else
|
||||
else
|
||||
{
|
||||
suffix = _xdg_utf8_next_char (suffix);
|
||||
if (*suffix == '\0')
|
||||
|
@ -517,7 +519,7 @@ cache_glob_node_lookup_suffix (XdgMimeCache *cache,
|
|||
n = 0;
|
||||
if (cache->buffer[mimetype_offset])
|
||||
mime_types[n++] = cache->buffer + mimetype_offset;
|
||||
|
||||
|
||||
n_children = GET_UINT32 (cache->buffer, offset + 16 * mid + 8);
|
||||
child_offset = GET_UINT32 (cache->buffer, offset + 16 * mid + 12);
|
||||
i = 0;
|
||||
|
@ -539,8 +541,8 @@ cache_glob_node_lookup_suffix (XdgMimeCache *cache,
|
|||
{
|
||||
n_children = GET_UINT32 (cache->buffer, offset + 16 * mid + 8);
|
||||
child_offset = GET_UINT32 (cache->buffer, offset + 16 * mid + 12);
|
||||
|
||||
return cache_glob_node_lookup_suffix (cache,
|
||||
|
||||
return cache_glob_node_lookup_suffix (cache,
|
||||
n_children, child_offset,
|
||||
suffix, ignore_case,
|
||||
mime_types,
|
||||
|
@ -553,7 +555,7 @@ cache_glob_node_lookup_suffix (XdgMimeCache *cache,
|
|||
}
|
||||
|
||||
static int
|
||||
cache_glob_lookup_suffix (const char *suffix,
|
||||
cache_glob_lookup_suffix (const char *suffix,
|
||||
int ignore_case,
|
||||
const char *mime_types[],
|
||||
int n_mime_types)
|
||||
|
@ -568,8 +570,8 @@ cache_glob_lookup_suffix (const char *suffix,
|
|||
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
xdg_uint32_t offset = GET_UINT32 (cache->buffer, list_offset + 4);
|
||||
|
||||
n = cache_glob_node_lookup_suffix (cache,
|
||||
n_entries, offset,
|
||||
n = cache_glob_node_lookup_suffix (cache,
|
||||
n_entries, offset,
|
||||
suffix, ignore_case,
|
||||
mime_types,
|
||||
n_mime_types);
|
||||
|
@ -584,7 +586,7 @@ static void
|
|||
find_stopchars (char *stopchars)
|
||||
{
|
||||
int i, j, k, l;
|
||||
|
||||
|
||||
k = 0;
|
||||
for (i = 0; _xdg_mime_caches[i]; i++)
|
||||
{
|
||||
|
@ -597,7 +599,7 @@ find_stopchars (char *stopchars)
|
|||
for (j = 0; j < n_entries; j++)
|
||||
{
|
||||
xdg_uint32_t match_char = GET_UINT32 (cache->buffer, offset);
|
||||
|
||||
|
||||
if (match_char < 128)
|
||||
{
|
||||
for (l = 0; l < k; l++)
|
||||
|
@ -618,14 +620,14 @@ find_stopchars (char *stopchars)
|
|||
}
|
||||
|
||||
static int
|
||||
cache_glob_lookup_file_name (const char *file_name,
|
||||
cache_glob_lookup_file_name (const char *file_name,
|
||||
const char *mime_types[],
|
||||
int n_mime_types)
|
||||
{
|
||||
const char *ptr;
|
||||
char stopchars[128];
|
||||
int n;
|
||||
|
||||
|
||||
assert (file_name != NULL);
|
||||
|
||||
/* First, check the literals */
|
||||
|
@ -642,14 +644,14 @@ cache_glob_lookup_file_name (const char *file_name,
|
|||
n = cache_glob_lookup_suffix (ptr, FALSE, mime_types, n_mime_types);
|
||||
if (n > 0)
|
||||
return n;
|
||||
|
||||
|
||||
n = cache_glob_lookup_suffix (ptr, TRUE, mime_types, n_mime_types);
|
||||
if (n > 0)
|
||||
return n;
|
||||
|
||||
ptr = strpbrk (ptr + 1, stopchars);
|
||||
}
|
||||
|
||||
|
||||
/* Last, try fnmatch */
|
||||
return cache_glob_lookup_fnmatch (file_name, mime_types, n_mime_types);
|
||||
}
|
||||
|
@ -691,7 +693,7 @@ cache_get_mime_type_for_data (const void *data,
|
|||
int prio;
|
||||
const char *match;
|
||||
|
||||
match = cache_magic_lookup_data (cache, data, len, &prio,
|
||||
match = cache_magic_lookup_data (cache, data, len, &prio,
|
||||
mime_types, n_mime_types);
|
||||
if (prio > priority && match && *match)
|
||||
{
|
||||
|
@ -765,7 +767,7 @@ _xdg_mime_cache_get_mime_type_for_file (const char *file_name,
|
|||
data = malloc (max_extent);
|
||||
if (data == NULL)
|
||||
return XDG_MIME_TYPE_UNKNOWN;
|
||||
|
||||
|
||||
file = fopen (file_name, "r");
|
||||
if (file == NULL)
|
||||
{
|
||||
|
@ -825,7 +827,7 @@ _xdg_mime_cache_mime_type_subclass (const char *mime,
|
|||
const char *umime, *ubase;
|
||||
|
||||
int i, j, min, max, med, cmp;
|
||||
|
||||
|
||||
umime = _xdg_mime_cache_unalias_mime_type (mime);
|
||||
ubase = _xdg_mime_cache_unalias_mime_type (base);
|
||||
|
||||
|
@ -843,27 +845,27 @@ _xdg_mime_cache_mime_type_subclass (const char *mime,
|
|||
#endif
|
||||
|
||||
/* Handle special cases text/plain and application/octet-stream */
|
||||
if (strcmp (ubase, "text/plain") == 0 &&
|
||||
if (strcmp (ubase, "text/plain") == 0 &&
|
||||
strncmp (umime, "text/", 5) == 0)
|
||||
return 1;
|
||||
|
||||
if (strcmp (ubase, "application/octet-stream") == 0)
|
||||
return 1;
|
||||
|
||||
|
||||
for (i = 0; _xdg_mime_caches[i]; i++)
|
||||
{
|
||||
XdgMimeCache *cache = _xdg_mime_caches[i];
|
||||
|
||||
|
||||
xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 8);
|
||||
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
xdg_uint32_t offset, n_parents, parent_offset;
|
||||
|
||||
min = 0;
|
||||
min = 0;
|
||||
max = n_entries - 1;
|
||||
while (max >= min)
|
||||
{
|
||||
med = (min + max)/2;
|
||||
|
||||
|
||||
offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * med);
|
||||
cmp = strcmp (cache->buffer + offset, umime);
|
||||
if (cmp < 0)
|
||||
|
@ -874,7 +876,7 @@ _xdg_mime_cache_mime_type_subclass (const char *mime,
|
|||
{
|
||||
offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * med + 4);
|
||||
n_parents = GET_UINT32 (cache->buffer, offset);
|
||||
|
||||
|
||||
for (j = 0; j < n_parents; j++)
|
||||
{
|
||||
parent_offset = GET_UINT32 (cache->buffer, offset + 4 + 4 * j);
|
||||
|
@ -894,57 +896,57 @@ const char *
|
|||
_xdg_mime_cache_unalias_mime_type (const char *mime)
|
||||
{
|
||||
const char *lookup;
|
||||
|
||||
|
||||
lookup = cache_alias_lookup (mime);
|
||||
|
||||
|
||||
if (lookup)
|
||||
return lookup;
|
||||
|
||||
return mime;
|
||||
|
||||
return mime;
|
||||
}
|
||||
|
||||
char **
|
||||
_xdg_mime_cache_list_mime_parents (const char *mime)
|
||||
{
|
||||
int i, j, p;
|
||||
char *all_parents[128]; /* we'll stop at 128 */
|
||||
char **result;
|
||||
|
||||
char *all_parents[128]; /* we'll stop at 128 */
|
||||
char **result;
|
||||
|
||||
mime = xdg_mime_unalias_mime_type (mime);
|
||||
|
||||
p = 0;
|
||||
p = 0;
|
||||
for (i = 0; _xdg_mime_caches[i]; i++)
|
||||
{
|
||||
{
|
||||
XdgMimeCache *cache = _xdg_mime_caches[i];
|
||||
|
||||
xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 8);
|
||||
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
|
||||
for (j = 0; j < n_entries; j++)
|
||||
{
|
||||
xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 8);
|
||||
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
|
||||
|
||||
for (j = 0; j < n_entries; j++)
|
||||
{
|
||||
xdg_uint32_t mimetype_offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * j);
|
||||
xdg_uint32_t parents_offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * j + 4);
|
||||
|
||||
if (strcmp (cache->buffer + mimetype_offset, mime) == 0)
|
||||
{
|
||||
if (strcmp (cache->buffer + mimetype_offset, mime) == 0)
|
||||
{
|
||||
int k;
|
||||
xdg_uint32_t parent_mime_offset;
|
||||
xdg_uint32_t n_parents = GET_UINT32 (cache->buffer, parents_offset);
|
||||
xdg_uint32_t n_parents = GET_UINT32 (cache->buffer, parents_offset);
|
||||
|
||||
for (k = 0; k < n_parents; k++)
|
||||
{
|
||||
parent_mime_offset = GET_UINT32 (cache->buffer, parents_offset + 4 + 4 * k);
|
||||
all_parents[p++] = cache->buffer + parent_mime_offset;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
all_parents[p++] = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
all_parents[p++] = 0;
|
||||
|
||||
result = (char **) malloc (p * sizeof (char *));
|
||||
memcpy (result, all_parents, p * sizeof (char *));
|
||||
|
||||
return result;
|
||||
}
|
||||
result = (char **) malloc (p * sizeof (char *));
|
||||
memcpy (result, all_parents, p * sizeof (char *));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
#ifdef HAVE_FNMATCH_H
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#include <mooutils/mooutils-win32.h>
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#ifdef __WIN32__
|
||||
#include <mooutils/mooutils-win32.h>
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
|
@ -475,7 +477,6 @@ _xdg_mime_magic_parse_magic_line (FILE *magic_file,
|
|||
/* We clean up the matchlet, byte swapping if needed */
|
||||
if (matchlet->word_size > 1)
|
||||
{
|
||||
int i;
|
||||
if (matchlet->value_length % matchlet->word_size != 0)
|
||||
{
|
||||
_xdg_mime_magic_matchlet_free (matchlet);
|
||||
|
|
Loading…
Reference in New Issue