gcmd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gcmd-dev] sorting and diacritic


From: Piotr Eljasiak
Subject: Re: [gcmd-dev] sorting and diacritic
Date: Mon, 17 Mar 2008 17:20:35 +0100

I think I've fixed the bug (rev. #1653). The problem was caused by using
for sorting strcmp() function which works correctly only for ascii
strings. As a workaround gcmd could use it's utf-8 equivalent -
g_utf8_collate (), but unfortunately it's much slower.

The solution is to convert a filename into a so called 'collation key'
that can be compared with other collation keys produced by the same
function using plain old strcmp(). Of course there will a penalty for
this, but not so big as the collation keys are generated only once - at
reading directory (and when updating files if any).

As a side effect (and bonus, I hope) we've got slightly different way of
sorting file names. Instead of previous:

    event.c
    eventgenerator.c
    event.h
    file1.c
    file10.c
    file2.c
    file3.c

we get now:

    event.c
    event.h
    eventgenerator.c
    file1.c
    file2.c
    file3.c
    file10.c



Please do test thoroughly,
Piotr





reply via email to

[Prev in Thread] Current Thread [Next in Thread]