Avoid -Werror,-Wdeprecated-enum-enum-conversion

...with recent Clang 10 trunk:

> helpcompiler/source/HelpIndexer.cxx:119:71: error: bitwise operation between different enumeration types ('lucene::document::Field::Store' and 'lucene::document::Field::Index') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
>     doc->add(*_CLNEW Field(_T("path"), aPath.data(), Field::STORE_YES | Field::INDEX_UNTOKENIZED));
>                                                      ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~

where the Field constructor in
workdir/UnpackedTarball/clucene/src/core/CLucene/document/Field.h has an "int
_config" parameter that is apparently intended to take a mix of Store (bit
values 1, 2, 4) and Index (bit values 16, 32, 64, 128) flags.

Change-Id: Ie080e44bf820cb776bc61ac22cf73f5437d8c5dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85972
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2019-12-29 23:33:49 +01:00
parent cd8616e003
commit ba2ef4a37f

View file

@ -116,7 +116,7 @@ void HelpIndexer::helpDocument(OUString const & fileName, Document *doc) const {
OUString path = "#HLP#" + d_module + "/" + fileName;
std::vector<TCHAR> aPath(OUStringToTCHARVec(path));
doc->add(*_CLNEW Field(_T("path"), aPath.data(), Field::STORE_YES | Field::INDEX_UNTOKENIZED));
doc->add(*_CLNEW Field(_T("path"), aPath.data(), int(Field::STORE_YES) | int(Field::INDEX_UNTOKENIZED)));
OUString sEscapedFileName =
rtl::Uri::encode(fileName,
@ -124,11 +124,11 @@ void HelpIndexer::helpDocument(OUString const & fileName, Document *doc) const {
// Add the caption as a field.
OUString captionPath = d_captionDir + "/" + sEscapedFileName;
doc->add(*_CLNEW Field(_T("caption"), helpFileReader(captionPath), Field::STORE_NO | Field::INDEX_TOKENIZED));
doc->add(*_CLNEW Field(_T("caption"), helpFileReader(captionPath), int(Field::STORE_NO) | int(Field::INDEX_TOKENIZED)));
// Add the content as a field.
OUString contentPath = d_contentDir + "/" + sEscapedFileName;
doc->add(*_CLNEW Field(_T("content"), helpFileReader(contentPath), Field::STORE_NO | Field::INDEX_TOKENIZED));
doc->add(*_CLNEW Field(_T("content"), helpFileReader(contentPath), int(Field::STORE_NO) | int(Field::INDEX_TOKENIZED)));
}
lucene::util::Reader *HelpIndexer::helpFileReader(OUString const & path) {