summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-23 09:59:18 +0000
committerPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-23 09:59:18 +0000
commit5490163200131e4d2af9676f22d13a611ed2b7b3 (patch)
treee24779c9a7cee4cd077518d11da10268964f47a6 /pb_decode.c
parent5a9f85b87615078868d3b394370a30b550186cce (diff)
More unittests
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@960 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 9208bdac..26924472 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -257,7 +257,7 @@ static bool decode_field(pb_istream_t *stream, int wire_type, pb_field_iterator_
while (substream.bytes_left && *size < iter->current->array_size)
{
void *pItem = (uint8_t*)iter->pData + iter->current->data_size * (*size);
- if (!func(stream, iter->current, pItem))
+ if (!func(&substream, iter->current, pItem))
return false;
(*size)++;
}
@@ -381,7 +381,8 @@ bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struc
if (!pb_field_find(&iter, tag))
{
/* No match found, skip data */
- skip(stream, wire_type);
+ if (!skip(stream, wire_type))
+ return false;
continue;
}