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:
Petteri Aimonen
2012-06-30 18:10:08 +03:00
parent 7bcf7ef579
commit 95eb4a5499
6 changed files with 229 additions and 24 deletions

View File

@@ -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. ::