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, 2 insertions, 3 deletions
diff --git a/pb_encode.c b/pb_encode.c
index 58e03a68..317e31ef 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -149,15 +149,14 @@ bool checkreturn pb_encode(pb_ostream_t *stream, const pb_field_t fields[], cons
while (field->tag != 0)
{
+ pb_encoder_t func = PB_ENCODERS[PB_LTYPE(field->type)];
pData = (const char*)pData + prev_size + field->data_offset;
pSize = (const char*)pData + field->size_offset;
prev_size = field->data_size;
if (PB_HTYPE(field->type) == PB_HTYPE_ARRAY)
prev_size *= field->array_size;
-
- pb_encoder_t func = PB_ENCODERS[PB_LTYPE(field->type)];
-
+
switch (PB_HTYPE(field->type))
{
case PB_HTYPE_REQUIRED: