How to use protobuf3 MessageDifferencer ReportModified()?

46 views
Skip to first unread message

Jens F. Prinz-Sander

unread,
Sep 20, 2018, 4:34:34 AM9/20/18
to Protocol Buffers
Hi,

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.



string diff_report;
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.




Kiran Kumar

unread,
May 10, 2019, 8:08:16 PM5/10/19
to Protocol Buffers
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


Reply all
Reply to author
Forward
0 new messages