Reorganize the field decoder interface.

This makes the field decoding functions more intuitive to use.
The old interface is still present if you specify NANOPB_INTERNALS.

Update issue 2
Status: FixedInGit
This commit is contained in:
Petteri Aimonen
2012-08-24 20:23:25 +03:00
parent dc2da0edc5
commit 2941e90e04
6 changed files with 150 additions and 152 deletions

View File

@@ -44,10 +44,11 @@ const pb_field_t* decode_unionmessage_type(pb_istream_t *stream)
bool decode_unionmessage_contents(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
{
pb_field_t field = {}; /* NB: Could get rid of this wrapper by fixing issue #2. */
field.ptr = fields;
pb_istream_t substream;
if (!pb_make_string_substream(stream, &substream))
return false;
return pb_dec_submessage(stream, &field, dest_struct);
return pb_decode(&substream, fields, dest_struct);
}
int main()