@@ -56,7 +56,7 @@ bool /* continue */ skipLdArgs(
5656 continue ;
5757 }
5858
59- const std::string argVal = (*pIt)-> second . get_value <std::string>( );
59+ const std::string argVal = getStringValue (*pIt);
6060 if (argVal == " --preload" )
6161 goto skip_arg;
6262
@@ -103,7 +103,7 @@ void readExeArgs(
103103 break ;
104104
105105 *pArgs += " " ;
106- *pArgs += it-> second . get_value <std::string>( );
106+ *pArgs += getStringValue (it );
107107 }
108108}
109109
@@ -144,12 +144,12 @@ std::string readMsg(const pt::ptree &defNode)
144144 const pt::ptree *whatNode;
145145 if (findChildOf (&whatNode, defNode, " what" ))
146146 // message found in <what>...</what>
147- return whatNode-> get_value <std::string>( );
147+ return getStringValue (whatNode );
148148
149149 if (findChildOf (&whatNode, defNode, " xwhat" )
150150 && findChildOf (&whatNode, *whatNode, " text" ))
151151 // message found in <xwhat><text>...</text></xwhat>
152- return whatNode-> get_value <std::string>( );
152+ return getStringValue (whatNode );
153153
154154 // message not found
155155 return " <unknown>" ;
@@ -195,7 +195,7 @@ void readStack(Defect *pDef, const pt::ptree &stackNode)
195195 const pt::ptree *fileNode;
196196 if (findChildOf (&fileNode, frameNode, " file" )) {
197197 // read absolute path of the source file
198- noteEvt.fileName = fileNode-> get_value <std::string>( );
198+ noteEvt.fileName = getStringValue (fileNode );
199199 const std::string dir = valueOf<std::string>(frameNode, " dir" , " " );
200200 if (!dir.empty ())
201201 noteEvt.fileName = dir + " /" + noteEvt.fileName ;
@@ -206,12 +206,12 @@ void readStack(Defect *pDef, const pt::ptree &stackNode)
206206 }
207207 else if (findChildOf (&fileNode, frameNode, " obj" )) {
208208 // pick path of the object file
209- noteEvt.fileName = fileNode-> get_value <std::string>( );
209+ noteEvt.fileName = getStringValue (fileNode );
210210 keyEventScore = 4 ;
211211 }
212212 else if (findChildOf (&fileNode, frameNode, " ip" )) {
213213 // pick address of the code in memory
214- noteEvt.fileName = fileNode-> get_value <std::string>( );
214+ noteEvt.fileName = getStringValue (fileNode );
215215 keyEventScore = 2 ;
216216 }
217217 else {
@@ -254,9 +254,9 @@ bool ValgrindTreeDecoder::readNode(Defect *pDef, pt::ptree::const_iterator defIt
254254 keyEvent.msg = readMsg (defNode);
255255
256256 // read "kind" of the report
257- pt::ptree::const_assoc_iterator itKind = defNode. find ( " kind" );
258- if (defNode. not_found () != itKind )
259- keyEvent.event += " [" + itKind-> second . get_value <std::string>() + " ]" ;
257+ const std::string kind = valueOf<std::string>(defNode, " kind" , " " );
258+ if (!kind. empty () )
259+ keyEvent.event += " [" + kind + " ]" ;
260260
261261 // go through stack trace
262262 const pt::ptree *stackNode;
@@ -270,7 +270,7 @@ bool ValgrindTreeDecoder::readNode(Defect *pDef, pt::ptree::const_iterator defIt
270270 DefEvent auxEvent = def.events [def.keyEventIdx ];
271271 auxEvent.event = " note" ;
272272 auxEvent.verbosityLevel = /* note */ 1 ;
273- auxEvent.msg = auxwhat-> get_value <std::string>( );
273+ auxEvent.msg = getStringValue (auxwhat );
274274 def.events .insert (def.events .begin () + def.keyEventIdx + 1 , auxEvent);
275275 }
276276
0 commit comments