瀏覽代碼

Merge pull request #10413 from richardkchapman/cpp11-gen

HPCC-18017 Use c++11 for generated code

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 7 年之前
父節點
當前提交
a6fb5a325d
共有 61 個文件被更改,包括 515 次插入462 次删除
  1. 6 0
      common/deftype/deftype.cpp
  2. 3 0
      common/deftype/deftype.hpp
  3. 57 25
      common/deftype/defvalue.cpp
  4. 21 21
      common/thorhelper/roxierow.cpp
  5. 2 2
      common/thorhelper/thorcommon.hpp
  6. 2 2
      common/thorhelper/thorcommon.ipp
  7. 1 1
      ecl/eclagent/agentctx.hpp
  8. 2 2
      ecl/eclagent/eclagent.cpp
  9. 23 23
      ecl/eclagent/eclagent.ipp
  10. 6 6
      ecl/eclagent/eclgraph.cpp
  11. 1 1
      ecl/hql/hqlattr.cpp
  12. 2 2
      ecl/hql/hqlfold.cpp
  13. 3 3
      ecl/hql/hqlgram.y
  14. 1 1
      ecl/hql/hqlutil.cpp
  15. 1 1
      ecl/hqlcpp/hqlckey.cpp
  16. 2 0
      ecl/hqlcpp/hqlcppc.cpp
  17. 24 24
      ecl/hqlcpp/hqlcppds.cpp
  18. 2 2
      ecl/hqlcpp/hqlcset.cpp
  19. 10 10
      ecl/hqlcpp/hqlhtcpp.cpp
  20. 5 5
      ecl/hqlcpp/hqliter.cpp
  21. 2 1
      ecl/hqlcpp/hqlnlp.cpp
  22. 7 8
      ecl/hqlcpp/hqlsource.cpp
  23. 1 1
      ecl/hqlcpp/hqlstep.cpp
  24. 3 3
      ecl/hqlcpp/hqltcppc2.cpp
  25. 21 10
      ecl/hqlcpp/hqlwcpp.cpp
  26. 2 2
      ecl/hthor/hthor.cpp
  27. 3 3
      ecllibrary/std/Date.ecl
  28. 1 1
      plugins/Rembed/Rembed.cpp
  29. 1 1
      plugins/cassandra/cassandraembed.cpp
  30. 1 1
      plugins/couchbase/couchbaseembed.cpp
  31. 1 1
      plugins/couchbase/couchbaseembed.hpp
  32. 1 1
      plugins/javaembed/javaembed.cpp
  33. 1 1
      plugins/mysql/mysqlembed.cpp
  34. 1 1
      plugins/py3embed/py3embed.cpp
  35. 1 1
      plugins/pyembed/pyembed.cpp
  36. 1 1
      plugins/sqlite3/sqlite3.cpp
  37. 1 1
      plugins/v8embed/v8embed.cpp
  38. 2 2
      roxie/ccd/ccdactivities.cpp
  39. 19 19
      roxie/ccd/ccdcontext.cpp
  40. 4 4
      roxie/ccd/ccdcontext.hpp
  41. 9 9
      roxie/ccd/ccdserver.cpp
  42. 1 1
      roxie/ccd/ccdserver.hpp
  43. 5 5
      roxie/roxiemem/roxiemem.cpp
  44. 3 3
      roxie/roxiemem/roxiemem.hpp
  45. 20 20
      rtl/eclrtl/eclrtl.cpp
  46. 23 23
      rtl/eclrtl/eclrtl.hpp
  47. 95 95
      rtl/eclrtl/rtlds.cpp
  48. 65 65
      rtl/eclrtl/rtlds_imp.hpp
  49. 4 4
      rtl/eclrtl/rtldynfield.cpp
  50. 1 1
      rtl/eclrtl/rtlfield.cpp
  51. 1 1
      rtl/eclrtl/rtlrecord.hpp
  52. 11 11
      rtl/include/eclhelper.hpp
  53. 5 5
      rtl/include/eclhelper_base.hpp
  54. 1 1
      system/jlib/jcomp.cpp
  55. 1 1
      testing/regress/ecl/streamread.ecl
  56. 2 2
      thorlcr/activities/loop/thloopslave.cpp
  57. 4 4
      thorlcr/graph/thgraph.cpp
  58. 9 10
      thorlcr/graph/thgraph.hpp
  59. 3 3
      thorlcr/graph/thgraphmaster.cpp
  60. 2 2
      thorlcr/graph/thgraphslave.cpp
  61. 2 2
      tools/wutool/wutool.cpp

+ 6 - 0
common/deftype/deftype.cpp

@@ -1998,6 +1998,12 @@ ITypeInfo * makeConstantModifier(ITypeInfo * basetype)
 }
 
 /* In basetype: linked. Return: linked */
+ITypeInfo * makeNonConstantModifier(ITypeInfo * basetype)
+{
+    return makeModifier(basetype, typemod_nonconst, NULL);
+}
+
+/* In basetype: linked. Return: linked */
 ITypeInfo * makeReferenceModifier(ITypeInfo * basetype)
 {
     return makeModifier(basetype, typemod_ref, NULL);

+ 3 - 0
common/deftype/deftype.hpp

@@ -61,6 +61,7 @@ enum typemod_t
     typemod_attr        = 9,
     typemod_indirect    = 10,       // type definition needs to go via an ecl definition
     typemod_mutable     = 11,
+    typemod_nonconst    = 12,
     typemod_max
 };
 
@@ -195,6 +196,7 @@ extern DEFTYPE_API ITypeInfo * makePointerType(ITypeInfo * basetype);
 extern DEFTYPE_API ITypeInfo * makeArrayType(ITypeInfo * basetype, unsigned size=0);
 extern DEFTYPE_API ITypeInfo * makeClassType(const char * className);
 extern DEFTYPE_API ITypeInfo * makeConstantModifier(ITypeInfo * basetype);
+extern DEFTYPE_API ITypeInfo * makeNonConstantModifier(ITypeInfo * basetype);
 extern DEFTYPE_API ITypeInfo * makeReferenceModifier(ITypeInfo * basetype);
 extern DEFTYPE_API ITypeInfo * makeWrapperModifier(ITypeInfo * basetype);
 extern DEFTYPE_API ITypeInfo * makeModifier(ITypeInfo * basetype, typemod_t modifier, IInterface * extra=NULL);
@@ -286,6 +288,7 @@ extern DEFTYPE_API ITypeInfo * getTruncType(ITypeInfo * type);
 inline bool hasConstModifier(ITypeInfo * t)      { return hasModifier(t, typemod_const); }
 inline bool hasReferenceModifier(ITypeInfo * t)  { return hasModifier(t, typemod_ref); }
 inline bool hasWrapperModifier(ITypeInfo * t)    { return hasModifier(t, typemod_wrapper); }
+inline bool hasNonconstModifier(ITypeInfo * t)   { return hasModifier(t, typemod_nonconst); }
 inline bool hasOutOfLineModifier(ITypeInfo * t)  { return hasModifier(t, typemod_outofline); }
 inline bool sameUnqualifiedType(ITypeInfo * t1, ITypeInfo * t2)  { return queryUnqualifiedType(t1) == queryUnqualifiedType(t2); }
 inline ITypeInfo * stripFunctionType(ITypeInfo * type)

+ 57 - 25
common/deftype/defvalue.cpp

@@ -1684,44 +1684,76 @@ const char *IntValue::generateECL(StringBuffer &s)
     return getStringValue(s);
 }
 
-const char *IntValue::generateCPP(StringBuffer &s, CompilerType compiler)
+static void generateUnsignedCPP(StringBuffer &s, __uint64 val, unsigned size, CompilerType compiler)
 {
-    if (type->isSwappedEndian())
-    {
-        if (type->isSigned())
-            s.append(rtlReadSwapInt(getAddressValue(), type->getSize()));
-        else
-            s.append(rtlReadSwapUInt(getAddressValue(), type->getSize()));
-    }
-    else
-        getStringValue(s);
-
+    s.append(val);
     switch (compiler)
     {
     case GccCppCompiler:
-        if (val && (type->getSize() > sizeof(unsigned)))
-        {
-            s.append("LL");
-            if (!type->isSigned())
-                s.append("U");
-        }
-        else if (!type->isSigned())
+        if (val && (size > sizeof(unsigned)))
+            s.append("LLU");
+        else
             s.append("U");
         break;
     case Vs6CppCompiler:
-        if (val && (type->getSize() > sizeof(unsigned)))
-        {
-            if (!type->isSigned())
-                s.append("U");
+        s.append("U");
+        if (val && (size > sizeof(unsigned)))
             s.append("i64");
-        }
-        else if (!type->isSigned())
-            s.append("U");
         break;
     default:
         throwUnexpected();
     }
+}
+
+static void generateSignedCPP(StringBuffer &s, __int64 val, unsigned size, CompilerType compiler)
+{
+    // Special case needed for MININT etc
+    if (val && (size > sizeof(unsigned)))
+    {
+        if (val == LLONG_MIN)
+            s.append("LLONG_MIN");
+        else
+        {
+            s.append(val);
+            switch (compiler)
+            {
+            case GccCppCompiler:
+                s.append("LL");
+                break;
+            case Vs6CppCompiler:
+                s.append("i64");
+                break;
+            default:
+                throwUnexpected();
+            }
+        }
+    }
+    else
+    {
+        if (val == INT_MIN)
+            s.append("INT_MIN");
+        else
+            s.append(val);
+    }
+}
 
+const char *IntValue::generateCPP(StringBuffer &s, CompilerType compiler)
+{
+    unsigned size = type->getSize();
+    if (type->isSwappedEndian())
+    {
+        if (type->isSigned())
+            generateSignedCPP(s, rtlReadSwapInt(getAddressValue(), size), size, compiler);
+        else
+            generateUnsignedCPP(s, rtlReadSwapUInt(getAddressValue(), size), size, compiler);
+    }
+    else
+    {
+        if (type->isSigned())
+            generateSignedCPP(s, (__int64) val, size, compiler);
+        else
+            generateUnsignedCPP(s, val, size, compiler);
+    }
     return s.str();
 }
 

+ 21 - 21
common/thorhelper/roxierow.cpp

@@ -132,76 +132,76 @@ public:
     IMPLEMENT_IINTERFACE
 
 //interface IEngineRowsetAllocator
-    virtual byte * * createRowset(unsigned count)
+    virtual const byte * * createRowset(unsigned count) override
     {
         if (count == 0)
             return NULL;
-        return (byte **) rowManager.allocate(count * sizeof(void *), allocatorId | ACTIVITY_FLAG_ISREGISTERED);
+        return (const byte **) rowManager.allocate(count * sizeof(void *), allocatorId | ACTIVITY_FLAG_ISREGISTERED);
     }
 
-    virtual void releaseRowset(unsigned count, byte * * rowset)
+    virtual void releaseRowset(unsigned count, const byte * * rowset) override
     {
         rtlReleaseRowset(count, rowset);
     }
 
-    virtual byte * * linkRowset(byte * * rowset)
+    virtual const byte * * linkRowset(const byte * * rowset) override
     {
         return rtlLinkRowset(rowset);
     }
 
-    virtual byte * * appendRowOwn(byte * * rowset, unsigned newRowCount, void * row)
+    virtual const byte * * appendRowOwn(const byte * * rowset, unsigned newRowCount, void * row) override
     {
-        byte * * expanded = doReallocRows(rowset, newRowCount-1, newRowCount);
+        const byte * * expanded = doReallocRows(rowset, newRowCount-1, newRowCount);
         expanded[newRowCount-1] = (byte *)row;
         return expanded;
     }
 
-    virtual byte * * reallocRows(byte * * rowset, unsigned oldRowCount, unsigned newRowCount)
+    virtual const byte * * reallocRows(const byte * * rowset, unsigned oldRowCount, unsigned newRowCount) override
     {
         //New rows (if any) aren't cleared....
         return doReallocRows(rowset, oldRowCount, newRowCount);
     }
 
-    virtual void releaseRow(const void * row)
+    virtual void releaseRow(const void * row) override
     {
         ReleaseRoxieRow(row);
     }
 
-    virtual void * linkRow(const void * row)
+    virtual void * linkRow(const void * row) override
     {
         LinkRoxieRow(row);
         return const_cast<void *>(row);
     }
 
-    virtual IOutputMetaData * queryOutputMeta()
+    virtual IOutputMetaData * queryOutputMeta() override
     {
         return meta.queryOriginal();
     }
-    virtual unsigned queryActivityId() const
+    virtual unsigned queryActivityId() const override
     {
         return activityId;
     }
-    virtual StringBuffer &getId(StringBuffer &idStr)
+    virtual StringBuffer &getId(StringBuffer &idStr) override
     {
         return idStr.append(activityId); // MORE - may want more context info in here
     }
-    virtual IOutputRowSerializer *createDiskSerializer(ICodeContext *ctx)
+    virtual IOutputRowSerializer *createDiskSerializer(ICodeContext *ctx) override
     {
         return meta.createDiskSerializer(ctx, activityId);
     }
-    virtual IOutputRowDeserializer *createDiskDeserializer(ICodeContext *ctx)
+    virtual IOutputRowDeserializer *createDiskDeserializer(ICodeContext *ctx) override
     {
         return meta.createDiskDeserializer(ctx, activityId);
     }
-    virtual IOutputRowSerializer *createInternalSerializer(ICodeContext *ctx)
+    virtual IOutputRowSerializer *createInternalSerializer(ICodeContext *ctx) override
     {
         return meta.createInternalSerializer(ctx, activityId);
     }
-    virtual IOutputRowDeserializer *createInternalDeserializer(ICodeContext *ctx)
+    virtual IOutputRowDeserializer *createInternalDeserializer(ICodeContext *ctx) override
     {
         return meta.createInternalDeserializer(ctx, activityId);
     }
-    virtual IEngineRowAllocator *createChildRowAllocator(const RtlTypeInfo *type)
+    virtual IEngineRowAllocator *createChildRowAllocator(const RtlTypeInfo *type) override
     {
         CriticalBlock block(cs); // Not very likely but better be safe
         if (children.empty())
@@ -224,7 +224,7 @@ public:
     }
 
 protected:
-    inline byte * * doReallocRows(byte * * rowset, unsigned oldRowCount, unsigned newRowCount)
+    inline const byte * * doReallocRows(const byte * * rowset, unsigned oldRowCount, unsigned newRowCount)
     {
         if (!rowset)
             return createRowset(newRowCount);
@@ -233,10 +233,10 @@ protected:
         //target rowset.  It could be that the rowset is unshared immediately, but that is inefficient at worst.
         if (RoxieRowIsShared(rowset))
         {
-            byte * * newset = createRowset(newRowCount);
+            const byte * * newset = createRowset(newRowCount);
             for (unsigned i=0; i < oldRowCount; i++)
             {
-                byte * cur = rowset[i];
+                const byte * cur = rowset[i];
                 LinkRoxieRow(cur);
                 newset[i] = cur;
             }
@@ -251,7 +251,7 @@ protected:
         memsize_t capacity;
         void * ptr = (void *)rowset;
         rowManager.resizeRow(capacity, ptr, oldRowCount * sizeof(void *), newRowCount * sizeof(void *), allocatorId | ACTIVITY_FLAG_ISREGISTERED);
-        return (byte * *)ptr;
+        return (const byte * *)ptr;
     }
 
 protected:

+ 2 - 2
common/thorhelper/thorcommon.hpp

@@ -563,11 +563,11 @@ public:
     {
         return ctx->cloneVString(len, str);
     }
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer)
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override
     {
         ctx->getResultRowset(tcount, tgt, name, sequence, _rowAllocator, isGrouped, xmlTransformer, csvTransformer);
     }
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher)
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override
     {
         ctx->getResultDictionary(tcount, tgt, _rowAllocator, name, sequence, xmlTransformer, csvTransformer, hasher);
     }

+ 2 - 2
common/thorhelper/thorcommon.ipp

@@ -834,11 +834,11 @@ protected:
 class ChildRowLinkerWalker : implements IIndirectMemberVisitor
 {
 public:
-    virtual void visitRowset(size32_t count, byte * * rows)
+    virtual void visitRowset(size32_t count, const byte * * rows) override
     {
         rtlLinkRowset(rows);
     }
-    virtual void visitRow(const byte * row)
+    virtual void visitRow(const byte * row) override
     {
         rtlLinkRow(row);
     }

+ 1 - 1
ecl/eclagent/agentctx.hpp

@@ -38,7 +38,7 @@ struct IHThorGraphResult : extends IInterface
 {
     virtual void addRowOwn(const void * row) = 0;
     virtual const void * queryRow(unsigned whichRow) = 0;
-    virtual void getLinkedResult(unsigned & count, byte * * & ret) = 0;
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret) = 0;
     virtual const void * getOwnRow(unsigned whichRow) = 0;      // used internally, removes row from result
     virtual const void * getLinkedRowResult() = 0;
 };

+ 2 - 2
ecl/eclagent/eclagent.cpp

@@ -1021,7 +1021,7 @@ void EclAgent::getExternalResultRaw(unsigned & tlen, void * & tgt, const char *
     }
 }
 
-void EclAgent::getResultRowset(size32_t & tcount, byte * * & tgt, const char * stepname, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer)
+void EclAgent::getResultRowset(size32_t & tcount, const byte * * & tgt, const char * stepname, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer)
 {
     tgt = NULL;
     PROTECTED_GETRESULT(stepname, sequence, "Rowset", "rowset",
@@ -1035,7 +1035,7 @@ void EclAgent::getResultRowset(size32_t & tcount, byte * * & tgt, const char * s
     );
 }
 
-void EclAgent::getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher)
+void EclAgent::getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher)
 {
     tcount = 0;
     tgt = NULL;

+ 23 - 23
ecl/eclagent/eclagent.ipp

@@ -473,8 +473,8 @@ public:
     virtual unsigned getResultHash(const char * name, unsigned sequence);
     virtual void getExternalResultRaw(unsigned & tlen, void * & tgt, const char * wuid, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer);
     virtual unsigned getExternalResultHash(const char * wuid, const char * name, unsigned sequence);
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer);
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher);
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override;
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override;
     virtual char *getJobName();
     virtual char *getJobOwner();
     virtual char *getClusterName();
@@ -797,11 +797,11 @@ public:
     UninitializedGraphResult(unsigned _id) { id = _id; }
     IMPLEMENT_IINTERFACE
 
-    virtual void addRowOwn(const void * row);
-    virtual const void * queryRow(unsigned whichRow);
-    virtual void getLinkedResult(unsigned & count, byte * * & ret);
-    virtual const void * getOwnRow(unsigned whichRow);
-    virtual const void * getLinkedRowResult();
+    virtual void addRowOwn(const void * row) override;
+    virtual const void * queryRow(unsigned whichRow) override;
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret) override;
+    virtual const void * getOwnRow(unsigned whichRow) override;
+    virtual const void * getLinkedRowResult() override;
 
 protected:
     unsigned id;
