Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 288820
Collapse All | Expand All

(-)pcmanfm-0.5.1.orig/src/mime-type/mime-cache.c (-6 / +8 lines)
Lines 40-46 Link Here
40
#include <fnmatch.h>
40
#include <fnmatch.h>
41
41
42
#define LIB_MAJOR_VERSION 1
42
#define LIB_MAJOR_VERSION 1
43
#define LIB_MAX_MINOR_VERSION 1
43
/* FIXME: since mime-cache 1.2, weight is splitted into three parts
44
 * only lower 8 bit contains weight, and higher bits are flags and case-sensitivity.
45
 * anyway, since we don't support weight at all, it'll be fixed later.
46
 * We claimed that we support 1.2 to cheat pcmanfm as a temporary quick dirty fix
47
 * for the broken file manager, but this should be correctly done in the future.
48
 * Weight and case-sensitivity are not handled now. */
49
#define LIB_MAX_MINOR_VERSION 2
44
#define LIB_MIN_MINOR_VERSION 0
50
#define LIB_MIN_MINOR_VERSION 0
45
51
46
/* handle byte order here */
52
/* handle byte order here */
Lines 57-63 Link Here
57
#define    GLOB_LIST    20
63
#define    GLOB_LIST    20
58
#define    MAGIC_LIST    24
64
#define    MAGIC_LIST    24
59
#define    NAMESPACE_LIST    28
65
#define    NAMESPACE_LIST    28
60
#define    HEADER_SIZE    32
61
66
62
MimeCache* mime_cache_new( const char* file_path )
67
MimeCache* mime_cache_new( const char* file_path )
63
{
68
{
Lines 111-117 Link Here
111
    if ( fd < 0 )
116
    if ( fd < 0 )
112
        return FALSE;
117
        return FALSE;
113
118
114
    if( fstat ( fd, &statbuf ) < 0 || statbuf.st_size < HEADER_SIZE )
119
    if( fstat ( fd, &statbuf ) < 0 )
115
    {
120
    {
116
        close( fd );
121
        close( fd );
117
        return FALSE;
122
        return FALSE;
Lines 346-352 Link Here
346
        const char* node =nodes + i * 12;
351
        const char* node =nodes + i * 12;
347
        guint32 ch = VAL32(node, 0);
352
        guint32 ch = VAL32(node, 0);
348
        _suffix_pos = suffix;
353
        _suffix_pos = suffix;
349
350
        if( G_LIKELY( ch ) )
354
        if( G_LIKELY( ch ) )
351
        {
355
        {
352
            if( ch == uchar )
356
            if( ch == uchar )
Lines 391-404 Link Here
391
395
392
    if( G_UNLIKELY( ! filename || ! *filename || 0 == n ) )
396
    if( G_UNLIKELY( ! filename || ! *filename || 0 == n ) )
393
        return NULL;
397
        return NULL;
394
395
    if( cache->has_reverse_suffix )  /* since mime.cache ver: 1.1 */
398
    if( cache->has_reverse_suffix )  /* since mime.cache ver: 1.1 */
396
    {
399
    {
397
        const char *suffix, *leaf_node, *_suffix_pos = (const char*)-1;
400
        const char *suffix, *leaf_node, *_suffix_pos = (const char*)-1;
398
        fn_len = strlen( filename );
401
        fn_len = strlen( filename );
399
        suffix = g_utf8_find_prev_char( filename, filename + fn_len );
402
        suffix = g_utf8_find_prev_char( filename, filename + fn_len );
400
        leaf_node = lookup_reverse_suffix_nodes( cache->buffer, root, n, filename, suffix, &_suffix_pos );
403
        leaf_node = lookup_reverse_suffix_nodes( cache->buffer, root, n, filename, suffix, &_suffix_pos );
401
402
        if( leaf_node )
404
        if( leaf_node )
403
        {
405
        {
404
            mime_type = cache->buffer + VAL32( leaf_node, 4 );
406
            mime_type = cache->buffer + VAL32( leaf_node, 4 );

Return to bug 288820