Improve the detection of missing required fields.
Now the limit of tracked fields is configurable at compile-time using PB_MAX_REQUIRED_FIELDS. Added related test and updated documentation. Fixes issue #18.
This commit is contained in:
@@ -10,11 +10,12 @@ Compilation options
|
||||
===================
|
||||
The following options can be specified using -D switch given to the C compiler:
|
||||
|
||||
================== ==============================================================================================
|
||||
__BIG_ENDIAN__ Set this if your platform stores integers and floats in big-endian format.
|
||||
Mixed-endian systems (different layout for ints and floats) are currently not supported.
|
||||
NANOPB_INTERNALS Set this to expose the field encoder functions that are hidden since nanopb-0.1.3.
|
||||
================== ==============================================================================================
|
||||
============================ ==============================================================================================
|
||||
__BIG_ENDIAN__ Set this if your platform stores integers and floats in big-endian format.
|
||||
Mixed-endian systems (different layout for ints and floats) are currently not supported.
|
||||
NANOPB_INTERNALS Set this to expose the field encoder functions that are hidden since nanopb-0.1.3.
|
||||
PB_MAX_REQUIRED_FIELDS Maximum number of required fields to check for presence. Default value is 64.
|
||||
============================ ==============================================================================================
|
||||
|
||||
pb.h
|
||||
====
|
||||
@@ -310,8 +311,6 @@ In addition to EOF, the pb_decode implementation supports terminating a message
|
||||
|
||||
For optional fields, this function applies the default value and sets *has_<field>* to false if the field is not present.
|
||||
|
||||
Because of memory concerns, the detection of missing required fields is not perfect if the structure contains more than 32 fields.
|
||||
|
||||
pb_decode_varint
|
||||
----------------
|
||||
Read and decode a varint_ encoded integer. ::
|
||||
|
||||
Reference in New Issue
Block a user