Browse Source

Fix warnings on -Wbool-conversions

CLang compiler generates many new warnings - getting rid of them slowly...

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 years ago
parent
commit
3eb49bc502

+ 1 - 1
cmake_modules/commonSetup.cmake

@@ -123,7 +123,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
       SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -fno-default-inline -fno-inline-functions")
     endif ()
     if (CMAKE_COMPILER_IS_CLANGXX)
-      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=logical-op-parentheses")
+      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=logical-op-parentheses -Werror=bool-conversions")
     endif()
     # All of these are defined in platform.h too, but need to be defned before any system header is included
     ADD_DEFINITIONS (-D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64=1 -D__USE_FILE_OFFSET64=1)

+ 1 - 1
common/fileview2/fvsource.cpp

@@ -609,7 +609,7 @@ const void * VariableRowBlock::fetchRow(__int64 offset, size32_t & len)
     size32_t rowOffset = (size32_t)(offset - startOffset);
     unsigned pos = rowIndex.find(rowOffset);
     if (pos == NotFound)
-        return false;
+        return NULL;
     len = rowIndex.item(pos+1)-rowOffset;
     return buffer.toByteArray() + rowOffset;
 }

+ 2 - 2
common/roxiehelper/roxiehelper.cpp

@@ -266,7 +266,7 @@ const void * CRHDualCache::cOut::nextInGroup()
 {
     CRHRollingCacheElem *e;
     if (stopped || !parent->get(pos,e))
-        return false;   //no more data
+        return NULL;   //no more data
     LinkRoxieRow(e->row);
     pos++;
     return e->row;
@@ -559,7 +559,7 @@ bool CSafeSocket::readBlock(StringBuffer &ret, unsigned timeout, HttpHelper *pHt
                 char *str;
 
                 // capture authentication token
-                if (str = strstr(header, "Authorization: Basic "))
+                if ((str = strstr(header, "Authorization: Basic ")) != NULL)
                 {
                     char *authToken = str + strlen("Authorization: Basic ");
                     str = strchr(authToken, '\r');

+ 1 - 1
common/roxiemanager/roxiequerycompiler.cpp

@@ -303,7 +303,7 @@ public:
                     status.s.appendf("Unknown error: Could not compile query - make sure eclserver is running - workunit status = %s", state.str());
                 }
             }
-            return false;
+            return NULL;
         }
     }
 

+ 1 - 1
common/roxiemanager/roxiequerymanager.cpp

@@ -251,7 +251,7 @@ public:
             query = tree->queryPropTree(xpath.str());
 
             if (!query)
-                return false;
+                return NULL;
 
             querySetWuId.set(query->queryProp("@wuid"));
         }

+ 1 - 1
common/thorhelper/thorstep.cpp

@@ -1099,7 +1099,7 @@ const void * CMergeJoinProcessor::nextInputRowGE(const void * seek, unsigned num
     }
 
     if (!findCandidates(seek, numFields))
-        return false;
+        return NULL;
     return nextInputRow();
 }
 

+ 1 - 1
common/thorhelper/thortalgo.cpp

@@ -647,7 +647,7 @@ GrammarSymbol * LRProduction::reduce(GrammarSymbol * * symbols, const byte * red
     FeatureValue resultFeatures;
     //check whether guard conditions are met.
     if (!mergeFeatures(resultFeatures, &feature, symbols))
-        return false;
+        return NULL;
 
     //Is the user 
     if (!validator.isValid(numSymbols, symbols, reducePtr, state))

+ 2 - 2
common/workunit/wujobq.cpp

@@ -1723,10 +1723,10 @@ public:
     IJobQueueItem *find(const char *wuid)
     {
         if (!qdata)
-            return false;
+            return NULL;
         sQueueData *qd = qdata->next?findQD(wuid):qdata;
         if (!qd)
-            return false;
+            return NULL;
         return find(*qd,wuid);
     }
 

+ 1 - 1
ecl/hql/hqlgram2.cpp

@@ -5801,7 +5801,7 @@ IHqlScope * HqlGram::queryTemplateContext()
         if (scope)
             return scope;
     }
-    return false;
+    return NULL;
 }
 
 

+ 2 - 2
ecl/hqlcpp/hqlhtcpp.cpp

@@ -12313,14 +12313,14 @@ IHqlExpression * MergeTransformCreator::transformAssign(IHqlExpression * expr)
         {
             IHqlExpression * list = rhs->queryChild(0);
             if (list->getOperator() != no_list)
-                return false;
+                return NULL;
             unwindChildren(args, list);
             break;
         }
     default:
         //ok, if it is only assigned once.
         if (exprReferencesDataset(rhs, right))
-            return false;
+            return NULL;
         //need to preserve the value if at a variable offset...  Should be stripped if unnecessary
         OwnedHqlExpr newRhs = createSelectExpr(LINK(mergeLeft), LINK(field));
         return createAssign(LINK(lhs), newRhs.getClear());

+ 1 - 1
plugins/workunitservices/workunitservices.cpp

@@ -405,7 +405,7 @@ public:
 static IPropertyTree *getWorkUnitBranch(ICodeContext *ctx,const char *wuid,const char *branch)
 {
     if (!wuid||!*wuid)
-        return false;
+        return NULL;
     StringBuffer _wuid(wuid);
     wuid = _wuid.toUpperCase().str();
     StringBuffer query;

+ 1 - 1
thorlcr/activities/aggregate/thaggregateslave.cpp

@@ -299,7 +299,7 @@ public:
     {
         ActivityTimer t(totalCycles, timeActivities, NULL);
         if (inputStopped)
-            return false;
+            return NULL;
         OwnedConstThorRow row = input->ungroupedNextRow();
         if (!row)
             return NULL;

+ 1 - 1
thorlcr/activities/choosesets/thchoosesetsslave.cpp

@@ -219,7 +219,7 @@ public:
         }
         if (!container.queryLocalOrGrouped() && !lastNode())
             sendTallies();
-        return false;       
+        return NULL;
     }
     void getMetaInfo(ThorDataLinkMetaInfo &info)
     {

+ 1 - 1
thorlcr/activities/thdiskbase.cpp

@@ -365,7 +365,7 @@ const void *getAggregate(CActivityBase &activity, unsigned partialResults, IRowI
     {
         CMessageBuffer mb;
         rank_t sender;
-        if (!activity.receiveMsg(mb, RANK_ALL, mpTag, &sender)) return false;
+        if (!activity.receiveMsg(mb, RANK_ALL, mpTag, &sender)) return NULL;
         if (activity.queryAbortSoon()) return 0;
         if (mb.length())
         {

+ 1 - 1
thorlcr/activities/xmlread/thxmlreadslave.cpp

@@ -95,7 +95,7 @@ class CXmlReadSlaveActivity : public CDiskReadSlaveActivityBase, public CThorDat
         const void *nextRow()
         {
             if (eoi || activity.abortSoon)
-                return false;
+                return NULL;
 
             try
             {