Explorar o código

Merge pull request #1155 from richardkchapman/clang2

Fixes for warnings generared by clang
Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday %!s(int64=13) %!d(string=hai) anos
pai
achega
932e9d0fa8
Modificáronse 42 ficheiros con 102 adicións e 205 borrados
  1. 4 0
      cmake_modules/commonSetup.cmake
  2. 1 1
      common/fileview2/fvserver.cpp
  3. 1 1
      common/fileview2/fvsource.cpp
  4. 2 2
      common/remote/sockfile.cpp
  5. 2 2
      common/roxiehelper/roxiehelper.cpp
  6. 1 1
      common/roxiemanager/roxiequerycompiler.cpp
  7. 1 1
      common/roxiemanager/roxiequerymanager.cpp
  8. 1 1
      common/thorhelper/thorstep.cpp
  9. 1 1
      common/thorhelper/thortalgo.cpp
  10. 10 16
      common/thorhelper/thortparse.cpp
  11. 2 2
      common/thorhelper/thorxmlread.cpp
  12. 2 2
      common/workunit/wujobq.cpp
  13. 2 2
      dali/base/dacsds.cpp
  14. 1 1
      dali/base/dacsds.ipp
  15. 1 1
      dali/base/dasds.ipp
  16. 1 1
      dali/sdsfix/sdsfix2.cpp
  17. 1 1
      ecl/hql/hqlgram2.cpp
  18. 2 2
      ecl/hqlcpp/hqlhtcpp.cpp
  19. 1 1
      ecl/hqlcpp/hqlttcpp.cpp
  20. 2 4
      esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h
  21. 6 6
      esp/services/WsDeploy/WsDeployService.cpp
  22. 1 1
      esp/services/ws_dfu/ws_dfuView.hpp
  23. 2 2
      esp/services/ws_ecl/ws_ecl_service.cpp
  24. 1 2
      esp/services/ws_topology/ws_topologyService.cpp
  25. 1 4
      esp/services/ws_workunits/ws_workunitsHelpers.cpp
  26. 1 1
      esp/services/ws_workunits/ws_workunitsService.cpp
  27. 1 1
      plugins/workunitservices/workunitservices.cpp
  28. 1 1
      system/jlib/jbroadcast.ipp
  29. 2 2
      system/jlib/jencrypt.cpp
  30. 4 1
      system/jlib/jexcept.cpp
  31. 2 75
      system/jlib/jfile.cpp
  32. 0 31
      system/jlib/jfile.ipp
  33. 1 1
      system/jlib/jmisc.hpp
  34. 20 20
      system/jlib/jstring.cpp
  35. 11 5
      system/jlib/jutil.cpp
  36. 2 2
      system/security/zcrypt/aes.cpp
  37. 1 1
      thorlcr/activities/aggregate/thaggregateslave.cpp
  38. 1 1
      thorlcr/activities/choosesets/thchoosesetsslave.cpp
  39. 1 1
      thorlcr/activities/thdiskbase.cpp
  40. 1 1
      thorlcr/activities/xmlread/thxmlreadslave.cpp
  41. 1 1
      thorlcr/thorutil/thbuf.cpp
  42. 2 2
      tools/hidl/hidlcomp.cpp

+ 4 - 0
cmake_modules/commonSetup.cmake

@@ -132,6 +132,10 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
       SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
       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 -Werror=bool-conversions -Werror=return-type -Werror=comment")
+      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Werror=bitwise-op-parentheses -Werror=tautological-compare")
+    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)
     if ("${GIT_COMMAND}" STREQUAL "")

+ 1 - 1
common/fileview2/fvserver.cpp

