From 0dac7c3390e2b3f505fe130c119788e436257d2a Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Wed, 25 Jun 2014 04:42:15 +0000 Subject: [PATCH] Fix compiler warnings. Note some patches were obtained from LibreOffice. --- textproc/clucene/Makefile | 2 +- ...ore__CLucene__analysis__AnalysisHeader.cpp | 11 ++++ ...ene__index__DocumentsWriterThreadState.cpp | 21 +++++++ ...core__CLucene__index__IndexFileDeleter.cpp | 11 ++++ ...src__core__CLucene__index__IndexWriter.cpp | 39 +++++++++++- ...h-src__core__CLucene__index__IndexWriter.h | 17 +++++ ..._core__CLucene__index__TermInfosReader.cpp | 11 ++++ ...ore__CLucene__queryParser__QueryParser.cpp | 11 ++++ ...__queryParser__QueryParserTokenManager.cpp | 62 +++++++++++++++++++ ...e__CLucene__queryParser__legacy__Lexer.cpp | 11 ++++ ...src__core__CLucene__store__FSDirectory.cpp | 14 +++++ ...-src__core__CLucene__store__IndexInput.cpp | 13 ++++ .../patch-src__core__CLucene__util__VoidMap.h | 20 +++++- ...tch-src__shared__CLucene__LuceneThreads.h} | 0 ...ch-src__shared__cmake__CheckHashmaps.cmake | 15 +++++ 15 files changed, 252 insertions(+), 6 deletions(-) create mode 100644 textproc/clucene/files/patch-src__core__CLucene__analysis__AnalysisHeader.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__index__DocumentsWriterThreadState.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__index__IndexFileDeleter.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.h create mode 100644 textproc/clucene/files/patch-src__core__CLucene__index__TermInfosReader.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__queryParser__QueryParser.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__queryParser__QueryParserTokenManager.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__queryParser__legacy__Lexer.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__store__FSDirectory.cpp create mode 100644 textproc/clucene/files/patch-src__core__CLucene__store__IndexInput.cpp rename textproc/clucene/files/{patch-libc++ => patch-src__shared__CLucene__LuceneThreads.h} (100%) create mode 100644 textproc/clucene/files/patch-src__shared__cmake__CheckHashmaps.cmake diff --git a/textproc/clucene/Makefile b/textproc/clucene/Makefile index 2d2eb91bc1ef..ae4f81a6c867 100644 --- a/textproc/clucene/Makefile +++ b/textproc/clucene/Makefile @@ -3,7 +3,7 @@ PORTNAME= clucene PORTVERSION= 2.3.3.4 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= textproc MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-core-unstable/2.3 DISTNAME= ${PORTNAME}-core-${PORTVERSION} diff --git a/textproc/clucene/files/patch-src__core__CLucene__analysis__AnalysisHeader.cpp b/textproc/clucene/files/patch-src__core__CLucene__analysis__AnalysisHeader.cpp new file mode 100644 index 000000000000..bf9bfdfe3e6f --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__analysis__AnalysisHeader.cpp @@ -0,0 +1,11 @@ +--- src/core/CLucene/analysis/AnalysisHeader.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/analysis/AnalysisHeader.cpp 2014-06-24 18:57:17.000000000 -0400 +@@ -212,7 +212,7 @@ + sb.append(_T(",")); + sb.appendInt( _endOffset ); + +- if (!_tcscmp( _type, _T("word")) == 0 ){ ++ if (_tcscmp( _type, _T("word")) != 0) { + sb.append(_T(",type=")); + sb.append(_type); + } diff --git a/textproc/clucene/files/patch-src__core__CLucene__index__DocumentsWriterThreadState.cpp b/textproc/clucene/files/patch-src__core__CLucene__index__DocumentsWriterThreadState.cpp new file mode 100644 index 000000000000..b6f3381941ff --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__index__DocumentsWriterThreadState.cpp @@ -0,0 +1,21 @@ +--- src/core/CLucene/index/DocumentsWriterThreadState.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/index/DocumentsWriterThreadState.cpp 2014-06-24 18:37:18.000000000 -0400 +@@ -994,7 +994,7 @@ + const TCHAR* tokenText = token->termBuffer(); + const int32_t tokenTextLen = token->termLength(); + +- int32_t code = 0; ++ uint32_t code = 0; + + // Compute hashcode + int32_t downto = tokenTextLen; +@@ -1203,7 +1203,8 @@ + const int32_t newMask = newSize-1; + + ValueArray newHash(newSize); +- int32_t hashPos, code; ++ int32_t hashPos; ++ uint32_t code; + const TCHAR* pos = NULL; + const TCHAR* start = NULL; + Posting* p0; diff --git a/textproc/clucene/files/patch-src__core__CLucene__index__IndexFileDeleter.cpp b/textproc/clucene/files/patch-src__core__CLucene__index__IndexFileDeleter.cpp new file mode 100644 index 000000000000..10c2c1164425 --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__index__IndexFileDeleter.cpp @@ -0,0 +1,11 @@ +--- src/core/CLucene/index/IndexFileDeleter.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/index/IndexFileDeleter.cpp 2014-06-24 19:06:58.000000000 -0400 +@@ -129,7 +129,7 @@ + + string& fileName = files.at(i); + +- if (filter->accept(NULL, fileName.c_str()) && !fileName.compare(IndexFileNames::SEGMENTS_GEN) == 0) { ++ if (filter->accept(NULL, fileName.c_str()) && fileName.compare(IndexFileNames::SEGMENTS_GEN) != 0) { + + // Add this file to refCounts with initial count 0: + getRefCount(fileName.c_str()); diff --git a/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.cpp b/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.cpp index cb8aab7e7dd7..65d132589023 100644 --- a/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.cpp +++ b/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.cpp @@ -1,6 +1,14 @@ --- src/core/CLucene/index/IndexWriter.cpp.orig 2011-03-16 20:21:07.000000000 -0400 -+++ src/core/CLucene/index/IndexWriter.cpp 2013-03-27 16:56:54.000000000 -0400 -@@ -814,7 +814,7 @@ ++++ src/core/CLucene/index/IndexWriter.cpp 2014-06-24 19:10:36.000000000 -0400 +@@ -53,7 +53,6 @@ + + DEFINE_MUTEX(IndexWriter::MESSAGE_ID_LOCK) + int32_t IndexWriter::MESSAGE_ID = 0; +-const int32_t IndexWriter::MAX_TERM_LENGTH = DocumentsWriter::MAX_TERM_LENGTH; + + class IndexWriter::Internal{ + public: +@@ -814,7 +813,7 @@ ensureOpen(); if (maxNumSegments < 1) @@ -9,3 +17,30 @@ if (infoStream != NULL) message("optimize: index now " + segString()); +@@ -1392,7 +1391,7 @@ + // Check if the doc stores must be separately flushed + // because other segments, besides the one we are about + // to flush, reference it +- if (_flushDocStores && (!flushDocs || !docWriter->getSegment().compare(docWriter->getDocStoreSegment())==0 )) { ++ if (_flushDocStores && (!flushDocs || docWriter->getSegment().compare(docWriter->getDocStoreSegment()) != 0)) { + // We must separately flush the doc store + if (infoStream != NULL) + message(" flush shared docStore segment " + docStoreSegment); +@@ -1631,7 +1630,7 @@ + // Load deletes present @ start of merge, for this segment: + BitVector previousDeletes(previousInfo->dir, previousInfo->getDelFileName().c_str()); + +- if (!currentInfo->getDelFileName().compare(previousInfo->getDelFileName())==0 ){ ++ if (currentInfo->getDelFileName().compare(previousInfo->getDelFileName()) != 0) { + // This means this segment has had new deletes + // committed since we started the merge, so we + // must merge them: +@@ -1928,7 +1927,7 @@ + mergeDocStores = true; + else if (lastDocStoreSegment.empty()) + lastDocStoreSegment = docStoreSegment; +- else if (!lastDocStoreSegment.compare(docStoreSegment)==0 ) ++ else if (lastDocStoreSegment.compare(docStoreSegment) != 0) + mergeDocStores = true; + + // Segments' docScoreOffsets must be in-order, diff --git a/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.h b/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.h new file mode 100644 index 000000000000..1f70b85ee607 --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__index__IndexWriter.h @@ -0,0 +1,17 @@ +--- src/core/CLucene/index/IndexWriter.h.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/index/IndexWriter.h 2014-06-24 18:17:57.000000000 -0400 +@@ -384,14 +384,6 @@ + */ + static const int32_t DEFAULT_MAX_MERGE_DOCS; + +- /** +- * Absolute hard maximum length for a term. If a term +- * arrives from the analyzer longer than this length, it +- * is skipped and a message is printed to infoStream, if +- * set (see {@link #setInfoStream}). +- */ +- static const int32_t MAX_TERM_LENGTH; +- + + /* Determines how often segment indices are merged by addDocument(). With + * smaller values, less RAM is used while indexing, and searches on diff --git a/textproc/clucene/files/patch-src__core__CLucene__index__TermInfosReader.cpp b/textproc/clucene/files/patch-src__core__CLucene__index__TermInfosReader.cpp new file mode 100644 index 000000000000..c8a5ceb8759a --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__index__TermInfosReader.cpp @@ -0,0 +1,11 @@ +--- src/core/CLucene/index/TermInfosReader.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/index/TermInfosReader.cpp 2014-06-24 18:19:42.000000000 -0400 +@@ -111,7 +111,7 @@ + //destroy their elements + #ifdef _DEBUG + for ( int32_t i=0; i") + }; + +-const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,0x80000000,0x20000000,0x80000000,0x10000,0x80000,0x10000,0x1f68000}; ++const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,int32_t(0x80000000),0x20000000,int32_t(0x80000000),0x10000,0x80000,0x10000,0x1f68000}; + const int32_t QueryParser::jj_la1_1[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0}; + + struct QueryParser::JJCalls { diff --git a/textproc/clucene/files/patch-src__core__CLucene__queryParser__QueryParserTokenManager.cpp b/textproc/clucene/files/patch-src__core__CLucene__queryParser__QueryParserTokenManager.cpp new file mode 100644 index 000000000000..f75af43712f5 --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__queryParser__QueryParserTokenManager.cpp @@ -0,0 +1,62 @@ +--- src/core/CLucene/queryParser/QueryParserTokenManager.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/queryParser/QueryParserTokenManager.cpp 2014-06-24 19:34:09.000000000 -0400 +@@ -15,9 +15,9 @@ + + CL_NS_DEF(queryParser) + +-const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)}; ++const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))}; + const int64_t QueryParserTokenManager::jjbitVec0[] = { +- _ILONGLONG(0xfffffffffffffffe), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff) ++ int64_t(_ILONGLONG(0xfffffffffffffffe)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)) + }; + const int32_t QueryParserTokenManager::jjnextStates[]={ + 15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, +@@ -544,7 +544,10 @@ + kind = 0x7fffffff; + } + ++curPos; +- if ((i = jjnewStateCnt) == (startsAt = 36 - (jjnewStateCnt = startsAt))) ++ i = jjnewStateCnt; ++ jjnewStateCnt = startsAt; ++ startsAt = 36 - jjnewStateCnt; ++ if (i == startsAt) + return curPos; + try { curChar = input_stream->readChar(); } + catch(CLuceneError& e) { +@@ -756,7 +759,10 @@ + kind = 0x7fffffff; + } + ++curPos; +- if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) ++ i = jjnewStateCnt; ++ jjnewStateCnt = startsAt; ++ startsAt = 7 - jjnewStateCnt; ++ if (i == startsAt) + return curPos; + try { curChar = input_stream->readChar(); } + catch(CLuceneError& e) { +@@ -854,7 +860,10 @@ + kind = 0x7fffffff; + } + ++curPos; +- if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) ++ i = jjnewStateCnt; ++ jjnewStateCnt = startsAt; ++ startsAt = 3 - jjnewStateCnt; ++ if (i == startsAt) + return curPos; + try { curChar = input_stream->readChar(); } + catch(CLuceneError& e) { +@@ -1066,7 +1075,10 @@ + kind = 0x7fffffff; + } + ++curPos; +- if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) ++ i = jjnewStateCnt; ++ jjnewStateCnt = startsAt; ++ startsAt = 7 - jjnewStateCnt; ++ if (i == startsAt) + return curPos; + try { curChar = input_stream->readChar(); } + catch(CLuceneError& e) { diff --git a/textproc/clucene/files/patch-src__core__CLucene__queryParser__legacy__Lexer.cpp b/textproc/clucene/files/patch-src__core__CLucene__queryParser__legacy__Lexer.cpp new file mode 100644 index 000000000000..857ab369d7ef --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__queryParser__legacy__Lexer.cpp @@ -0,0 +1,11 @@ +--- src/core/CLucene/queryParser/legacy/Lexer.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/queryParser/legacy/Lexer.cpp 2014-06-24 18:33:06.000000000 -0400 +@@ -117,7 +117,7 @@ + if( _istspace(ch)!=0 ) { + continue; + } +- TCHAR buf[2] = {ch,'\0'}; ++ TCHAR buf[2] = {TCHAR(ch),'\0'}; + switch(ch) { + case '+': + token->set(buf, QueryToken::PLUS); diff --git a/textproc/clucene/files/patch-src__core__CLucene__store__FSDirectory.cpp b/textproc/clucene/files/patch-src__core__CLucene__store__FSDirectory.cpp new file mode 100644 index 000000000000..5eca0abfa0bd --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__store__FSDirectory.cpp @@ -0,0 +1,14 @@ +--- src/core/CLucene/store/FSDirectory.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/store/FSDirectory.cpp 2014-06-24 18:26:54.000000000 -0400 +@@ -219,9 +219,8 @@ + _CLDECDELETE(handle); + + //printf("handle=%d\n", handle->__cl_refcount); +- if ( dounlock ){ +- mutex->unlock(); +- }else{ ++ mutex->unlock(); ++ if ( !dounlock ) { + delete mutex; + } + } diff --git a/textproc/clucene/files/patch-src__core__CLucene__store__IndexInput.cpp b/textproc/clucene/files/patch-src__core__CLucene__store__IndexInput.cpp new file mode 100644 index 000000000000..e25e314c45ef --- /dev/null +++ b/textproc/clucene/files/patch-src__core__CLucene__store__IndexInput.cpp @@ -0,0 +1,13 @@ +--- src/core/CLucene/store/IndexInput.cpp.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/core/CLucene/store/IndexInput.cpp 2014-06-24 18:38:50.000000000 -0400 +@@ -41,8 +41,8 @@ + } + + int64_t IndexInput::readLong() { +- int64_t i = ((int64_t)readInt() << 32); +- return (i | ((int64_t)readInt() & 0xFFFFFFFFL)); ++ uint64_t i = ((uint64_t)readInt() << 32); ++ return (i | ((uint64_t)readInt() & 0xFFFFFFFFL)); + } + + int64_t IndexInput::readVLong() { diff --git a/textproc/clucene/files/patch-src__core__CLucene__util__VoidMap.h b/textproc/clucene/files/patch-src__core__CLucene__util__VoidMap.h index bb5492e0874b..f2eb21679c20 100644 --- a/textproc/clucene/files/patch-src__core__CLucene__util__VoidMap.h +++ b/textproc/clucene/files/patch-src__core__CLucene__util__VoidMap.h @@ -1,6 +1,20 @@ --- src/core/CLucene/util/VoidMap.h.orig 2011-03-16 20:21:07.000000000 -0400 -+++ src/core/CLucene/util/VoidMap.h 2013-01-08 17:37:43.000000000 -0500 -@@ -83,7 +83,7 @@ ++++ src/core/CLucene/util/VoidMap.h 2014-06-24 18:48:01.000000000 -0400 +@@ -11,8 +11,13 @@ + #include "CLucene/LuceneThreads.h" + + #if defined(_CL_HAVE_TR1_UNORDERED_MAP) && defined(_CL_HAVE_TR1_UNORDERED_SET) ++#if defined(_LIBCPP_VERSION) ++ #include ++ #include ++#else + #include + #include ++#endif + #elif defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET) + //hashing is all or nothing! + #include +@@ -83,7 +88,7 @@ _vt get( _kt k) const { const_iterator itr = base::find(k); if ( itr==base::end() ) @@ -9,7 +23,7 @@ else return itr->second; } -@@ -316,6 +316,7 @@ +@@ -316,6 +321,7 @@ if ( _this::dk || _this::dv ) _this::remove(k); diff --git a/textproc/clucene/files/patch-libc++ b/textproc/clucene/files/patch-src__shared__CLucene__LuceneThreads.h similarity index 100% rename from textproc/clucene/files/patch-libc++ rename to textproc/clucene/files/patch-src__shared__CLucene__LuceneThreads.h diff --git a/textproc/clucene/files/patch-src__shared__cmake__CheckHashmaps.cmake b/textproc/clucene/files/patch-src__shared__cmake__CheckHashmaps.cmake new file mode 100644 index 000000000000..2280761e6503 --- /dev/null +++ b/textproc/clucene/files/patch-src__shared__cmake__CheckHashmaps.cmake @@ -0,0 +1,15 @@ +--- src/shared/cmake/CheckHashmaps.cmake.orig 2011-03-16 20:21:07.000000000 -0400 ++++ src/shared/cmake/CheckHashmaps.cmake 2014-06-24 19:20:14.000000000 -0400 +@@ -35,8 +35,12 @@ + #elif defined(_CL_HAVE_EXT_HASH_MAP) + #include + #elif defined(_CL_HAVE_TR1_UNORDERED_MAP) ++#if defined(_LIBCPP_VERSION) ++ #include ++#else + #include + #endif ++#endif + int main() { + ${namespace}::${_CL_HASH_MAP} a; + return 0;