I am struggling with the MessageDifferencer of protobuf (version 3). I was hoping to use the StreamReporter::ReportModified(const Message & message1, const Message & message2, const std::vector< SpecificField > & field_path) to get the modified fields filled into the field_path vector. So I could just focus on those differences.
However, when I run the following code, I get a segmentation fault. I am not sure yet why that is.
MessageDifferencer md;md.set_report_matches(false);md.set_report_moves(false);md.set_scope(MessageDifferencer::FULL);md.ReportDifferencesToString(&diff_report);bool diff = md.Compare(msgIn01, msgIn02);cout << "diff : " << boolalpha << diff << endl;cout << "diff : " << diff_report << endl;
string reporterString;google::protobuf::io::StringOutputStream sos(&reporterString);MessageDifferencer::StreamReporter reporter(&sos);std::vector< MessageDifferencer::SpecificField > field_path;md.ReportDifferencesTo(&reporter);reporter.ReportMatched(msgIn01, msgIn02, field_path);
The output I get is showing this :
diff : false diff : modified: msg.send.settings.Scan.Frames[0].txFstop: 0.5 -> 2.5 Program received signal SIGSEGV, Segmentation fault.
| Jens F. Prinz-Sander, Were you able to solve this ? I am also getting the same error and need help in fixing this. Thanks, Kiran |