summaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
Diffstat (limited to 'pb_encode.c')
-rw-r--r--pb_encode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pb_encode.c b/pb_encode.c
index 13bda22c..cafe853c 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -59,11 +59,12 @@ static const pb_encoder_t PB_ENCODERS[PB_LTYPES_COUNT] = {
static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
{
+ size_t i;
pb_byte_t *dest = (pb_byte_t*)stream->state;
stream->state = dest + count;
- while (count--)
- *dest++ = *buf++;
+ for (i = 0; i < count; i++)
+ dest[i] = buf[i];
return true;
}