Merge the generated has_<name> fields into a single one.
git-svn-id: https://svn.kapsi.fi/jpa/nanopb-dev@1008 e3a754e5-d11d-0410-8d38-ebb782a927b9
This commit is contained in:
committed by
Petteri Aimonen
parent
43b8e20744
commit
8e5337e9ef
@@ -144,6 +144,7 @@ bool checkreturn pb_encode(pb_ostream_t *stream, const pb_message_t *msg, const
|
||||
{
|
||||
const void *pData = src_struct;
|
||||
const void *pSize;
|
||||
const char *has_fields = src_struct;
|
||||
unsigned int i;
|
||||
size_t prev_size = 0;
|
||||
|
||||
@@ -168,7 +169,7 @@ bool checkreturn pb_encode(pb_ostream_t *stream, const pb_message_t *msg, const
|
||||
break;
|
||||
|
||||
case PB_HTYPE_OPTIONAL:
|
||||
if (*(bool*)pSize)
|
||||
if (has_fields[i/8] & (1 << i%8))
|
||||
{
|
||||
if (!pb_encode_tag_for_field(stream, field))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user