From 7f224f61cda0e5731c26e5c9ae89a39ba9c7ed34 Mon Sep 17 00:00:00 2001 From: Srivats P Date: Fri, 2 Oct 2015 13:49:54 +0530 Subject: [PATCH] Bugfix: Variable fields related code is now generated correctly when saving a stream as a python script Fixes #158 --- common/pythonfileformat.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/pythonfileformat.cpp b/common/pythonfileformat.cpp index c2f9b0c..cd9f37e 100644 --- a/common/pythonfileformat.cpp +++ b/common/pythonfileformat.cpp @@ -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() != @@ -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)); }