我写了个挺无聊的补丁…… LZ看如何:
[c]--- Thunar-1.4.0 的副本/thunar/thunar-file.c 2012-04-29 04:16:39.000000000 +0800
+++ Thunar-1.4.0/thunar/thunar-file.c 2012-07-19 19:51:07.000000000 +0800
@@ -3327,19 +3327,6 @@ thunar_file_compare_by_name (const Thuna
if (ac != bc || ac == 0 || ac > 127)
break;
}
-
- /* fallback to Unicode comparison */
- if (G_UNLIKELY (ac > 127 || bc > 127))
- {
- for (;; ap = g_utf8_next_char (ap), bp = g_utf8_next_char (bp))
- {
- /* check if characters differ or end of string */
- ac = g_utf8_get_char (ap);
- bc = g_utf8_get_char (bp);
- if (ac != bc || ac == 0)
- break;
- }
- }
}
else
{
@@ -3352,19 +3339,6 @@ thunar_file_compare_by_name (const Thuna
if (g_ascii_tolower (ac) != g_ascii_tolower (bc) || ac == 0 || ac > 127)
break;
}
-
- /* fallback to Unicode comparison (case-insensitive!) */
- if (G_UNLIKELY (ac > 127 || bc > 127))
- {
- for (;; ap = g_utf8_next_char (ap), bp = g_utf8_next_char (bp))
- {
- /* check if characters differ or end of string */
- ac = g_utf8_get_char (ap);
- bc = g_utf8_get_char (bp);
- if (g_unichar_tolower (ac) != g_unichar_tolower (bc) || ac == 0)
- break;
- }
- }
}
/* if both strings are equal, we're done */
@@ -3402,44 +3376,6 @@ thunar_file_compare_by_name (const Thuna
}
}
- /* otherwise, if they differ in a unicode char, use the
- * appropriate collate function for the current locale (only
- * if charset is UTF-8, else the required transformations
- * would be too expensive)
- */
-#ifdef HAVE_STRCOLL
- if ((ac > 127 || bc > 127) && g_get_charset (NULL))
- {
- /* case-sensitive is easy, case-insensitive is expensive,
- * but we use a simple optimization to make it fast.
- */
- if (G_LIKELY (case_sensitive))
- {
- return strcoll (ap, bp);
- }
- else
- {
- /* we use a trick here, so we don't need to allocate
- * and transform the two strings completely first (8
- * byte for each buffer, so all compilers should align
- * them properly)
- */
- gchar abuf[8];
- gchar bbuf[8];
-
- /* transform the unicode chars to strings and
- * make sure the strings are nul-terminated.
- */
- abuf[g_unichar_to_utf8 (g_unichar_tolower(ac), abuf)] = '\0';
- bbuf[g_unichar_to_utf8 (g_unichar_tolower(bc), bbuf)] = '\0';
-
- /* compare the unicode chars (as strings) */
- return strcoll (abuf, bbuf);
- }
- }
-#endif
-
- /* else, they differ in an ASCII character */
if (G_UNLIKELY (!case_sensitive))
return (g_unichar_tolower (ac) > g_unichar_tolower (bc)) ? 1 : -1;
else[/c]
(嘛,为了折叠代码,直接用C高亮算了。)