@@ -270,6 +270,7 @@ std::string ErrorMessage::serialize() const
270270 oss << Severity::toString (severity).length () << " " << Severity::toString (severity);
271271 oss << MathLib::toString (cwe.id ).length () << " " << MathLib::toString (cwe.id );
272272 oss << MathLib::toString (hash).length () << " " << MathLib::toString (hash);
273+ oss << file0.size () << " " << file0;
273274 if (certainty == Certainty::inconclusive) {
274275 const std::string text (" inconclusive" );
275276 oss << text.length () << " " << text;
@@ -296,9 +297,9 @@ bool ErrorMessage::deserialize(const std::string &data)
296297 certainty = Certainty::normal;
297298 callStack.clear ();
298299 std::istringstream iss (data);
299- std::array<std::string, 6 > results;
300+ std::array<std::string, 7 > results;
300301 std::size_t elem = 0 ;
301- while (iss.good () && elem < 6 ) {
302+ while (iss.good () && elem < 7 ) {
302303 unsigned int len = 0 ;
303304 if (!(iss >> len))
304305 return false ;
@@ -318,15 +319,16 @@ bool ErrorMessage::deserialize(const std::string &data)
318319 results[elem++] = temp;
319320 }
320321
321- if (elem != 6 )
322+ if (elem != 7 )
322323 throw InternalError (nullptr , " Internal Error: Deserialization of error message failed" );
323324
324325 id = results[0 ];
325326 severity = Severity::fromString (results[1 ]);
326327 std::istringstream (results[2 ]) >> cwe.id ;
327328 std::istringstream (results[3 ]) >> hash;
328- mShortMessage = results[4 ];
329- mVerboseMessage = results[5 ];
329+ std::istringstream (results[4 ]) >> file0;
330+ mShortMessage = results[5 ];
331+ mVerboseMessage = results[6 ];
330332
331333 unsigned int stackSize = 0 ;
332334 if (!(iss >> stackSize))
@@ -438,10 +440,11 @@ std::string ErrorMessage::toXML() const
438440 if (certainty == Certainty::inconclusive)
439441 printer.PushAttribute (" inconclusive" , " true" );
440442
443+ if (!file0.empty ())
444+ printer.PushAttribute (" file0" , file0.c_str ());
445+
441446 for (std::list<FileLocation>::const_reverse_iterator it = callStack.rbegin (); it != callStack.rend (); ++it) {
442447 printer.OpenElement (" location" , false );
443- if (!file0.empty () && (*it).getfile () != file0)
444- printer.PushAttribute (" file0" , Path::toNativeSeparators (file0).c_str ());
445448 printer.PushAttribute (" file" , (*it).getfile ().c_str ());
446449 printer.PushAttribute (" line" , std::max ((*it).line ,0 ));
447450 printer.PushAttribute (" column" , (*it).column );
0 commit comments