Skip to content

Commit

Permalink
Bugfix: Variable fields related code is now generated correctly when …
Browse files Browse the repository at this point in the history
…saving a stream as a python script

Fixes pstavirs#158
  • Loading branch information
pstavirs committed Oct 2, 2015
1 parent 14d29a0 commit 0052ec6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/pythonfileformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ bool PythonFileFormat::saveStreams(const OstProto::StreamConfigList streams,

refl->ListFields(protocol, &fields);
for (uint k = 0; k < fields.size(); k++) {
// skip protocol_id field
if (fields.at(k)->number() ==
OstProto::Protocol::kProtocolIdFieldNumber)
// skip non extension fields
if (!fields.at(k)->is_extension())
continue;

if (fields.at(k)->file()->name() !=
Expand Down Expand Up @@ -199,7 +198,8 @@ bool PythonFileFormat::saveStreams(const OstProto::StreamConfigList streams,
OstProto::Protocol::kProtocolIdFieldNumber)
continue;
QString pfx(" p.Extensions[X]");
pfx.replace("X", fields.at(k)->name().c_str());
pfx.replace(fields.at(k)->is_extension()? "X": "Extensions[X]",
fields.at(k)->name().c_str());
writeFieldAssignment(out, pfx, protocol,
refl, fields.at(k));
}
Expand Down

0 comments on commit 0052ec6

Please sign in to comment.