dovecot-1.2: fts-squat: Fixed searching multi-byte characters.

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 23 19:51:14 EET 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/6541fcc3bf54
changeset: 9489:6541fcc3bf54
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 23 12:51:07 2009 -0500
description:
fts-squat: Fixed searching multi-byte characters.

diffstat:

1 file changed, 5 insertions(+), 4 deletions(-)
src/plugins/fts-squat/squat-trie.c |    9 +++++----

diffs (40 lines):

diff -r e47eb506eebd -r 6541fcc3bf54 src/plugins/fts-squat/squat-trie.c
--- a/src/plugins/fts-squat/squat-trie.c	Mon Nov 23 12:19:24 2009 -0500
+++ b/src/plugins/fts-squat/squat-trie.c	Mon Nov 23 12:51:07 2009 -0500
@@ -1906,7 +1906,8 @@ squat_trie_lookup_partial(struct squat_t
 	unsigned int char_idx, max_chars, i, j, bytelen;
 	int ret;
 
-	max_chars = uni_utf8_strlen_n(data, size);
+	for (i = 0, max_chars = 0; i < size; max_chars++)
+		i += char_lengths[i];
 	i_assert(max_chars > 0);
 
 	i = 0; char_idx = 0;
@@ -2001,7 +2002,7 @@ squat_trie_lookup_real(struct squat_trie
 		   search it in parts. */
 		if (i != start) {
 			ret = squat_trie_lookup_partial(&ctx, data + start,
-							char_lengths,
+							char_lengths + start,
 							i - start);
 			searched = TRUE;
 		}
@@ -2027,7 +2028,7 @@ squat_trie_lookup_real(struct squat_trie
 			array_clear(maybe_uids);
 		} else {
 			ret = squat_trie_lookup_partial(&ctx, data + start,
-							char_lengths,
+							char_lengths + start,
 							i - start);
 		}
 	} else if (str_bytelen > 0) {
@@ -2035,7 +2036,7 @@ squat_trie_lookup_real(struct squat_trie
 		array_clear(definite_uids);
 		if (i != start && ret >= 0) {
 			ret = squat_trie_lookup_partial(&ctx, data + start,
-							char_lengths,
+							char_lengths + start,
 							i - start);
 		} else if (!searched) {
 			/* string has only nonindexed chars,


More information about the dovecot-cvs mailing list