Bladeren bron

HPCC-12785 Update based on review

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Anthony Fishbeck 10 jaren geleden
bovenliggende
commit
0661bd431d

+ 2 - 2
common/fileview2/fvresultset.cpp

@@ -3309,11 +3309,11 @@ extern FILEVIEW_API void writeFullWorkUnitResults(const char *username, const ch
 
             writer.outputBeginNested(getSeverityTagname(severity, flags), false);
             if (code)
-                writer.outputUInt(code, 0, "Code");
+                writer.outputUInt(code, sizeof(unsigned), "Code");
             if (filename.length())
                 writer.outputCString(filename.str(), "Filename");
             if (lineno)
-                writer.outputUInt(lineno, 0, "Line");
+                writer.outputUInt(lineno, sizeof(unsigned), "Line");
 
             writer.outputCString(src.str(), "Source");
             writer.outputCString(msg.str(), "Message");

+ 16 - 16
common/thorhelper/roxiedebug.cpp

@@ -851,7 +851,7 @@ void CBreakpointInfo::toXML(IXmlWriter *output) const
     }
     if (rowCount)
     {
-        output->outputInt(rowCount, 0, "@rowCount");
+        output->outputInt(rowCount, sizeof(int), "@rowCount");
         output->outputCString(BreakpointCountModes[rowCountMode], "@rowCountMode"); 
     }
     ForEachItemIn(edgeIdx, activeEdges)
@@ -906,14 +906,14 @@ void DebugActivityRecord::outputProperties(IXmlWriter *output)
     {
         output->outputBeginNested("att", false); 
         output->outputCString("localTime", "@name"); 
-        output->outputUInt((unsigned) (cycle_to_nanosec(localCycles)/1000), 0, "@value");
+        output->outputUInt((unsigned) (cycle_to_nanosec(localCycles)/1000), sizeof(unsigned), "@value");
         output->outputEndNested("att");
     }
     if (totalCycles)
     {
         output->outputBeginNested("att", false); 
         output->outputCString("totalTime", "@name"); 
-        output->outputUInt((unsigned) (cycle_to_nanosec(totalCycles)/1000), 0, "@value");
+        output->outputUInt((unsigned) (cycle_to_nanosec(totalCycles)/1000), sizeof(unsigned), "@value");
         output->outputEndNested("att");
     }
 }
