summaryrefslogtreecommitdiffstats
path: root/example_unions
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-08-24 20:43:21 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-08-24 20:43:39 +0300
commit9383f305dc42eeca8b043c5c6dff3fe2e3e8f4f2 (patch)
treef612bef3fe96720101b2e4c8a6bb4387ea8f8361 /example_unions
parent2941e90e041b0d7872a4ea458e77dcc787ca6ff2 (diff)
Revert "Change the substream implementation in pb_decode."
This reverts commit dc2da0edc568b29361479fb7405c96b1a13442cf. Add pb_close_string_substream() for copying back the state. This makes adding error messages easier in the future, as also them need to be propagated back from the substream.
Diffstat (limited to 'example_unions')
-rw-r--r--example_unions/decode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/example_unions/decode.c b/example_unions/decode.c
index a7cc7814..d40cd8ce 100644
--- a/example_unions/decode.c
+++ b/example_unions/decode.c
@@ -45,10 +45,13 @@ 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_istream_t substream;
+ bool status;
if (!pb_make_string_substream(stream, &substream))
return false;
- return pb_decode(&substream, fields, dest_struct);
+ status = pb_decode(&substream, fields, dest_struct);
+ pb_close_string_substream(stream, &substream);
+ return status;
}
int main()