summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
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 1f6aeae0..b2a3a310 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -75,13 +75,14 @@ static const pb_decoder_t PB_DECODERS[PB_LTYPES_COUNT] = {
static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count)
{
+ size_t i;
const pb_byte_t *source = (const pb_byte_t*)stream->state;
stream->state = (pb_byte_t*)stream->state + count;
if (buf != NULL)
{
- while (count--)
- *buf++ = *source++;
+ for (i = 0; i < count; i++)
+ buf[i] = source[i];
}
return true;