[haiku-bugs] Re: [Haiku] #8192: Incorrect collation in Tracker and Deskbar

  • From: "jscipione" <trac@xxxxxxxxxxxx>
  • Date: Fri, 09 Dec 2011 22:42:28 -0000

#8192: Incorrect collation in Tracker and Deskbar
------------------------------------+----------------------------
   Reporter:  rq                    |      Owner:  axeld
       Type:  bug                   |     Status:  new
   Priority:  normal                |  Milestone:  R1
  Component:  Applications/Tracker  |    Version:  R1/Development
 Resolution:                        |   Keywords:
 Blocked By:                        |   Blocking:
Has a Patch:  0                     |   Platform:  All
------------------------------------+----------------------------

Comment (by jscipione):

 Replying to [comment:2 axeld]:
 > I don't see why it can't be done as is. All that is needed is to use a
 strcasecmp() that does support collations

 BCollator->Compare() is a strcasecmp() that supports localized collations.

 > the natural sort algorithm wouldn't need to be replaced at all (of
 course, once we have that kind of functionality in the locale kit, it
 should).

 Yes it does, you can either perform a natural ASCII sort or a localized
 compare.

 See http://cgit.haiku-
 os.org/haiku/tree/src/apps/deskbar/WindowMenuItem.cpp#n149 for how
 comparisons of window titles is done in Deskbar now.

 Unless we want to resort the entire list we need to use a single
 comparison method.

 The way to fix this is to extend BCollator to support localized natural
 compares and then alter Tracker and Deskbar to use this algorithm. All the
 hard work is already done by ICU, it simply needs to be exposed by the
 Locale Kit.

 Also, there are locking issues when using BCollator that must be taken
 into account. I tried replacing the existing NaturalCompare() with
 BCollator->Compare() without locking and it crashes Deskbar. I believe
 protecting the Compare() method with locks will fix the crashing.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/8192#comment:3>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: