summaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
Diffstat (limited to 'pb_encode.c')
-rw-r--r--pb_encode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pb_encode.c b/pb_encode.c
index cbf7a667..8f01b10b 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -598,14 +598,14 @@ bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, c
bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src)
{
- const pb_bytes_array_t *bytes = (const pb_bytes_array_t*)src;
-
if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
{
- return pb_encode_string(stream, *(const uint8_t**)bytes->bytes, bytes->size);
+ const pb_bytes_ptr_t *bytes = (const pb_bytes_ptr_t*)src;
+ return pb_encode_string(stream, bytes->bytes, bytes->size);
}
else
{
+ const pb_bytes_array_t *bytes = (const pb_bytes_array_t*)src;
if (bytes->size + offsetof(pb_bytes_array_t, bytes) > field->data_size)
PB_RETURN_ERROR(stream, "bytes size exceeded");