[dovecot-cvs] dovecot/src/plugins/fts-lucene lucene-wrapper.cc, 1.11, 1.12

tss at dovecot.org tss at dovecot.org
Sun Mar 25 21:18:17 EEST 2007


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

Modified Files:
	lucene-wrapper.cc 
Log Message:
Fixes



Index: lucene-wrapper.cc
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-lucene/lucene-wrapper.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- lucene-wrapper.cc	25 Mar 2007 16:21:10 -0000	1.11
+++ lucene-wrapper.cc	25 Mar 2007 18:18:15 -0000	1.12
@@ -416,7 +416,8 @@
 
 	len = uni_utf8_strlen_n(data, size);
 	wchar_t dest[len+1];
-	lucene_utf8towcs(dest, (const char *)data, len + 1);
+	lucene_utf8towcs(dest, (const char *)data, len);
+	dest[len] = 0;
 
 	if (uid != index->prev_uid) {
 		char id[MAX_INT_STRLEN];
@@ -531,16 +532,18 @@
 		_CLDELETE(hits);
 	} catch (CLuceneError &err) {
 		lucene_handle_error(index, err, "expunge search");
-		return -1;
+		ret = -1;
 	}
 
 	try {
 		index->reader->close();
-		return 0;
 	} catch (CLuceneError &err) {
 		lucene_handle_error(index, err, "IndexReader::close()");
-		return -1;
+		ret = -1;
 	}
+
+	lucene_index_close(index);
+	return ret;
 }
 
 int lucene_index_lookup(struct lucene_index *index, enum fts_lookup_flags flags,
@@ -560,7 +563,8 @@
 		t_strdup_printf("\"%s\"", key);
 	unsigned int len = uni_utf8_strlen_n(quoted_key, (size_t)-1);
 	wchar_t tkey[len + 1];
-	lucene_utf8towcs(tkey, quoted_key, len + 1);
+	lucene_utf8towcs(tkey, quoted_key, len);
+	tkey[len] = 0;
 	t_pop();
 
 	BooleanQuery lookup_query;



More information about the dovecot-cvs mailing list