Salome HOME
Fix compilation failure
authorGilles DAVID <gilles-g.david@edf.fr>
Wed, 12 Feb 2014 16:45:28 +0000 (17:45 +0100)
committerGilles DAVID <gilles-g.david@edf.fr>
Wed, 12 Feb 2014 16:45:28 +0000 (17:45 +0100)
With recent gcc versions, the previous commit does not compile...

src/engine/ForEachLoop.cxx
src/engine/ForLoop.cxx
src/engine/Proc.hxx

index 9f277975fe3e8ef3bd88a5275e48a5c04d582ab8..d5c52d4a21c66064391b46bbc11e9667a3733f83 100644 (file)
@@ -842,10 +842,10 @@ void ForEachLoop::resetState(int level)
 std::string ForEachLoop::getProgress() const
 {
   int nbElems = _splitterNode.getNumberOfElements();
-  char* aProgress = new char[];
+  std::stringstream aProgress;
   if (nbElems > 0)
-    sprintf(aProgress, "%i/%i", _currentIndex, nbElems);
+    aProgress << _currentIndex << "/" << nbElems;
   else
-    sprintf(aProgress, "0");
-  return aProgress;
+    aProgress << "0";
+  return aProgress.str();
 }
index 30fcb66ea13d5ee510b9b223a13419bdbdfe9d8f..8b3acaeb87743e917b616e36ffad8483569e498a 100644 (file)
@@ -267,14 +267,15 @@ std::list<OutputPort *> ForLoop::getSetOfOutputPort() const
 
 std::string ForLoop::getProgress() const
 {
-  char* aProgress = new char[];
-  sprintf(aProgress, "0");
+  std::stringstream aProgress;
+  aProgress << "0";
   AnyInputPort* aNbStepsPort = (AnyInputPort*)&_nbOfTimesPort;
   if (aNbStepsPort && !aNbStepsPort->isEmpty()) {
     int nbSteps = aNbStepsPort->getIntValue();
     if (nbSteps > 0 && _nbOfTurns >= 0) {
-      sprintf(aProgress, "%i/%i", _nbOfTurns, nbSteps);
+      aProgress.clear();
+      aProgress << _nbOfTurns << "/" << nbSteps;
     }
   }
-  return aProgress;
+  return aProgress.str();
 }
index 5300ce684e8883f4f6709c31729d855045924edf..48483944453d3003441fce298219de3ea054d822 100644 (file)
@@ -65,7 +65,7 @@ namespace YACS
       virtual const Proc * getProc() const;
 
       YACS::StatesForNode getNodeState(int numId);
-      std::string Proc::getNodeProgress(int numId);
+      std::string getNodeProgress(int numId);
       std::string getInPortValue(int nodeNumId, std::string portName);
       std::string setInPortValue(std::string nodeName, std::string portName, std::string value);
       std::string getOutPortValue(int nodeNumId, std::string portName);