Commit 9d0d7b9a authored by Giorgio Azzinnaro's avatar Giorgio Azzinnaro

recurse into nested messages to copy when marshalling

parent 3eae7adb
......@@ -209,8 +209,13 @@ void Marshaller::CopyField(
#undef HANDLE_TYPE
case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE:
toReflection->MutableMessage(to, toField)->MergeFrom(
fromReflection->GetMessage(from, fromField));
const Message & nestedFrom = fromReflection->GetMessage(from, fromField);
Message * nestedTo = toReflection->MutableMessage(to, toField);
std::vector< const FieldDescriptor * > setFields;
nestedFrom.GetReflection()->ListFields(from, &setFields);
for (auto field: setFields)
this->CopyField(field, nestedFrom, nestedTo);
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment