aboutsummaryrefslogtreecommitdiff
path: root/src/stardict.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-09-27 03:35:14 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-09-27 03:35:14 +0200
commitda6c46cba9a7e9fd982a82b89a23e812e1ff6d62 (patch)
tree3538fdc193daf9d97a7489ea7f61136a7a3ee985 /src/stardict.c
parentc9eb47de7e3ae7da8db149e3683a3ad7e1ac3c26 (diff)
downloadtdv-da6c46cba9a7e9fd982a82b89a23e812e1ff6d62.tar.gz
tdv-da6c46cba9a7e9fd982a82b89a23e812e1ff6d62.tar.xz
tdv-da6c46cba9a7e9fd982a82b89a23e812e1ff6d62.zip
Fix common prefix search with no collator
Diffstat (limited to 'src/stardict.c')
-rw-r--r--src/stardict.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/stardict.c b/src/stardict.c
index 9ce6059..cc69c07 100644
--- a/src/stardict.c
+++ b/src/stardict.c
@@ -980,7 +980,13 @@ stardict_longest_common_collation_prefix (StardictDict *sd,
while ((pos1 = ubrk_next (it1)) != UBRK_DONE
&& (pos2 = ubrk_next (it2)) != UBRK_DONE)
{
- if (!ucol_strcoll (sd->priv->collator, uc1, pos1, uc2, pos2))
+ if (sd->priv->collator)
+ {
+ if (!ucol_strcoll (sd->priv->collator, uc1, pos1, uc2, pos2))
+ longest = pos1;
+ }
+ // I'd need a new collator, so just do the minimal working thing
+ else if (pos1 == pos2 && !memcmp (uc1, uc2, pos1 * sizeof *uc1))
longest = pos1;
}
ubrk_close (it1);