dovecot-2.2: fts-solr: laxer check of uni_utf8_get_char_n() retu...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 1 19:19:03 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/7bd2f9be5493
changeset: 18785:7bd2f9be5493
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Jun 01 22:08:27 2015 +0300
description:
fts-solr: laxer check of uni_utf8_get_char_n() return value
If uni_utf8_get_char*() were changed to return the number of bytes in the
character on success, then all we care about is it being > 0 (i.e. not
error, not truncated).

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/plugins/fts-solr/fts-backend-solr-old.c |  2 +-
 src/plugins/fts-solr/fts-backend-solr.c     |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 3468de815591 -r 7bd2f9be5493 src/plugins/fts-solr/fts-backend-solr-old.c
--- a/src/plugins/fts-solr/fts-backend-solr-old.c	Mon Jun 01 22:07:44 2015 +0300
+++ b/src/plugins/fts-solr/fts-backend-solr-old.c	Mon Jun 01 22:08:27 2015 +0300
@@ -91,7 +91,7 @@
 				unsigned int char_len =
 					uni_utf8_char_bytes(data[i]);
 				if (i + char_len <= len &&
-				    uni_utf8_get_char_n(data + i, char_len, &chr) == 1 &&
+				    uni_utf8_get_char_n(data + i, char_len, &chr) > 0 &&
 				    is_valid_xml_char(chr))
 					str_append_n(dest, data + i, char_len);
 				else {
diff -r 3468de815591 -r 7bd2f9be5493 src/plugins/fts-solr/fts-backend-solr.c
--- a/src/plugins/fts-solr/fts-backend-solr.c	Mon Jun 01 22:07:44 2015 +0300
+++ b/src/plugins/fts-solr/fts-backend-solr.c	Mon Jun 01 22:08:27 2015 +0300
@@ -112,7 +112,7 @@
 				unsigned int char_len =
 					uni_utf8_char_bytes(data[i]);
 				if (i + char_len <= len &&
-				    uni_utf8_get_char_n(data + i, char_len, &chr) == 1 &&
+				    uni_utf8_get_char_n(data + i, char_len, &chr) > 0 &&
 				    is_valid_xml_char(chr))
 					str_append_n(dest, data + i, char_len);
 				else {


More information about the dovecot-cvs mailing list