@@ -814,11 +814,11 @@ public:
     IMPLEMENT_IINTERFACE
 
 
-    virtual void addRowOwn(const void * row);
-    virtual const void * queryRow(unsigned whichRow);
-    virtual void getLinkedResult(unsigned & count, byte * * & ret);
-    virtual const void * getOwnRow(unsigned whichRow);
-    virtual const void * getLinkedRowResult();
+    virtual void addRowOwn(const void * row) override;
+    virtual const void * queryRow(unsigned whichRow) override;
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret) override;
+    virtual const void * getOwnRow(unsigned whichRow) override;
+    virtual const void * getLinkedRowResult() override;
 
 protected:
     Owned<IEngineRowAllocator> rowsetAllocator;
@@ -837,24 +837,24 @@ public:
     void init(unsigned _maxResults);
 
     virtual void clear();
-    virtual IHThorGraphResult * queryResult(unsigned id);
-    virtual IHThorGraphResult * queryGraphLoopResult(unsigned id);
-    virtual IHThorGraphResult * createResult(unsigned id, IEngineRowAllocator * ownedRowsetAllocator);
-    virtual IHThorGraphResult * createResult(IEngineRowAllocator * ownedRowsetAllocator);
-    virtual IHThorGraphResult * createGraphLoopResult(IEngineRowAllocator * ownedRowsetAllocator) { throwUnexpected(); }
+    virtual IHThorGraphResult * queryResult(unsigned id) override;
+    virtual IHThorGraphResult * queryGraphLoopResult(unsigned id) override;
+    virtual IHThorGraphResult * createResult(unsigned id, IEngineRowAllocator * ownedRowsetAllocator) override;
+    virtual IHThorGraphResult * createResult(IEngineRowAllocator * ownedRowsetAllocator) override;
+    virtual IHThorGraphResult * createGraphLoopResult(IEngineRowAllocator * ownedRowsetAllocator) override { throwUnexpected(); }
 
-    virtual void setResult(unsigned id, IHThorGraphResult * result);
+    virtual void setResult(unsigned id, IHThorGraphResult * result) override;
 
 //interface IEclGraphResults
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         queryResult(id)->getLinkedResult(count, ret);
     }
-    virtual void getDictionaryResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         queryResult(id)->getLinkedResult(count, ret);
     }
-    virtual const void * getLinkedRowResult(unsigned id)
+    virtual const void * getLinkedRowResult(unsigned id) override
     {
         return queryResult(id)->getLinkedRowResult();
     }
@@ -1027,8 +1027,8 @@ public:
     virtual IHThorGraphResult * createGraphLoopResult(IEngineRowAllocator * ownedRowsetAllocator);
     virtual IEclGraphResults * evaluate(unsigned parentExtractSize, const byte * parentExtract);
 
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id);
-    virtual void getDictionaryResult(size32_t & tcount, byte * * & tgt, unsigned id);
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) override;
+    virtual void getDictionaryResult(size32_t & tcount, const byte * * & tgt, unsigned id) override;
     virtual const void * getLinkedRowResult(unsigned id);
     inline unsigned __int64 queryId() const
     {

+ 6 - 6
ecl/eclagent/eclgraph.cpp

@@ -1039,13 +1039,13 @@ IHThorGraphResult * EclSubGraph::createGraphLoopResult(IEngineRowAllocator * own
     return graphLoopResults->createResult(ownedRowsetAllocator);
 }
 
-void EclSubGraph::getLinkedResult(unsigned & count, byte * * & ret, unsigned id)
+void EclSubGraph::getLinkedResult(unsigned & count, const byte * * & ret, unsigned id)
 {
     localResults->queryResult(id)->getLinkedResult(count, ret);
 }
 
 
-void EclSubGraph::getDictionaryResult(unsigned & count, byte * * & ret, unsigned id)
+void EclSubGraph::getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id)
 {
     localResults->queryResult(id)->getLinkedResult(count, ret);
 }
@@ -1295,7 +1295,7 @@ const void * UninitializedGraphResult::queryRow(unsigned whichRow)
     throw MakeStringException(99, "Graph Result %d accessed before it is created", id);
 }
 
-void UninitializedGraphResult::getLinkedResult(unsigned & count, byte * * & ret)
+void UninitializedGraphResult::getLinkedResult(unsigned & count, const byte * * & ret)
 {
     throw MakeStringException(99, "Graph Result %d accessed before it is created", id);
 }
@@ -1329,16 +1329,16 @@ const void * GraphResult::queryRow(unsigned whichRow)
     return NULL;
 }
 
