| … | |
… | |
| 2202 | -keycompare (const struct line *a, const struct line *b) |
2202 | -keycompare (const struct line *a, const struct line *b) |
| 2203 | +keycompare_uni (const struct line *a, const struct line *b) |
2203 | +keycompare_uni (const struct line *a, const struct line *b) |
| 2204 | { |
2204 | { |
| 2205 | struct keyfield *key = keylist; |
2205 | struct keyfield *key = keylist; |
| 2206 | |
2206 | |
| 2207 | @@ -1875,6 +2265,181 @@ |
2207 | @@ -1875,6 +2265,179 @@ |
| 2208 | return key->reverse ? -diff : diff; |
2208 | return key->reverse ? -diff : diff; |
| 2209 | } |
2209 | } |
| 2210 | |
2210 | |
| 2211 | +#if HAVE_MBRTOWC |
2211 | +#if HAVE_MBRTOWC |
| 2212 | +static int |
2212 | +static int |
| … | |
… | |
| 2230 | + memset (&state_a, '\0', sizeof(mbstate_t)); |
2230 | + memset (&state_a, '\0', sizeof(mbstate_t)); |
| 2231 | + memset (&state_b, '\0', sizeof(mbstate_t)); |
2231 | + memset (&state_b, '\0', sizeof(mbstate_t)); |
| 2232 | + |
2232 | + |
| 2233 | + for (;;) |
2233 | + for (;;) |
| 2234 | + { |
2234 | + { |
| 2235 | + unsigned char *translate = (unsigned char *) key->translate; |
2235 | + char const *translate = key->translate; |
| 2236 | + bool const *ignore = key->ignore; |
2236 | + bool const *ignore = key->ignore; |
| 2237 | + |
2237 | + |
| 2238 | + /* Find the lengths. */ |
2238 | + /* Find the lengths. */ |
| 2239 | + size_t lena = lima <= texta ? 0 : lima - texta; |
2239 | + size_t lena = lima <= texta ? 0 : lima - texta; |
| 2240 | + size_t lenb = limb <= textb ? 0 : limb - textb; |
2240 | + size_t lenb = limb <= textb ? 0 : limb - textb; |
| 2241 | + |
2241 | + |
| 2242 | + /* Actually compare the fields. */ |
2242 | + /* Actually compare the fields. */ |
| 2243 | + if (key->random) |
2243 | + if (key->random) |
| 2244 | + diff = compare_random (texta, lena, textb, lenb); |
2244 | + diff = compare_random (texta, lena, textb, lenb); |
| 2245 | + else if (key->numeric | key->general_numeric) |
2245 | + else if (key->numeric | key->general_numeric | key->human_numeric) |
| 2246 | + { |
2246 | + { |
| 2247 | + char savea = *lima, saveb = *limb; |
2247 | + char savea = *lima, saveb = *limb; |
| 2248 | + |
2248 | + |
| 2249 | + *lima = *limb = '\0'; |
2249 | + *lima = *limb = '\0'; |
| 2250 | + if (force_general_numcompare) |
|
|
| 2251 | + diff = general_numcompare (texta, textb); |
2250 | + diff = (key->numeric ? numcompare (texta, textb) |
| 2252 | + else |
2251 | + : key->general_numeric ? general_numcompare (texta, textb) |
| 2253 | + diff = ((key->numeric ? numcompare : general_numcompare) |
2252 | + : human_numcompare (texta, textb, key)); |
| 2254 | + (texta, textb)); |
|
|
| 2255 | + *lima = savea, *limb = saveb; |
2253 | + *lima = savea, *limb = saveb; |
| 2256 | + } |
2254 | + } |
| 2257 | + else if (key->version) |
2255 | + else if (key->version) |
| 2258 | + diff = compare_version (texta, lena, textb, lenb); |
2256 | + diff = compare_version (texta, lena, textb, lenb); |
| 2259 | + else if (key->month) |
2257 | + else if (key->month) |