|
From: <ust...@us...> - 2008-12-07 20:13:10
|
Revision: 2943
http://clucene.svn.sourceforge.net/clucene/?rev=2943&view=rev
Author: ustramooner
Date: 2008-12-07 20:13:07 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
fix various strict compiler warnings. some are actually really bad bugs!
IndexSearcher::getClassName was flawed
various comparisons were done with = instead of equality
more to come on this, this is just the beginning.
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp
branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp
branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp
branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp
branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h
branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp
branches/lucene2_3_2/src/core/CLucene/search/Searchable.h
branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h
branches/lucene2_3_2/src/core/CLucene/store/_Lock.h
branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h
branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake
Modified: branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -103,7 +103,6 @@
#include "CLucene/util/BitSet.cpp"
#include "CLucene/util/Equators.cpp"
#include "CLucene/util/FastCharStream.cpp"
-#include "CLucene/util/fileinputstream.cpp"
#include "CLucene/util/MD5Digester.cpp"
#include "CLucene/util/Reader.cpp"
#include "CLucene/util/StringIntern.cpp"
Modified: branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -202,27 +202,26 @@
//TODO: Find an alternative approach here if this list continues to grow beyond the
//list of 5 or 6 currently here. See Lucene 762 for discussion
- if (acceptField = FieldSelector::LOAD) {
+ if (acceptField == FieldSelector::LOAD) {
addField(doc, fi, binary, compressed, tokenize);
}
- else if (acceptField = FieldSelector::LOAD_FOR_MERGE) {
+ else if (acceptField == FieldSelector::LOAD_FOR_MERGE) {
addFieldForMerge(doc, fi, binary, compressed, tokenize);
}
- else if (acceptField = FieldSelector::LOAD_AND_BREAK){
+ else if (acceptField == FieldSelector::LOAD_AND_BREAK){
addField(doc, fi, binary, compressed, tokenize);
break;//Get out of this loop
}
- else if (acceptField = FieldSelector::LAZY_LOAD) {
+ else if (acceptField == FieldSelector::LAZY_LOAD) {
addFieldLazy(doc, fi, binary, compressed, tokenize);
}
- else if (acceptField = FieldSelector::SIZE){
+ else if (acceptField == FieldSelector::SIZE){
skipField(binary, compressed, addFieldSize(doc, fi, binary, compressed));
}
- else if (acceptField = FieldSelector::SIZE_AND_BREAK){
+ else if (acceptField == FieldSelector::SIZE_AND_BREAK){
addFieldSize(doc, fi, binary, compressed);
break;
- }
- else {
+ }else {
skipField(binary, compressed);
}
@@ -440,8 +439,8 @@
int32_t FieldsReader::addFieldSize(CL_NS(document)::Document& doc, const FieldInfo* fi, const bool binary, const bool compressed) {
const int32_t size = fieldsStream->readVInt();
- const int32_t bytesize = binary || compressed ? size : 2*size;
/*
+ const int32_t bytesize = binary || compressed ? size : 2*size;
uint8_t* sizebytes = _CL_NEWARRAY(uint8_t, 4);
sizebytes[0] = (byte) (bytesize>>>24);
sizebytes[1] = (byte) (bytesize>>>16);
Modified: branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -75,7 +75,7 @@
// count # deletions, return -1 if unknown.
int32_t Hits::countDeletions(CL_NS(search)::Searcher* s) {
int32_t cnt = -1;
- if ( s->getClassName() == _T("IndexSearcher") ) {
+ if ( s->getObjectName() == IndexSearcher::getClassName() ) {
cnt = s->maxDoc() - static_cast<IndexSearcher*>(s)->getReader()->numDocs();
}
return cnt;
Modified: branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -367,8 +367,11 @@
return reader;
}
- const TCHAR* IndexSearcher::getClassName(){
- return _T("IndexSearcher");
+ const char* IndexSearcher::getClassName(){
+ return "IndexSearcher";
}
+ const char* IndexSearcher::getObjectName(){
+ return IndexSearcher::getClassName();
+ }
CL_NS_END
Modified: branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -36,16 +36,16 @@
bool readerOwner;
public:
- /** Creates a searcher searching the index in the named directory.
- * @throws CorruptIndexException if the index is corrupt
- * @throws IOException if there is a low-level IO error
+ /** Creates a searcher searching the index in the named directory.
+ * @throws CorruptIndexException if the index is corrupt
+ * @throws IOException if there is a low-level IO error
*/
IndexSearcher(const char* path);
- /** Creates a searcher searching the index in the provided directory.
- * @throws CorruptIndexException if the index is corrupt
- * @throws IOException if there is a low-level IO error
- */
+ /** Creates a searcher searching the index in the provided directory.
+ * @throws CorruptIndexException if the index is corrupt
+ * @throws IOException if there is a low-level IO error
+ */
IndexSearcher(CL_NS(store)::Directory* directory);
/** Creates a searcher searching the provided index. */
@@ -53,11 +53,11 @@
~IndexSearcher();
- /**
- * Note that the underlying IndexReader is not closed, if
- * IndexSearcher was constructed with IndexSearcher(IndexReader r).
- * If the IndexReader was supplied implicitly by specifying a directory, then
- * the IndexReader gets closed.
+ /**
+ * Note that the underlying IndexReader is not closed, if
+ * IndexSearcher was constructed with IndexSearcher(IndexReader r).
+ * If the IndexReader was supplied implicitly by specifying a directory, then
+ * the IndexReader gets closed.
*/
void close();
@@ -79,7 +79,8 @@
Query* rewrite(Query* original);
void explain(Query* query, int32_t doc, Explanation* ret);
- virtual const TCHAR* getClassName();
+ virtual const char* getObjectName();
+ static const char* getClassName();
};
CL_NS_END
#endif
Modified: branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -184,11 +184,15 @@
return this->similarity;
}
-const TCHAR* Searcher::getClassName(){
- return _T("Searcher");
+const char* Searcher::getClassName(){
+ return "Searcher";
}
+const char* Searcher::getObjectName(){
+ return Searcher::getClassName();
+}
+
Weight::~Weight(){
}
Modified: branches/lucene2_3_2/src/core/CLucene/search/Searchable.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/Searchable.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/Searchable.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -172,7 +172,8 @@
*/
Similarity* getSimilarity();
- virtual const TCHAR* getClassName();
+ virtual const char* getObjectName();
+ static const char* getClassName();
virtual void _search(Query* query, Filter* filter, HitCollector* results) = 0;
};
Modified: branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -37,7 +37,7 @@
class CLUCENE_EXPORT SingleInstanceLockFactory: public LockFactory {
private:
LocksType* locks;
- DEFINE_MUTEX(locks_LOCK);
+ DEFINE_MUTEX(locks_LOCK)
public:
SingleInstanceLockFactory();
Modified: branches/lucene2_3_2/src/core/CLucene/store/_Lock.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/store/_Lock.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/store/_Lock.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -28,7 +28,7 @@
private:
const char* lockName;
LocksType* locks;
- DEFINE_MUTEX(*locks_LOCK);
+ DEFINE_MUTEX(*locks_LOCK)
public:
SingleInstanceLock( LocksType* locks, _LUCENE_THREADMUTEX* locks_LOCK, const char* lockName );
Modified: branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -160,7 +160,7 @@
};
-class FilteredBufferedReader: public BufferedReader{
+class CLUCENE_EXPORT FilteredBufferedReader: public BufferedReader{
class Internal;
Internal* internal;
public:
Modified: branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake 2008-12-07 20:13:07 UTC (rev 2943)
@@ -92,7 +92,7 @@
*/
#cmakedefine LUCENE_USE_INTERNAL_CHAR_FUNCTIONS 1
-/** fix ansi for loop scope
+/** fix ansi for loop scope */
#if @CMAKE_ANSI_FOR_SCOPE@==0
#define for if (0); else for
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|