Fixed _xdg_mime_cache_list_mime_parents()
This commit is contained in:
parent
ecdd1a58f0
commit
39198279d1
@ -907,9 +907,11 @@ char **
|
||||
_xdg_mime_cache_list_mime_parents (const char *mime)
|
||||
{
|
||||
int i, j, p;
|
||||
char *all_parents[128]; /* we'll stop at 128 */
|
||||
char *all_parents[128]; /* we'll stop at 128 */
|
||||
char **result;
|
||||
|
||||
mime = xdg_mime_unalias_mime_type (mime);
|
||||
|
||||
p = 0;
|
||||
for (i = 0; _xdg_mime_caches[i]; i++)
|
||||
{
|
||||
@ -920,15 +922,20 @@ _xdg_mime_cache_list_mime_parents (const char *mime)
|
||||
|
||||
for (j = 0; j < n_entries; j++)
|
||||
{
|
||||
xdg_uint32_t mimetype_offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * i);
|
||||
xdg_uint32_t parents_offset = GET_UINT32 (cache->buffer, list_offset + 4 + 8 * i + 4);
|
||||
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)
|
||||
{
|
||||
int k;
|
||||
xdg_uint32_t parent_mime_offset;
|
||||
xdg_uint32_t n_parents = GET_UINT32 (cache->buffer, parents_offset);
|
||||
|
||||
for (j = 0; j < n_parents; j++)
|
||||
all_parents[p++] = cache->buffer + parents_offset + 4 + 4 * j;
|
||||
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;
|
||||
}
|
||||
@ -941,4 +948,3 @@ _xdg_mime_cache_list_mime_parents (const char *mime)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user