From dbb062085b09bb1a51b782b81e95e54d6ddb62a1 Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Wed, 4 Sep 2024 15:30:51 +0100 Subject: [PATCH 1/3] HPCC-32595 Fix warnings in generated hidl output Signed-off-by: Richard Chapman --- tools/hidl/hidlcomp.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tools/hidl/hidlcomp.cpp b/tools/hidl/hidlcomp.cpp index 1f6a8bf1d4c..d519357216f 100644 --- a/tools/hidl/hidlcomp.cpp +++ b/tools/hidl/hidlcomp.cpp @@ -2912,7 +2912,7 @@ void EspMessageInfo::write_esp() if (hasMapInfo()) { outf("\tIEspContext* ctx = rpc_resp.queryContext();\n"); - outf("\tdouble clientVer= ctx ? ctx->getClientVersion() : -1; /* no context gets everything */\n"); + outf("\t[[maybe_unused]] double clientVer= ctx ? ctx->getClientVersion() : -1; /* no context gets everything */\n"); } outf("\trpc_resp.set_ns(%s);\n", getMetaString("ns_var", "\"\"")); @@ -3040,7 +3040,7 @@ void EspMessageInfo::write_esp() outf("\t\tC%s::serializeContent(ctx,buffer);\n", parent); if (hasMapInfo()) - outf("\t\tdouble clientVer = ctx ? ctx->getClientVersion() : -1;\n"); + outf("\t\t[[maybe_unused]] double clientVer = ctx ? ctx->getClientVersion() : -1;\n"); bool encodeJSON = true; const char * name = getName(); @@ -3064,7 +3064,7 @@ void EspMessageInfo::write_esp() if (parent) outf("\tC%s::serializeContent(ctx,buffer);\n", parent); if (hasMapInfo()) - outf("\tdouble clientVer = ctx ? ctx->getClientVersion() : -1;\n"); + outf("\t[[maybe_unused]] double clientVer = ctx ? ctx->getClientVersion() : -1;\n"); //attributes first int attribCount=0; for (pi=getParams();pi!=NULL;pi=pi->next) @@ -3167,7 +3167,7 @@ void EspMessageInfo::write_esp() // -- versioning if (hasMapInfo()) { - outf("\tdouble clientVer = ctx ? ctx->getClientVersion() : -1;\n"); + outf("\t[[maybe_unused]] double clientVer = ctx ? ctx->getClientVersion() : -1;\n"); } // not respecting nil_remove: backward compatible @@ -4188,7 +4188,7 @@ void EspServInfo::write_esp_binding(const char *packagename) outs(1, "IEspContext *ctx=rpc_call->queryContext();\n"); outs(1, "DBGLOG(\"Client version: %g\", ctx->getClientVersion());\n"); outs(1, "StringBuffer serviceName;\n"); - outs(1, "double clientVer=(ctx) ? ctx->getClientVersion() : 0.0;\n"); + outs(1, "[[maybe_unused]] double clientVer=(ctx) ? ctx->getClientVersion() : 0.0;\n"); outs(1, "qualifyServiceName(*ctx, ctx->queryServiceName(NULL), NULL, serviceName, NULL);\n"); outs(1, "CRpcCall* thecall = static_cast(rpc_call);\n"); //interface must be from a class derived from CRpcCall outs(1, "CRpcResponse* response = static_cast(rpc_response);\n"); //interface must be from a class derived from CRpcResponse @@ -4265,7 +4265,7 @@ void EspServInfo::write_esp_binding(const char *packagename) if (hasMinVer) { outf("\t\t\tif (clientVer!=-1.0 && clientVer<%s)\n", minVer.str()); - outs("\t\t\t\tthrow MakeStringException(-1, \"Client version is too old, please update your client application.\");"); + outs("\t\t\t\tthrow MakeStringException(-1, \"Client version is too old, please update your client application.\");\n"); } if (mthi->getMetaInt("do_not_log",0)) @@ -4709,7 +4709,7 @@ void EspServInfo::write_esp_binding(const char *packagename) outs("\t\t\telse\n"); outs("\t\t\t{\n"); - outs("\t\t\t\tIProperties *props=request->queryParameters();\n"); + outs("\t\t\t\t[[maybe_unused]] IProperties *props=request->queryParameters();\n"); outs("\t\t\t\tif (skipXslt(context))\n"); outs("\t\t\t\t{\n"); outs("\t\t\t\t\tMemoryBuffer content;\n"); @@ -5532,7 +5532,12 @@ void HIDLcompiler::write_esp_ex_ipp() outf("#ifndef %s_EX_ESPGEN_INCLUDED\n", packagename); outf("#define %s_EX_ESPGEN_INCLUDED\n\n", packagename); - outs("#pragma warning( disable : 4786)\n\n"); + outs("#ifdef _MSC_VER\n"); + outs("#pragma warning( disable : 4786)\n"); + outs("#else\n"); + outs("#pragma GCC diagnostic push\n"); + outs("#pragma GCC diagnostic ignored \"-Woverloaded-virtual\"\n"); + outs("#endif\n\n"); outs("//JLib\n"); outs("#include \"jliball.hpp\"\n"); outs("\n"); @@ -5577,6 +5582,12 @@ void HIDLcompiler::write_esp_ex_ipp() outs("}\n"); outf("using namespace %s;\n\n", packagename); + outs("#ifdef _MSC_VER\n"); + outs("#pragma pop\n"); + outs("#else\n"); + outs("#pragma GCC diagnostic pop\n"); + outs("#endif\n"); + outf("#endif //%s_ESPGEN_INCLUDED\n", packagename); } From 4a5cb11de3c0c4dd92faa95a3b5603f9ee64696a Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Wed, 4 Sep 2024 15:22:48 +0100 Subject: [PATCH 2/3] HPCC-32596 Fix warnings in ecl subdirectory Signed-off-by: Richard Chapman --- ecl/CMakeLists.txt | 2 ++ ecl/agentexec/agentexec.cpp | 1 - ecl/ecl-bundle/ecl-bundle.cpp | 1 - ecl/eclcc/eclcc.cpp | 4 ++-- ecl/eclccserver/eclccserver.cpp | 13 ++----------- ecl/eclcmd/eclcmd_core.cpp | 9 ++------- ecl/eclcmd/queries/ecl-queries.cpp | 1 - ecl/eclplus/ViewHelper.cpp | 2 -- ecl/eclplus/main.cpp | 4 +--- ecl/eclscheduler/eclscheduler.cpp | 2 -- esp/bindings/SOAP/Platform/soapmessage.hpp | 2 ++ esp/bindings/SOAP/Platform/soapparam.hpp | 8 ++++---- .../SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp | 2 +- esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h | 5 ++++- esp/bindings/SOAP/xpp/xpp/XmlPullParser.h | 7 +++---- esp/bindings/bindutil.cpp | 2 ++ esp/platform/esp.hpp | 8 ++++---- esp/platform/espcontext.cpp | 16 ++++++++-------- esp/platform/espcontext.hpp | 8 ++++---- esp/platform/espprotocol.hpp | 2 +- system/jlib/jargv.hpp | 2 +- 21 files changed, 43 insertions(+), 58 deletions(-) diff --git a/ecl/CMakeLists.txt b/ecl/CMakeLists.txt index 1bcd8aacf18..9b8cd448b10 100644 --- a/ecl/CMakeLists.txt +++ b/ecl/CMakeLists.txt @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. ################################################################################ +project (ecl) +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STRICT_CXX_FLAGS}") HPCC_ADD_SUBDIRECTORY (agentexec "PLATFORM") HPCC_ADD_SUBDIRECTORY (eclagent "PLATFORM") HPCC_ADD_SUBDIRECTORY (eclcc) diff --git a/ecl/agentexec/agentexec.cpp b/ecl/agentexec/agentexec.cpp index 919b08e4204..90c8efc902a 100644 --- a/ecl/agentexec/agentexec.cpp +++ b/ecl/agentexec/agentexec.cpp @@ -278,7 +278,6 @@ class WaitThread : public CInterfaceOf if (isContainerized() && !useChildProcesses) { sharedK8sJob = true; - constexpr unsigned queueWaitingTimeoutMs = 10000; constexpr unsigned queueWaitingCheckPeriodMs = 1000; if (!owner.lingerQueue || !queueJobIfQueueWaiting(owner.lingerQueue, item, queueWaitingCheckPeriodMs, queueWaitingCheckPeriodMs)) { diff --git a/ecl/ecl-bundle/ecl-bundle.cpp b/ecl/ecl-bundle/ecl-bundle.cpp index b91a316752c..d8464cfbea4 100644 --- a/ecl/ecl-bundle/ecl-bundle.cpp +++ b/ecl/ecl-bundle/ecl-bundle.cpp @@ -1082,7 +1082,6 @@ class EclCmdBundleBase : public EclCmdCommon if (optVerbose) printf("mkdir %s\n", tmp.str()); - const char *ext = pathExtension(url); if (isGitUrl(url)) { fetchedLocation.append(tmp).append(PATHSEPCHAR); diff --git a/ecl/eclcc/eclcc.cpp b/ecl/eclcc/eclcc.cpp index 3f73dbc466b..07eb08a2bad 100644 --- a/ecl/eclcc/eclcc.cpp +++ b/ecl/eclcc/eclcc.cpp @@ -212,6 +212,7 @@ static bool extractOption(StringBuffer & option, IProperties * globals, const ch return false; } +#ifndef _CONTAINERIZED static bool extractOption(StringAttr & option, IProperties * globals, const char * envName, const char * propertyName, const char * defaultPrefix, const char * defaultSuffix) { if (option) @@ -221,6 +222,7 @@ static bool extractOption(StringAttr & option, IProperties * globals, const char option.set(temp.str()); return ret; } +#endif static bool getHomeFolder(StringBuffer & homepath) { @@ -2128,8 +2130,6 @@ void EclCC::generateOutput(EclCompileInstance & instance) void EclCC::processReference(EclCompileInstance & instance, const char * queryAttributePath, const char * queryAttributePackage) { - const char * outputFilename = instance.outputFilename; - instance.wu.setown(createLocalWorkUnit()); if (optArchive || optGenerateDepend || optSaveQueryArchive) instance.archive.setown(createAttributeArchive()); diff --git a/ecl/eclccserver/eclccserver.cpp b/ecl/eclccserver/eclccserver.cpp index 175fedfd2d6..c6804e9bd6a 100644 --- a/ecl/eclccserver/eclccserver.cpp +++ b/ecl/eclccserver/eclccserver.cpp @@ -223,17 +223,6 @@ class AbortPipeWaiter // A threadpool is used to allow multiple compiles to be submitted at once. Threads are reused when compilation completes. //------------------------------------------------------------------------------------------------------------------ -static bool getHomeFolder(StringBuffer & homepath) -{ - if (!getHomeDir(homepath)) - return false; - addPathSepChar(homepath); -#ifndef WIN32 - homepath.append('.'); -#endif - homepath.append(hpccBuildInfo.dirName); - return true; -} static bool guardGitUpdates = false; static StringBuffer gitLockKey; @@ -1118,6 +1107,7 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter, } }; +#ifndef _CONTAINERIZED #ifndef _WIN32 static void generatePrecompiledHeader() { @@ -1150,6 +1140,7 @@ static void removePrecompiledHeader() removeFileTraceIfFail("eclinclude4.hpp.gch"); } #endif +#endif //------------------------------------------------------------------------------------------------------------------ // Class EclccServer manages a pool of compile threads diff --git a/ecl/eclcmd/eclcmd_core.cpp b/ecl/eclcmd/eclcmd_core.cpp index 463b17217ec..eb217ecd28e 100644 --- a/ecl/eclcmd/eclcmd_core.cpp +++ b/ecl/eclcmd/eclcmd_core.cpp @@ -253,7 +253,6 @@ class EclCmdDeploy : public EclCmdWithEclTarget for (; !iter.done(); iter.next()) { - const char *arg = iter.query(); if (iter.matchOption(optName, ECLOPT_JOB_NAME)||iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S)) continue; if (iter.matchFlag(optProtect, ECLOPT_PROTECT)) @@ -1496,7 +1495,6 @@ class EclCmdAbort : public EclCmdCommon for (; !iter.done(); iter.next()) { - const char *arg = iter.query(); if (iter.matchOption(optName, ECLOPT_WUID)||iter.matchOption(optName, ECLOPT_WUID_S)) { optObj.type = eclObjWuid; @@ -1532,7 +1530,7 @@ class EclCmdAbort : public EclCmdCommon reqQ->setJobname(optName.get()); Owned respQ = client->WUQuery(reqQ); - int res = respQ->queryClientStatus(); + [[maybe_unused]] int res = respQ->queryClientStatus(); if (!respQ->getCount_isNull()) { @@ -1628,7 +1626,6 @@ class EclCmdGetName : public EclCmdCommon for (; !iter.done(); iter.next()) { - const char *arg = iter.query(); if (iter.matchOption(optName, ECLOPT_WUID)||iter.matchOption(optName, ECLOPT_WUID_S)) { optObj.type = eclObjWuid; @@ -1714,7 +1711,6 @@ class EclCmdGetWuid : public EclCmdCommon for (; !iter.done(); iter.next()) { - const char *arg = iter.query(); if (iter.matchOption(optName, ECLOPT_NAME)||iter.matchOption(optName, ECLOPT_NAME_S)) { retVal = EclCmdOptionMatch; @@ -1799,7 +1795,6 @@ class EclCmdStatus : public EclCmdCommon for (; !iter.done(); iter.next()) { - const char *arg = iter.query(); if (iter.matchOption(optName, ECLOPT_WUID)||iter.matchOption(optName, ECLOPT_WUID_S)) { optObj.type = eclObjWuid; @@ -1847,7 +1842,7 @@ class EclCmdStatus : public EclCmdCommon req->setJobname(optName.get()); Owned resp = client->WUQuery(req); - int res = resp->queryClientStatus(); + [[maybe_unused]] int res = resp->queryClientStatus(); IArrayOf& wus = resp->getWorkunits(); diff --git a/ecl/eclcmd/queries/ecl-queries.cpp b/ecl/eclcmd/queries/ecl-queries.cpp index b3e192ccfe5..5434c898294 100644 --- a/ecl/eclcmd/queries/ecl-queries.cpp +++ b/ecl/eclcmd/queries/ecl-queries.cpp @@ -396,7 +396,6 @@ class EclCmdQueryFiles : public EclCmdCommon int ret = outputMultiExceptionsEx(resp->getExceptions()); if (ret == 0) { - IArrayOf &files = resp->getFiles(); if (optQuery.length()) outputQueryFiles(optQuery.str(), resp->getFiles(), resp->getSuperFiles()); else diff --git a/ecl/eclplus/ViewHelper.cpp b/ecl/eclplus/ViewHelper.cpp index 331f0b0f3a7..59bba2bdbfa 100644 --- a/ecl/eclplus/ViewHelper.cpp +++ b/ecl/eclplus/ViewHelper.cpp @@ -116,8 +116,6 @@ bool ViewHelper::doit(FILE * fp) if (w->getStateID() == WUStateFailed) return false; - int queryid = 0; - IArrayOf& results = w->getResults(); ForEachItemIn(res_ind, results) { diff --git a/ecl/eclplus/main.cpp b/ecl/eclplus/main.cpp index ed9ee75f390..b48b6ece25c 100644 --- a/ecl/eclplus/main.cpp +++ b/ecl/eclplus/main.cpp @@ -97,8 +97,8 @@ void promptFor(const char *prompt, const char *prop, bool hide, IProperties * gl } SetConsoleMode(hStdIn, dwInputMode); #else - int fn = fileno(stdin); #if defined (__linux__) + int fn = fileno(stdin); struct termio t; /* If ioctl fails, we're probably not connected to a terminal. */ if(!ioctl(fn, TCGETA, &t)) @@ -147,8 +147,6 @@ bool build_globals(int argc, const char *argv[], IProperties * globals) if (arg[0] == '-') { StringBuffer name; - const char * value = NULL; - if (arg[1] == 'f') { if (eq) diff --git a/ecl/eclscheduler/eclscheduler.cpp b/ecl/eclscheduler/eclscheduler.cpp index 288bbfdef9b..87b5bc64543 100644 --- a/ecl/eclscheduler/eclscheduler.cpp +++ b/ecl/eclscheduler/eclscheduler.cpp @@ -31,8 +31,6 @@ #include "wujobq.hpp" #include "eventqueue.hpp" -static unsigned traceLevel; - //========================================================================================= ////////////////////////////////////////////////////////////////////////////////////////////// extern "C" void caughtSIGPIPE(int sig) diff --git a/esp/bindings/SOAP/Platform/soapmessage.hpp b/esp/bindings/SOAP/Platform/soapmessage.hpp index d1d4f6db1fa..425dcdda4d2 100644 --- a/esp/bindings/SOAP/Platform/soapmessage.hpp +++ b/esp/bindings/SOAP/Platform/soapmessage.hpp @@ -15,7 +15,9 @@ limitations under the License. ############################################################################## */ +#ifdef _MSC_VER #pragma warning( disable : 4786) +#endif #ifndef _SOAPMESSAGE_HPP__ #define _SOAPMESSAGE_HPP__ diff --git a/esp/bindings/SOAP/Platform/soapparam.hpp b/esp/bindings/SOAP/Platform/soapparam.hpp index a0f1a0f6036..bd6c0ac4e44 100644 --- a/esp/bindings/SOAP/Platform/soapparam.hpp +++ b/esp/bindings/SOAP/Platform/soapparam.hpp @@ -919,7 +919,7 @@ class SoapEnumParamNew { if (s) { - int tempval = enumstrings.find(s); + aindex_t tempval = enumstrings.find(s); if (tempval == NotFound) throw MakeStringException(-1, "Invalid value for type %s: %s", typeName_.get(), s); @@ -956,7 +956,7 @@ class SoapEnumParamNew { if (s) { - int tempval = enumstrings.find(s); + aindex_t tempval = enumstrings.find(s); if (tempval != NotFound) return (enumtype)tempval; } @@ -987,7 +987,7 @@ class SoapEnumParamNew { if (s) { - int tempval = enumstrings.find(s); + aindex_t tempval = enumstrings.find(s); if (tempval == NotFound) throw MakeStringException(-1, "Invalid value for type %s: %s", typeName_.get(), s); else @@ -1022,7 +1022,7 @@ class SoapEnumParamNew void marshall(IRpcMessage &rpc_call, const char *tagname, const char* itemname, const char* elementtype="",const char *basepath="", const char *prefix="") { - if ((value >= 0) && (value < enumstrings.length())) + if (enumstrings.isItem(value)) rpc_call.add_value(basepath, prefix, tagname, "string", enumstrings.item(value)); } diff --git a/esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp b/esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp index 3eac05e553b..377fa52d846 100644 --- a/esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp +++ b/esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp @@ -387,7 +387,7 @@ class CFragmentedXmlPullParser : public IFragmentedXmlPullParser return parserRef().getColumnNumber(); } - virtual const bool whitespaceContent() const override + virtual bool whitespaceContent() const override { DataFrame* df = peekDataFrame(); if (!df) diff --git a/esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h b/esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h index 0cf668e78d5..9aa057b9e1c 100644 --- a/esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h +++ b/esp/bindings/SOAP/xpp/sxt/XmlTokenizer.h @@ -47,8 +47,10 @@ typedef char SXT_CHAR; //#define SXT_TRACING false; //#define SXT_TEST_VALIDATING false; +#ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4290) +#endif namespace sxt { @@ -377,7 +379,6 @@ namespace sxt { } else { // it must be STag or ETag //bool prevMixSeenContent = seenContent; bool prevMixInElement = mixInElement; - bool prevMixSeenContent = seenContent; if(ch == _MYT('/')) { state = STATE_SCAN_ETAG_NAME; mixInElement = false; @@ -1080,7 +1081,9 @@ inline ostream& operator<<(ostream& output, } // namespace +#ifdef _MSC_VER #pragma warning(pop) +#endif #endif // SXT_XML_TOKENIZER_H_ diff --git a/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h b/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h index 4f5a9b88d7c..032aa8d9592 100644 --- a/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h +++ b/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h @@ -102,7 +102,7 @@ namespace xpp { virtual const SXT_STRING getPosDesc() const = 0; virtual int getLineNumber() const = 0; virtual int getColumnNumber() const = 0; - virtual const bool whitespaceContent() const = 0; + virtual bool whitespaceContent() const = 0; }; class XmlPullParser : implements IXmlPullParser { @@ -387,7 +387,7 @@ namespace xpp { } - virtual const bool whitespaceContent() const override { + virtual bool whitespaceContent() const override { if(eventType != CONTENT) { throw XmlPullParserException("no content available to read"); } @@ -773,8 +773,7 @@ namespace xpp { } } - void ensureNsBufSpace(int addSpace) { - addSpace = addSpace; + void ensureNsBufSpace(int) { /* // NOTE: unfortunately it can not be used as i was storing char* pointers // to this block of memory, storing relative offsets though will work - but later! diff --git a/esp/bindings/bindutil.cpp b/esp/bindings/bindutil.cpp index b08f83e46a4..acb97c0bc0b 100644 --- a/esp/bindings/bindutil.cpp +++ b/esp/bindings/bindutil.cpp @@ -15,7 +15,9 @@ limitations under the License. ############################################################################## */ +#ifdef _MSC_VER #pragma warning( disable : 4786) +#endif #include "platform.h" #define BINDUTIL_EXPORT DECL_EXPORT diff --git a/esp/platform/esp.hpp b/esp/platform/esp.hpp index 65c3008f412..2dd9f550fba 100644 --- a/esp/platform/esp.hpp +++ b/esp/platform/esp.hpp @@ -161,12 +161,12 @@ interface IEspContext : extends IInterface virtual void setServiceName(const char *name)=0; virtual const char * queryServiceName(const char *name)=0; - virtual const unsigned queryCreationTime()=0; + virtual unsigned queryCreationTime()=0; virtual void setProcessingTime()=0; - virtual const unsigned queryProcessingTime()=0; + virtual unsigned queryProcessingTime()=0; virtual void setException(int exceptionCode)=0; - virtual const bool queryException(int& exceptionCode, unsigned& exceptionTime)=0; - virtual const bool queryHasException()=0; + virtual bool queryException(int& exceptionCode, unsigned& exceptionTime)=0; + virtual bool queryHasException()=0; virtual IProperties * queryRequestParameters()=0; virtual void setRequestParameters(IProperties * Parameters)=0; diff --git a/esp/platform/espcontext.cpp b/esp/platform/espcontext.cpp index ea2c90f2d23..e5016f6506e 100755 --- a/esp/platform/espcontext.cpp +++ b/esp/platform/espcontext.cpp @@ -244,7 +244,7 @@ class CEspContext : public CInterface, implements IEspContext return m_servName.str(); } - virtual const unsigned queryCreationTime() + virtual unsigned queryCreationTime() { return m_creationTime; } @@ -252,7 +252,7 @@ class CEspContext : public CInterface, implements IEspContext { m_processingTime = msTick() - m_creationTime; } - virtual const unsigned queryProcessingTime() + virtual unsigned queryProcessingTime() { return m_processingTime; } @@ -262,7 +262,7 @@ class CEspContext : public CInterface, implements IEspContext m_exceptionCode = exceptionCode; m_exceptionTime = msTick() - m_creationTime; } - virtual const bool queryException(int& exceptionCode, unsigned& exceptionTime) + virtual bool queryException(int& exceptionCode, unsigned& exceptionTime) { if (m_hasException) { @@ -271,7 +271,7 @@ class CEspContext : public CInterface, implements IEspContext } return m_hasException; } - virtual const bool queryHasException() + virtual bool queryHasException() { return m_hasException; } @@ -951,7 +951,7 @@ LogLevel getTxSummaryLevel() return LogMin; } -const unsigned int readTxSummaryStyle(char const* style) +unsigned int readTxSummaryStyle(char const* style) { if (isEmptyString(style)) return TXSUMMARY_OUT_TEXT; @@ -966,7 +966,7 @@ const unsigned int readTxSummaryStyle(char const* style) return TXSUMMARY_OUT_TEXT; } -const unsigned int readTxSummaryGroup(char const* group) +unsigned int readTxSummaryGroup(char const* group) { if (isEmptyString(group)) return TXSUMMARY_GRP_CORE; @@ -981,14 +981,14 @@ const unsigned int readTxSummaryGroup(char const* group) return TXSUMMARY_GRP_CORE; } -const unsigned int getTxSummaryStyle() +unsigned int getTxSummaryStyle() { if (getContainer()) return getContainer()->getTxSummaryStyle(); return TXSUMMARY_OUT_TEXT; } -const unsigned int getTxSummaryGroup() +unsigned int getTxSummaryGroup() { if (getContainer()) return getContainer()->getTxSummaryGroup(); diff --git a/esp/platform/espcontext.hpp b/esp/platform/espcontext.hpp index a4ff8d006ba..9443732009b 100644 --- a/esp/platform/espcontext.hpp +++ b/esp/platform/espcontext.hpp @@ -132,10 +132,10 @@ esp_http_decl LogLevel getEspLogLevel(); esp_http_decl LogRequest getEspLogRequests(); esp_http_decl bool getEspLogResponses(); esp_http_decl LogLevel getTxSummaryLevel(); -esp_http_decl const unsigned int getTxSummaryStyle(); -esp_http_decl const unsigned int readTxSummaryStyle(const char* style); -esp_http_decl const unsigned int getTxSummaryGroup(); -esp_http_decl const unsigned int readTxSummaryGroup(const char* group); +esp_http_decl unsigned int getTxSummaryStyle(); +esp_http_decl unsigned int readTxSummaryStyle(const char* style); +esp_http_decl unsigned int getTxSummaryGroup(); +esp_http_decl unsigned int readTxSummaryGroup(const char* group); esp_http_decl bool getTxSummaryResourceReq(); esp_http_decl unsigned getSlowProcessingTime(); diff --git a/esp/platform/espprotocol.hpp b/esp/platform/espprotocol.hpp index 1ac077b20dd..8cf71ac9718 100644 --- a/esp/platform/espprotocol.hpp +++ b/esp/platform/espprotocol.hpp @@ -127,7 +127,7 @@ class CEspApplicationPort CEspBindingEntry* queryBindingItem(int item) { ReadLockBlock rblock(rwLock); - return (item Date: Wed, 11 Sep 2024 12:37:36 +0100 Subject: [PATCH 3/3] HPCC-32648 Possible memory corruption in pull parser code Signed-off-by: Richard Chapman --- esp/bindings/SOAP/xpp/xpp/XmlPullParser.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h b/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h index 032aa8d9592..cd89f3cbdfb 100644 --- a/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h +++ b/esp/bindings/SOAP/xpp/xpp/XmlPullParser.h @@ -379,7 +379,7 @@ namespace xpp { } - } catch(XmlTokenizerException ex) { + } catch(XmlTokenizerException const &ex) { throw XmlPullParserException(string("tokenizer exception: ") + ex.getMessage()); } @@ -588,7 +588,7 @@ namespace xpp { +to_string(token)); } } - } catch(XmlTokenizerException ex) { + } catch(XmlTokenizerException const &ex) { throw XmlPullParserException(string("tokenizer exception: ") + ex.getMessage()); } @@ -759,8 +759,8 @@ namespace xpp { if(elStackSize < newSize) { ElementContent* newStack = new ElementContent[newSize]; if(elStack != NULL) { - //System.arraycopy(elStack, 0, newStack, 0, elStackDepth); - memcpy(newStack, elStack, elStackDepth * sizeof(newStack[0])); + for(int i = 0; i < elStackDepth; ++i) + new(newStack+i) ElementContent(std::move(elStack[i])); delete [] elStack; elStack = NULL; } @@ -878,6 +878,21 @@ namespace xpp { prevNsBufPos = -1; } + ElementContent(ElementContent &&src) { + qName = src.qName; + uri = src.uri; + localName = src.localName; + prefix = src.prefix; + defaultNs = src.defaultNs; + prevNsBufPos = src.prevNsBufPos; + prefixesEnd = src.prefixesEnd; + prefixesSize = src.prefixesSize; + prefixes = src.prefixes; + src.prefixes = NULL; + prefixPrevNs = src.prefixPrevNs; + src.prefixPrevNs = NULL; + } + ~ElementContent() { if(prefixes != NULL) { delete [] prefixes;