Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-08-24 21:43:21 +0400
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-08-24 21:43:39 +0400
commit9383f305dc42eeca8b043c5c6dff3fe2e3e8f4f2 (patch)
treef612bef3fe96720101b2e4c8a6bb4387ea8f8361 /pb_decode.h
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 'pb_decode.h')
-rw-r--r--pb_decode.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/pb_decode.h b/pb_decode.h
index 27535c1..2880c07 100644
--- a/pb_decode.h
+++ b/pb_decode.h
@@ -23,6 +23,10 @@
*
* 3) You can use state to store your own data (e.g. buffer pointer),
* and rely on pb_read to verify that no-body reads past bytes_left.
+ *
+ * 4) Your callback may be used with substreams, in which case bytes_left
+ * is different than from the main stream. Don't use bytes_left to compute
+ * any pointers.
*/
struct _pb_istream_t
{
@@ -69,6 +73,7 @@ bool pb_decode_fixed64(pb_istream_t *stream, void *dest);
/* Make a limited-length substream for reading a PB_WT_STRING field. */
bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream);
+void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream);
/* --- Internal functions ---
* These functions are not terribly useful for the average library user, but