Fix bugs in extension support when multiple extension fields are present.

This commit is contained in:
Petteri Aimonen
2013-07-22 18:59:15 +03:00
parent 64947cb382
commit 1f13e8cd2c
3 changed files with 23 additions and 4 deletions

View File

@@ -161,9 +161,14 @@ static bool checkreturn encode_static_field(pb_ostream_t *stream,
{
pb_encoder_t func;
const void *pSize;
bool dummy = true;
func = PB_ENCODERS[PB_LTYPE(field->type)];
pSize = (const char*)pData + field->size_offset;
if (field->size_offset)
pSize = (const char*)pData + field->size_offset;
else
pSize = &dummy;
switch (PB_HTYPE(field->type))
{