@@ -56,7 +56,7 @@ bool myAbortHandler()
 int main(int argc, const char *argv[])
 {
     InitModuleObjects();
-    if (argc < 4 || argv[1][0]=='/' && argv[1][1]=='?')
+    if (argc < 4)
     {
         printf("fvserver <dali-server> <queue> <cluster>");
         return 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/remote/sockfile.cpp

@@ -4506,8 +4506,8 @@ public:
     {
         if (msTick()-clientcounttick>1000*60*60) {
             CriticalBlock block(ClientCountSect);
-            if ((ClientCount!=0)||(MaxClientCount!=0)&&TF_TRACE_CLIENT_STATS)
-                PROGLOG("Client count = %d, max = %d",ClientCount,MaxClientCount);
+            if (TF_TRACE_CLIENT_STATS && (ClientCount || MaxClientCount))
+                PROGLOG("Client count = %d, max = %d", ClientCount, MaxClientCount);
             clientcounttick = msTick();
             MaxClientCount = ClientCount;
             if (closedclients) {

+ 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))

+ 10 - 16
common/thorhelper/thortparse.cpp

@@ -1316,25 +1316,21 @@ void TomitaParser::reset()
     iter.invalidate();
 }
 
-/*
- * To be done to finish multi parser
+#if 0
+To be done to finish multi parser
  a) Save reductions on separate stack if >1 token at same position
  b) Use two states for the single token case, and swap between to avoid copy.
 
-/******************
-* Implementing a multiple lex parser:
-* 
-* 1) Parser maintain an ordered list of current start positions.
-     active[position-firstPosition] - use pointers into an array of states;  States are cached on a list.
-* 2) lex from the first position in the list
-* 3) pass end position to parser - selects where new nodes get placed.
-* 4) Reductions have to be placed on to a separate list for each token, since dependant.
-* 4) Parser has associative array on position[x].  
-*    Items are processed from position x to position y
-***/
+Implementing a multiple lex parser:
 
+ 1) Parser maintain an ordered list of current start positions.
+     active[position-firstPosition] - use pointers into an array of states;  States are cached on a list.
+ 2) lex from the first position in the list
+ 3) pass end position to parser - selects where new nodes get placed.
+ 4) Reductions have to be placed on to a separate list for each token, since dependant.
+ 4) Parser has associative array on position[x].
+    Items are processed from position x to position y
 
-/*
 Notes:
 
 Caching: 
@@ -1344,8 +1340,6 @@ Caching:
 Local ambiguity packing:
   When shifting a value, if it gets commoned up, and one of the common branches shifts the same symbol, and the preceeding state for that branch is the same, then common up that node.
 
-  */
-#if 0
 ToDo:
 
 * Do some more planning re:

+ 2 - 2
common/thorhelper/thorxmlread.cpp

