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:
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c7
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)