[dovecot-cvs] dovecot/src/plugins/fts-squat squat-trie.c, 1.10, 1.11

tss at dovecot.org tss at dovecot.org
Wed Dec 13 13:49:48 UTC 2006


Update of /var/lib/cvs/dovecot/src/plugins/fts-squat
In directory talvi:/tmp/cvs-serv29020

Modified Files:
	squat-trie.c 
Log Message:
Handle broken UTF8



Index: squat-trie.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-squat/squat-trie.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- squat-trie.c	13 Dec 2006 13:46:23 -0000	1.10
+++ squat-trie.c	13 Dec 2006 13:49:46 -0000	1.11
@@ -252,8 +252,12 @@
 			/* FIXME: can we do anything better than just
 			   truncate with >16bit values? */
 			uchr = uni_utf8_get_char_len(src+i, size-i);
-			uchr -= 32 - 26;
-			chr = uchr < (uint16_t)-1 ? uchr : 0;
+			if (uchr == (unichar_t)-1)
+				chr = 0;
+			else {
+				uchr -= 32 - 26;
+				chr = uchr < (uint16_t)-1 ? uchr : 0;
+			}
 			i += uni_utf8_skip[src[i] & 0xff] - 1;
 		}
 		buffer_append(dest, &chr, sizeof(chr));



More information about the dovecot-cvs mailing list