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@github.mail.kapsi.fi>2017-09-18 14:51:06 +0300
committerGitHub <noreply@github.com>2017-09-18 14:51:06 +0300
commitb1392a3e56179af6104be386f43ad5eec202372a (patch)
treefb527c7663740026ac260f71857d15c4739ee800
parentd0e9e643f7e8ca159dcbbf9c9ef23ac87e4c4f93 (diff)
parentbd0fbe30840c9ac03535e3c34bf3057ba86da70f (diff)
Merge pull request #284 from elcojacobs/develop
Added pb_decode_delimited_noinit
-rw-r--r--pb_decode.c15
-rw-r--r--pb_decode.h5
2 files changed, 20 insertions, 0 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 391d463..dc344dc 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -1017,6 +1017,21 @@ bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void
return status;
}
+bool pb_decode_delimited_noinit(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;
+
+ status = pb_decode_noinit(&substream, fields, dest_struct);
+
+ if (!pb_close_string_substream(stream, &substream))
+ return false;
+ return status;
+}
+
bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
{
pb_istream_t substream;
diff --git a/pb_decode.h b/pb_decode.h
index d51ce39..398b24a 100644
--- a/pb_decode.h
+++ b/pb_decode.h
@@ -85,6 +85,11 @@ bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *des
*/
bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
+/* Same as pb_decode_delimited, except that it does not initialize the destination structure.
+ * See pb_decode_noinit
+ */
+bool pb_decode_delimited_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
+
/* Same as pb_decode, except allows the message to be terminated with a null byte.
* NOTE: Until nanopb-0.4.0, pb_decode() also allows null-termination. This behaviour
* is not supported in most other protobuf implementations, so pb_decode_delimited()