X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=docs%2Freference.rst;h=2b10c2ee0bad3e50cfaba941d9d72f801918b943;hb=871e5be9dd6bb69e2bee2d8e23d27b89285c8f8b;hp=3a6e11a4e026d3744bffbbdbbda967f3e4c535e6;hpb=ea57f74741b5b5ab3ab4a3e81d8b61811417b4c6;p=apps%2Fagl-service-can-low-level.git diff --git a/docs/reference.rst b/docs/reference.rst index 3a6e11a4..2b10c2ee 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -20,6 +20,8 @@ PB_FIELD_16BIT Add support for tag numbers > 255 and fields larg Increases code size 3 bytes per each field. Compiler error will tell if you need this. PB_FIELD_32BIT Add support for tag numbers > 65535 and fields larger than 65535 bytes or 65535 array entries. Increases code size 9 bytes per each field. Compiler error will tell if you need this. +PB_NO_ERRMSG Disables the support for error messages; only error information is the true/false return value. + Decreases the code size by a few hundred bytes. ============================ ================================================================================================ The PB_MAX_REQUIRED_FIELDS, PB_FIELD_16BIT and PB_FIELD_32BIT settings allow raising some datatype limits to suit larger messages. @@ -320,6 +322,16 @@ In addition to EOF, the pb_decode implementation supports terminating a message For optional fields, this function applies the default value and sets *has_* to false if the field is not present. +pb_decode_noinit +---------------- +Same as `pb_decode`_, except does not apply the default values to fields. :: + + bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +(parameters are the same as for `pb_decode`_.) + +The destination structure should be filled with zeros before calling this function. Doing a *memset* manually can be slightly faster than using `pb_decode`_ if you don't need any default values. + pb_skip_varint -------------- Skip a varint_ encoded integer without decoding it. :: @@ -369,7 +381,7 @@ Remove the data for a field from the stream, without actually decoding it:: For decoding numeric (including enumerated and boolean) values, use `pb_decode_varint`_, `pb_decode_svarint`_, `pb_decode_fixed32`_ and `pb_decode_fixed64`_. They take a pointer to a 32- or 64-bit C variable, which you may then cast to smaller datatype for storage. - For decoding strings and bytes fields, the length has already been decoded. You can therefore check the total length in *stream->state* and read the data using `pb_read`_. + For decoding strings and bytes fields, the length has already been decoded. You can therefore check the total length in *stream->bytes_left* and read the data using `pb_read`_. Finally, for decoding submessages in a callback, simply use `pb_decode`_ and pass it the *SubMessage_fields* descriptor array. @@ -431,7 +443,7 @@ Decode the length for a field with wire type *PB_WT_STRING* and create a substre This function uses `pb_decode_varint`_ to read an integer from the stream. This is interpreted as a number of bytes, and the substream is set up so that its `bytes_left` is initially the same as the length, and its callback function and state the same as the parent stream. pb_close_string_substream ------------------------- +------------------------- Close the substream created with `pb_make_string_substream`_. :: void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream);