diff options
author | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-07-30 09:59:08 +0000 |
---|---|---|
committer | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-07-30 09:59:08 +0000 |
commit | f8364310d3ca85d2cf59019bb4bc5e9ff4c52dc3 (patch) | |
tree | e5ddbe4c28353630fb4881717058ed5f9cd83db7 /pb_decode.c | |
parent | d7863b7424b1be5da33e9d632365f3e2c0538461 (diff) |
unittests (some)
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@949 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'pb_decode.c')
-rw-r--r-- | pb_decode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pb_decode.c b/pb_decode.c index 58d6480..63008dd 100644 --- a/pb_decode.c +++ b/pb_decode.c @@ -23,13 +23,14 @@ const pb_decoder_t PB_DECODERS[PB_LTYPES_COUNT] = { bool pb_read(pb_istream_t *stream, uint8_t *buf, size_t count) { - bool status; if (stream->bytes_left < count) return false; - status = stream->callback(stream, buf, count); + if (!stream->callback(stream, buf, count)) + return false; + stream->bytes_left -= count; - return status; + return true; } static bool buf_read(pb_istream_t *stream, uint8_t *buf, size_t count) |