Pārlūkot izejas kodu

HPCC-14380 Fix warnings and errors on windows builds

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 9 gadi atpakaļ
vecāks
revīzija
f460a5007a

+ 1 - 1
common/deftype/defvalue.cpp

@@ -69,7 +69,7 @@ static double powerOfTen[] = {1e0, 1e1, 1e2, 1e3, 1e4,
                        1e25, 1e26, 1e27, 1e28, 1e29, 
                        1e30, 1e31, 1e32 };
 
-static unsigned __int64 maxUIntValue[]  =   { I64C(0), I64C(0xFF), I64C(0xFFFF), I64C(0xFFFFFF), I64C(0xFFFFFFFF), I64C(0xFFFFFFFFFF), I64C(0xFFFFFFFFFFFF), I64C(0xFFFFFFFFFFFFFF), I64C(0xFFFFFFFFFFFFFFFF) };
+static unsigned __int64 maxUIntValue[]  =   { I64C(0), I64C(0xFF), I64C(0xFFFF), I64C(0xFFFFFF), I64C(0xFFFFFFFF), I64C(0xFFFFFFFFFF), I64C(0xFFFFFFFFFFFF), I64C(0xFFFFFFFFFFFFFF), U64C(0xFFFFFFFFFFFFFFFF) };
 static __int64 maxIntValue[] =  { I64C(0), I64C(0x7F), I64C(0x7FFF), I64C(0x7FFFFF), I64C(0x7FFFFFFF), I64C(0x7FFFFFFFFF), I64C(0x7FFFFFFFFFFF), I64C(0x7FFFFFFFFFFFFF), I64C(0x7FFFFFFFFFFFFFFF) };
 
 int rangeCompare(double value, ITypeInfo * targetType)

+ 2 - 2
common/workunit/workunit.cpp

@@ -847,7 +847,7 @@ public:
         priorityLevel = calcPriorityValue(&p);
         wuscope.set(p.queryProp("@scope"));
         appvalues.load(&p,"Application/*");
-        totalThorTime = nanoToMilli(extractTimeCollatable(p.queryProp("@totalThorTime"), false));
+        totalThorTime = (unsigned)nanoToMilli(extractTimeCollatable(p.queryProp("@totalThorTime"), false));
         _isProtected = p.getPropBool("@protected", false);
     }
     virtual const char *queryWuid() const { return wuid.str(); }
@@ -3758,7 +3758,7 @@ unsigned CLocalWorkUnit::getDebugAgentListenerPort() const
 unsigned CLocalWorkUnit::getTotalThorTime() const
 {
     CriticalBlock block(crit);
-    return nanoToMilli(extractTimeCollatable(p->queryProp("@totalThorTime"), false));
+    return (unsigned)nanoToMilli(extractTimeCollatable(p->queryProp("@totalThorTime"), false));
 }
 
 void CLocalWorkUnit::setDebugAgentListenerPort(unsigned port)

+ 4 - 4
dali/ft/filecopy.cpp