-void GraphResult::getLinkedResult(unsigned & count, byte * * & ret)
+void GraphResult::getLinkedResult(unsigned & count, const byte * * & ret)
 {
     unsigned max = rows.ordinality();
-    byte * * rowset = rowsetAllocator->createRowset(max);
+    const byte * * rowset = rowsetAllocator->createRowset(max);
     unsigned i;
     for (i = 0; i < max; i++)
     {
         const void * next = rows.item(i);
         if (next) LinkRoxieRow(next);
-        rowset[i] = (byte *)next;
+        rowset[i] = (const byte *)next;
     }
 
     count = max;

+ 1 - 1
ecl/hql/hqlattr.cpp

@@ -923,7 +923,7 @@ static IHqlExpression * evaluateFieldAttrSize(IHqlExpression * expr)
             {
                 if (expr->hasAttribute(_linkCounted_Atom))
                 {
-                    thisSize = sizeof(size32_t) + sizeof(byte * *);
+                    thisSize = sizeof(size32_t) + sizeof(const byte * *);
                     break;
                 }
                 IHqlExpression * count = NULL;

+ 2 - 2
ecl/hql/hqlfold.cpp

@@ -1436,12 +1436,12 @@ class DummyContext: implements ICodeContext
     virtual bool getResultBool(const char * name, unsigned sequence) { throwUnexpected(); }
     virtual void getResultData(unsigned & tlen, void * & tgt, const char * name, unsigned sequence) { throwUnexpected(); }
     virtual void getResultDecimal(unsigned tlen, int precision, bool isSigned, void * tgt, const char * stepname, unsigned sequence) { throwUnexpected(); }
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) { throwUnexpected(); }
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override { throwUnexpected(); }
     virtual void getResultRaw(unsigned & tlen, void * & tgt, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
     virtual void getResultSet(bool & isAll, size32_t & tlen, void * & tgt, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
     virtual __int64 getResultInt(const char * name, unsigned sequence) { throwUnexpected(); }
     virtual double getResultReal(const char * name, unsigned sequence) { throwUnexpected(); }
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override { throwUnexpected(); }
     virtual void getResultString(unsigned & tlen, char * & tgt, const char * name, unsigned sequence) { throwUnexpected(); }
     virtual void getResultStringF(unsigned tlen, char * tgt, const char * name, unsigned sequence) { throwUnexpected(); }
     virtual void getResultUnicode(unsigned & tlen, UChar * & tgt, const char * name, unsigned sequence) { throwUnexpected(); }

+ 3 - 3
ecl/hql/hqlgram.y

@@ -2940,7 +2940,7 @@ buildFlag
     | skewAttribute
     | THRESHOLD '(' expression ')'
                         {
-                            parser->normalizeExpression($3, type_numeric, true);
+                            parser->normalizeExpression($3, type_int, true);
                             $$.setExpr(createExprAttribute(thresholdAtom, $3.getExpr()));
                         }
     | FEW               {
@@ -10687,7 +10687,7 @@ JoinFlag
                         }
     | THRESHOLD '(' expression ')'
                         {
-                            parser->normalizeExpression($3, type_numeric, true);
+                            parser->normalizeExpression($3, type_int, true);
                             $$.setExpr(createAttribute(thresholdAtom, $3.getExpr()));
                             $$.setPosition($1);
                         }
@@ -11732,7 +11732,7 @@ sortItem
                         }
     | THRESHOLD '(' expression ')'
                         {
-                            parser->normalizeExpression($3, type_numeric, true);
+                            parser->normalizeExpression($3, type_int, true);
                             $$.setExpr(createAttribute(thresholdAtom, $3.getExpr()));
                         }
     | WHOLE RECORD      {   $$.setExpr(createAttribute(recordAtom)); }

+ 1 - 1
ecl/hql/hqlutil.cpp

@@ -8833,7 +8833,7 @@ bool ConstantRowCreator::processFieldValue(IHqlExpression * optLhs, ITypeInfo *
                     if (rhsOp == no_null)
                     {
                         rtlWriteSize32t(out.reserve(sizeof(size32_t)), 0);
-                        memset(out.reserve(sizeof(byte * *)), 0, sizeof(byte * *));
+                        memset(out.reserve(sizeof(const byte * *)), 0, sizeof(const byte * *));
                         return true;
                     }
                 }

+ 1 - 1
ecl/hqlcpp/hqlckey.cpp

@@ -589,7 +589,7 @@ void KeyedJoinInfo::buildTransform(BuildCtx & ctx)
     case no_denormalizegroup:
         {
             func.start("virtual size32_t transform(ARowBuilder & crSelf, const void * _left, const void * _right, unsigned numRows, const void * * _rows)");
-            func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+            func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
             break;
         }
     }   

+ 2 - 0
ecl/hqlcpp/hqlcppc.cpp

@@ -39,6 +39,8 @@ IHqlExpression * convertAddressToValue(IHqlExpression * address, ITypeInfo * col
 
     Owned<ITypeInfo> pointerType = makePointerType(LINK(columnType));
     assertex(address->getOperator() == no_externalcall || pointerType == address->queryType());
+    if (columnType->getTypeCode()==type_table)
+        pointerType.setown(makePointerType(makeConstantModifier(LINK(columnType))));
     IHqlExpression * temp = createValue(no_implicitcast, LINK(pointerType), LINK(address));
     return createValue(no_deref, LINK(columnType), temp);
 }

+ 24 - 24
ecl/hqlcpp/hqlcppds.cpp

@@ -2999,37 +2999,37 @@ bool HqlCppTranslator::doBuildConstantDatasetInlineTable(IHqlExpression * expr,
 class EclccEngineRowAllocator : public CInterfaceOf<IEngineRowAllocator>
 {
 public:
-    virtual byte * * createRowset(unsigned _numItems) { return (byte * *)malloc(_numItems * sizeof(byte *)); }
-    virtual byte * * linkRowset(byte * * rowset) { throwUnexpected(); }
-    virtual void releaseRowset(unsigned count, byte * * rowset) { free(rowset); }
-    virtual byte * * appendRowOwn(byte * * rowset, unsigned newRowCount, void * row)
+    virtual const byte * * createRowset(unsigned _numItems) override { return (const byte * *)malloc(_numItems * sizeof(byte *)); }
+    virtual const byte * * linkRowset(const byte * * rowset) override { throwUnexpected(); }
+    virtual void releaseRowset(unsigned count, const byte * * rowset) override { free(rowset); }
+    virtual const byte * * appendRowOwn(const byte * * rowset, unsigned newRowCount, void * row) override
     {
-        byte * * expanded = reallocRows(rowset, newRowCount-1, newRowCount);
-        expanded[newRowCount-1] = (byte *)row;
+        const byte * * expanded = reallocRows(rowset, newRowCount-1, newRowCount);
+        expanded[newRowCount-1] = (const byte *)row;
         return expanded;
     }
-    virtual byte * * reallocRows(byte * * rowset, unsigned oldRowCount, unsigned newRowCount)
+    virtual const byte * * reallocRows(const byte * * rowset, unsigned oldRowCount, unsigned newRowCount) override
     {
-        return (byte * *)realloc(rowset, newRowCount * sizeof(byte *));
+        return (const byte * *)realloc(rowset, newRowCount * sizeof(byte *));
     }
 
-    virtual void * createRow() { throwUnexpected(); }
-    virtual void releaseRow(const void * row) {  } // can occur if a row is removed from a dictionary.
-    virtual void * linkRow(const void * row) { return const_cast<void *>(row); }  // can occur if a dictionary is resized.
+    virtual void * createRow() override { throwUnexpected(); }
+    virtual void releaseRow(const void * row) override {  } // can occur if a row is removed from a dictionary.
+    virtual void * linkRow(const void * row) override { return const_cast<void *>(row); }  // can occur if a dictionary is resized.
 
 //Used for dynamically sizing rows.
-    virtual void * createRow(size32_t & allocatedSize) { throwUnexpected(); }
-    virtual void * resizeRow(size32_t newSize, void * row, size32_t & size) { throwUnexpected(); }
-    virtual void * finalizeRow(size32_t newSize, void * row, size32_t oldSize) { throwUnexpected(); }
-
-    virtual IOutputMetaData * queryOutputMeta() { return NULL; }
-    virtual unsigned queryActivityId() const { return 0; }
-    virtual StringBuffer &getId(StringBuffer & out) { return out; }
-    virtual IOutputRowSerializer *createDiskSerializer(ICodeContext *ctx = NULL) { throwUnexpected(); }
-    virtual IOutputRowDeserializer *createDiskDeserializer(ICodeContext *ctx) { throwUnexpected(); }
-    virtual IOutputRowSerializer *createInternalSerializer(ICodeContext *ctx = NULL) { throwUnexpected(); }
-    virtual IOutputRowDeserializer *createInternalDeserializer(ICodeContext *ctx) { throwUnexpected(); }
-    virtual IEngineRowAllocator *createChildRowAllocator(const RtlTypeInfo *type) { throwUnexpected(); }
+    virtual void * createRow(size32_t & allocatedSize) override { throwUnexpected(); }
+    virtual void * resizeRow(size32_t newSize, void * row, size32_t & size) override { throwUnexpected(); }
+    virtual void * finalizeRow(size32_t newSize, void * row, size32_t oldSize) override { throwUnexpected(); }
+
+    virtual IOutputMetaData * queryOutputMeta() override { return NULL; }
+    virtual unsigned queryActivityId() const override { return 0; }
+    virtual StringBuffer &getId(StringBuffer & out) override { return out; }
+    virtual IOutputRowSerializer *createDiskSerializer(ICodeContext *ctx = NULL) override { throwUnexpected(); }
+    virtual IOutputRowDeserializer *createDiskDeserializer(ICodeContext *ctx) override { throwUnexpected(); }
+    virtual IOutputRowSerializer *createInternalSerializer(ICodeContext *ctx = NULL) override { throwUnexpected(); }
+    virtual IOutputRowDeserializer *createInternalDeserializer(ICodeContext *ctx) override { throwUnexpected(); }
+    virtual IEngineRowAllocator *createChildRowAllocator(const RtlTypeInfo *type) override { throwUnexpected(); }
     virtual void gatherStats(CRuntimeStatisticCollection & stats) override {}
 };
 
@@ -3119,7 +3119,7 @@ void HqlCppTranslator::createInlineDictionaryRows(HqlExprArray & args, ConstantR
         builder.appendOwn(&boundRows.item(i));
 
     unsigned size = builder.getcount();
-    ConstantRow * * rows = reinterpret_cast<ConstantRow * *>(builder.queryrows());
+    const ConstantRow * * rows = reinterpret_cast<const ConstantRow * *>(builder.queryrows());
     for (unsigned i=0; i < size; i++)
     {
         if (rows[i])

+ 2 - 2
ecl/hqlcpp/hqlcset.cpp

@@ -615,7 +615,7 @@ BoundRow * InlineLinkedDatasetCursor::doBuildIterateLoop(BuildCtx & ctx, bool ne
     //row = ds;
     OwnedHqlExpr address = getPointer(boundDs.expr);            // ensure no longer a wrapped item
 
-    s.clear().append("byte * * ").append(cursorName).append(" = ");
+    s.clear().append("const byte * * ").append(cursorName).append(" = ");
     translator.generateExprCpp(s, address).append(";");
     ctx.addQuoted(s);
 
@@ -1787,7 +1787,7 @@ InlineDatasetBuilder::InlineDatasetBuilder(HqlCppTranslator & _translator, IHqlE
     StringBuffer cursorName;
     getUniqueId(cursorName.append("p"));
 
-    ITypeInfo * rowType = makeRowReferenceType(record);
+    ITypeInfo * rowType = makeNonConstantModifier(makeRowReferenceType(record));
     cursorVar.setown(createVariable(cursorName.str(), rowType));
     dataset.setown(createDataset(no_anon, LINK(record), getSelfAttr()));
     size.set(_size);

+ 10 - 10
ecl/hqlcpp/hqlhtcpp.cpp

@@ -5436,7 +5436,7 @@ void HqlCppTranslator::buildNaryCompareClass(BuildCtx & ctx, const char * name,
     {
         MemberFunction func(*this, classctx, "virtual bool match(unsigned numRows, const void * * _rows) const");
         func.ctx.addQuotedLiteral("const unsigned char * left = (const unsigned char *) _rows[0];");
-        func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+        func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
         func.ctx.associateExpr(constantMemberMarkerExpr, constantMemberMarkerExpr);
 
         bindTableCursor(func.ctx, dataset, "left", no_left, selSeq);
@@ -8590,7 +8590,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityLoop(BuildCtx & ctx, IHqlExpre
     if (loopCond)
     {
         MemberFunction func(*this, instance->startctx, "virtual bool loopAgain(unsigned counter, unsigned numRows, const void * * _rows)");
-        func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+        func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
 
         associateCounter(func.ctx, counter, "counter");
 
@@ -12297,8 +12297,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityJoinOrDenormalize(BuildCtx & c
             associateLocalJoinTransformFlags(func.ctx, "flags", dataset1, no_left, selSeq);
             associateLocalJoinTransformFlags(func.ctx, "flags", dataset2, no_right, selSeq);
 
-            func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
-
+            func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
 
             BoundRow * selfCursor = buildTransformCursors(func.ctx, transform, dataset1, dataset2, instance->dataset, selSeq);
             bindRows(func.ctx, no_right, selSeq, expr->queryAttribute(_rowsid_Atom), dataset2, "numRows", "rows", options.mainRowsAreLinkCounted);
@@ -13871,9 +13870,9 @@ ABoundActivity * HqlCppTranslator::doBuildActivityLinkedRawChildDataset(BuildCtx
     OwnedHqlExpr zero = getSizetConstant(0);
     buildTempExpr(*callctx, *declarectx, boundActiveIndex, zero, FormatNatural, false);
 
-    //virtual byte * next() = 0;
+    //virtual const byte * next() = 0;
     {
-        MemberFunction func(*this, instance->startctx, "virtual byte * next()");
+        MemberFunction func(*this, instance->startctx, "virtual const byte * next()");
         OwnedHqlExpr count = getBoundCount(boundDs);
         OwnedHqlExpr test = createValue(no_lt, makeBoolType(), LINK(boundActiveIndex.expr), LINK(count));
         BuildCtx subctx(func.ctx);
@@ -15176,9 +15175,10 @@ ABoundActivity * HqlCppTranslator::doBuildActivitySerialize(BuildCtx & ctx, IHql
 
     {
         MemberFunction func(*this, instance->startctx, "virtual size32_t transform(ARowBuilder & crSelf, const void * _left)");
+        func.ctx.addQuotedLiteral("const unsigned char * left = (const byte *) left;");
 
         // Bind left to "left" and right to RIGHT
-        bindTableCursor(func.ctx, dataset, "_left");
+        bindTableCursor(func.ctx, dataset, "left");
         BoundRow * selfCursor = bindSelf(func.ctx, expr, "crSelf");
 
         //MORE: I don't have any examples that trigger this code as far as I know...
@@ -15393,7 +15393,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityFilterGroup(BuildCtx & ctx, IH
     {
         MemberFunction func(*this, instance->startctx, "virtual bool isValid(unsigned numRows, const void * * _rows)");
         func.ctx.addQuotedLiteral("const unsigned char * left = (const unsigned char *) _rows[0];");
-        func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+        func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
 
         bindTableCursor(func.ctx, dataset, "left", no_left, selSeq);
         bindRows(func.ctx, no_left, selSeq, rowsid, dataset, "numRows", "rows", options.mainRowsAreLinkCounted);
@@ -15511,7 +15511,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityCombineGroup(BuildCtx & ctx, I
         {
             func.ctx.addQuotedLiteral("const unsigned char * left = (const unsigned char *)_left;");
             func.ctx.addQuotedLiteral("const unsigned char * right = (const unsigned char *) _rows[0];");
-            func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+            func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
             ensureRowAllocated(func.ctx, "crSelf");
 
             bindTableCursor(func.ctx, left, "left", no_left, selSeq);
@@ -15560,7 +15560,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityRollupGroup(BuildCtx & ctx, IH
         if (transform->getOperator() != no_skip)
         {
             func.ctx.addQuotedLiteral("const unsigned char * left = (const unsigned char *) _rows[0];");
-            func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+            func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
             ensureRowAllocated(func.ctx, "crSelf");
 
             bindTableCursor(func.ctx, dataset, "left", no_left, selSeq);

+ 5 - 5
ecl/hqlcpp/hqliter.cpp

@@ -251,7 +251,7 @@ void CompoundIteratorBuilder::createSingleLevelIterator(StringBuffer & iterName,
     createSingleIterator(iterName, cur, cursors);
 
     translator.getUniqueId(cursorName.append("row"));
-    OwnedHqlExpr row = createVariable(cursorName, makeRowReferenceType(cur));
+    OwnedHqlExpr row = createVariable(cursorName, makeConstantModifier(makeRowReferenceType(cur)));
     declarectx.addDeclare(row);
     cursors.append(*translator.createTableCursor(cur, row, false, no_none, NULL));
 }
@@ -268,13 +268,13 @@ void CompoundIteratorBuilder::createSingleIterator(StringBuffer & iterName, IHql
 
     if (isArrayRowset(expr->queryType()))
     {
-        classctx.addQuotedLiteral("byte * * end;");
-        classctx.addQuotedLiteral("byte * * cur;");
+        classctx.addQuotedLiteral("const byte * * end;");
+        classctx.addQuotedLiteral("const byte * * cur;");
     }
     else
     {
-        classctx.addQuotedLiteral("byte * end;");
-        classctx.addQuotedLiteral("byte * cur;");
+        classctx.addQuotedLiteral("const byte * end;");
+        classctx.addQuotedLiteral("const byte * cur;");
     }
 
     IHqlExpression * root = queryRoot(expr);

+ 2 - 1
ecl/hqlcpp/hqlnlp.cpp

@@ -594,7 +594,8 @@ void HqlCppTranslator::doBuildParseSearchText(BuildCtx & classctx, IHqlExpressio
             buildExpr(func.ctx, castSearch, bound);
             OwnedHqlExpr len = getBoundLength(bound);
             func.ctx.addAssign(target.length, len);
-            func.ctx.addAssign(target.expr, bound.expr);
+            OwnedHqlExpr transferred = createValue(no_cast, LINK(retType), LINK(bound.expr));
+            func.ctx.addAssign(target.expr, transferred);
         }
         if (tempLen)
         {

+ 7 - 8
ecl/hqlcpp/hqlsource.cpp

@@ -3101,7 +3101,7 @@ void DiskAggregateBuilder::buildMembers(IHqlExpression * expr)
     {
         BuildCtx rowctx(instance->startctx);
         rowctx.addQuotedFunction("virtual void processRow(ARowBuilder & crSelf, const void * src)");
-        rowctx.addQuotedLiteral("doProcessRow(crSelf, (byte *)src);");
+        rowctx.addQuotedLiteral("doProcessRow(crSelf, (const byte *)src);");
     }
 
     //virtual void processRows(void * self, size32_t srcLen, const void * src) = 0;
@@ -3124,7 +3124,7 @@ void DiskAggregateBuilder::buildMembers(IHqlExpression * expr)
 
 void DiskAggregateBuilder::buildTransform(IHqlExpression * expr)
 {
-    MemberFunction func(translator, instance->startctx, "void doProcessRow(ARowBuilder & crSelf, byte * left)");
+    MemberFunction func(translator, instance->startctx, "void doProcessRow(ARowBuilder & crSelf, const byte * left)");
     translator.ensureRowAllocated(func.ctx, "crSelf");
     buildTransformBody(func.ctx, expr, false, false, true);
 }
@@ -3178,8 +3178,7 @@ void DiskCountBuilder::buildTransform(IHqlExpression * expr)
 {
     if (transformCanFilter||isNormalize)
     {
-        MemberFunction func(translator, instance->startctx, "size32_t valid(byte * _left)");
-        func.ctx.addQuotedLiteral("unsigned char * left = (unsigned char *)_left;");
+        MemberFunction func(translator, instance->startctx, "size32_t valid(const byte * left)");
         OwnedHqlExpr cnt;
         if (isNormalize)
         {
@@ -3269,7 +3268,7 @@ void DiskGroupAggregateBuilder::buildMembers(IHqlExpression * expr)
 
 void DiskGroupAggregateBuilder::buildTransform(IHqlExpression * expr)
 {
-    MemberFunction func(translator, instance->startctx, "void doProcessRow(byte * left, IHThorGroupAggregateCallback * callback)");
+    MemberFunction func(translator, instance->startctx, "void doProcessRow(const byte * left, IHThorGroupAggregateCallback * callback)");
     bool accessesCallback = containsOperator(expr, no_filepos) || containsOperator(expr, no_file_logicalname); 
     buildGroupAggregateTransformBody(func.ctx, expr, isNormalize || accessesCallback, true);
 }
@@ -6616,7 +6615,7 @@ void IndexAggregateBuilder::buildMembers(IHqlExpression * expr)
     {
         BuildCtx rowctx(instance->startctx);
         rowctx.addQuotedFunction("virtual void processRow(ARowBuilder & crSelf, const void * src)");
-        rowctx.addQuotedLiteral("doProcessRow(crSelf, (byte *)src);");
+        rowctx.addQuotedLiteral("doProcessRow(crSelf, (const byte *)src);");
     }
 
     {
@@ -6638,7 +6637,7 @@ void IndexAggregateBuilder::buildMembers(IHqlExpression * expr)
 
 void IndexAggregateBuilder::buildTransform(IHqlExpression * expr)
 {
-    MemberFunction func(translator, instance->startctx, "void doProcessRow(ARowBuilder & crSelf, byte * left)");
+    MemberFunction func(translator, instance->startctx, "void doProcessRow(ARowBuilder & crSelf, const byte * left)");
     translator.ensureRowAllocated(func.ctx, "crSelf");
     translator.associateBlobHelper(func.ctx, tableExpr, "fpp");
     buildTransformBody(func.ctx, expr, false, false, true);
@@ -6881,7 +6880,7 @@ void IndexGroupAggregateBuilder::doBuildProcessCountMembers(BuildCtx & ctx, IHql
 
 void IndexGroupAggregateBuilder::buildTransform(IHqlExpression * expr)
 {
-    MemberFunction func(translator, instance->startctx, "void doProcessRow(byte * left, IHThorGroupAggregateCallback * callback)");
+    MemberFunction func(translator, instance->startctx, "void doProcessRow(const byte * left, IHThorGroupAggregateCallback * callback)");
     translator.associateBlobHelper(func.ctx, tableExpr, "fpp");
     buildGroupAggregateTransformBody(func.ctx, expr, isNormalize || transformAccessesCallback, true);
 }

+ 1 - 1
ecl/hqlcpp/hqlstep.cpp

@@ -1060,7 +1060,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityNWayMergeJoin(BuildCtx & ctx,
         ensureRowAllocated(func.ctx, "crSelf");
         func.ctx.addQuotedLiteral("const unsigned char * left = (const unsigned char *) _rows[0];");
         func.ctx.addQuotedLiteral("const unsigned char * right = (const unsigned char *) _rows[1];");
-        func.ctx.addQuotedLiteral("unsigned char * * rows = (unsigned char * *) _rows;");
+        func.ctx.addQuotedLiteral("const byte * * rows = (const byte * *) _rows;");
 
         bindTableCursor(func.ctx, dataset, "left", no_left, selSeq);
         bindTableCursor(func.ctx, dataset, "right", no_right, selSeq);

+ 3 - 3
ecl/hqlcpp/hqltcppc2.cpp

@@ -636,7 +636,7 @@ void CChildLinkedDatasetColumnInfo::buildColumnExpr(HqlCppTranslator & translato
 
 void CChildLinkedDatasetColumnInfo::gatherSize(SizeStruct & target)
 {
-    unsigned thisSize = sizeof(size32_t) + sizeof(byte * *);
+    unsigned thisSize = sizeof(size32_t) + sizeof(const byte * *);
     if (isConditional())
         addVariableSize(thisSize, target);      // the size is used for ensure if condition is true
     else
@@ -646,13 +646,13 @@ void CChildLinkedDatasetColumnInfo::gatherSize(SizeStruct & target)
 
 IHqlExpression * CChildLinkedDatasetColumnInfo::buildSizeOfUnbound(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector)
 {
-    return getSizetConstant(sizeof(size32_t) + sizeof(byte * *));
+    return getSizetConstant(sizeof(size32_t) + sizeof(const byte * *));
 }
 
 void CChildLinkedDatasetColumnInfo::buildDeserialize(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector, IHqlExpression * helper, IAtom * serializeFormat)
 {
     if (isConditional())
-        checkAssignOk(translator, ctx, selector, queryZero(), sizeof(size32_t) + sizeof(byte * *));
+        checkAssignOk(translator, ctx, selector, queryZero(), sizeof(size32_t) + sizeof(const byte * *));
 
     OwnedHqlExpr addressSize = getColumnAddress(translator, ctx, selector, sizetType, 0);
     OwnedHqlExpr addressData = getColumnAddress(translator, ctx, selector, queryType(), sizeof(size32_t));

+ 21 - 10
ecl/hqlcpp/hqlwcpp.cpp

@@ -339,6 +339,10 @@ class TypeNameBuilder
 public:
     TypeNameBuilder(const char * name) { typeOnLeft = false; str.append(name); }
 
+    void addConst()
+    {
+        isConst = true;
+    }
     void addPrefix(const char * text)
     {
         if (str.length())
@@ -362,11 +366,17 @@ public:
         return addSuffix().append("[").append(length ? length : 1).append("]");
     }
     
-    void get(StringBuffer & out) { out.append(str); }
+    void get(StringBuffer & out)
+    {
+        if (isConst)
+            out.append("const ");
+        out.append(str);
+    }
 
 protected:
     StringBuffer str;
     bool typeOnLeft;
+    bool isConst = false;
 };
 
 void HqlCppWriter::generateType(StringBuffer & result, ITypeInfo * type, const char * name)
@@ -391,7 +401,7 @@ void HqlCppWriter::generateType(ITypeInfo * type, const char * name)
             switch (tmod)
             {
             case typemod_const:
-//              result.addPrefix("const");
+                result.addConst();
                 break;
             case typemod_outofline:
                 outOfLine = false;
@@ -454,7 +464,7 @@ void HqlCppWriter::generateType(ITypeInfo * type, const char * name)
                     if (isPointer)
                         prefix = "void";
                     else
-                        prefix = "char";
+                        prefix = "byte";
                 }
                 else
                     prefix = "char";
@@ -478,6 +488,8 @@ void HqlCppWriter::generateType(ITypeInfo * type, const char * name)
         case type_sortlist:
             if (hasLinkCountedModifier(fullType))
                 isPointer = true;
+            if (!hasNonconstModifier(fullType))
+                result.addConst();
             prefix = "byte";
             next = NULL;
             break;
@@ -879,7 +891,7 @@ void HqlCppWriter::generateParamCpp(IHqlExpression * param, IHqlExpression * att
         out.append(",");
         break;
     case type_row:
-        isConst = true;
+        isConst = false; // bit of a hack - we forced it on in generateType above, and this avoids duplicates.
         break;
     }
     
@@ -896,8 +908,7 @@ void HqlCppWriter::generateParamCpp(IHqlExpression * param, IHqlExpression * att
             out.append("IRowStream *");
         else if (hasOutOfLineModifier(paramType) || hasLinkCountedModifier(paramType))
         {
-            //At some point in the future this should change to "const byte * const *"
-            out.append("byte * *");
+            out.append("const byte * *");  // Arguably should be const byte * const *
         }
         else
         {
@@ -926,7 +937,7 @@ void HqlCppWriter::generateParamCpp(IHqlExpression * param, IHqlExpression * att
             if(isStringType(childType)) {
                 // process stringn and varstringn specially.
                 if(childType->getSize() > 0) {
-                    out.append("char ");
+                    out.append("const char ");
                     if(paramName) {
                         out.append(paramNameText);
                         nameappended = true;
@@ -938,7 +949,7 @@ void HqlCppWriter::generateParamCpp(IHqlExpression * param, IHqlExpression * att
                 }
                 // Process string and varstring specially
                 else {
-                    out.append("char *");
+                    out.append("const char *");
                     if(paramName) {
                         out.append(paramNameText);
                         nameappended = true;
@@ -948,7 +959,7 @@ void HqlCppWriter::generateParamCpp(IHqlExpression * param, IHqlExpression * att
             }
             else
             {
-                OwnedITypeInfo pointerType = makePointerType(LINK(childType));
+                OwnedITypeInfo pointerType = makeConstantModifier(makePointerType(LINK(childType)));
                 generateType(pointerType, NULL);
             }
             break;
@@ -1033,7 +1044,7 @@ void HqlCppWriter::generateFunctionReturnType(StringBuffer & params, ITypeInfo *
             params.append("size32_t & __countResult,");
     //      if (hasConstModifier(retType))
     //          params.append("const ");
-            params.append("byte * * & __result");
+            params.append("const byte * * & __result");
             if (hasNonNullRecord(retType) && getBoolAttribute(attrs, allocatorAtom, true))
                 params.append(", IEngineRowAllocator * _resultAllocator");
         }

+ 2 - 2
ecl/hthor/hthor.cpp

@@ -9272,10 +9272,10 @@ void CHThorDictionaryResultWriteActivity::execute()
     }
     IHThorGraphResult * result = graph->createResult(helper.querySequence(), LINK(rowAllocator));
     size32_t dictSize = builder.getcount();
-    byte ** dictRows = builder.queryrows();
+    const byte ** dictRows = builder.queryrows();
     for (size32_t row = 0; row < dictSize; row++)
     {
-        byte *thisRow = dictRows[row];
+        const byte *thisRow = dictRows[row];
         if (thisRow)
             LinkRoxieRow(thisRow);
         result->addRowOwn(thisRow);

+ 3 - 3
ecllibrary/std/Date.ecl

@@ -1159,9 +1159,9 @@ END;
  */
 
 EXPORT BOOLEAN IsValidTime(Time_t time) := FUNCTION
-    hourInBounds := (Hour(time) BETWEEN 0 AND 23);
-    minuteInBounds := (Minute(time) BETWEEN 0 AND 59);
-    secondInBounds := (Second(time) BETWEEN 0 AND 59);
+    hourInBounds := (Hour(time) <= 23);
+    minuteInBounds := (Minute(time) <= 59);
+    secondInBounds := (Second(time) <= 59);
 
     RETURN hourInBounds AND minuteInBounds AND secondInBounds;
 END;

+ 1 - 1
plugins/Rembed/Rembed.cpp

@@ -1299,7 +1299,7 @@ public:
             break;
         }
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *row)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *row) override
     {
         // We create a list
         const RtlTypeInfo *typeInfo = metaVal.queryTypeInfo();

+ 1 - 1
plugins/cassandra/cassandraembed.cpp

@@ -1521,7 +1521,7 @@ public:
         RtlFieldStrInfo dummyField("<row>", NULL, typeInfo);
         return typeInfo->build(rowBuilder, 0, &dummyField, cassandraRowBuilder);
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         CassandraRecordBinder binder(logctx, metaVal.queryTypeInfo(), stmtInfo, nextParam);
         binder.processRow(val);

+ 1 - 1
plugins/couchbase/couchbaseembed.cpp

@@ -940,7 +940,7 @@ namespace couchbaseembed
         return typeInfo->build(rowBuilder, 0, &dummyField, couchbaseRowBuilder);
     }
 
-    void CouchbaseEmbedFunctionContext::bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    void CouchbaseEmbedFunctionContext::bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val)
     {
         CouchbaseRecordBinder binder(logctx, metaVal.queryTypeInfo(), m_pQcmd, m_nextParam);
         binder.processRow(val);

+ 1 - 1
plugins/couchbase/couchbaseembed.hpp

@@ -414,7 +414,7 @@ namespace couchbaseembed
            virtual IRowStream * getDatasetResult(IEngineRowAllocator * _resultAllocator);
            virtual byte * getRowResult(IEngineRowAllocator * _resultAllocator);
            virtual size32_t getTransformResult(ARowBuilder & rowBuilder);
-           virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val);
+           virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override;
            virtual void bindDatasetParam(const char *name, IOutputMetaData & metaVal, IRowStream * val);
            virtual void bindBooleanParam(const char *name, bool val);
            virtual void bindDataParam(const char *name, size32_t len, const void *val);

+ 1 - 1
plugins/javaembed/javaembed.cpp

@@ -2922,7 +2922,7 @@ public:
         argsig++;
         addArg(v);
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         if (*argsig != 'L')  // should tell us the type of the object we need to create to pass in
             typeError("RECORD");

+ 1 - 1
plugins/mysql/mysqlembed.cpp

@@ -1475,7 +1475,7 @@ public:
             typeError("row", NULL);  // Check that a single row was returned
         return ret;
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         MySQLRecordBinder binder(metaVal.queryTypeInfo(), stmtInfo->queryInputBindings(), nextParam);
         binder.processRow(val);

+ 1 - 1
plugins/py3embed/py3embed.cpp

@@ -1553,7 +1553,7 @@ public:
         }
         addArg(name, vval.getLink());
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         const RtlTypeInfo *typeInfo = metaVal.queryTypeInfo();
         assertex(typeInfo);

+ 1 - 1
plugins/pyembed/pyembed.cpp

@@ -1542,7 +1542,7 @@ public:
         }
         addArg(name, vval.getLink());
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         const RtlTypeInfo *typeInfo = metaVal.queryTypeInfo();
         assertex(typeInfo);

+ 1 - 1
plugins/sqlite3/sqlite3.cpp

@@ -458,7 +458,7 @@ public:
         RtlFieldStrInfo dummyField("<row>", NULL, typeInfo);
         return typeInfo->build(rowBuilder, 0, &dummyField, sqliteRowBuilder);
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         UNSUPPORTED("Row parameters");  // Probably SHOULD support - see MySQL plugin
     }

+ 1 - 1
plugins/v8embed/v8embed.cpp

@@ -649,7 +649,7 @@ public:
         }
         context->Global()->Set(v8::String::New(name), array);
     }
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val)
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) override
     {
         v8::HandleScope handle_scope;
         const RtlTypeInfo *typeInfo = metaVal.queryTypeInfo();

+ 2 - 2
roxie/ccd/ccdactivities.cpp

@@ -534,11 +534,11 @@ public:
     {
         return queryContext->queryCodeContext()->getResultVarUnicode(name, sequence);
     }
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer)
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override
     {
         return queryContext->queryCodeContext()->getResultRowset(tcount, tgt, name, sequence, _rowAllocator, isGrouped, xmlTransformer, csvTransformer);
     }
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher)
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override
     {
         return queryContext->queryCodeContext()->getResultDictionary(tcount, tgt, _rowAllocator, name, sequence, xmlTransformer, csvTransformer, hasher);
     }

+ 19 - 19
roxie/ccd/ccdcontext.cpp

@@ -754,12 +754,12 @@ CRoxieWorkflowMachine *createRoxieWorkflowMachine(IPropertyTree *_workflowInfo,
 
 //=======================================================================================================================
 
-typedef byte *row_t;
-typedef row_t * rowset_t;
+typedef const byte *row_t;
+typedef const byte ** rowset_t;
 
 class DeserializedDataReader : implements IWorkUnitRowReader, public CInterface
 {
-    const rowset_t data;
+    rowset_t data;
     size32_t count;
     unsigned idx;
 public:
@@ -769,7 +769,7 @@ public:
     {
         idx = 0;
     }
-    virtual const void * nextRow()
+    virtual const void * nextRow() override
     {
         if (idx < count)
         {
@@ -781,7 +781,7 @@ public:
         }
         return NULL;
     }
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt)
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt) override
     {
         tcount = count;
         if (data)
@@ -805,11 +805,11 @@ public:
             rowset_t rows = stored.item(idx);
             if (rows)
             {
-                rtlReleaseRowset(counts.item(idx), (byte**) rows);
+                rtlReleaseRowset(counts.item(idx), rows);
             }
         }
     }
-    virtual int addResult(size32_t count, rowset_t data, IOutputMetaData *meta)
+    virtual int addResult(size32_t count, rowset_t data, IOutputMetaData *meta) override
     {
         SpinBlock b(lock);
         stored.append(data);
@@ -817,16 +817,16 @@ public:
         metas.append(meta);
         return stored.ordinality()-1;
     }
-    virtual void queryResult(int id, size32_t &count, rowset_t &data) const
+    virtual void queryResult(int id, size32_t &count, rowset_t &data) const override
     {
         count = counts.item(id);
         data = stored.item(id);
     }
-    virtual IWorkUnitRowReader *createDeserializedReader(int id) const
+    virtual IWorkUnitRowReader *createDeserializedReader(int id) const override
     {
         return new DeserializedDataReader(counts.item(id), stored.item(id));
     }
-    virtual void serialize(unsigned & tlen, void * & tgt, int id, ICodeContext *codectx) const
+    virtual void serialize(unsigned & tlen, void * & tgt, int id, ICodeContext *codectx) const override
     {
         IOutputMetaData *meta = metas.item(id);
         rowset_t data = stored.item(id);
@@ -870,7 +870,7 @@ public:
 
     }
 
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt)
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt) override
     {
         bool atEOG = true;
         RtlLinkedDatasetBuilder builder(rowAllocator);
@@ -934,7 +934,7 @@ public:
         if (bufferBase)
             free(bufferBase);
     }
-    virtual const void *nextRow()
+    virtual const void *nextRow() override
     {
         if (eof)
             return NULL;
@@ -972,7 +972,7 @@ public:
     {
     }
 
-    virtual bool nextBlock(unsigned & tlen, void * & tgt, void * & base)
+    virtual bool nextBlock(unsigned & tlen, void * & tgt, void * & base) override
     {
         base = tgt = NULL;
         if (xml)
@@ -1004,7 +1004,7 @@ public:
         offset = 0;
     }
 
-    virtual bool nextBlock(unsigned & tlen, void * & tgt, void * & base)
+    virtual bool nextBlock(unsigned & tlen, void * & tgt, void * & base) override
     {
         try
         {
@@ -1073,7 +1073,7 @@ public:
     {
     }
 
-    virtual bool nextBlock(unsigned & tlen, void * & tgt, void * & base)
+    virtual bool nextBlock(unsigned & tlen, void * & tgt, void * & base) override
     {
         tgt = NULL;
         base = NULL;
@@ -1109,7 +1109,7 @@ public:
         rows->first();
     }
 
-    virtual const void *nextRow()
+    virtual const void *nextRow() override
     {
         if (rows->isValid())
         {
@@ -1734,7 +1734,7 @@ public:
             return createRoxieRowAllocator(cache, *rowManager, meta, activityId, id, flags);
     }
 
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * stepname, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer)
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * stepname, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override
     {
         try
         {
@@ -1754,7 +1754,7 @@ public:
         }
     }
 
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher)
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override
     {
         try
         {
@@ -3188,7 +3188,7 @@ public:
             }
         }
     }
-    virtual void appendResultDeserialized(const char *name, unsigned sequence, size32_t count, rowset_t data, bool extend, IOutputMetaData *meta)
+    virtual void appendResultDeserialized(const char *name, unsigned sequence, size32_t count, rowset_t data, bool extend, IOutputMetaData *meta) override
     {
         CriticalBlock b(contextCrit);
         IPropertyTree &ctx = useContext(sequence);

+ 4 - 4
roxie/ccd/ccdcontext.hpp

@@ -38,7 +38,7 @@ class WorkflowMachine;
 interface IWorkUnitRowReader : public IInterface
 {
     virtual const void * nextRow() = 0;
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt) = 0;
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt) = 0;
 };
 
 interface IRoxieServerContext;
@@ -77,7 +77,7 @@ interface IRoxieServerContext : extends IInterface
 {
     virtual IGlobalCodeContext *queryGlobalCodeContext() = 0;
     virtual void setResultXml(const char *name, unsigned sequence, const char *xml) = 0;
-    virtual void appendResultDeserialized(const char *name, unsigned sequence, size32_t count, byte **data, bool extend, IOutputMetaData *meta) = 0;
+    virtual void appendResultDeserialized(const char *name, unsigned sequence, size32_t count, const byte **data, bool extend, IOutputMetaData *meta) = 0;
     virtual void appendResultRawContext(const char *name, unsigned sequence, int len, const void * data, int numRows, bool extend, bool saveInContext) = 0;
     virtual roxiemem::IRowManager &queryRowManager() = 0;
 
@@ -98,8 +98,8 @@ interface IRoxieServerContext : extends IInterface
 
 interface IDeserializedResultStore : public IInterface
 {
-    virtual int addResult(size32_t count, byte **data, IOutputMetaData *meta) = 0;
-    virtual void queryResult(int id, size32_t &count, byte ** &data) const = 0;
+    virtual int addResult(size32_t count, const byte **data, IOutputMetaData *meta) = 0;
+    virtual void queryResult(int id, size32_t &count, const byte ** &data) const = 0;
     virtual IWorkUnitRowReader *createDeserializedReader(int id) const = 0;
     virtual void serialize(unsigned & tlen, void * & tgt, int id, ICodeContext *ctx) const = 0;
 };

+ 9 - 9
roxie/ccd/ccdserver.cpp

@@ -6376,7 +6376,7 @@ public:
 class CGraphResult : implements IGraphResult, public CInterface
 {
     CriticalSection cs;
-    byte **rowset;
+    const byte **rowset;
     size32_t count;
     bool complete;
 
@@ -6398,7 +6398,7 @@ public:
         count = 0;
     }
 
-    CGraphResult(size32_t _count, byte **_rowset)
+    CGraphResult(size32_t _count, const byte **_rowset)
     : count(_count), rowset(_rowset)
     { 
         complete = true;
@@ -6416,7 +6416,7 @@ public:
         return new CGraphResultIterator(this);
     }
 
-    virtual void getLinkedResult(unsigned & countResult, byte * * & result)
+    virtual void getLinkedResult(unsigned & countResult, const byte * * & result) override
     {
         if (!complete)
             throw MakeStringException(ROXIE_GRAPH_PROCESSING_ERROR, "Internal Error: Reading uninitialised graph result"); 
@@ -14676,7 +14676,7 @@ public:
         rowcount = 0;
         curRow = 0;
     }
-    void init(size32_t _rowcount, byte **_rowset)
+    void init(size32_t _rowcount, const byte **_rowset)
     {
         rowset = _rowset;
         rowcount = _rowcount;
@@ -14695,7 +14695,7 @@ public:
         return NULL;
     }
 protected:
-    byte **rowset;
+    const byte **rowset;
     size32_t rowcount;
     size32_t curRow;
 };
@@ -26922,11 +26922,11 @@ public:
     {
         return select(id).createIterator();
     }
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         select(id).getLinkedResult(count, ret);
     }
-    virtual void getDictionaryResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         select(id).getLinkedResult(count, ret);
     }
@@ -27405,11 +27405,11 @@ public:
         doExecute(parentExtractSize, parentExtract);
         return LINK(results);
     }
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         results->getLinkedResult(count, ret, id);
     }
-    virtual void getDictionaryResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         results->getLinkedResult(count, ret, id);
     }

+ 1 - 1
roxie/ccd/ccdserver.hpp

@@ -229,7 +229,7 @@ interface IRoxieServerActivityFactory : extends IActivityFactory
 };
 interface IGraphResult : public IInterface
 {
-    virtual void getLinkedResult(unsigned & countResult, byte * * & result) = 0;
+    virtual void getLinkedResult(unsigned & countResult, const byte * * & result) = 0;
     virtual IEngineRowStream * createIterator() = 0;
     virtual const void * getLinkedRowResult() = 0;
 };

+ 5 - 5
roxie/roxiemem/roxiemem.cpp

@@ -1094,7 +1094,7 @@ void HeapletBase::release(const void *ptr)
 }
 
 
-void HeapletBase::releaseRowset(unsigned count, byte * * rowset)
+void HeapletBase::releaseRowset(unsigned count, const byte * * rowset)
 {
     if (isValidRoxiePtr(rowset))
     {
@@ -1720,7 +1720,7 @@ public:
         }
     }
 
-    virtual void noteReleased(unsigned numRows, byte * * rowset) override
+    virtual void noteReleased(unsigned numRows, const byte * * rowset) override
     {
         checkPtr(rowset, "Release");
 
@@ -2017,7 +2017,7 @@ public:
         }
     }
 
-    virtual void noteReleased(unsigned numRows, byte * * rowset) override
+    virtual void noteReleased(unsigned numRows, const byte * * rowset) override
     {
         char *ptr = (char *) rowset - chunkHeaderSize;
         ChunkHeader * header = (ChunkHeader *)ptr;
@@ -2236,7 +2236,7 @@ public:
         }
     }
 
-    virtual void noteReleased(unsigned numRows, byte * * rowset) override
+    virtual void noteReleased(unsigned numRows, const byte * * rowset) override
     {
         //NORE: See comment on FixedSizeHeaplet::noteReleased() regarding the memory order operands
 
@@ -6361,7 +6361,7 @@ void DataBufferBottom::noteReleased(const void *ptr)
     buffer->noteReleased(ptr);
 }
 
-void DataBufferBottom::noteReleased(unsigned numRows, byte * * rowset)
+void DataBufferBottom::noteReleased(unsigned numRows, const byte * * rowset)
 {
     throwUnexpected();
 }

+ 3 - 3
roxie/roxiemem/roxiemem.hpp

@@ -129,7 +129,7 @@ protected:
     }
 
     virtual void noteReleased(const void *ptr) = 0;
-    virtual void noteReleased(unsigned count, byte * * rowset) = 0;
+    virtual void noteReleased(unsigned count, const byte * * rowset) = 0;
     virtual bool _isShared(const void *ptr) const = 0;
     virtual memsize_t _capacity() const = 0;
     virtual void _setDestructorFlag(const void *ptr) = 0;
@@ -148,7 +148,7 @@ public:
     }
 
     static void release(const void *ptr);
-    static void releaseRowset(unsigned count, byte * * rowset);
+    static void releaseRowset(unsigned count, const byte * * rowset);
     static bool isShared(const void *ptr);
     static void link(const void *ptr);
     static memsize_t capacity(const void *ptr);
@@ -244,7 +244,7 @@ private:
     void released();
 
     virtual void noteReleased(const void *ptr) override;
-    virtual void noteReleased(unsigned count, byte * * rowset) override;
+    virtual void noteReleased(unsigned count, const byte * * rowset) override;
     virtual bool _isShared(const void *ptr) const;
     virtual memsize_t _capacity() const;
     virtual void _setDestructorFlag(const void *ptr);

+ 20 - 20
rtl/eclrtl/eclrtl.cpp

@@ -105,7 +105,7 @@ ECLRTL_API void rtlReleaseRow(const void * row)
     ReleaseRoxieRow(row);
 }
 
-ECLRTL_API void rtlReleaseRowset(unsigned count, byte * * rowset)
+ECLRTL_API void rtlReleaseRowset(unsigned count, const byte * * rowset)
 {
     ReleaseRoxieRowset(count, rowset);
 }
@@ -116,7 +116,7 @@ ECLRTL_API void * rtlLinkRow(const void * row)
     return const_cast<void *>(row);
 }
 
-ECLRTL_API byte * * rtlLinkRowset(byte * * rowset)
+ECLRTL_API const byte * * rtlLinkRowset(const byte * * rowset)
 {
     LinkRoxieRowset(rowset);
     return rowset;
@@ -2785,7 +2785,7 @@ int searchTableStringN(unsigned count, const char * * table, unsigned width, con
     return -1;
 }
 
-int rtlSearchTableStringN(unsigned count, char * * table, unsigned width, const char * search)
+int rtlSearchTableStringN(unsigned count, const char * * table, unsigned width, const char * search)
 {
     int left = 0;
     int right = count;
@@ -2807,7 +2807,7 @@ int rtlSearchTableStringN(unsigned count, char * * table, unsigned width, const
 }
 
 
-int rtlSearchTableVStringN(unsigned count, char * * table, const char * search)
+int rtlSearchTableVStringN(unsigned count, const char * * table, const char * search)
 {
     int left = 0;
     int right = count;
@@ -2825,7 +2825,7 @@ int rtlSearchTableVStringN(unsigned count, char * * table, const char * search)
     return -1;
 }
 
-int rtlNewSearchDataTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search)
+int rtlNewSearchDataTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search)
 {
     int left = 0;
     int right = count;
@@ -2847,7 +2847,7 @@ int rtlNewSearchDataTable(unsigned count, unsigned elemlen, char * * table, unsi
     return -1;
 }
 
-int rtlNewSearchEStringTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search)
+int rtlNewSearchEStringTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search)
 {
     int left = 0;
     int right = count;
@@ -2869,7 +2869,7 @@ int rtlNewSearchEStringTable(unsigned count, unsigned elemlen, char * * table, u
     return -1;
 }
 
-int rtlNewSearchQStringTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search)
+int rtlNewSearchQStringTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search)
 {
     int left = 0;
     int right = count;
@@ -2891,7 +2891,7 @@ int rtlNewSearchQStringTable(unsigned count, unsigned elemlen, char * * table, u
     return -1;
 }
 
-int rtlNewSearchStringTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search)
+int rtlNewSearchStringTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search)
 {
     int left = 0;
     int right = count;
@@ -2915,7 +2915,7 @@ int rtlNewSearchStringTable(unsigned count, unsigned elemlen, char * * table, un
 
 
 #ifdef _USE_ICU
-int rtlNewSearchUnicodeTable(unsigned count, unsigned elemlen, UChar * * table, unsigned width, const UChar * search, const char * locale)
+int rtlNewSearchUnicodeTable(unsigned count, unsigned elemlen, const UChar * * table, unsigned width, const UChar * search, const char * locale)
 {
     UCollator * coll = queryRTLLocale(locale)->queryCollator();
     int left = 0;
@@ -2940,7 +2940,7 @@ int rtlNewSearchUnicodeTable(unsigned count, unsigned elemlen, UChar * * table,
     return -1;
 }
 
-int rtlNewSearchVUnicodeTable(unsigned count, UChar * * table, const UChar * search, const char * locale)
+int rtlNewSearchVUnicodeTable(unsigned count, const UChar * * table, const UChar * search, const char * locale)
 {
     UCollator * coll = queryRTLLocale(locale)->queryCollator();
     int left = 0;
@@ -2965,7 +2965,7 @@ int rtlNewSearchVUnicodeTable(unsigned count, UChar * * table, const UChar * sea
 //-----------------------------------------------------------------------------
 
 template <class T>
-int rtlSearchIntegerTable(unsigned count, T * table, T search)
+int rtlSearchIntegerTable(unsigned count, const T * table, T search)
 {
     int left = 0;
     int right = count;
@@ -2986,22 +2986,22 @@ int rtlSearchIntegerTable(unsigned count, T * table, T search)
 }
 
 
-int rtlSearchTableInteger8(unsigned count, __int64 * table, __int64 search)
+int rtlSearchTableInteger8(unsigned count, const __int64 * table, __int64 search)
 {
     return rtlSearchIntegerTable(count, table, search);
 }
 
-int rtlSearchTableUInteger8(unsigned count, unsigned __int64 * table, unsigned __int64 search)
+int rtlSearchTableUInteger8(unsigned count, const unsigned __int64 * table, unsigned __int64 search)
 {
     return rtlSearchIntegerTable(count, table, search);
 }
 
-int rtlSearchTableInteger4(unsigned count, int * table, int search)
+int rtlSearchTableInteger4(unsigned count, const int * table, int search)
 {
     return rtlSearchIntegerTable(count, table, search);
 }
 
-int rtlSearchTableUInteger4(unsigned count, unsigned  * table, unsigned search)
+int rtlSearchTableUInteger4(unsigned count, const unsigned  * table, unsigned search)
 {
     return rtlSearchIntegerTable(count, table, search);
 }
@@ -5034,7 +5034,7 @@ unsigned rtlCrcUtf8(unsigned length, const char * k, unsigned initval)
     return rtlCrcData(rtlUtf8Size(length, k), k, initval);
 }
 
-int rtlNewSearchUtf8Table(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search, const char * locale)
+int rtlNewSearchUtf8Table(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search, const char * locale)
 {
     //MORE: Hopelessly inefficient....  Should rethink - possibly introducing a class for doing string searching, and the Utf8 variety pre-converting the
     //search strings into unicode.
@@ -5850,7 +5850,7 @@ bool RtlCInterface::Release(void) const
 class RtlRowStream : implements IRowStream, public RtlCInterface
 {
 public:
-    RtlRowStream(size32_t _count, byte * * _rowset) : count(_count), rowset(_rowset)
+    RtlRowStream(size32_t _count, const byte * * _rowset) : count(_count), rowset(_rowset)
     {
         rtlLinkRowset(rowset);
         cur = 0;
@@ -5865,7 +5865,7 @@ public:
     {
         if (cur >= count)
             return NULL;
-        byte * ret = rowset[cur];
+        const byte * ret = rowset[cur];
         cur++;
         rtlLinkRow(ret);
         return ret;
@@ -5878,11 +5878,11 @@ public:
 protected:
     size32_t cur;
     size32_t count;
-    byte * * rowset;
+    const byte * * rowset;
 
 };
 
-ECLRTL_API IRowStream * createRowStream(size32_t count, byte * * rowset)
+ECLRTL_API IRowStream * createRowStream(size32_t count, const byte * * rowset)
 {
     return new RtlRowStream(count, rowset);
 }

+ 23 - 23
rtl/eclrtl/eclrtl.hpp

@@ -175,23 +175,23 @@ ECLRTL_API int rtlVStrToInt4(const char * t);
 ECLRTL_API __int64 rtlVStrToInt8(const char * t);
 ECLRTL_API bool rtlVStrToBool(const char * t);
 
-ECLRTL_API int rtlSearchTableStringN(unsigned count, char * * table, unsigned width, const char * search);
-ECLRTL_API int rtlSearchTableVStringN(unsigned count, char * * table, const char * search);
+ECLRTL_API int rtlSearchTableStringN(unsigned count, const char * * table, unsigned width, const char * search);
+ECLRTL_API int rtlSearchTableVStringN(unsigned count, const char * * table, const char * search);
 
-ECLRTL_API int rtlNewSearchDataTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search);
-ECLRTL_API int rtlNewSearchEStringTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search);
-ECLRTL_API int rtlNewSearchQStringTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search);
-ECLRTL_API int rtlNewSearchStringTable(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search);
+ECLRTL_API int rtlNewSearchDataTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search);
+ECLRTL_API int rtlNewSearchEStringTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search);
+ECLRTL_API int rtlNewSearchQStringTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search);
+ECLRTL_API int rtlNewSearchStringTable(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search);
 
-ECLRTL_API int rtlNewSearchUnicodeTable(unsigned count, unsigned elemlen, UChar * * table, unsigned width, const UChar * search, const char * locale);
-ECLRTL_API int rtlNewSearchVUnicodeTable(unsigned count, UChar * * table, const UChar * search, const char * locale);
-ECLRTL_API int rtlNewSearchUtf8Table(unsigned count, unsigned elemlen, char * * table, unsigned width, const char * search, const char * locale);
+ECLRTL_API int rtlNewSearchUnicodeTable(unsigned count, unsigned elemlen, const UChar * * table, unsigned width, const UChar * search, const char * locale);
+ECLRTL_API int rtlNewSearchVUnicodeTable(unsigned count, const UChar * * table, const UChar * search, const char * locale);
+ECLRTL_API int rtlNewSearchUtf8Table(unsigned count, unsigned elemlen, const char * * table, unsigned width, const char * search, const char * locale);
 
 
-ECLRTL_API int rtlSearchTableInteger8(unsigned count, __int64 * table, __int64 search);
-ECLRTL_API int rtlSearchTableUInteger8(unsigned count, unsigned __int64 * table, unsigned __int64 search);
-ECLRTL_API int rtlSearchTableInteger4(unsigned count, int * table, int search);
-ECLRTL_API int rtlSearchTableUInteger4(unsigned count, unsigned * table, unsigned search);
+ECLRTL_API int rtlSearchTableInteger8(unsigned count, const __int64 * table, __int64 search);
+ECLRTL_API int rtlSearchTableUInteger8(unsigned count, const unsigned __int64 * table, unsigned __int64 search);
+ECLRTL_API int rtlSearchTableInteger4(unsigned count, const int * table, int search);
+ECLRTL_API int rtlSearchTableUInteger4(unsigned count, const unsigned * table, unsigned search);
 
 ECLRTL_API int searchTableStringN(unsigned count, const char * * table, unsigned width, const char * search);
 ECLRTL_API unsigned rtlCrc32(unsigned len, const void * buffer, unsigned crc);
@@ -512,8 +512,8 @@ ECLRTL_API size32_t rtlGetPackedSizeFromFirst(byte first);
 
 ECLRTL_API void rtlReleaseRow(const void * row);
 ECLRTL_API void * rtlLinkRow(const void * row);
-ECLRTL_API void rtlReleaseRowset(unsigned count, byte * * rowset);
-ECLRTL_API byte * * rtlLinkRowset(byte * * rowset);
+ECLRTL_API void rtlReleaseRowset(unsigned count, const byte * * rowset);
+ECLRTL_API const byte * * rtlLinkRowset(const byte * * rowset);
 
 ECLRTL_API void ensureRtlLoaded();      // call this to create a static link to the rtl...
 
@@ -555,9 +555,9 @@ ECLRTL_API void deserializeUnicodeX(size32_t & len, UChar * & data, MemoryBuffer
 ECLRTL_API void deserializeUtf8X(size32_t & len, char * & data, MemoryBuffer &in);
 ECLRTL_API UChar * deserializeVUnicodeX(MemoryBuffer &in);
 ECLRTL_API void deserializeQStrX(size32_t & len, char * & data, MemoryBuffer &out);
-ECLRTL_API void deserializeRowsetX(size32_t & count, byte * * & data, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in);
-ECLRTL_API void deserializeGroupedRowsetX(size32_t & count, byte * * & data, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in);
-ECLRTL_API void deserializeDictionaryX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in);
+ECLRTL_API void deserializeRowsetX(size32_t & count, const byte * * & data, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in);
+ECLRTL_API void deserializeGroupedRowsetX(size32_t & count, const byte * * & data, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in);
+ECLRTL_API void deserializeDictionaryX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in);
 
 ECLRTL_API byte * rtlDeserializeRow(IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, const void * src);
 ECLRTL_API byte * rtlDeserializeBufferRow(IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer & buffer);
@@ -570,10 +570,10 @@ ECLRTL_API void serializeSet(bool isAll, size32_t len, const void * data, Memory
 ECLRTL_API void serializeUnicodeX(size32_t len, const UChar * data, MemoryBuffer &out);
 ECLRTL_API void serializeUtf8X(size32_t len, const char * data, MemoryBuffer &out);
 ECLRTL_API void serializeQStrX(size32_t len, const char * data, MemoryBuffer &out);
-ECLRTL_API void serializeRowsetX(size32_t count, byte * * data, IOutputRowSerializer * serializer, MemoryBuffer &out);
-ECLRTL_API void serializeGroupedRowsetX(size32_t count, byte * * data, IOutputRowSerializer * serializer, MemoryBuffer &out);
+ECLRTL_API void serializeRowsetX(size32_t count, const  byte * * data, IOutputRowSerializer * serializer, MemoryBuffer &out);
+ECLRTL_API void serializeGroupedRowsetX(size32_t count, const byte * * data, IOutputRowSerializer * serializer, MemoryBuffer &out);
 ECLRTL_API void serializeRow(const void * row, IOutputRowSerializer * serializer, MemoryBuffer & out);
-ECLRTL_API void serializeDictionaryX(size32_t count, byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer);
+ECLRTL_API void serializeDictionaryX(size32_t count, const byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer);
 
 ECLRTL_API void serializeFixedString(unsigned len, const char *field, MemoryBuffer &out);
 ECLRTL_API void serializeLPString(unsigned len, const char *field, MemoryBuffer &out);
@@ -786,7 +786,7 @@ interface IRowStream;
 
 //-----------------------------------------------------------------------------
 
-ECLRTL_API IRowStream * createRowStream(size32_t count, byte * * rowset);
+ECLRTL_API IRowStream * createRowStream(size32_t count, const byte * * rowset);
 
 //-----------------------------------------------------------------------------
 struct RtlTypeInfo;
@@ -822,7 +822,7 @@ interface IEmbedFunctionContext : extends IInterface
     virtual IRowStream *getDatasetResult(IEngineRowAllocator * _resultAllocator) = 0;
     virtual byte * getRowResult(IEngineRowAllocator * _resultAllocator) = 0;
     virtual size32_t getTransformResult(ARowBuilder & builder) = 0;
-    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val) = 0;
+    virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, const byte *val) = 0;
     virtual void bindDatasetParam(const char *name, IOutputMetaData & metaVal, IRowStream * val) = 0;
 
     virtual void bindFloatParam(const char *name, float val) = 0;

+ 95 - 95
rtl/eclrtl/rtlds.cpp

@@ -223,14 +223,14 @@ void RtlLimitedVariableDatasetBuilder::flushDataset()
 
 //---------------------------------------------------------------------------
 
-byte * * rtlRowsAttr::linkrows() const      
+const byte * * rtlRowsAttr::linkrows() const
 { 
     if (rows)
         rtlLinkRowset(rows);
     return rows;
 }
 
-void rtlRowsAttr::set(size32_t _count, byte * * _rows)
+void rtlRowsAttr::set(size32_t _count, const byte * * _rows)
 {
     setown(_count, rtlLinkRowset(_rows));
 }
@@ -240,7 +240,7 @@ void rtlRowsAttr::setRow(IEngineRowAllocator * rowAllocator, const byte * _row)
     setown(1, rowAllocator->appendRowOwn(NULL, 1, rowAllocator->linkRow(_row)));
 }
 
-void rtlRowsAttr::setown(size32_t _count, byte * * _rows)
+void rtlRowsAttr::setown(size32_t _count, const byte * * _rows)
 {
     dispose();
     count = _count;
@@ -353,7 +353,7 @@ void RtlLinkedDatasetBuilder::append(const void * source)
     }
 }
 
-void RtlLinkedDatasetBuilder::appendRows(size32_t num, byte * * rows)
+void RtlLinkedDatasetBuilder::appendRows(size32_t num, const byte * * rows)
 {
     if (num && (count < choosenLimit))
     {
@@ -362,10 +362,10 @@ void RtlLinkedDatasetBuilder::appendRows(size32_t num, byte * * rows)
         ensure(count+maxNumToAdd);
         for (unsigned i=0; i < num; i++)
         {
-            byte *row = rows[i];
+            const byte *row = rows[i];
             if (row)
             {
-                rowset[count+numAdded] = (byte *)rowAllocator->linkRow(row);
+                rowset[count+numAdded] = (const byte *) rowAllocator->linkRow(row);
                 numAdded++;
                 if (numAdded == maxNumToAdd)
                     break;
@@ -401,11 +401,11 @@ byte * RtlLinkedDatasetBuilder::createRow()
 class RtlChildRowLinkerWalker : implements IIndirectMemberVisitor
 {
 public:
-    virtual void visitRowset(size32_t count, byte * * rows)
+    virtual void visitRowset(size32_t count, const byte * * rows) override
     {
         rtlLinkRowset(rows);
     }
-    virtual void visitRow(const byte * row)
+    virtual void visitRow(const byte * row) override
     {
         rtlLinkRow(row);
     }
@@ -453,7 +453,7 @@ void RtlLinkedDatasetBuilder::finalizeRow(size32_t rowSize)
     appendOwn(next);
 }
 
-byte * * RtlLinkedDatasetBuilder::linkrows() 
+const byte * * RtlLinkedDatasetBuilder::linkrows()
 { 
     finalizeRows(); 
     return rtlLinkRowset(rowset);
@@ -480,16 +480,16 @@ void RtlLinkedDatasetBuilder::resize(size32_t required)
     max = required;
 }
 
-void appendRowsToRowset(size32_t & targetCount, byte * * & targetRowset, IEngineRowAllocator * rowAllocator, size32_t extraCount, byte * * extraRows)
+void appendRowsToRowset(size32_t & targetCount, const byte * * & targetRowset, IEngineRowAllocator * rowAllocator, size32_t extraCount, const byte * * extraRows)
 {
     if (extraCount)
     {
         size32_t prevCount = targetCount;
-        byte * * expandedRowset = rowAllocator->reallocRows(targetRowset, prevCount, prevCount+extraCount);
+        const byte * * expandedRowset = rowAllocator->reallocRows(targetRowset, prevCount, prevCount+extraCount);
         unsigned numAdded = 0;
         for (unsigned i=0; i < extraCount; i++)
         {
-            byte *extraRow = extraRows[i];
+            const byte *extraRow = extraRows[i];
             if (extraRow)
             {
                 expandedRowset[prevCount+numAdded] = (byte *)rowAllocator->linkRow(extraRow);
@@ -618,7 +618,7 @@ void RtlLinkedDictionaryBuilder::checkSpace()
     else if (usedCount >= usedLimit)
     {
         // Rehash
-        byte * * oldTable = table;
+        const byte * * oldTable = table;
         unsigned oldSize = tableSize;
         table = rowAllocator->createRowset(tableSize*2);
         tableSize = tableSize*2; // Don't update until we have successfully allocated, so that we remain consistent if createRowset throws an exception.
@@ -641,7 +641,7 @@ void RtlLinkedDictionaryBuilder::deserializeRow(IOutputRowDeserializer & deseria
     finalizeRow(rowSize);
 }
 
-void RtlLinkedDictionaryBuilder::appendRows(size32_t num, byte * * rows)
+void RtlLinkedDictionaryBuilder::appendRows(size32_t num, const byte * * rows)
 {
     // MORE - if we know that the source is already a hashtable, we can optimize the add to an empty table...
     for (unsigned i=0; i < num; i++)
@@ -670,7 +670,7 @@ void RtlLinkedDictionaryBuilder::cloneRow(size32_t len, const void * row)
     finalizeRow(len);
 }
 
-extern ECLRTL_API unsigned __int64 rtlDictionaryCount(size32_t tableSize, byte **table)
+extern ECLRTL_API unsigned __int64 rtlDictionaryCount(size32_t tableSize, const byte **table)
 {
     unsigned __int64 ret = 0;
     for (size32_t i = 0; i < tableSize; i++)
@@ -679,7 +679,7 @@ extern ECLRTL_API unsigned __int64 rtlDictionaryCount(size32_t tableSize, byte *
     return ret;
 }
 
-extern ECLRTL_API bool rtlDictionaryExists(size32_t tableSize, byte **table)
+extern ECLRTL_API bool rtlDictionaryExists(size32_t tableSize, const byte **table)
 {
     unsigned __int64 ret = 0;
     for (size32_t i = 0; i < tableSize; i++)
@@ -688,10 +688,10 @@ extern ECLRTL_API bool rtlDictionaryExists(size32_t tableSize, byte **table)
     return false;
 }
 
-extern ECLRTL_API byte *rtlDictionaryLookup(IHThorHashLookupInfo &hashInfo, size32_t tableSize, byte **table, const byte *source, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookup(IHThorHashLookupInfo &hashInfo, size32_t tableSize, const byte **table, const byte *source, const byte *defaultRow)
 {
     if (!tableSize)
-        return (byte *) rtlLinkRow(defaultRow);
+        return (const byte *) rtlLinkRow(defaultRow);
 
     IHash *hash  = hashInfo.queryHashLookup();
     ICompare *compare  = hashInfo.queryCompareLookup();
@@ -700,9 +700,9 @@ extern ECLRTL_API byte *rtlDictionaryLookup(IHThorHashLookupInfo &hashInfo, size
     {
         const void *entry = table[rowidx];
         if (!entry)
-            return (byte *) rtlLinkRow(defaultRow);
+            return (const byte *) rtlLinkRow(defaultRow);
         if (compare->docompare(source, entry)==0)
-            return (byte *) rtlLinkRow(entry);
+            return (const byte *) rtlLinkRow(entry);
         rowidx++;
         if (rowidx==tableSize)
             rowidx = 0;
@@ -711,26 +711,26 @@ extern ECLRTL_API byte *rtlDictionaryLookup(IHThorHashLookupInfo &hashInfo, size
 
 // Optimized cases for common single-field lookups
 
-extern ECLRTL_API byte *rtlDictionaryLookupString(size32_t tableSize, byte **table, size32_t searchLen, const char *searchFor, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookupString(size32_t tableSize, const byte **table, size32_t searchLen, const char *searchFor, const byte *defaultRow)
 {
     if (!tableSize)
-        return (byte *) rtlLinkRow(defaultRow);
+        return (const byte *) rtlLinkRow(defaultRow);
     unsigned hash = rtlHash32Data(rtlTrimStrLen(searchLen, searchFor), searchFor, HASH32_INIT);
     unsigned rowidx = hash % tableSize;
     for (;;)
     {
         const char *entry = (const char *) table[rowidx];
         if (!entry)
-            return (byte *) rtlLinkRow(defaultRow);
+            return (const byte *) rtlLinkRow(defaultRow);
         if (rtlCompareStrStr(searchLen, searchFor, * (size32_t *) entry, entry+sizeof(size32_t))==0)
-            return (byte *) rtlLinkRow(entry);
+            return (const byte *) rtlLinkRow(entry);
         rowidx++;
         if (rowidx==tableSize)
             rowidx = 0;
     }
 }
 
-extern ECLRTL_API byte *rtlDictionaryLookupStringN(size32_t tableSize, byte **table, size32_t N, size32_t searchLen, const char *searchFor, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookupStringN(size32_t tableSize, const byte **table, size32_t N, size32_t searchLen, const char *searchFor, const byte *defaultRow)
 {
     if (!tableSize)
         return (byte *) rtlLinkRow(defaultRow);
@@ -749,83 +749,83 @@ extern ECLRTL_API byte *rtlDictionaryLookupStringN(size32_t tableSize, byte **ta
     }
 }
 
-extern ECLRTL_API byte *rtlDictionaryLookupSigned(size32_t tableSize, byte **table, __int64 searchFor, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookupSigned(size32_t tableSize, const byte **table, __int64 searchFor, const byte *defaultRow)
 {
     if (!tableSize)
-        return (byte *) rtlLinkRow(defaultRow);
+        return (const byte *) rtlLinkRow(defaultRow);
     unsigned hash = rtlHash32Data8(&searchFor, HASH32_INIT);
     unsigned rowidx = hash % tableSize;
     for (;;)
     {
         const void *entry = table[rowidx];
         if (!entry)
-            return (byte *) rtlLinkRow(defaultRow);
+            return (const byte *) rtlLinkRow(defaultRow);
         if (* (__int64 *) entry == searchFor)
-            return (byte *) rtlLinkRow(entry);
+            return (const byte *) rtlLinkRow(entry);
         rowidx++;
         if (rowidx==tableSize)
             rowidx = 0;
     }
 }
 
-extern ECLRTL_API byte *rtlDictionaryLookupUnsigned(size32_t tableSize, byte **table, __uint64 searchFor, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookupUnsigned(size32_t tableSize, const byte **table, __uint64 searchFor, const byte *defaultRow)
 {
     if (!tableSize)
-        return (byte *) rtlLinkRow(defaultRow);
+        return (const byte *) rtlLinkRow(defaultRow);
     unsigned hash = rtlHash32Data8(&searchFor, HASH32_INIT);
     unsigned rowidx = hash % tableSize;
     for (;;)
     {
         const void *entry = table[rowidx];
         if (!entry)
-            return (byte *) rtlLinkRow(defaultRow);
+            return (const byte *) rtlLinkRow(defaultRow);
         if (* (__uint64 *) entry == searchFor)
-            return (byte *) rtlLinkRow(entry);
+            return (const byte *) rtlLinkRow(entry);
         rowidx++;
         if (rowidx==tableSize)
             rowidx = 0;
     }
 }
 
-extern ECLRTL_API byte *rtlDictionaryLookupSignedN(size32_t tableSize, byte **table, size32_t size, __int64 searchFor, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookupSignedN(size32_t tableSize, const byte **table, size32_t size, __int64 searchFor, const byte *defaultRow)
 {
     if (!tableSize)
-        return (byte *) rtlLinkRow(defaultRow);
+        return (const byte *) rtlLinkRow(defaultRow);
     unsigned hash = rtlHash32Data8(&searchFor, HASH32_INIT);
     unsigned rowidx = hash % tableSize;
     for (;;)
     {
         const void *entry = table[rowidx];
         if (!entry)
-            return (byte *) rtlLinkRow(defaultRow);
+            return (const byte *) rtlLinkRow(defaultRow);
         if (rtlReadInt(entry, size) == searchFor)
-            return (byte *) rtlLinkRow(entry);
+            return (const byte *) rtlLinkRow(entry);
         rowidx++;
         if (rowidx==tableSize)
             rowidx = 0;
     }
 }
 
-extern ECLRTL_API byte *rtlDictionaryLookupUnsignedN(size32_t tableSize, byte **table, size32_t size, __uint64 searchFor, byte *defaultRow)
+extern ECLRTL_API const byte *rtlDictionaryLookupUnsignedN(size32_t tableSize, const byte **table, size32_t size, __uint64 searchFor, const byte *defaultRow)
 {
     if (!tableSize)
-        return (byte *) rtlLinkRow(defaultRow);
+        return (const byte *) rtlLinkRow(defaultRow);
     unsigned hash = rtlHash32Data8(&searchFor, HASH32_INIT);
     unsigned rowidx = hash % tableSize;
     for (;;)
     {
         const void *entry = table[rowidx];
         if (!entry)
-            return (byte *) rtlLinkRow(defaultRow);
+            return (const byte *) rtlLinkRow(defaultRow);
         if (rtlReadUInt(entry, size) == searchFor)
-            return (byte *) rtlLinkRow(entry);
+            return (const byte *) rtlLinkRow(entry);
         rowidx++;
         if (rowidx==tableSize)
             rowidx = 0;
     }
 }
 
-extern ECLRTL_API bool rtlDictionaryLookupExists(IHThorHashLookupInfo &hashInfo, size32_t tableSize, byte **table, const byte *source)
+extern ECLRTL_API bool rtlDictionaryLookupExists(IHThorHashLookupInfo &hashInfo, size32_t tableSize, const byte **table, const byte *source)
 {
     if (!tableSize)
         return false;
@@ -848,7 +848,7 @@ extern ECLRTL_API bool rtlDictionaryLookupExists(IHThorHashLookupInfo &hashInfo,
 
 // Optimized exists cases for common single-field lookups
 
-extern ECLRTL_API bool rtlDictionaryLookupExistsString(size32_t tableSize, byte **table, size32_t searchLen, const char *searchFor)
+extern ECLRTL_API bool rtlDictionaryLookupExistsString(size32_t tableSize, const byte **table, size32_t searchLen, const char *searchFor)
 {
     if (!tableSize)
         return false;
@@ -867,7 +867,7 @@ extern ECLRTL_API bool rtlDictionaryLookupExistsString(size32_t tableSize, byte
     }
 }
 
-extern ECLRTL_API bool rtlDictionaryLookupExistsStringN(size32_t tableSize, byte **table, size32_t N, size32_t searchLen, const char *searchFor)
+extern ECLRTL_API bool rtlDictionaryLookupExistsStringN(size32_t tableSize, const byte **table, size32_t N, size32_t searchLen, const char *searchFor)
 {
     if (!tableSize)
         return false;
@@ -886,7 +886,7 @@ extern ECLRTL_API bool rtlDictionaryLookupExistsStringN(size32_t tableSize, byte
     }
 }
 
-extern ECLRTL_API bool rtlDictionaryLookupExistsSigned(size32_t tableSize, byte **table, __int64 searchFor)
+extern ECLRTL_API bool rtlDictionaryLookupExistsSigned(size32_t tableSize, const byte **table, __int64 searchFor)
 {
     if (!tableSize)
         return false;
@@ -905,7 +905,7 @@ extern ECLRTL_API bool rtlDictionaryLookupExistsSigned(size32_t tableSize, byte
     }
 }
 
-extern ECLRTL_API bool rtlDictionaryLookupExistsUnsigned(size32_t tableSize, byte **table, __uint64 searchFor)
+extern ECLRTL_API bool rtlDictionaryLookupExistsUnsigned(size32_t tableSize, const byte **table, __uint64 searchFor)
 {
     if (!tableSize)
         return false;
@@ -924,7 +924,7 @@ extern ECLRTL_API bool rtlDictionaryLookupExistsUnsigned(size32_t tableSize, byt
     }
 }
 
-extern ECLRTL_API bool rtlDictionaryLookupExistsSignedN(size32_t tableSize, byte **table, size32_t size, __int64 searchFor)
+extern ECLRTL_API bool rtlDictionaryLookupExistsSignedN(size32_t tableSize, const byte **table, size32_t size, __int64 searchFor)
 {
     if (!tableSize)
         return false;
@@ -943,7 +943,7 @@ extern ECLRTL_API bool rtlDictionaryLookupExistsSignedN(size32_t tableSize, byte
     }
 }
 
-extern ECLRTL_API bool rtlDictionaryLookupExistsUnsignedN(size32_t tableSize, byte **table, size32_t size, __uint64 searchFor)
+extern ECLRTL_API bool rtlDictionaryLookupExistsUnsignedN(size32_t tableSize, const byte **table, size32_t size, __uint64 searchFor)
 {
     if (!tableSize)
         return false;
@@ -1052,11 +1052,11 @@ inline void doDeserializeRowset(RtlLinkedDatasetBuilder & builder, IOutputRowDes
     }
 }
 
-inline void doSerializeRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows, bool isGrouped)
+inline void doSerializeRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows, bool isGrouped)
 {
     for (unsigned i=0; i < count; i++)
     {
-        byte *row = rows[i];
+        const byte *row = rows[i];
         if (row)
         {
             serializer->serialize(out, rows[i]);
@@ -1074,17 +1074,17 @@ inline void doSerializeRowset(IRowSerializerTarget & out, IOutputRowSerializer *
 }
 
 
-inline void doSerializeRowsetStripNulls(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+inline void doSerializeRowsetStripNulls(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     for (unsigned i=0; i < count; i++)
     {
-        byte *row = rows[i];
+        const byte *row = rows[i];
         if (row)
             serializer->serialize(out, rows[i]);
     }
 }
 
-inline void doDeserializeRowset(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, offset_t marker, IRowDeserializerSource & in, bool isGrouped)
+inline void doDeserializeRowset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, offset_t marker, IRowDeserializerSource & in, bool isGrouped)
 {
     RtlLinkedDatasetBuilder builder(_rowAllocator);
 
@@ -1095,7 +1095,7 @@ inline void doDeserializeRowset(size32_t & count, byte * * & rowset, IEngineRowA
 }
 
 
-inline void doDeserializeChildRowset(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in, bool isGrouped)
+inline void doDeserializeChildRowset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in, bool isGrouped)
 {
     offset_t marker = in.beginNested();
     doDeserializeRowset(count, rowset, _rowAllocator, deserializer, marker, in, isGrouped);
@@ -1105,26 +1105,26 @@ inline void doDeserializeChildRowset(size32_t & count, byte * * & rowset, IEngin
 //--------------------------------------------------------------------------------------------------------------------
 //Serialize/deserialize functions call for child datasets in the row serializer
 
-extern ECLRTL_API void rtlDeserializeChildRowset(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in)
+extern ECLRTL_API void rtlDeserializeChildRowset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in)
 {
     doDeserializeChildRowset(count, rowset, _rowAllocator, deserializer, in, false);
 }
 
 
-extern ECLRTL_API void rtlDeserializeChildGroupedRowset(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in)
+extern ECLRTL_API void rtlDeserializeChildGroupedRowset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in)
 {
     doDeserializeChildRowset(count, rowset, _rowAllocator, deserializer, in, true);
 }
 
 
-void rtlSerializeChildRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeChildRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     size32_t marker = out.beginNested(count);
     doSerializeRowset(out, serializer, count, rows, false);
     out.endNested(marker);
 }
 
-void rtlSerializeChildGroupedRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeChildGroupedRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     size32_t marker = out.beginNested(count);
     doSerializeRowset(out, serializer, count, rows, true);
@@ -1134,27 +1134,27 @@ void rtlSerializeChildGroupedRowset(IRowSerializerTarget & out, IOutputRowSerial
 //--------------------------------------------------------------------------------------------------------------------
 //Serialize/deserialize functions used to serialize data from the master to the slave (defined in eclrtl.hpp)  to/from a MemoryBuffer
 
-extern void deserializeRowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in)
+extern void deserializeRowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in)
 {
     Owned<ISerialStream> stream = createMemoryBufferSerialStream(in);
     CThorStreamDeserializerSource rowSource(stream);
     doDeserializeChildRowset(count, rowset, _rowAllocator, deserializer, rowSource, false);
 }
 
-extern void deserializeGroupedRowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in)
+extern void deserializeGroupedRowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in)
 {
     Owned<ISerialStream> stream = createMemoryBufferSerialStream(in);
     CThorStreamDeserializerSource rowSource(stream);
     doDeserializeChildRowset(count, rowset, _rowAllocator, deserializer, rowSource, true);
 }
 
-extern void serializeRowsetX(size32_t count, byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer)
+extern void serializeRowsetX(size32_t count, const byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer)
 {
     CMemoryBufferSerializeTarget out(buffer);
     rtlSerializeChildRowset(out, serializer, count, rows);
 }
 
-extern void serializeGroupedRowsetX(size32_t count, byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer)
+extern void serializeGroupedRowsetX(size32_t count, const byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer)
 {
     CMemoryBufferSerializeTarget out(buffer);
     rtlSerializeChildGroupedRowset(out, serializer, count, rows);
@@ -1164,7 +1164,7 @@ extern void serializeGroupedRowsetX(size32_t count, byte * * rows, IOutputRowSer
 //--------------------------------------------------------------------------------------------------------------------
 // Functions for converting between different representations - where the source/target are complete datasets
 
-inline void doDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src, bool isGrouped)
+inline void doDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src, bool isGrouped)
 {
     Owned<ISerialStream> stream = createMemorySerialStream(src, lenSrc);
     CThorStreamDeserializerSource source(stream);
@@ -1172,23 +1172,23 @@ inline void doDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAll
     doDeserializeRowset(count, rowset, rowAllocator, deserializer, lenSrc, source, isGrouped);
 }
 
-extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src, bool isGrouped)
+extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src, bool isGrouped)
 {
     doDataset2RowsetX(count, rowset, rowAllocator, deserializer, lenSrc, src, isGrouped);
 }
 
-extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src)
+extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src)
 {
     doDataset2RowsetX(count, rowset, rowAllocator, deserializer, lenSrc, src, false);
 }
 
-extern ECLRTL_API void rtlGroupedDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src)
+extern ECLRTL_API void rtlGroupedDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src)
 {
     doDataset2RowsetX(count, rowset, rowAllocator, deserializer, lenSrc, src, true);
 }
 
 
-inline void doRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows, bool isGrouped)
+inline void doRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows, bool isGrouped)
 {
     MemoryBuffer buffer;
     CMemoryBufferSerializeTarget out(buffer);
@@ -1200,17 +1200,17 @@ inline void doRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerialize
     tgt = buffer.detach();      // not strictly speaking correct - it should have been allocated with rtlMalloc();
 }
 
-extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows, bool isGrouped)
+extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows, bool isGrouped)
 {
     doRowset2DatasetX(tlen, tgt, serializer, count, rows, isGrouped);
 }
 
-extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     doRowset2DatasetX(tlen, tgt, serializer, count, rows, false);
 }
 
-extern ECLRTL_API void rtlGroupedRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlGroupedRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     doRowset2DatasetX(tlen, tgt, serializer, count, rows, true);
 }
@@ -1267,7 +1267,7 @@ extern ECLRTL_API size32_t rtlSerializeToBuilder(ARowBuilder & builder, IOutputR
 
 //--------------------------------------------------------------------------------------------------------------------
 
-static void doSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+static void doSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     out.put(sizeof(count), &count);
     size32_t idx = 0;
@@ -1279,7 +1279,7 @@ static void doSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializ
         out.put(1, &numRows);
         for (int i = 0; i < numRows; i++)
         {
-            byte *nextrec = rows[idx+i];
+            const byte *nextrec = rows[idx+i];
             assert(nextrec);
             serializer->serialize(out, nextrec);
         }
@@ -1292,7 +1292,7 @@ static void doSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializ
     }
 }
 
-static void doDeserializeDictionary(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, offset_t marker, IRowDeserializerSource & in)
+static void doDeserializeDictionary(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, offset_t marker, IRowDeserializerSource & in)
 {
     RtlLinkedDatasetBuilder builder(rowAllocator);
 
@@ -1317,7 +1317,7 @@ static void doDeserializeDictionary(size32_t & count, byte * * & rowset, IEngine
 }
 
 
-static void doDeserializeDictionaryFromDataset(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, offset_t marker, IRowDeserializerSource & in)
+static void doDeserializeDictionaryFromDataset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, offset_t marker, IRowDeserializerSource & in)
 {
     RtlLinkedDictionaryBuilder builder(rowAllocator, &hashInfo);
 
@@ -1328,57 +1328,57 @@ static void doDeserializeDictionaryFromDataset(size32_t & count, byte * * & rows
     rowset = builder.linkrows();
 }
 
-extern ECLRTL_API void rtlSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     doSerializeDictionary(out, serializer, count, rows);
 }
 
-extern ECLRTL_API void rtlSerializeDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     doSerializeRowsetStripNulls(out, serializer, count, rows);
 }
 
-extern ECLRTL_API void rtlDeserializeChildDictionary(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in)
+extern ECLRTL_API void rtlDeserializeChildDictionary(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in)
 {
     offset_t marker = in.beginNested(); // MORE: Would this be better as a count?
     doDeserializeDictionary(count, rowset, rowAllocator, deserializer, marker, in);
 }
 
-extern ECLRTL_API void rtlDeserializeChildDictionaryFromDataset(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, IRowDeserializerSource & in)
+extern ECLRTL_API void rtlDeserializeChildDictionaryFromDataset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, IRowDeserializerSource & in)
 {
     offset_t marker = in.beginNested(); // MORE: Would this be better as a count?
     doDeserializeDictionaryFromDataset(count, rowset, rowAllocator, deserializer, hashInfo, marker, in);
 }
 
-extern ECLRTL_API void rtlSerializeChildDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeChildDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     size32_t marker = out.beginNested(count);
     doSerializeDictionary(out, serializer, count, rows);
     out.endNested(marker);
 }
 
-extern ECLRTL_API void rtlSerializeChildDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeChildDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     size32_t marker = out.beginNested(count);
     doSerializeRowsetStripNulls(out, serializer, count, rows);
     out.endNested(marker);
 }
 
-extern void deserializeDictionaryX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in)
+extern void deserializeDictionaryX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, MemoryBuffer &in)
 {
     Owned<ISerialStream> stream = createMemoryBufferSerialStream(in);
     CThorStreamDeserializerSource rowSource(stream);
     rtlDeserializeChildDictionary(count, rowset, _rowAllocator, deserializer, rowSource);
 }
 
-extern void serializeDictionaryX(size32_t count, byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer)
+extern void serializeDictionaryX(size32_t count, const byte * * rows, IOutputRowSerializer * serializer, MemoryBuffer & buffer)
 {
     CMemoryBufferSerializeTarget out(buffer);
     rtlSerializeChildDictionary(out, serializer, count, rows);
 }
 
 
-extern ECLRTL_API void rtlDeserializeDictionary(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src)
+extern ECLRTL_API void rtlDeserializeDictionary(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src)
 {
     Owned<ISerialStream> stream = createMemorySerialStream(src, lenSrc);
     CThorStreamDeserializerSource in(stream);
@@ -1387,7 +1387,7 @@ extern ECLRTL_API void rtlDeserializeDictionary(size32_t & count, byte * * & row
 }
 
 
-extern ECLRTL_API void rtlDeserializeDictionaryFromDataset(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, size32_t lenSrc, const void * src)
+extern ECLRTL_API void rtlDeserializeDictionaryFromDataset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, size32_t lenSrc, const void * src)
 {
     Owned<ISerialStream> stream = createMemorySerialStream(src, lenSrc);
     CThorStreamDeserializerSource in(stream);
@@ -1395,7 +1395,7 @@ extern ECLRTL_API void rtlDeserializeDictionaryFromDataset(size32_t & count, byt
     doDeserializeDictionaryFromDataset(count, rowset, rowAllocator, deserializer, hashInfo, lenSrc, in);
 }
 
-extern ECLRTL_API void rtlSerializeDictionary(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeDictionary(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     MemoryBuffer buffer;
     CMemoryBufferSerializeTarget out(buffer);
@@ -1407,7 +1407,7 @@ extern ECLRTL_API void rtlSerializeDictionary(unsigned & tlen, void * & tgt, IOu
     tgt = buffer.detach();      // not strictly speaking correct - it should have been allocated with rtlMalloc();
 }
 
-extern ECLRTL_API void rtlSerializeDictionaryToDataset(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows)
+extern ECLRTL_API void rtlSerializeDictionaryToDataset(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows)
 {
     MemoryBuffer buffer;
     CMemoryBufferSerializeTarget out(buffer);
@@ -1586,7 +1586,7 @@ const byte * RtlVariableDatasetCursor::select(unsigned idx)
 
 //---------------------------------------------------------------------------
 
-RtlLinkedDatasetCursor::RtlLinkedDatasetCursor(unsigned _numRows, byte * * _rows) : numRows(_numRows), rows(_rows)
+RtlLinkedDatasetCursor::RtlLinkedDatasetCursor(unsigned _numRows, const byte * * _rows) : numRows(_numRows), rows(_rows)
 {
     cur = (unsigned)-1;
 }
@@ -1598,7 +1598,7 @@ RtlLinkedDatasetCursor::RtlLinkedDatasetCursor()
     cur = (unsigned)-1;
 }
 
-void RtlLinkedDatasetCursor::init(unsigned _numRows, byte * * _rows)
+void RtlLinkedDatasetCursor::init(unsigned _numRows, const byte * * _rows)
 {
     numRows = _numRows;
     rows = _rows;
@@ -1637,7 +1637,7 @@ const byte * RtlLinkedDatasetCursor::select(unsigned idx)
 
 //---------------------------------------------------------------------------
 
-RtlSafeLinkedDatasetCursor::RtlSafeLinkedDatasetCursor(unsigned _numRows, byte * * _rows)
+RtlSafeLinkedDatasetCursor::RtlSafeLinkedDatasetCursor(unsigned _numRows, const byte * * _rows)
 {
     init(_numRows, _rows);
 }
@@ -1647,7 +1647,7 @@ RtlSafeLinkedDatasetCursor::~RtlSafeLinkedDatasetCursor()
     ReleaseRoxieRowset(numRows, rows);
 }
 
-void RtlSafeLinkedDatasetCursor::init(unsigned _numRows, byte * * _rows)
+void RtlSafeLinkedDatasetCursor::init(unsigned _numRows, const byte * * _rows)
 {
     ReleaseRoxieRowset(numRows, rows);
     numRows = _numRows;
@@ -1744,7 +1744,7 @@ RtlCompoundIterator::~RtlCompoundIterator()
 }
 
 
-void RtlCompoundIterator::addIter(unsigned idx, IRtlDatasetSimpleCursor * iter, byte * * cursor)
+void RtlCompoundIterator::addIter(unsigned idx, IRtlDatasetSimpleCursor * iter, const byte * * cursor)
 {
     assertex(idx < numLevels);
     iters[idx] = iter;
@@ -1755,7 +1755,7 @@ void RtlCompoundIterator::init(unsigned _numLevels)
 {
     numLevels = _numLevels;
     iters = new IRtlDatasetSimpleCursor * [numLevels];
-    cursors = new byte * * [numLevels];
+    cursors = new const byte * * [numLevels];
 }
 
 //Could either duplicate this function, N times, or have it as a helper function that accesses pre-defined virtuals.
@@ -1814,7 +1814,7 @@ bool RtlCompoundIterator::next(unsigned level)
 
 //------------------------------------------------------------------------------
 
-void RtlSimpleIterator::addIter(unsigned idx, IRtlDatasetSimpleCursor * _iter, byte * * _cursor)
+void RtlSimpleIterator::addIter(unsigned idx, IRtlDatasetSimpleCursor * _iter, const byte * * _cursor)
 {
     assertex(idx == 0);
     iter = _iter;
@@ -1825,14 +1825,14 @@ void RtlSimpleIterator::addIter(unsigned idx, IRtlDatasetSimpleCursor * _iter, b
 bool RtlSimpleIterator::first()
 {
     const byte * cur = iter->first();
-    *cursor = (byte *)cur;
+    *cursor = cur;
     return (cur != NULL);
 }
 
 bool RtlSimpleIterator::next()
 {
     const byte * cur = iter->next();
-    *cursor = (byte *)cur;
+    *cursor = cur;
     return (cur != NULL);
 }
 

+ 65 - 65
rtl/eclrtl/rtlds_imp.hpp

@@ -177,18 +177,18 @@ public:
 
     inline void clear()                 { dispose(); rows = NULL; }
 
-    inline byte * * * addrrows()        { clear(); return &rows; }
+    inline const byte * * * addrrows()  { clear(); return &rows; }
 
-    inline byte * * queryrows() const   { return rows; }
+    inline const byte * * queryrows() const   { return rows; }
     inline unsigned querycount() const  { return count; }
 
-    byte * * linkrows() const;
+    const byte * * linkrows() const;
 
-    inline byte * * & refrows()         { clear(); return rows; }
+    inline const byte * * & refrows()   { clear(); return rows; }
 
-    void set(size32_t _count, byte * * _rows);
+    void set(size32_t _count, const byte * * _rows);
     void setRow(IEngineRowAllocator * rowAllocator, const byte * row);
-    void setown(size32_t _count, byte * * _rows);
+    void setown(size32_t _count, const byte * * _rows);
 
 protected:
     void dispose();
@@ -202,7 +202,7 @@ public:
     unsigned count;
 
 protected:
-    byte * * rows;
+    const byte * * rows;
 };
 
 //---------------------------------------------------------------------------
@@ -356,7 +356,7 @@ public:
     ~RtlLinkedDatasetBuilder();
 
     void append(const void * source);
-    void appendRows(size32_t num, byte * * rows);
+    void appendRows(size32_t num, const byte * * rows);
     inline void appendEOG() { appendOwn(NULL); }
     byte * createRow();
     void cloneRow(size32_t len, const void * ptr);
@@ -370,8 +370,8 @@ public:
     inline RtlDynamicRowBuilder & rowBuilder() { return builder; }
     inline void ensure(size32_t required) { if (required > max) expand(required); }
     inline size32_t getcount() { finalizeRows(); return count; }
-    byte * * linkrows();
-    inline byte * * queryrows() { finalizeRows(); return rowset; }
+    const byte * * linkrows();
+    inline const byte * * queryrows() { finalizeRows(); return rowset; }
     void appendOwn(const void * row);
 
     inline byte * row() const { return builder.row(); }
@@ -379,7 +379,7 @@ public:
 protected:
     IEngineRowAllocator * rowAllocator;
     RtlDynamicRowBuilder builder;
-    byte * * rowset;
+    const byte * * rowset;
     size32_t count;
     size32_t max;
     size32_t choosenLimit;
@@ -394,10 +394,10 @@ public:
 
     void append(const void * source);
     void appendOwn(const void * source);
-    void appendRows(size32_t num, byte * * rows);
+    void appendRows(size32_t num, const byte * * rows);
 
     inline size32_t getcount() { return tableSize; }
-    inline byte * * linkrows() { return rtlLinkRowset(table); }
+    inline const byte * * linkrows() { return rtlLinkRowset(table); }
 
     byte * createRow()         { return builder.getSelf(); }
     void finalizeRow(size32_t len);
@@ -413,8 +413,8 @@ public:
 
     inline void ensure(size32_t required) { if (required > max) expand(required); }
     */
-    inline byte * * queryrows() { return table; }
-    inline byte * row() const { return builder.row(); }
+    inline const byte * * queryrows() { return table; }
+    inline const byte * row() const { return builder.row(); }
 
 protected:
     void checkSpace();
@@ -425,68 +425,68 @@ protected:
     IHash *hash;
     ICompare *compare;
     RtlDynamicRowBuilder builder;
-    byte * * table;
+    const byte * * table;
     size32_t usedCount;
     size32_t usedLimit;
     size32_t initialSize;
     size32_t tableSize;
 };
 
-extern ECLRTL_API unsigned __int64 rtlDictionaryCount(size32_t tableSize, byte **table);
-extern ECLRTL_API bool rtlDictionaryExists(size32_t tableSize, byte **table);
-extern ECLRTL_API byte *rtlDictionaryLookup(IHThorHashLookupInfo &hashInfo, size32_t tableSize, byte **table, const byte *source, byte *defaultRow);
-extern ECLRTL_API byte *rtlDictionaryLookupString(size32_t tableSize, byte **table, size32_t len, const char *source, byte *defaultRow);
-extern ECLRTL_API byte *rtlDictionaryLookupStringN(size32_t tableSize, byte **table, size32_t N, size32_t len, const char *source, byte *defaultRow);
-extern ECLRTL_API byte *rtlDictionaryLookupSigned(size32_t tableSize, byte **table, __int64 source, byte *defaultRow);
-extern ECLRTL_API byte *rtlDictionaryLookupUnsigned(size32_t tableSize, byte **table, __uint64 source, byte *defaultRow);
-extern ECLRTL_API byte *rtlDictionaryLookupSignedN(size32_t tableSize, byte **table, size32_t size, __int64 source, byte *defaultRow);
-extern ECLRTL_API byte *rtlDictionaryLookupUnsignedN(size32_t tableSize, byte **table, size32_t size, __uint64 source, byte *defaultRow);
+extern ECLRTL_API unsigned __int64 rtlDictionaryCount(size32_t tableSize, const byte **table);
+extern ECLRTL_API bool rtlDictionaryExists(size32_t tableSize, const byte **table);
+extern ECLRTL_API const byte *rtlDictionaryLookup(IHThorHashLookupInfo &hashInfo, size32_t tableSize, const byte **table, const byte *source, const byte *defaultRow);
+extern ECLRTL_API const byte *rtlDictionaryLookupString(size32_t tableSize, const byte **table, size32_t len, const char *source, const byte *defaultRow);
+extern ECLRTL_API const byte *rtlDictionaryLookupStringN(size32_t tableSize, const byte **table, size32_t N, size32_t len, const char *source, const byte *defaultRow);
+extern ECLRTL_API const byte *rtlDictionaryLookupSigned(size32_t tableSize, const byte **table, __int64 source, const byte *defaultRow);
+extern ECLRTL_API const byte *rtlDictionaryLookupUnsigned(size32_t tableSize, const byte **table, __uint64 source, const byte *defaultRow);
+extern ECLRTL_API const byte *rtlDictionaryLookupSignedN(size32_t tableSize, const byte **table, size32_t size, __int64 source, const byte *defaultRow);
+extern ECLRTL_API const byte *rtlDictionaryLookupUnsignedN(size32_t tableSize, const byte **table, size32_t size, __uint64 source, const byte *defaultRow);
 
-extern ECLRTL_API bool rtlDictionaryLookupExists(IHThorHashLookupInfo &hashInfo, size32_t tableSize, byte **table, const byte *source);
-extern ECLRTL_API bool rtlDictionaryLookupExistsString(size32_t tableSize, byte **table, size32_t len, const char *source);
-extern ECLRTL_API bool rtlDictionaryLookupExistsStringN(size32_t tableSize, byte **table, size32_t N, size32_t len, const char *source);
-extern ECLRTL_API bool rtlDictionaryLookupExistsSigned(size32_t tableSize, byte **table, __int64 source);
-extern ECLRTL_API bool rtlDictionaryLookupExistsUnsigned(size32_t tableSize, byte **table, __uint64 source);
-extern ECLRTL_API bool rtlDictionaryLookupExistsSignedN(size32_t tableSize, byte **table, size32_t size, __uint64 source);
-extern ECLRTL_API bool rtlDictionaryLookupExistsUnsignedN(size32_t tableSize, byte **table, size32_t size, __uint64 source);
+extern ECLRTL_API bool rtlDictionaryLookupExists(IHThorHashLookupInfo &hashInfo, size32_t tableSize, const byte **table, const byte *source);
+extern ECLRTL_API bool rtlDictionaryLookupExistsString(size32_t tableSize, const byte **table, size32_t len, const char *source);
+extern ECLRTL_API bool rtlDictionaryLookupExistsStringN(size32_t tableSize, const byte **table, size32_t N, size32_t len, const char *source);
+extern ECLRTL_API bool rtlDictionaryLookupExistsSigned(size32_t tableSize, const byte **table, __int64 source);
+extern ECLRTL_API bool rtlDictionaryLookupExistsUnsigned(size32_t tableSize, const byte **table, __uint64 source);
+extern ECLRTL_API bool rtlDictionaryLookupExistsSignedN(size32_t tableSize, const byte **table, size32_t size, __int64 source);
+extern ECLRTL_API bool rtlDictionaryLookupExistsUnsignedN(size32_t tableSize, const byte **table, size32_t size, __uint64 source);
 
-extern ECLRTL_API void appendRowsToRowset(size32_t & targetCount, byte * * & targetRowset, IEngineRowAllocator * rowAllocator, size32_t count, byte * * rows);
+extern ECLRTL_API void appendRowsToRowset(size32_t & targetCount, const byte * * & targetRowset, IEngineRowAllocator * rowAllocator, size32_t count, const byte * * rows);
 
 
 //Functions that are used to convert between the serialized and internal memory format
 //functions containing child also serialize the length of the dataset, functions without it pass it independently
 
-extern ECLRTL_API void rtlDeserializeChildRowset(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in);
-extern ECLRTL_API void rtlDeserializeChildGroupRowset(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in);
-extern ECLRTL_API void rtlSerializeChildRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
-extern ECLRTL_API void rtlSerializeChildGroupRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
+extern ECLRTL_API void rtlDeserializeChildRowset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in);
+extern ECLRTL_API void rtlDeserializeChildGroupedRowset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in);
+extern ECLRTL_API void rtlSerializeChildRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
+extern ECLRTL_API void rtlSerializeChildGroupedRowset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
 
 //Functions for converting between rowsets and complete datasets (where length is known)
-extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src, bool isGrouped);
-extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows, bool isGrouped);
+extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src, bool isGrouped);
+extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows, bool isGrouped);
 
-extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src);
-extern ECLRTL_API void rtlGroupedDataset2RowsetX(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src);
-extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
-extern ECLRTL_API void rtlGroupedRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
+extern ECLRTL_API void rtlDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src);
+extern ECLRTL_API void rtlGroupedDataset2RowsetX(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src);
+extern ECLRTL_API void rtlRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
+extern ECLRTL_API void rtlGroupedRowset2DatasetX(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
 
 extern ECLRTL_API size32_t rtlDeserializeToBuilder(ARowBuilder & builder, IOutputRowDeserializer * deserializer, const void * src);
 extern ECLRTL_API size32_t rtlSerializeToBuilder(ARowBuilder & builder, IOutputRowSerializer * serializer, const void * src);
 
 //Dictionary serialization/deserialization
-extern ECLRTL_API void rtlDeserializeDictionary(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src);
-extern ECLRTL_API void rtlDeserializeDictionaryFromDataset(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, size32_t lenSrc, const void * src);
-extern ECLRTL_API void rtlSerializeDictionary(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
-extern ECLRTL_API void rtlSerializeDictionaryToDataset(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
+extern ECLRTL_API void rtlDeserializeDictionary(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, size32_t lenSrc, const void * src);
+extern ECLRTL_API void rtlDeserializeDictionaryFromDataset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, size32_t lenSrc, const void * src);
+extern ECLRTL_API void rtlSerializeDictionary(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
+extern ECLRTL_API void rtlSerializeDictionaryToDataset(unsigned & tlen, void * & tgt, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
 
-extern ECLRTL_API void rtlSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
-extern ECLRTL_API void rtlSerializeDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
+extern ECLRTL_API void rtlSerializeDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
+extern ECLRTL_API void rtlSerializeDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
 
 //Dictionary serialization/deserialization to a stream - includes length prefix
-extern ECLRTL_API void rtlDeserializeChildDictionary(size32_t & count, byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in);
-extern ECLRTL_API void rtlDeserializeChildDictionaryFromDataset(size32_t & count, byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, IRowDeserializerSource & in);
-extern ECLRTL_API void rtlSerializeChildDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
-extern ECLRTL_API void rtlSerializeChildDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, byte * * rows);
+extern ECLRTL_API void rtlDeserializeChildDictionary(size32_t & count, const byte * * & rowset, IEngineRowAllocator * _rowAllocator, IOutputRowDeserializer * deserializer, IRowDeserializerSource & in);
+extern ECLRTL_API void rtlDeserializeChildDictionaryFromDataset(size32_t & count, const byte * * & rowset, IEngineRowAllocator * rowAllocator, IOutputRowDeserializer * deserializer, IHThorHashLookupInfo & hashInfo, IRowDeserializerSource & in);
+extern ECLRTL_API void rtlSerializeChildDictionary(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
+extern ECLRTL_API void rtlSerializeChildDictionaryToDataset(IRowSerializerTarget & out, IOutputRowSerializer * serializer, size32_t count, const byte * * rows);
 
 //---------------------------------------------------------------------------
 
@@ -551,11 +551,11 @@ protected:
 class ECLRTL_API RtlLinkedDatasetCursor : public ARtlDatasetCursor
 {
 public:
-    RtlLinkedDatasetCursor(unsigned _numRows, byte * * _rows);
+    RtlLinkedDatasetCursor(unsigned _numRows, const byte * * _rows);
     RtlLinkedDatasetCursor();
 
-    void setDataset(unsigned _numRows, byte * * _rows) { init(_numRows, _rows); }
-    void init(unsigned _numRows, byte * * _rows);
+    void setDataset(unsigned _numRows, const byte * * _rows) { init(_numRows, _rows); }
+    void init(unsigned _numRows, const byte * * _rows);
 
     inline size32_t count() { return numRows; }
     inline bool exists() { return numRows != 0; }
@@ -567,7 +567,7 @@ public:
     bool isValid();
 
 protected:
-    byte * * rows;
+    const byte * * rows;
     unsigned numRows;
     unsigned cur;
 };
@@ -578,12 +578,12 @@ protected:
 class ECLRTL_API RtlSafeLinkedDatasetCursor : public RtlLinkedDatasetCursor
 {
 public:
-    RtlSafeLinkedDatasetCursor(unsigned _numRows, byte * * _rows);
+    RtlSafeLinkedDatasetCursor(unsigned _numRows, const byte * * _rows);
     RtlSafeLinkedDatasetCursor() {}
     ~RtlSafeLinkedDatasetCursor();
 
-    void setDataset(unsigned _numRows, byte * * _rows) { init(_numRows, _rows); }
-    void init(unsigned _numRows, byte * * _rows);
+    void setDataset(unsigned _numRows, const byte * * _rows) { init(_numRows, _rows); }
+    void init(unsigned _numRows, const byte * * _rows);
 
 };
 
@@ -627,7 +627,7 @@ public:
     ~RtlCompoundIterator();
 
     void init(unsigned numLevels);
-    void addIter(unsigned idx, IRtlDatasetSimpleCursor * iter, byte * * cursor);
+    void addIter(unsigned idx, IRtlDatasetSimpleCursor * iter, const byte * * cursor);
     bool first(unsigned level);
     bool next(unsigned level);
 
@@ -638,12 +638,12 @@ public:
 protected:
     inline void setCursor(unsigned level, const void * value)
     {
-        *cursors[level] = (byte *)value;
+        *cursors[level] = (const byte *) value;
     }
 
 protected:
     IRtlDatasetSimpleCursor * * iters;
-    byte * * * cursors;
+    const byte * * * cursors;
     unsigned numLevels;
     bool ok;
 };
@@ -653,7 +653,7 @@ protected:
 class ECLRTL_API RtlSimpleIterator
 {
 public:
-    void addIter(unsigned idx, IRtlDatasetSimpleCursor * iter, byte * * cursor);
+    void addIter(unsigned idx, IRtlDatasetSimpleCursor * iter, const byte * * cursor);
     bool first();
     bool next();
 
@@ -661,7 +661,7 @@ public:
 
 protected:
     IRtlDatasetSimpleCursor * iter;
-    byte * * cursor;
+    const byte * * cursor;
 };
 
 #endif

+ 4 - 4
rtl/eclrtl/rtldynfield.cpp

@@ -868,10 +868,10 @@ public:
                 case match_link:
                 {
                     // a 32-bit record count, and a (linked) pointer to an array of record pointers
-                    byte *dest = builder.ensureCapacity(offset+sizeof(size32_t)+sizeof(byte **), field->name)+offset;
+                    byte *dest = builder.ensureCapacity(offset+sizeof(size32_t)+sizeof(const byte **), field->name)+offset;
                     *(size32_t *)dest = *(size32_t *)source;
-                    *(byte ***)(dest + sizeof(size32_t)) = rtlLinkRowset(*(byte ***)(source + sizeof(size32_t)));
-                    offset += sizeof(size32_t)+sizeof(byte **);
+                    *(const byte ***)(dest + sizeof(size32_t)) = rtlLinkRowset(*(const byte ***)(source + sizeof(size32_t)));
+                    offset += sizeof(size32_t)+sizeof(const byte **);
                     break;
                 }
                 case match_recurse:
@@ -886,7 +886,7 @@ public:
                         size32_t sizeInBytes = sizeof(size32_t) + sizeof(void *);
                         builder.ensureCapacity(offset+sizeInBytes, field->name);
                         size32_t numRows = 0;
-                        byte **childRows = nullptr;
+                        const byte **childRows = nullptr;
                         if (sourceType->isLinkCounted())
                         {
                             // a 32-bit count, then a pointer to the source rows

+ 1 - 1
rtl/eclrtl/rtlfield.cpp

@@ -1981,7 +1981,7 @@ size32_t RtlDatasetTypeInfo::build(ARowBuilder &builder, size32_t offset, const
         builder.ensureCapacity(offset+sizeInBytes, field->name);
         size32_t numRows = 0;
         Owned<IEngineRowAllocator> childAllocator = builder.queryAllocator()->createChildRowAllocator(child);
-        byte **childRows = NULL;
+        const byte **childRows = NULL;
         RtlFieldStrInfo dummyField("<nested row>", NULL, child);
         while (source.processNextRow(field))
         {

+ 1 - 1
rtl/eclrtl/rtlrecord.hpp

@@ -158,7 +158,7 @@ public:
     virtual byte * next()                                   { return (byte *)iter.next(); }
     virtual void init(const void * parentRecord) = 0;
 
-    inline void setDataset(unsigned _numRows, byte * * _rows) { iter.setDataset(_numRows, _rows); }
+    inline void setDataset(unsigned _numRows, const byte * * _rows) { iter.setDataset(_numRows, _rows); }
 
 protected:
     RtlSafeLinkedDatasetCursor  iter;

+ 11 - 11
rtl/include/eclhelper.hpp

@@ -244,11 +244,11 @@ interface IOutputRowDeserializer;
 class CRuntimeStatisticCollection;
 interface IEngineRowAllocator : extends IInterface
 {
-    virtual byte * * createRowset(unsigned _numItems) = 0;
-    virtual byte * * linkRowset(byte * * rowset) = 0;
-    virtual void releaseRowset(unsigned count, byte * * rowset) = 0;
-    virtual byte * * appendRowOwn(byte * * rowset, unsigned newRowCount, void * row) = 0;
-    virtual byte * * reallocRows(byte * * rowset, unsigned oldRowCount, unsigned newRowCount) = 0;
+    virtual const byte * * createRowset(unsigned _numItems) = 0;
+    virtual const byte * * linkRowset(const byte * * rowset) = 0;
+    virtual void releaseRowset(unsigned count, const byte * * rowset) = 0;
+    virtual const byte * * appendRowOwn(const byte * * rowset, unsigned newRowCount, void * row) = 0;
+    virtual const byte * * reallocRows(const byte * * rowset, unsigned oldRowCount, unsigned newRowCount) = 0;
 
     virtual void * createRow() = 0;
     virtual void releaseRow(const void * row) = 0;
@@ -463,7 +463,7 @@ enum
 
 interface IIndirectMemberVisitor
 {
-    virtual void visitRowset(size32_t count, byte * * rows) = 0;
+    virtual void visitRowset(size32_t count, const byte * * rows) = 0;
     virtual void visitRow(const byte * row) = 0;
     //MORE: add new functions if anything else is implemented out of line (e.g., strings)
 };
@@ -563,8 +563,8 @@ interface IResourceContext
 //Provided by engine=>can extent
 interface IEclGraphResults : public IInterface
 {
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id) = 0;
-    virtual void getDictionaryResult(size32_t & tcount, byte * * & tgt, unsigned id) = 0;
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) = 0;
+    virtual void getDictionaryResult(size32_t & tcount, const byte * * & tgt, unsigned id) = 0;
     virtual const void * getLinkedRowResult(unsigned id) = 0;
 };
 
@@ -598,12 +598,12 @@ interface ICodeContext : public IResourceContext
     virtual bool getResultBool(const char * name, unsigned sequence) = 0;
     virtual void getResultData(unsigned & tlen, void * & tgt, const char * name, unsigned sequence) = 0;
     virtual void getResultDecimal(unsigned tlen, int precision, bool isSigned, void * tgt, const char * stepname, unsigned sequence) = 0;
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) = 0;
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) = 0;
     virtual void getResultRaw(unsigned & tlen, void * & tgt, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) = 0;
     virtual void getResultSet(bool & isAll, size32_t & tlen, void * & tgt, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) = 0;
     virtual __int64 getResultInt(const char * name, unsigned sequence) = 0;
     virtual double getResultReal(const char * name, unsigned sequence) = 0;
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) = 0;
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) = 0;
     virtual void getResultString(unsigned & tlen, char * & tgt, const char * name, unsigned sequence) = 0;
     virtual void getResultStringF(unsigned tlen, char * tgt, const char * name, unsigned sequence) = 0;
     virtual void getResultUnicode(unsigned & tlen, UChar * & tgt, const char * name, unsigned sequence) = 0;
@@ -1510,7 +1510,7 @@ struct IHThorRawIteratorArg : public IHThorArg
 
 struct IHThorLinkedRawIteratorArg : public IHThorArg
 {
-    virtual byte * next() = 0;
+    virtual const byte * next() = 0;
 };
 
 

+ 5 - 5
rtl/include/eclhelper_base.hpp

@@ -3480,27 +3480,27 @@ protected:
 class CLibraryConstantRawIteratorArg : public CThorLinkedRawIteratorArg
 {
 public:
-    inline CLibraryConstantRawIteratorArg(unsigned _numRows, byte * * _rows, IOutputMetaData * _meta)
+    inline CLibraryConstantRawIteratorArg(unsigned _numRows, const byte * * _rows, IOutputMetaData * _meta)
         : meta(_meta), numRows(_numRows), rows(_rows)
     {
         cur = 0;
     }
 
-    virtual void onStart(const byte *, MemoryBuffer * ) { cur = 0U; }
+    virtual void onStart(const byte *, MemoryBuffer * ) override { cur = 0U; }
 
-    virtual byte * next()
+    virtual const byte * next() override
     {
         if (cur < numRows)
             return rows[cur++];
         return NULL;
     }
 
-    virtual IOutputMetaData * queryOutputMeta() { return meta; }
+    virtual IOutputMetaData * queryOutputMeta() override { return meta; }
 
 protected:
     unsigned numRows;
     IOutputMetaData * meta;
-    byte * * rows;
+    const byte * * rows;
     unsigned cur;
 };
 

+ 1 - 1
system/jlib/jcomp.cpp

@@ -80,7 +80,7 @@ static const char * LIBFLAG_DEBUG[] = { "/MDd", "" };
 static const char * LIBFLAG_RELEASE[] = { "/MD", "" };
 static const char * COMPILE_ONLY[] = { "/c", "-c" };
 
-static const char * CC_OPTION_CORE[] = { "", "-fvisibility=hidden -DUSE_VISIBILITY=1" };
+static const char * CC_OPTION_CORE[] = { "", "-std=c++11 -fvisibility=hidden -DUSE_VISIBILITY=1 -Werror -Wno-tautological-compare" };
 static const char * LINK_OPTION_CORE[] = { "/DLL /libpath:." , "" };
 static const char * CC_OPTION_DEBUG[] = { "/Zm500 /EHsc /GR /Zi /nologo /bigobj", "-g -fPIC  -O0" };
 

+ 1 - 1
testing/regress/ecl/streamread.ecl

@@ -80,7 +80,7 @@ linkcounted dataset(outRecord) doReadRows(const varstring name) := EMBED(C++ : d
     #body
     //Can return constant allocations as roxie rows
     __countResult = 4;
-    __result = (byte * *)rows2;
+    __result = (const byte * *)rows2;
 ENDEMBED;
 
 

+ 2 - 2
thorlcr/activities/loop/thloopslave.cpp

@@ -782,10 +782,10 @@ public:
         IThorResult *result = graph->createResult(*this, helper->querySequence(), this, resultType);
         Owned<IRowWriter> resultWriter = result->getWriter();
         size32_t dictSize = builder.getcount();
-        byte ** dictRows = builder.queryrows();
+        const byte ** dictRows = builder.queryrows();
         for (size32_t row = 0; row < dictSize; row++)
         {
-            byte *thisRow = dictRows[row];
+            const byte *thisRow = dictRows[row];
             if (thisRow)
                 LinkThorRow(thisRow);
             resultWriter->putRow(thisRow);

+ 4 - 4
thorlcr/graph/thgraph.cpp

@@ -177,7 +177,7 @@ public:
         len = mb.length();
         data = mb.detach();
     }
-    virtual void getLinkedResult(unsigned &countResult, byte * * & result)
+    virtual void getLinkedResult(unsigned &countResult, const byte * * & result) override
     {
         assertex(rowStreamCount==((unsigned)rowStreamCount)); // catch, just in case
         Owned<IRowStream> stream = getRowStream();
@@ -189,7 +189,7 @@ public:
             OwnedConstThorRow row = stream->nextRow();
             rowset[countResult++] = row.getClear();
         }
-        result = (byte **)_rowset.getClear();
+        result = (const byte **)_rowset.getClear();
     }
     virtual const void * getLinkedRowResult()
     {
@@ -2101,13 +2101,13 @@ IThorResult *CGraphBase::createGraphLoopResult(CActivityBase &activity, IThorRow
 }
 
 // IEclGraphResults
-void CGraphBase::getDictionaryResult(unsigned & count, byte * * & ret, unsigned id)
+void CGraphBase::getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id)
 {
     Owned<IThorResult> result = getResult(id, true); // will get collated distributed result
     result->getLinkedResult(count, ret);
 }
 
-void CGraphBase::getLinkedResult(unsigned & count, byte * * & ret, unsigned id)
+void CGraphBase::getLinkedResult(unsigned & count, const byte * * & ret, unsigned id)
 {
     Owned<IThorResult> result = getResult(id, true); // will get collated distributed result
     result->getLinkedResult(count, ret);

+ 9 - 10
thorlcr/graph/thgraph.hpp

@@ -117,7 +117,7 @@ interface IThorResult : extends IInterface
     virtual CActivityBase *queryActivity() = 0;
     virtual bool isDistributed() const = 0;
     virtual void serialize(MemoryBuffer &mb) = 0;
-    virtual void getLinkedResult(unsigned & count, byte * * & ret) = 0;
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret) = 0;
     virtual const void * getLinkedRowResult() = 0;
 };
 
@@ -543,8 +543,8 @@ class graph_decl CGraphBase : public CGraphStub, implements IEclGraphResults
         virtual const IContextLogger &queryContextLogger() const { return ctx->queryContextLogger(); }
         virtual IEngineRowAllocator * getRowAllocator(IOutputMetaData * meta, unsigned activityId) const { return ctx->getRowAllocator(meta, activityId); }
         virtual IEngineRowAllocator * getRowAllocatorEx(IOutputMetaData * meta, unsigned activityId, unsigned heapFlags) const { return ctx->getRowAllocatorEx(meta, activityId, heapFlags); }
-        virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { ctx->getResultRowset(tcount, tgt, name, sequence, _rowAllocator, isGrouped, xmlTransformer, csvTransformer); }
-        virtual void getResultDictionary(size32_t & tcount, byte * * & tgt,IEngineRowAllocator * _rowAllocator,  const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) { ctx->getResultDictionary(tcount, tgt, _rowAllocator, name, sequence, xmlTransformer, csvTransformer, hasher); }
+        virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override { ctx->getResultRowset(tcount, tgt, name, sequence, _rowAllocator, isGrouped, xmlTransformer, csvTransformer); }
+        virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt,IEngineRowAllocator * _rowAllocator,  const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override { ctx->getResultDictionary(tcount, tgt, _rowAllocator, name, sequence, xmlTransformer, csvTransformer, hasher); }
 
         virtual void getRowXML(size32_t & lenResult, char * & result, IOutputMetaData & info, const void * row, unsigned flags) { convertRowToXML(lenResult, result, info, row, flags); }
         virtual void getRowJSON(size32_t & lenResult, char * & result, IOutputMetaData & info, const void * row, unsigned flags) { convertRowToJSON(lenResult, result, info, row, flags); }
@@ -753,13 +753,13 @@ public:
     virtual IThorResult *createGraphLoopResult(CActivityBase &activity, IThorRowInterfaces *rowIf, ThorGraphResultType resultType, unsigned spillPriority=SPILL_PRIORITY_RESULT);
 
 // IEclGraphResults
-    virtual void getDictionaryResult(unsigned & count, byte * * & ret, unsigned id);
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id);
+    virtual void getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id) override;
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) override;
     virtual const void * getLinkedRowResult(unsigned id);
 
 // IThorChildGraph
 //  virtual void getResult(size32_t & retSize, void * & ret, unsigned id);
