dovecot-2.0-sslstream: fts-squat: Fixed searching multi-byte cha...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:39 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/f34528b52196
changeset: 10388:f34528b52196
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 aa8a12288c93 -r f34528b52196 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
@@ -1904,7 +1904,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;
@@ -1999,7 +2000,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;
 		}
@@ -2025,7 +2026,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) {
@@ -2033,7 +2034,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