Bugfix: Don't use c_str for protobuf type bytes as an intermediate 0x00 is interpreted as terminator; fixes #170

This commit is contained in:
Srivats P 2015-12-11 20:57:48 +05:30
parent f8d5cbd252
commit 147469beee

View File

@ -450,7 +450,7 @@ void PythonFileFormat::writeFieldAssignment(
std::string val = fieldDesc->is_repeated() ?
refl->GetRepeatedStringReference(msg, fieldDesc, index, &val) :
refl->GetStringReference(msg, fieldDesc, &val);
QString escVal = escapeString(val.c_str());
QString escVal = escapeString(QString::fromStdString(val));
if (val != fieldDesc->default_value_string())
out << fieldName << " = '" << escVal << "'\n";
break;