@@ -1321,7 +1321,7 @@ void CBaseDebugContext::deserialize(MemoryBuffer &buff)
 void CBaseServerDebugContext::doStandardResult(IXmlWriter *output) const
 {
     const char *stateString = running ? "running" : queryStateString(currentState);
-    output->outputInt(sequence, 0, "@sequence");
+    output->outputInt(sequence, sizeof(int), "@sequence");
     output->outputString(strlen(stateString), stateString, "@state");
     if (currentNode)
         currentNode->outputId(output, "@nodeId");
@@ -1331,7 +1331,7 @@ void CBaseServerDebugContext::doStandardResult(IXmlWriter *output) const
         output->outputBool(true, "@skip");
     if (currentGraph)
         output->outputCString(currentGraph->queryGraphName(), "@graphId");
-    output->outputInt(graphChangeSequence, 0, "@graphSequenceNum");
+    output->outputInt(graphChangeSequence, sizeof(int), "@graphSequenceNum");
     if (graphChangeSequence != prevGraphChangeSequence)
         output->outputBool(true, "@graphChanged");
     if (currentBreakpointUID != (unsigned) -1)
@@ -1343,7 +1343,7 @@ void CBaseServerDebugContext::doStandardResult(IXmlWriter *output) const
     {
         output->outputBeginNested("Exception", true);
         output->outputCString("Roxie", "Source");
-        output->outputInt(currentException->errorCode(), 0, "Code");
+        output->outputInt(currentException->errorCode(), sizeof(int), "Code");
         StringBuffer s;
         currentException->errorMessage(s);
         output->outputString(s.length(), s.str(), "Message");
@@ -1356,7 +1356,7 @@ void CBaseServerDebugContext::_listBreakpoint(IXmlWriter *output, IBreakpointInf
     if (bp.queryMode() != BreakpointModeNone)
     {
         output->outputBeginNested("break", true);
-        output->outputInt(idx, 0, "@idx");
+        output->outputInt(idx, sizeof(int), "@idx");
         bp.toXML(output);
         output->outputEndNested("break");
     }
@@ -1699,7 +1699,7 @@ void CBaseServerDebugContext::debugCounts(IXmlWriter *output, unsigned sinceSequ
         {
             output->outputBeginNested("edge", true);
             output->outputCString((const char *) edges.query().getKey(), "@edgeId");
-            output->outputUInt(edge->queryCount(), 0, "@count");
+            output->outputUInt(edge->queryCount(), sizeof(unsigned), "@count");
             output->outputEndNested("edge");
         }
         if (reset)
@@ -1803,7 +1803,7 @@ void CBaseServerDebugContext::debugGetConfig(IXmlWriter *output, const char *nam
     }
     else if (stricmp(name, "stopOnLimits")==0)
     {
-        output->outputInt(stopOnLimits, 0, "@value");
+        output->outputInt(stopOnLimits, sizeof(int), "@value");
     }
     else if (stricmp(name, "historySize")==0)
     {
@@ -1814,11 +1814,11 @@ void CBaseServerDebugContext::debugGetConfig(IXmlWriter *output, const char *nam
             IActivityDebugContext *activityCtx = currentGraph->lookupActivityByEdgeId(id);
             if (!activityCtx)
                 throw MakeStringException(THORHELPER_DEBUG_ERROR, "Edge %s not found in current graph", id);
-            output->outputInt(activityCtx->queryHistoryCapacity(), 0, "@value");
+            output->outputInt(activityCtx->queryHistoryCapacity(), sizeof(int), "@value");
         }
         else
         {
-            output->outputInt(defaultHistoryCapacity, 0, "@value");
+            output->outputInt(defaultHistoryCapacity, sizeof(int), "@value");
         }
     }
     else
@@ -1996,7 +1996,7 @@ void CBaseDebugGraphManager::outputLinksForChildGraph(IXmlWriter *output, const
         StringBuffer idText;
         idText.append(childNode->idText).append('_').append(parentId);
         output->outputCString(idText.str(), "@id"); // MORE - is this guaranteed to be unique?
-        output->outputBeginNested("att", false); output->outputCString("_childGraph", "@name"); output->outputInt(1, 0, "@value"); output->outputEndNested("att");
+        output->outputBeginNested("att", false); output->outputCString("_childGraph", "@name"); output->outputInt(1, sizeof(int), "@value"); output->outputEndNested("att");
         output->outputBeginNested("att", false); output->outputCString("_sourceActivity", "@name"); childNode->outputId(output, "@value"); output->outputEndNested("att"); // MORE!!!
         output->outputBeginNested("att", false); output->outputCString("_targetActivity", "@name"); output->outputCString(parentId, "@value"); output->outputEndNested("att");
         output->outputEndNested("edge");
@@ -2028,20 +2028,20 @@ void CBaseDebugGraphManager::outputChildGraph(IXmlWriter *output, unsigned seque
                 output->outputString(kindStr.length(), kindStr.str(), "@shortlabel");
                 if (node->activity->isPassThrough())
                 {
-                    output->outputBeginNested("att", false); output->outputCString("_isPassthrough", "@name"); output->outputInt(1, 0, "@value"); output->outputEndNested("att");
+                    output->outputBeginNested("att", false); output->outputCString("_isPassthrough", "@name"); output->outputInt(1, sizeof(int), "@value"); output->outputEndNested("att");
                 }
                 if (node->totalCycles)
                 {
                     output->outputBeginNested("att", false); 
                     output->outputCString("totalTime", "@name"); 
-                    output->outputUInt((unsigned) (cycle_to_nanosec(node->totalCycles)/1000), 0, "@value");
+                    output->outputUInt((unsigned) (cycle_to_nanosec(node->totalCycles)/1000), sizeof(unsigned), "@value");
                     output->outputEndNested("att");
                 }
                 if (node->localCycles)
                 {
                     output->outputBeginNested("att", false); 
                     output->outputCString("localTime", "@name"); 
-                    output->outputUInt((unsigned) (cycle_to_nanosec(node->localCycles)/1000), 0, "@value");
+                    output->outputUInt((unsigned) (cycle_to_nanosec(node->localCycles)/1000), sizeof(unsigned), "@value");
                     output->outputEndNested("att");
                 }
                 node->outputProperties(output);
@@ -2246,7 +2246,7 @@ void CBaseDebugGraphManager::getXGMML(IXmlWriter *output, unsigned sequence, boo
             {
                 output->outputBeginNested("edge", true);
                 output->outputCString(dependency.edgeId, "@id");
-                output->outputBeginNested("att", false); output->outputCString("_dependsOn", "@name"); output->outputInt(1, 0, "@value"); output->outputEndNested("att");
+                output->outputBeginNested("att", false); output->outputCString("_dependsOn", "@name"); output->outputInt(1, sizeof(int), "@value"); output->outputEndNested("att");
                 output->outputBeginNested("att", false); output->outputCString("_sourceActivity", "@name"); source->outputId(output, "@value"); output->outputEndNested("att");
                 output->outputBeginNested("att", false); output->outputCString("_targetActivity", "@name"); target->outputId(output, "@value"); output->outputEndNested("att");
                 output->outputEndNested("edge");

+ 8 - 8
common/thorhelper/roxiehelper.cpp

@@ -1129,12 +1129,12 @@ void FlushingStringBuffer::startScalar(const char *resultName, unsigned sequence
 void FlushingStringBuffer::setScalarInt(const char *resultName, unsigned sequence, __int64 value, unsigned size)
 {
     startScalar(resultName, sequence);
-    s.appendf("%"I64F"d", value);
+    s.append(value);
 }
 void FlushingStringBuffer::setScalarUInt(const char *resultName, unsigned sequence, unsigned __int64 value, unsigned size)
 {
     startScalar(resultName, sequence);
-    s.appendf("%"I64F"u", value);
+    s.append(value);
 }
 
 void FlushingStringBuffer::incrementRowCount()
@@ -1205,19 +1205,19 @@ void FlushingJsonBuffer::startScalar(const char *resultName, unsigned sequence)
 void FlushingJsonBuffer::setScalarInt(const char *resultName, unsigned sequence, __int64 value, unsigned size)
 {
     startScalar(resultName, sequence);
-    if (size < 7)
-        s.appendf("%"I64F"d", value);
+    if (size < 7) //JavaScript only supports 53 significant bits
+        s.append(value);
     else
-        s.append('"').appendf("%"I64F"d", value).append('"');
+        s.append('"').append(value).append('"');
 }
 
 void FlushingJsonBuffer::setScalarUInt(const char *resultName, unsigned sequence, unsigned __int64 value, unsigned size)
 {
     startScalar(resultName, sequence);
-    if (size < 7)
-        s.appendf("%"I64F"u", value);
+    if (size < 6) //JavaScript doesn't support unsigned, and only supports 53 significant bits
+        s.append(value);
     else
-        s.append('"').appendf("%"I64F"u", value).append('"');
+        s.append('"').append(value).append('"');
 }
 
 //=====================================================================================================

+ 2 - 2
common/thorhelper/thorxmlwrite.cpp

@@ -488,7 +488,7 @@ void CommonJsonWriter::outputData(unsigned len, const void *field, const char *f
 
 void CommonJsonWriter::outputInt(__int64 field, unsigned size, const char *fieldname)
 {
-    if (size < 7)
+    if (size < 7) //JavaScript only supports 53 significant bits
     {
         checkDelimit();
         appendJSONValue(out, checkItemName(fieldname), field);
@@ -501,7 +501,7 @@ void CommonJsonWriter::outputInt(__int64 field, unsigned size, const char *field
 }
 void CommonJsonWriter::outputUInt(unsigned __int64 field, unsigned size, const char *fieldname)
 {
-    if (size < 6)
+    if (size < 6) //JavaScript doesn't support unsigned, and only supports 53 significant bits
     {
         checkDelimit();
         appendJSONValue(out, checkItemName(fieldname), field);

+ 3 - 3
ecl/eclagent/eclagent.cpp

@@ -2653,9 +2653,9 @@ void EclAgent::updatePersist(IRemoteConnection *persistLock, const char * logica
     eclName.append(lfn).append("$eclcrc");
     whenName.append(lfn).append("$when");
 
-    setResultInt(crcName,ResultSequencePersist,allCRC);
-    setResultInt(eclName,ResultSequencePersist,eclCRC);
-    setResultInt(whenName,ResultSequencePersist,time(NULL));
+    setResultInt(crcName,ResultSequencePersist,allCRC,sizeof(int));
+    setResultInt(eclName,ResultSequencePersist,eclCRC,sizeof(int));
+    setResultInt(whenName,ResultSequencePersist,time(NULL),sizeof(int));
 
     reportProgress("Convert persist write lock to read lock");
     changePersistLockMode(persistLock, RTM_LOCK_READ, logicalName, true);

+ 2 - 2
ecl/eclagent/eclagent.ipp

@@ -443,7 +443,7 @@ public:
     void setStandAloneOptions(bool _isStandAloneExe, bool _isRemoteWorkunit, bool _resolveFilesLocally, bool _writeResultsToStdout, outputFmts _outputFmt, IUserDescriptor *_standAloneUDesc);
     inline bool needToLockWorkunit() { return !isStandAloneExe; }           //If standalone exe then either no dali, or a unique remote workunit.
 
-    virtual void setResultInt(const char * stepname, unsigned sequence, __int64, unsigned size=0);
+    virtual void setResultInt(const char * stepname, unsigned sequence, __int64, unsigned size);
     virtual void setResultReal(const char * stepname, unsigned sequence, double);
     virtual void setResultBool(const char * stepname, unsigned sequence, bool);
     virtual void setResultString(const char * stepname, unsigned sequence, int len, const char *);
@@ -451,7 +451,7 @@ public:
     virtual void setResultDataset(const char * name, unsigned sequence, size32_t len, const void *val, unsigned numRows, bool extend);
     virtual void setResultRaw(const char * stepname, unsigned sequence, int len, const void *);
     virtual void setResultSet(const char *name, unsigned sequence, bool isAll, size32_t len, const void * data, ISetToXmlTransformer * transformer);
-    virtual void setResultUInt(const char * stepname, unsigned sequence, unsigned __int64, unsigned size=0);
+    virtual void setResultUInt(const char * stepname, unsigned sequence, unsigned __int64, unsigned size);
     virtual void setResultUnicode(const char *name, unsigned sequence, int len, UChar const * str);
     virtual void setResultDecimal(const char * stepname, unsigned sequence, int len, int precision, bool isSigned, const void *val);
     virtual void setResultVarString(const char * stepname, unsigned sequence, const char *);

+ 1 - 1
ecl/hqlcpp/hqlhtcpp.cpp

@@ -10918,7 +10918,7 @@ void HqlCppTranslator::buildXmlSerializeScalar(BuildCtx & ctx, IHqlExpression *
     case type_swapint:
     case type_packedint:
     case type_bitfield:
-        size.setown(createConstant((__int64)type->getSize()));
+        size.setown(getSizetConstant(type->getSize()));
         if (type->isSigned())
             func = outputXmlIntId;
         else

+ 2 - 2
esp/esdllib/esdl_transformer2.cpp

@@ -397,13 +397,13 @@ void Esdl2Base::output_content(Esdl2TransformerContext &ctx, const char * conten
                     case ESDLT_INT16:
                     case ESDLT_INT32:
                     case ESDLT_INT64:
-                        ctx.writer->outputInt(atoi(content), 0, tagname);
+                        ctx.writer->outputInt(atoi(content), sizeof(int), tagname);
                         break;
                     case ESDLT_UINT8:
                     case ESDLT_UINT16:
                     case ESDLT_UINT32:
                     case ESDLT_UINT64:
-                        ctx.writer->outputUInt(atoi(content), 0, tagname);
+                        ctx.writer->outputUInt(atoi(content), sizeof(unsigned), tagname);
                         break;
                     case ESDLT_BYTE:
                     case ESDLT_UBYTE:

+ 6 - 6
roxie/ccd/ccdcontext.cpp

@@ -179,7 +179,7 @@ public:
             {
                 output->outputBeginNested("edge", true);
                 output->outputCString((const char *) edges.query().getKey(), "@edgeId");
-                output->outputUInt(edge->queryCount(), 0, "@count");
+                output->outputUInt(edge->queryCount(), sizeof(unsigned), "@count");
                 output->outputEndNested("edge");
             }
             if (reset)
@@ -332,7 +332,7 @@ private:
         return r->getResultInt();
     }
 
-    void setResultInt(const char * name, unsigned sequence, unsigned __int64 value, unsigned size=0)
+    void setResultInt(const char * name, unsigned sequence, unsigned __int64 value, unsigned size)
     {
         WorkunitUpdate w(&workunit->lock());
         w->setResultInt(name, sequence, value);
@@ -512,9 +512,9 @@ private:
         eclName.append(lfn).append("$eclcrc");
         whenName.append(lfn).append("$when");
 
-        setResultInt(crcName, ResultSequencePersist, allCRC);
-        setResultInt(eclName, ResultSequencePersist, eclCRC);
-        setResultInt(whenName, ResultSequencePersist, time(NULL));
+        setResultInt(crcName, ResultSequencePersist, allCRC, sizeof(int));
+        setResultInt(eclName, ResultSequencePersist, eclCRC, sizeof(int));
+        setResultInt(whenName, ResultSequencePersist, time(NULL), sizeof(int));
 
         logctx.CTXLOG("Convert persist write lock to read lock");
         changePersistLockMode(persistLock, RTM_LOCK_READ, logicalName, true);
@@ -3279,7 +3279,7 @@ public:
         }
     }
 
-    virtual void setResultUInt(const char *name, unsigned sequence, unsigned __int64 value, unsigned size=0)
+    virtual void setResultUInt(const char *name, unsigned sequence, unsigned __int64 value, unsigned size)
     {
         if (isSpecialResultSequence(sequence))
         {

+ 7 - 7
roxie/ccd/ccddebug.cpp

@@ -509,14 +509,14 @@ class DebugProbe : public InputProbe, implements IActivityDebugContext
     {
         output->outputBeginNested("att", false);
         output->outputCString(name, "@name");
-        output->outputInt(value, 0, "@value");
+        output->outputInt(value, sizeof(int), "@value");
         output->outputEndNested("att");
     }
 
     void rowToXML(IXmlWriter *output, const void *row, unsigned sequence, unsigned rowCount, bool skipped, bool limited, bool eof, bool eog) const
     {
         output->outputBeginNested("Row", true);
-        output->outputInt(sequence, 0, "@seq");
+        output->outputInt(sequence, sizeof(int), "@seq");
         if (skipped)
             output->outputBool(true, "@skip");
         if (limited)
@@ -527,9 +527,9 @@ class DebugProbe : public InputProbe, implements IActivityDebugContext
             output->outputBool(true, "@eog");
         if (row)
         {
-            output->outputInt(rowCount, 0, "@count");
+            output->outputInt(rowCount, sizeof(int), "@count");
             IOutputMetaData *meta = queryOutputMeta();
-            output->outputInt(meta->getRecordSize(row), 0, "@size");
+            output->outputInt(meta->getRecordSize(row), sizeof(int), "@size");
             meta->toXML((const byte *) row, *output);
         }
         output->outputEndNested("Row");
@@ -675,8 +675,8 @@ public:
                         else
                         {
                             output->outputBeginNested("Row", true);
-                            output->outputInt(rowData->querySequence(), 0, "@sequence");
-                            output->outputInt(rowData->queryRowCount(), 0, "@count");
+                            output->outputInt(rowData->querySequence(), sizeof(int), "@sequence");
+                            output->outputInt(rowData->queryRowCount(), sizeof(int), "@count");
                             output->outputEndNested("Row");
                         }
                     }
@@ -1270,7 +1270,7 @@ public:
             output->outputBeginNested("Result", true);
             IActivityDebugContext *edge = manager->lookupActivityByEdgeId(id);
             if (edge)
-                output->outputInt(edge->queryProxyId(), 0, "@proxyId");
+                output->outputInt(edge->queryProxyId(), sizeof(int), "@proxyId");
             output->outputEndNested("Result");
         }
         else