Make magic comparisons work correctly in the cache.

2005-10-18  Matthias Clasen  <mclasen@redhat.com>

        * xdgmimecache.c: Make magic comparisons work correctly
        in the cache.
This commit is contained in:
Matthias Clasen 2005-10-18 20:32:35 +00:00 committed by Matthias Clasen
parent faff0f5f8b
commit fcacded8ff
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2005-10-18 Matthias Clasen <mclasen@redhat.com>
* xdgmimecache.c: Make magic comparisons work correctly
in the cache.
2005-10-17 Matthias Clasen <mclasen@redhat.com> 2005-10-17 Matthias Clasen <mclasen@redhat.com>
* xdgmime.c (xdg_mime_get_mime_type_for_file): Remove * xdgmime.c (xdg_mime_get_mime_type_for_file): Remove

View File

@ -176,8 +176,8 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
{ {
for (j = 0; j < data_length; j++) for (j = 0; j < data_length; j++)
{ {
if ((cache->buffer[data_offset + j] & cache->buffer[mask_offset + j]) != if ((((unsigned char *)cache->buffer)[data_offset + j] & ((unsigned char *)cache->buffer)[mask_offset + j]) !=
((((unsigned char *) data)[j + i]) & cache->buffer[mask_offset + j])) ((((unsigned char *) data)[j + i]) & ((unsigned char *)cache->buffer)[mask_offset + j]))
{ {
valid_matchlet = FALSE; valid_matchlet = FALSE;
break; break;
@ -188,7 +188,7 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
{ {
for (j = 0; j < data_length; j++) for (j = 0; j < data_length; j++)
{ {
if (cache->buffer[data_offset + j] != ((unsigned char *) data)[j + i]) if (((unsigned char *)cache->buffer)[data_offset + j] != ((unsigned char *) data)[j + i])
{ {
valid_matchlet = FALSE; valid_matchlet = FALSE;
break; break;
@ -296,7 +296,7 @@ cache_alias_lookup (const char *alias)
for (i = 0; _caches[i]; i++) for (i = 0; _caches[i]; i++)
{ {
XdgMimeCache *cache = _caches[i]; XdgMimeCache *cache = _caches[i];
xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 4 ); xdg_uint32_t list_offset = GET_UINT32 (cache->buffer, 4);
xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset); xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
xdg_uint32_t offset; xdg_uint32_t offset;