-//  virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id);
+//  virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id);
     virtual IEclGraphResults *evaluate(unsigned parentExtractSz, const byte * parentExtract);
 
 friend class CGraphElementBase;
@@ -1173,8 +1173,7 @@ protected:
         virtual bool isDistributed() const { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
         virtual void serialize(MemoryBuffer &mb) { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
         virtual void getResult(size32_t & retSize, void * & ret) { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
-        virtual void getLinkedResult(unsigned & count, byte * * & ret) { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
-        virtual void getDictionaryResult(unsigned & count, byte * * & ret) { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
+        virtual void getLinkedResult(unsigned & count, const byte * * & ret) override { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
         virtual const void * getLinkedRowResult() { throw MakeStringException(0, "Graph Result %d accessed before it is created", id); }
     };
     IArrayOf<IThorResult> results;
@@ -1223,12 +1222,12 @@ public:
             results.append(*LINK(result));
     }
     virtual unsigned count() { return results.ordinality(); }
-    virtual void getLinkedResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         Owned<IThorResult> result = getResult(id, true);
         result->getLinkedResult(count, ret);
     }
-    virtual void getDictionaryResult(unsigned & count, byte * * & ret, unsigned id)
+    virtual void getDictionaryResult(unsigned & count, const byte * * & ret, unsigned id) override
     {
         Owned<IThorResult> result = getResult(id, true);
         result->getLinkedResult(count, ret);

+ 3 - 3
thorlcr/graph/thgraphmaster.cpp

@@ -1091,7 +1091,7 @@ public:
             throw MakeStringException(TE_FailedToRetrieveWorkunitValue, "Failed to retrieve external data hash %s from workunit %s", stepname, wuid);
         }
     }
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * stepname, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * stepname, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override
     {
         tgt = NULL;
         PROTECTED_GETRESULT(stepname, sequence, "Rowset", "rowset",
@@ -1104,7 +1104,7 @@ public:
             rtlDataset2RowsetX(tcount, tgt, _rowAllocator, deserializer, datasetBuffer.length(), datasetBuffer.toByteArray(), isGrouped);
         );
     }
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * stepname, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override
     {
         tcount = 0;
         tgt = NULL;
@@ -2074,7 +2074,7 @@ public:
         ensure();
         result->serialize(mb);
     }
-    virtual void getLinkedResult(unsigned & count, byte * * & ret)
+    virtual void getLinkedResult(unsigned & count, const byte * * & ret) override
     {
         ensure();
         result->getLinkedResult(count, ret);

+ 2 - 2
thorlcr/graph/thgraphslave.cpp

@@ -1404,8 +1404,8 @@ public:
         return superfiletransaction.get();
     }
     virtual void getResultStringF(unsigned tlen, char * tgt, const char * name, unsigned sequence) { throwUnexpected(); }
-    virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
-    virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) { throwUnexpected(); }
+    virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override { throwUnexpected(); }
+    virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override { throwUnexpected(); }
     virtual void addWuAssertFailure(unsigned code, const char * text, const char * filename, unsigned lineno, unsigned column, bool isAbort)
     {
         DBGLOG("%s", text);

+ 2 - 2
tools/wutool/wutool.cpp

@@ -1788,12 +1788,12 @@ protected:
             virtual bool getResultBool(const char * name, unsigned sequence) { throwUnexpected(); }
             virtual void getResultData(unsigned & tlen, void * & tgt, const char * name, unsigned sequence) { throwUnexpected(); }
             virtual void getResultDecimal(unsigned tlen, int precision, bool isSigned, void * tgt, const char * stepname, unsigned sequence) { throwUnexpected(); }
-            virtual void getResultDictionary(size32_t & tcount, byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) { throwUnexpected(); }
+            virtual void getResultDictionary(size32_t & tcount, const byte * * & tgt, IEngineRowAllocator * _rowAllocator, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer, IHThorHashLookupInfo * hasher) override { throwUnexpected(); }
             virtual void getResultRaw(unsigned & tlen, void * & tgt, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
             virtual void getResultSet(bool & isAll, size32_t & tlen, void * & tgt, const char * name, unsigned sequence, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
             virtual __int64 getResultInt(const char * name, unsigned sequence) { throwUnexpected(); }
             virtual double getResultReal(const char * name, unsigned sequence) { throwUnexpected(); }
-            virtual void getResultRowset(size32_t & tcount, byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) { throwUnexpected(); }
+            virtual void getResultRowset(size32_t & tcount, const byte * * & tgt, const char * name, unsigned sequence, IEngineRowAllocator * _rowAllocator, bool isGrouped, IXmlToRowTransformer * xmlTransformer, ICsvToRowTransformer * csvTransformer) override { throwUnexpected(); }
             virtual void getResultString(unsigned & tlen, char * & tgt, const char * name, unsigned sequence) { throwUnexpected(); }
             virtual void getResultStringF(unsigned tlen, char * tgt, const char * name, unsigned sequence) { throwUnexpected(); }
             virtual void getResultUnicode(unsigned & tlen, UChar * & tgt, const char * name, unsigned sequence) { throwUnexpected(); }