@@ -2979,10 +2979,10 @@ void FileSprayer::updateTargetProperties()
                 if (!sameSizeHeaderFooter)
                 {
                     FilePartInfo & curHeaderSource = sources.item(whichHeaderInput);
-                    curProps.setPropInt(FPheaderLength, curHeaderSource.xmlHeaderLength);
+                    curProps.setPropInt64(FPheaderLength, curHeaderSource.xmlHeaderLength);
 
                     FilePartInfo & curFooterSource = sources.item(cur.whichInput);
-                    curProps.setPropInt(FPfooterLength, curFooterSource.xmlFooterLength);
+                    curProps.setPropInt64(FPfooterLength, curFooterSource.xmlFooterLength);
 
                     if ( idx+1 != partition.ordinality() )
                         whichHeaderInput = partition.item(idx+1).whichInput;
@@ -3086,8 +3086,8 @@ void FileSprayer::updateTargetProperties()
 
         if (sameSizeHeaderFooter)
         {
-            curProps.setPropInt(FPheaderLength, headerSize);
-            curProps.setPropInt(FPfooterLength, footerSize);
+            curProps.setPropInt64(FPheaderLength, headerSize);
+            curProps.setPropInt64(FPfooterLength, footerSize);
         }
 
         if (srcAttr.get() && !mirroring) {

+ 1 - 1
ecl/eclplus/ViewHelper.cpp

@@ -164,7 +164,7 @@ bool ViewHelper::doit(FILE * fp)
 
                         const MemoryBuffer& resultbuf = res_resp->getResult();
                         count = res_resp->getCount();
-                        total = res_resp->getTotal();
+                        total = (int)res_resp->getTotal();
                         
                         if(format)
                         {

+ 1 - 1
ecl/hqlcpp/hqlwcpp.cpp

@@ -1981,7 +1981,7 @@ void HqlCppWriter::generateStmtDeclare(IHqlStmt * declare)
             IHqlExpression * size = static_cast<IHqlExpression *>(builderModifier->queryModifierExtra());
             if (size)
             {
-                unsigned fixedSize = getIntValue(size);
+                unsigned __int64 fixedSize = getIntValue(size);
                 if (fixedSize == 0)
                     out.append("rtlEmptyRowBuilder ").append(targetName);
                 else

+ 1 - 1
esp/clients/WUManager/WUManager.cpp

@@ -90,7 +90,7 @@ int main(int argc, char* argv[])
         return 0 ;
     }
 
-    for (unsigned i=4;i<argc;i++) {
+    for (int i=4;i<argc;i++) {
         char* delim = strstr(argv[i],":");
         if (delim)
         {

+ 4 - 2
esp/esdllib/esdl_def.cpp

@@ -1924,7 +1924,8 @@ public:
 
 bool EsdlDefinition::hasFileLoaded(const char *filename)
 {
-    return added.getValue(filename);
+    //The existance of the entry indicates whether it has been added or not
+    return added.getValue(filename) != NULL;
 }
 bool EsdlDefinition::hasXMLDefintionLoaded(const char *esdlDefName, int ver)
 {
@@ -1939,7 +1940,8 @@ bool EsdlDefinition::hasXMLDefintionLoaded(const char *esdlDefName, int ver)
 
 bool EsdlDefinition::hasXMLDefintionLoaded(const char *esdlDefId)
 {
-    return added.getValue(esdlDefId);
+    //The existance of the entry indicates whether it has been added or not
+    return added.getValue(esdlDefId) != NULL;
 }
 
 void EsdlDefinition::addDefinitionsFromFile(const char *filename)

+ 1 - 1
esp/platform/sechandler.cpp

@@ -236,7 +236,7 @@ bool SecHandler::authorizeSecReqFeatures(StringArray & features, IEspStringIntMa
     }
     if(auth_ok)
     {
-        for(i = 0; i < plist->count(); i++)
+        for(i = 0; i < (unsigned)plist->count(); i++)
         {
             ISecResource* resource = plist->queryResource(i);
             if(resource != NULL)

+ 0 - 1
esp/services/ws_dfu/ws_dfuService.cpp

@@ -1327,7 +1327,6 @@ void doDeleteFiles(StringArray &files, IUserDescriptor *userdesc, StringArray &s
         if(!fn || !*fn)
             continue;
 
-        DeleteActionResult ar;
         if (DeleteActionFailure==doDeleteFile(fn, userdesc, superFiles, failedFiles, returnStr, actionResults, superFilesOnly, removeFromSuperfiles, deleteRecursively))
             failedFiles.appendUniq(fn);
     }

+ 1 - 1
esp/services/ws_machine/componentstatus.cpp

@@ -88,7 +88,7 @@ bool CESPComponentStatusInfo::isSameComponent(const char* ep, int componentTypeI
     const char* ep1 = status.getEndPoint();
     if (!ep1 || !*ep1 || !ep || !*ep)
         return false;
-    bool hasPort = strchr(ep, ':');
+    bool hasPort = strchr(ep, ':') != NULL;
     if (hasPort)
         return streq(ep1, ep);
     //If no port, for now, only one componentType is reported per IP.

+ 5 - 5
esp/services/ws_machine/componentstatus.ipp

@@ -23,12 +23,12 @@
 #include "jiface.hpp"
 
 class StringBuffer;
-class IPropertyTree;
-class IPropertyTreeIterator;
+interface IPropertyTree;
+interface IPropertyTreeIterator;
 
-class IEspStatusReport;
-class IEspComponentStatus;
-class IConstComponentStatus;
+interface IEspStatusReport;
+interface IEspComponentStatus;
+interface IConstComponentStatus;
 template<class IEspComponentStatus> class IArrayOf;
 
 

+ 1 - 1
esp/services/ws_smc/ws_smcService.cpp

@@ -517,7 +517,7 @@ bool CActivityInfo::checkSetUniqueECLWUID(const char* wuid)
     bool* idFound = uniqueECLWUIDs.getValue(wuid);
     if (!idFound || !*idFound)
         uniqueECLWUIDs.setValue(wuid, true);
-    return idFound;
+    return idFound && *idFound;
 }
 
 CWsSMCTargetCluster* CActivityInfo::findWUClusterInfo(const char* wuid, bool isOnECLAgent, CIArrayOf<CWsSMCTargetCluster>& targetClusters,

+ 6 - 4
esp/tools/soapplus/http.cpp

@@ -23,7 +23,9 @@
 #ifdef _WIN32
 #include "winsock.h"
 #define ERRNO() WSAGetLastError()
+#ifndef EWOULDBLOCK
 #define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
 #else
 #define ERRNO() (errno)
 #define strnicmp strncasecmp
@@ -60,14 +62,14 @@ void HttpStat::printStat(FILE* ofile)
     {
         fprintf(ofile, "%s", sepstr);
         fprintf(ofile, "Number of Threads:                %d\n", threads);
-        fprintf(ofile, "Total hits:                       %Ld\n", numrequests);
+        fprintf(ofile, "Total hits:                       %" I64F "d\n", numrequests);
         fprintf(ofile, "Run length(millisecond):          %d\n", duration);
         if(duration > 0)
             fprintf(ofile, "Hits per second:                  %3.1f\n", numrequests/(duration*0.001));
-        fprintf(ofile, "Total data sent:                  %Ld\n", totalreqlen);
-        fprintf(ofile, "Total data received:              %Ld\n", totalresplen);
+        fprintf(ofile, "Total data sent:                  %" I64F "d\n", totalreqlen);
+        fprintf(ofile, "Total data received:              %" I64F "d\n", totalresplen);
         __int64 totallen = totalreqlen + totalresplen;
-        fprintf(ofile, "Total data transferred:           %Ld\n", totallen);
+        fprintf(ofile, "Total data transferred:           %" I64F "d\n", totallen);
         if(duration > 0)
             fprintf(ofile, "Data transferred per second:      %5.1f\n", totallen/(duration*0.001));
         if(numrequests > 0)

+ 0 - 1
plugins/workunitservices/workunitservices.cpp

@@ -602,7 +602,6 @@ WORKUNITSERVICES_API void wsWorkunitTimings( ICodeContext *ctx, size32_t & __len
         filter.setMeasure(SMeasureTimeNs);
 
         SCMStringBuffer desc;
-        unsigned tmp;
         Owned<IConstWUStatisticIterator> iter = &wu->getStatistics(&filter);
         ForEach(*iter)
         {

+ 1 - 1
roxie/ccd/ccdkey.cpp

@@ -381,7 +381,7 @@ public:
             if (length / size > UINT_MAX)
                 throw MakeStringException(ROXIE_FILE_ERROR, "Maximum row count %u exceeded", UINT_MAX);
             unsigned oldMax = maxPtrs;
-            maxPtrs += length / size;
+            maxPtrs += (unsigned)(length / size);
             if (oldMax > maxPtrs) // Check if it wrapped
                 throw MakeStringException(ROXIE_FILE_ERROR, "Maximum row count %u exceeded", UINT_MAX);
         }

+ 4 - 0
system/include/platform.h

@@ -107,6 +107,10 @@ typedef memsize_t rowsize_t;
 
 // **** END   OF X-PLATFORM SECTION ****
 #if defined(_WIN32)
+
+#define _CRT_SECURE_NO_WARNINGS
+#define NO_WARN_MBCS_MFC_DEPRECATION
+
 #if (_MSC_VER>=1300)
 #pragma warning(disable:4996)
 #endif

+ 3 - 2
system/jlib/CMakeLists.txt

@@ -149,8 +149,9 @@ set (    INCLUDES
         jvmem.hpp
         )
 
-set_source_files_properties (jmalloc.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
-
+if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
+    set_source_files_properties (jmalloc.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
+endif ()
 
 include_directories ( 
          ../../system/win32 

+ 0 - 1
system/jlib/jfile.cpp

@@ -17,7 +17,6 @@
 #include "platform.h"
 
 #ifdef _WIN32
-#define _WIN32_WINNT 0x0500  // for CreateHardLink
 #include <errno.h>
 //#include <winsock.h>  // for TransmitFile
 #endif

+ 6 - 2
system/jlib/jsocket.cpp

@@ -314,8 +314,11 @@ struct MCASTREQ
 #define T_SOCKET SOCKET
 #define T_FD_SET fd_set
 #define XFD_SETSIZE FD_SETSIZE
+//Following are defined in more modern headers
+#ifndef ETIMEDOUT
 #define ETIMEDOUT WSAETIMEDOUT
 #define ECONNREFUSED WSAECONNREFUSED
+#endif
 #define XFD_ZERO(s) FD_ZERO(s)
 #define SEND_FLAGS 0
 #define BADSOCKERR(err) ((err==WSAEBADF)||(err==WSAENOTSOCK))
@@ -518,8 +521,8 @@ bool win_socket_library::initdone = false;
 static win_socket_library ws32_lib;
 
 #define ERRNO() WSAGetLastError()
+#ifndef EADDRINUSE
 #define EADDRINUSE WSAEADDRINUSE
-#define EINTRCALL WSAEINTR
 #define ECONNRESET WSAECONNRESET
 #define ECONNABORTED WSAECONNABORTED
 #define ENOTCONN WSAENOTCONN
@@ -527,7 +530,8 @@ static win_socket_library ws32_lib;
 #define EINPROGRESS WSAEINPROGRESS
 #define ENETUNREACH WSAENETUNREACH
 #define ENOTSOCK WSAENOTSOCK
-
+#endif
+#define EINTRCALL WSAEINTR
 
 struct j_sockaddr_in6 {
     short   sin6_family;        /* AF_INET6 */

+ 3 - 2
system/win32/win32.hpp

@@ -18,6 +18,7 @@
 #ifndef __JWIN32_HPP
 #define __JWIN32_HPP
 
+#define _CRT_SECURE_NO_WARNINGS
 #define _WIN32_WINNT 0x0500
 #include <windows.h>
 
@@ -57,7 +58,7 @@ public:
         LPVOID msg=0;
         if(::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &msg, 0, NULL) && msg)
         {
-            _tprintf(TEXT("System error %d: %s\n"),code,msg);
+            _tprintf(TEXT("System error %d: %s\n"),code,(const char *)msg);
             ::LocalFree(msg);
         }
     }
@@ -89,7 +90,7 @@ public:
             {
                 int len=_tcslen(buf);
                 if(len<arraysize(buf)-1)
-                    _sntprintf(buf+len,arraysize(buf)-1-len,TEXT(" - (%d) %s"),code,msg);
+                    _sntprintf(buf+len,arraysize(buf)-1-len,TEXT(" - (%d) %s"),code,(const char *)msg);
                 ::LocalFree(msg);
             }
         }

+ 1 - 1
thorlcr/graph/thgraph.hpp

@@ -1030,7 +1030,7 @@ public:
 
 // IExceptionHandler
     bool fireException(IException *e);
-    void processAndThrowOwnedException(IException * e) __attribute__((noreturn));
+    __declspec(noreturn) void processAndThrowOwnedException(IException * e) __attribute__((noreturn));
 
     virtual IEngineRowAllocator * queryRowAllocator();  
     virtual IOutputRowSerializer * queryRowSerializer(); 

+ 5 - 1
tools/esdlcomp/CMakeLists.txt

@@ -47,7 +47,11 @@ include_directories (
          ${CMAKE_CURRENT_SOURCE_DIR}
     )
 
-ADD_DEFINITIONS( -D_CONSOLE -DESDLCOMP_EXPORTS -O0 )
+ADD_DEFINITIONS( -D_CONSOLE -DESDLCOMP_EXPORTS )
+if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
+    ADD_DEFINITIONS( -O0 )
+endif ()
+
 HPCC_ADD_LIBRARY ( esdlcomp SHARED ${SRCS} )
 
 MESSAGE("----INSTALLING esdlcomp")