This shouldn't happen.. That means your unfiltered C also contains
uninitialized messages.. Did you add new required fields in your .proto file
(or change optional to required)?
On Wed, Jun 8, 2011 at 5:55 AM, ksamdev <samvel.khalat...@gmail.com> wrote:
> I've got nested messages like:
> message A
> required double value = 1;
> message B
> required A a = 1;
> message C
> repeated B entries = 1;
> The C object is saved in file and may have any number of B entries.
> However, now I'd like to save a copy of C in a different file with B's that
> match some criteria, e.g.
> C original;
> // Read object from file
> C *copy = new C();
> typedef ::google::protobuf::RepeatedPtrField<B> Bs;
> for(Bs::const_iterator b = c->entries().begin();
> c->entries().end() != b;
> if (b->a().value() < 5)
> // Copy B entry and add it to the Filtered C
> B *entry = copy->add_entries();
> *entry = *b;
> // save copy
> Sometimes it happens that I get the error message upon reading filtered C:
> libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message
> of type "C" because it is missing required fields: entries.A
> It seems that deep copy of nested repeated messages failed for some reason.
> Any ideas how to fix this?
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> To post to this group, send email to email@example.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to firstname.lastname@example.org.
To unsubscribe from this group, send email to
For more options, visit this group at