Hi,
I'm using the protocol buffers package for c. It's very useful and
handy. However I've encountered a problem when trying to use a message
with a nested repeated field of an other message type.
This is the simplified version -
message Item {
int32 id = 1;
}
message LookupReply {
repeated Item replica_list = 1;
}
Here is the code for constructing the message:
...
LookupReply nlr = LOOKUP_REPLY__INIT;
(&nlr)->replica_list = (Item**)malloc(1*sizeof(Item*));
(&nlr)->n_replica_list = 1;
Item* item1 = (Item*)malloc(sizeof(Item));
item1->id = 1;
(&nlr)->replica_list[0] = item1;
int len = lookup_reply__get_packed_size(nlr);
...
The call to lookup_reply__get_packed_size causes a segmentation
fault.
I first tried using a string id field in the Item message, and that
failed too.
However when I used a string repeated field (with a few obvious
semantic changes) everything worked fine.
Anyone else has maybe used repeated message field in the c package and
got it to work (or if not, can explain why it doesn't work)?
Thank you,
Aviad
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---