@@ -1789,7 +1789,7 @@ class CXMLParse : public CInterface, implements IXMLParse
             {
                 if (!stackInfo.keptForQualifier)
                 {
-                    if (0 == xpath.queryDepth() && 0 == level || level == xpath.queryDepth()-1) // qualified and now back to right level
+                    if ((0 == xpath.queryDepth() && 0 == level) || level == xpath.queryDepth()-1)
                     {
                         unsigned topQ = xpath.queryHighestQualifier();
                         unsigned noHigherQualifiers = -1 == topQ || topQ >= level;
@@ -1879,7 +1879,7 @@ class CXMLParse : public CInterface, implements IXMLParse
                 stack.pop();
 
             // Track last level kept
-            if (lastMatchKeptNode || keep && matched)
+            if (lastMatchKeptNode || (keep && matched))
             {
                 assertex(nodeMade);
                 lastMatchKeptLevel = level;

+ 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);
     }
 

+ 2 - 2
dali/base/dacsds.cpp

@@ -1244,7 +1244,7 @@ static void matchServerTree(CClientRemoteTree *local, IPropertyTree &matchTree,
     Owned<IPropertyTreeIterator> matchIter = matchTree.getElements("*");
     if (matchIter->first())
     {
-        if (!local || local->hasChildren() && NULL == local->queryChildren())
+        if (!local || (local->hasChildren() && NULL == local->queryChildren()))
         {
             if (local)
             {
@@ -1267,7 +1267,7 @@ static void matchServerTree(CClientRemoteTree *local, IPropertyTree &matchTree,
     }
     else
     {
-        if (!local || local->hasChildren() && NULL == local->queryChildren())
+        if (!local || (local->hasChildren() && NULL == local->queryChildren()))
         {
             if (local)
             {

+ 1 - 1
dali/base/dacsds.ipp

@@ -347,7 +347,7 @@ public:
     virtual bool getPropBin(const char *xpath, MemoryBuffer &ret) const;
     virtual void localizeElements(const char *xpath, bool allTail=false);
     virtual IPropertyTree *queryBranch(const char *xpath) const;
-    virtual bool hasChildren() const { return children && children->count() || !children && 0 != (serverTreeInfo & STI_HaveChildren); }
+    virtual bool hasChildren() const { return (children && children->count()) || (!children && 0 != (serverTreeInfo & STI_HaveChildren)); }
 
 // ITrackChanges
     virtual ChangeInfo *queryChanges();

+ 1 - 1
dali/base/dasds.ipp

@@ -625,7 +625,7 @@ public:
                 out.append('[').append(childPositions.item(p-1)).append(']');
         }
         out.append(currentChild->queryName());
-        out.append('[').append(childPositions.tos()).append(']');
+        return out.append('[').append(childPositions.tos()).append(']');
     }
 
     virtual IPropertyTree *queryChild(IPropertyTree *parent, const char *path)

+ 1 - 1
dali/sdsfix/sdsfix2.cpp

@@ -320,7 +320,7 @@ void checkExternals(unsigned argc, char **args)
     while (a<argc)
     {
         const char *arg = args[a];
-        if (arg && '-' == *arg || '+' == *arg)
+        if (arg && ('-' == *arg || '+' == *arg))
         {
             bool onOff = ('+' == *arg);
             switch (arg[1])

+ 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

@@ -12231,14 +12231,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
ecl/hqlcpp/hqlttcpp.cpp

@@ -11268,7 +11268,7 @@ IHqlExpression * HqlTreeNormalizer::createTransformedBody(IHqlExpression * expr)
             HqlExprArray children;
             bool same = transformChildren(expr, children);
             IHqlExpression * denom = expr->queryChild(2);
-            if (!denom || denom->isAttribute() && !expr->queryProperty(localAtom))
+            if (!denom || (denom->isAttribute() && !expr->queryProperty(localAtom)))
             {
                 children.add(*createValue(no_count, LINK(defaultIntegralType), LINK(&children.item(0))), 2);
                 same = false;

+ 2 - 4
esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h

@@ -340,8 +340,7 @@ namespace sxt {
             posEnd = pos;
             //if(paramPC && pcStart != pcEnd)
             //  pc[pcEnd++] = ch;
-            if(paramPC && pcStart != pcEnd
-              || (paramPC && NORMALIZE_LINE_BREAKS && ch == '\r') 
+            if(paramPC && (pcStart != pcEnd || (NORMALIZE_LINE_BREAKS && ch == '\r'))
             ) {
               //XXX
               if(NORMALIZE_LINE_BREAKS && ch == '\r') 
@@ -639,8 +638,7 @@ namespace sxt {
             posEnd = pos;
             //if(paramPC && pcStart != pcEnd)
             //  pc[pcEnd++] = ch;
-            if(paramPC && pcStart != pcEnd
-              || (paramPC && NORMALIZE_LINE_BREAKS && ch == '\r')   // ---- (P)
+            if(paramPC && (pcStart != pcEnd || (NORMALIZE_LINE_BREAKS && ch == '\r'))
             ) {
               //XXX
               if(NORMALIZE_LINE_BREAKS && ch == '\r') 

+ 6 - 6
esp/services/WsDeploy/WsDeployService.cpp

@@ -1569,15 +1569,15 @@ bool CWsDeployFileInfo::saveSetting(IEspContext &context, IEspSaveSettingRequest
           if (bEspServiceChanged)
           {
             IPropertyTree* pChild;
-            while (pChild = pComp->queryPropTree("Authenticate[1]"))
+            while ((pChild = pComp->queryPropTree("Authenticate[1]")) != NULL)
               if (pChild)
                 pComp->removeTree( pChild );
 
-            while (pChild = pComp->queryPropTree("AuthenticateFeature[1]"))
+            while ((pChild = pComp->queryPropTree("AuthenticateFeature[1]")) != NULL)
               if (pChild)
                 pComp->removeTree( pChild );
 
-            while (pChild = pComp->queryPropTree("AuthenticateSetting[1]"))
+            while ((pChild = pComp->queryPropTree("AuthenticateSetting[1]")) != NULL)
               if (pChild)
                 pComp->removeTree( pChild );
           }
@@ -2360,7 +2360,7 @@ bool CWsDeployFileInfo::rollbackEnvironmentForCloud(IEspContext &context, IEspRo
         {
             const char* newEnvId = req.getId();
 
-            if (newEnvId || *newEnvId && !strcmp(newEnvId, m_cloudEnvId.str()))
+            if (newEnvId && *newEnvId && !strcmp(newEnvId, m_cloudEnvId.str()))
             {
                 StringBuffer sbBackup;
                 Owned<IFile> pFile = createIFile(m_cloudEnvBkupFileName.str());
@@ -4999,7 +4999,7 @@ void CWsDeployFileInfo::addDeployableComponentAndInstances(IPropertyTree* pEnvRo
         IPropertyTree* pInstance = &iInst->query();
         const char* instType = pInstance->queryName();
 
-        if (instType && !strcmp(instType, XML_TAG_INSTANCE) || !strcmp(instType, XML_TAG_ROXIE_SERVER))
+        if (instType && (!strcmp(instType, XML_TAG_INSTANCE) || !strcmp(instType, XML_TAG_ROXIE_SERVER)))
         {
           const char* instName = pInstance->queryProp(XML_ATTR_NAME);
           const char* computer = pInstance->queryProp(XML_ATTR_COMPUTER);
@@ -5583,7 +5583,7 @@ CCloudTask* createCloudTask(CCloudActionHandler* pHandler, EnvAction eA, const c
 
 bool CWsDeployFileInfo::updateEnvironment(const char* xml)
 {
-  if (!xml || xml && !*xml)
+  if (!xml || !*xml)
     return false;
 
   Owned<IEnvironmentFactory> factory = getEnvironmentFactory();

+ 1 - 1
esp/services/ws_dfu/ws_dfuView.hpp

@@ -238,7 +238,7 @@ private:
 
         Owned<IProperties> props(createProperties(out.str()));
 
-        props->getPropInt("id");
+        return props->getPropInt("id");
     }
 
 

+ 2 - 2
esp/services/ws_ecl/ws_ecl_service.cpp

@@ -1129,7 +1129,7 @@ void appendEclInputXsds(StringBuffer &content, IPropertyTree *xsd, BoolHash &add
                 StringBuffer temp;
                 if (!stricmp(aname, "dataset"))
                 {
-                    /*
+#if 0
                     content.appendf("<xsd:complexType name=\"%s\"><xsd:sequence>", schema_name);
                     IPropertyTreeIterator *children = item.getElements("xs:complexType/xs:sequence/*");
                     ForEach(*children)
@@ -1144,7 +1144,7 @@ void appendEclInputXsds(StringBuffer &content, IPropertyTree *xsd, BoolHash &add
                         //toXML(&child, content);
                     }
                     content.appendf("</xsd:sequence></xsd:complexType>", aname);
-                    */
+#endif
                 }
                 else
                 {

+ 1 - 2
esp/services/ws_topology/ws_topologyService.cpp

@@ -374,8 +374,7 @@ bool CWsTopologyEx::onTpLogFile(IEspContext &context,IEspTpLogFileRequest  &req,
                 resp.setPageFrom(readLogReq.pageFrom);
             if (readLogReq.pageTo > 0)
                 resp.setPageTo(readLogReq.pageTo);
-            if (readLogReq.prevPage >= 0)
-                resp.setPrevPage(readLogReq.prevPage);
+            resp.setPrevPage(readLogReq.prevPage);
             if (readLogReq.nextPage > 0)
                 resp.setNextPage(readLogReq.nextPage);
 

+ 1 - 4
esp/services/ws_workunits/ws_workunitsHelpers.cpp

@@ -968,9 +968,6 @@ bool shouldFileContentBeShown(IEspContext &context, const char * logicalName)
     StringBuffer username;
     context.getUserID(username);
 
-    if(username.length() < 0)
-        return true; //??TBD
-
     Owned<IUserDescriptor> userdesc(createUserDescriptor());
     userdesc->set(username.str(), context.queryPassword());
 
@@ -1635,7 +1632,7 @@ WsWuSearch::WsWuSearch(IEspContext& context,const char* owner,const char* state,
         xpath.append("[@submitID=?~\"").append(owner).append("\"]");
     if(jobname && *jobname)
         xpath.append("[@jobName=?~\"*").append(jobname).append("*\"]");
-    if(appname && *appname || appkey && *appkey || appvalue && *appvalue)
+    if((appname && *appname) || (appkey && *appkey) || (appvalue && *appvalue))
     {
         xpath.append("[Application/").append(appname && *appname ? appname : "*");
         xpath.append("/").append(appkey && *appkey ? appkey : "*");

+ 1 - 1
esp/services/ws_workunits/ws_workunitsService.cpp

@@ -1477,7 +1477,7 @@ void doWUQueryWithSort(IEspContext &context, IEspWUQueryRequest & req, IEspWUQue
 
     IArrayOf<IEspECLWorkunit> results;
 
-    unsigned begin = 0;
+    int begin = 0;
     unsigned int count = 100;
     int pagesize = 100;
     if (version > 1.01)

+ 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
system/jlib/jbroadcast.ipp

@@ -53,7 +53,7 @@ public:
 
     MCPacketHeader *header;
     void *queryData() { return pktData; }
-    MCPacketHeader *detachPacket() { (MCPacketHeader *) mb.detach(); }
+    MCPacketHeader *detachPacket() { return (MCPacketHeader *) mb.detach(); }
 
 private:
     void *pktData;

+ 2 - 2
system/jlib/jencrypt.cpp

@@ -1243,7 +1243,7 @@ int Rijndael::blockEncrypt(const UINT8 *input,int inputLen,UINT8 *outBuffer)
                     iv[3][0] = (iv[3][0] << 1) | (iv[3][1] >> 7);
                     iv[3][1] = (iv[3][1] << 1) | (iv[3][2] >> 7);
                     iv[3][2] = (iv[3][2] << 1) | (iv[3][3] >> 7);
-                    iv[3][3] = (iv[3][3] << 1) | (outBuffer[k/8] >> (7-(k&7))) & 1;
+                    iv[3][3] = (iv[3][3] << 1) | ((outBuffer[k/8] >> (7-(k&7))) & 1);
                 }
             }
         break;
@@ -1397,7 +1397,7 @@ int Rijndael::blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer)
                     iv[3][0] = (iv[3][0] << 1) | (iv[3][1] >> 7);
                     iv[3][1] = (iv[3][1] << 1) | (iv[3][2] >> 7);
                     iv[3][2] = (iv[3][2] << 1) | (iv[3][3] >> 7);
-                    iv[3][3] = (iv[3][3] << 1) | (input[k/8] >> (7-(k&7))) & 1;
+                    iv[3][3] = (iv[3][3] << 1) | ((input[k/8] >> (7-(k&7))) & 1);
                     outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
                 }
             }

+ 4 - 1
system/jlib/jexcept.cpp

@@ -1083,9 +1083,12 @@ void *EnableSEHtranslation()
 {
 #ifdef NOSEH
     return NULL;
-#endif
+#else
 #ifdef _WIN32
     return _set_se_translator( CSEHException::Translate );
+#else
+    UNIMPLEMENTED;
+#endif
 #endif
 }
 

+ 2 - 75
system/jlib/jfile.cpp

@@ -1562,7 +1562,7 @@ IFileIO *_createIFileIO(const void *buffer, unsigned sz, bool readOnly)
             Owned<IFileIO> fileio = file->open(IFOread);
             offset_t ret=0;
             while (len) {
-                size32_t toread = ((len>=buffsize)||(len<0))?buffsize:(size32_t)len;
+                size32_t toread = (len>=buffsize)?buffsize:(size32_t)len;
                 size32_t read = fileio->read(pos,toread,buffer);
                 if (read<buffsize) 
                     mb.setLength(mb.length()+read-buffsize);
@@ -1710,7 +1710,7 @@ offset_t CFileIO::appendFile(IFile *file,offset_t pos,offset_t len)
     offset_t ret=0;
     offset_t outp = size();
     while (len) {
-        size32_t toread = ((len>=buffsize)||(len<0))?buffsize:(size32_t)len;
+        size32_t toread = (len>=buffsize) ? buffsize : (size32_t)len;
         size32_t read = fileio->read(pos,toread,buffer);
         if (read==0)
             break;
@@ -3789,79 +3789,6 @@ size32_t DirectBufferIO::write(offset_t pos, size32_t len, const void * data)
     return len;
 }
 
-
-//---------------------------------------------------------------------------
-
-size32_t StringBufferIO::read(offset_t pos, size32_t len, void * data)
-{
-    unsigned strLen = buffer.length();
-    if (pos + len > strLen)
-    {
-        if (pos > strLen)
-            pos = strLen;
-        len = (size32_t)(strLen - pos);
-    }
-    buffer.getChars((size32_t)pos, (size32_t)(pos+len), (char *)data);
-    return len;
-}
-
-offset_t StringBufferIO::size()
-{
-    return buffer.length();
-}
-
-size32_t StringBufferIO::write(offset_t pos, size32_t len, const void * data)
-{
-    unsigned strLen = buffer.length();
-    buffer.ensureCapacity((size32_t)(pos+len));
-    memcpy((byte *)buffer.toCharArray() + pos, data, len);
-    return len;
-}
-
-void StringBufferIO::setSize(offset_t size)
-{
-    if (size > buffer.length())
-        buffer.ensureCapacity((size32_t)size);
-    else
-        buffer.setLength((size32_t)size);
-}
-
-//---------------------------------------------------------------------------
-
-size32_t MemoryBufferIO::read(offset_t pos, size32_t len, void * data)
-{
-    unsigned strLen = buffer.length();
-    if (pos + len > strLen)
-    {
-        if (pos > strLen)
-            pos = strLen;
-        len = (size32_t)(strLen - pos);
-    }
-    memcpy(data, buffer.toByteArray() + pos, len);
-    return len;
-}
-
-offset_t MemoryBufferIO::size()
-{
-    return buffer.length();
-}
-
-size32_t MemoryBufferIO::write(offset_t pos, size32_t len, const void * data)
-{
-    unsigned strLen = buffer.length();
-    buffer.ensureCapacity((size32_t)(pos+len));
-    memcpy((byte *)buffer.toByteArray() + pos, data, len);
-    return len;
-}
-
-void MemoryBufferIO::setSize(offset_t size)
-{
-    if (size > buffer.length())
-        buffer.ensureCapacity((size32_t)size);
-    else
-        buffer.setLength((size32_t)size);
-}
-
 //---------------------------------------------------------------------------
 
 IFile * createIFile(const char * filename)

+ 0 - 31
system/jlib/jfile.ipp

@@ -244,35 +244,4 @@ public:
     virtual size32_t write(offset_t pos, size32_t len, const void * data);
 };
 
-class jlib_decl StringBufferIO : public CInterface, implements IFileIO
-{
-public:
-    StringBufferIO(StringBuffer & _buffer) : buffer(buffer) {}
-
-    virtual size32_t read(offset_t pos, size32_t len, void * data);
-    virtual offset_t size();
-    virtual size32_t write(offset_t pos, size32_t len, const void * data);
-    virtual void setSize(offset_t size);
-
-protected:
-    StringBuffer & buffer;
-};
-
-class jlib_decl MemoryBufferIO : public CInterface, implements IFileIO
-{
-public:
-    MemoryBufferIO (MemoryBuffer & _buffer) : buffer(buffer) {}
-
-    virtual size32_t read(offset_t pos, size32_t len, void * data);
-    virtual offset_t size();
-    virtual size32_t write(offset_t pos, size32_t len, const void * data);
-    virtual void setSize(offset_t size);
-
-protected:
-    MemoryBuffer & buffer;
-};
-
-
-
-
 #endif

+ 1 - 1
system/jlib/jmisc.hpp

@@ -231,7 +231,7 @@ public:
 
 template<typename T1,typename T2> inline __int64 makeint64(T1 high, T2 low)
 {
-    return (__int64)high<<32 | (__int64)low & (__int64)0xffffffff;
+    return (__int64)high<<32 | ((__int64)low & (__int64)0xffffffff);
 }
 
 inline __int32 high(__int64 n)

+ 20 - 20
system/jlib/jstring.cpp

@@ -1566,38 +1566,38 @@ static void writeUtf8(unsigned c, StringBuffer &out)
         out.append((char)c);
     else if (c < 0x800)
     {
-        out.append((char)(0xC0 | c>>6));
-        out.append((char)(0x80 | c & 0x3F));
+        out.append((char)(0xC0 | (c>>6)));
+        out.append((char)(0x80 | (c & 0x3F)));
     }
     else if (c < 0x10000)
     {
-        out.append((char) (0xE0 | c>>12));
-        out.append((char) (0x80 | c>>6 & 0x3F));
-        out.append((char) (0x80 | c & 0x3F));
+        out.append((char) (0xE0 | (c>>12)));
+        out.append((char) (0x80 | (c>>6 & 0x3F)));
+        out.append((char) (0x80 | (c & 0x3F)));
     }
     else if (c < 0x200000)
     {
-        out.append((char) (0xF0 | c>>18));
-        out.append((char) (0x80 | c>>12 & 0x3F));
-        out.append((char) (0x80 | c>>6 & 0x3F));
-        out.append((char) (0x80 | c & 0x3F));
+        out.append((char) (0xF0 | (c>>18)));
+        out.append((char) (0x80 | (c>>12 & 0x3F)));
+        out.append((char) (0x80 | (c>>6 & 0x3F)));
+        out.append((char) (0x80 | (c & 0x3F)));
     }
     else if (c < 0x4000000)
     {
-        out.append((char) (0xF8 | c>>24));
-        out.append((char) (0x80 | c>>18 & 0x3F));
-        out.append((char) (0x80 | c>>12 & 0x3F));
-        out.append((char) (0x80 | c>>6 & 0x3F));
-        out.append((char) (0x80 | c & 0x3F));
+        out.append((char) (0xF8 | (c>>24)));
+        out.append((char) (0x80 | (c>>18 & 0x3F)));
+        out.append((char) (0x80 | (c>>12 & 0x3F)));
+        out.append((char) (0x80 | (c>>6 & 0x3F)));
+        out.append((char) (0x80 | (c & 0x3F)));
     }
     else if (c < 0x80000000)
     {
-        out.append((char) (0xFC | c>>30));
-        out.append((char) (0x80 | c>>24 & 0x3F));
-        out.append((char) (0x80 | c>>18 & 0x3F));
-        out.append((char) (0x80 | c>>12 & 0x3F));
-        out.append((char) (0x80 | c>>6 & 0x3F));
-        out.append((char) (0x80 | c & 0x3F));
+        out.append((char) (0xFC | (c>>30)));
+        out.append((char) (0x80 | (c>>24 & 0x3F)));
+        out.append((char) (0x80 | (c>>18 & 0x3F)));
+        out.append((char) (0x80 | (c>>12 & 0x3F)));
+        out.append((char) (0x80 | (c>>6 & 0x3F)));
+        out.append((char) (0x80 | (c & 0x3F)));
     }
     else
         assertex(false);

+ 11 - 5
system/jlib/jutil.cpp

@@ -1547,11 +1547,17 @@ bool callExternalProgram(const char *progname, const StringBuffer &input, String
         size32_t count=input.length();
         for(;count>0;)
         {
-            size32_t w=pipe1.Write(data,count);
-            if(w<0 && errno!=EINTR)
-                throw MakeStringException(-1,"Pipe write failed: %d",errno); 
-            data+=w;
-            count-=w;
+            ssize_t w=pipe1.Write(data,count);
+            if(w<0)
+            {
+                if (errno!=EINTR)
+                    throw MakeStringException(-1,"Pipe write failed: %d",errno);
+            }
+            else
+            {
+                data+=w;
+                count-=w;
+            }
         }
         pipe1.CloseWrite();
 

+ 2 - 2
system/security/zcrypt/aes.cpp

@@ -1243,7 +1243,7 @@ int Rijndael::blockEncrypt(const UINT8 *input,int inputLen,UINT8 *outBuffer)
                     iv[3][0] = (iv[3][0] << 1) | (iv[3][1] >> 7);
                     iv[3][1] = (iv[3][1] << 1) | (iv[3][2] >> 7);
                     iv[3][2] = (iv[3][2] << 1) | (iv[3][3] >> 7);
-                    iv[3][3] = (iv[3][3] << 1) | (outBuffer[k/8] >> (7-(k&7))) & 1;
+                    iv[3][3] = (iv[3][3] << 1) | ((outBuffer[k/8] >> (7-(k&7))) & 1);
                 }
             }
         break;
@@ -1397,7 +1397,7 @@ int Rijndael::blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer)
                     iv[3][0] = (iv[3][0] << 1) | (iv[3][1] >> 7);
                     iv[3][1] = (iv[3][1] << 1) | (iv[3][2] >> 7);
                     iv[3][2] = (iv[3][2] << 1) | (iv[3][3] >> 7);
-                    iv[3][3] = (iv[3][3] << 1) | (input[k/8] >> (7-(k&7))) & 1;
+                    iv[3][3] = (iv[3][3] << 1) | ((input[k/8] >> (7-(k&7))) & 1);
                     outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
                 }
             }

+ 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
             {

+ 1 - 1
thorlcr/thorutil/thbuf.cpp

@@ -880,7 +880,7 @@ class CSharedWriteAheadBase : public CSimpleInterface, implements ISharedSmartBu
 
     inline bool isEof(rowcount_t rowsRead)
     {
-        return stopped || writeAtEof && rowsWritten == rowsRead;
+        return stopped || (writeAtEof && rowsWritten == rowsRead);
     }
     inline void signalReaders()
     {

+ 2 - 2
tools/hidl/hidlcomp.cpp

@@ -3033,7 +3033,7 @@ void EspMessageInfo::write_esp_ipp()
         outs("};\n\n");
 
         // array
-        /*
+#if 0
         //outf("MAKEValueArray(C%s,  %sArray);\n\n", name_, name_);
         outf("inline C%s Array__Member2Param(C%s &src)              { return src; }\n", name_, name_);
         outf("inline void Array__Assign(C%s & dest, C%s const & src){ dest = src; }\n", name_, name_);
@@ -3043,7 +3043,7 @@ void EspMessageInfo::write_esp_ipp()
         outf("MAKEArrayOf(C%s, C%s, %sArray)\n\n", name_,name_,name_);      
         //outf("class %sArray : public ArrayOf<C%s, C%s> {};\n\n",name_,name_,name_);
         outs("\n");
-        */
+#endif
 
         return;
     }