summaryrefslogtreecommitdiffstats
path: root/docs/concepts.rst
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-22 21:06:32 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-22 21:10:26 +0200
commit07375a126337916f3a34ea94f8085b8f89d789a1 (patch)
treeef95d9138252d8ae4797e0a7092bc7417c1abefb /docs/concepts.rst
parentca74746e23b5a9e7916e8fde6632d71d61603f50 (diff)
Extend inline / fixed length bytes array support (issue #244)
Adds support for proto3 and POINTER field types to have fixed length bytes arrays. Also changed the .proto option to a separate fixed_length:true, while also supporting the old FT_INLINE option. Restructured the generator and decoder logic to threat the inline bytes fields more like "just another field type".
Diffstat (limited to 'docs/concepts.rst')
-rw-r--r--docs/concepts.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/concepts.rst b/docs/concepts.rst
index ea33863c..2e0d3f9b 100644
--- a/docs/concepts.rst
+++ b/docs/concepts.rst
@@ -148,7 +148,7 @@ Most Protocol Buffers datatypes have directly corresponding C datatypes, such as
1) Strings, bytes and repeated fields of any type map to callback functions by default.
2) If there is a special option *(nanopb).max_size* specified in the .proto file, string maps to null-terminated char array and bytes map to a structure containing a char array and a size field.
-3) If *(nanopb).type* is set to *FT_INLINE* and *(nanopb).max_size* is also set, then bytes map to an inline byte array of fixed size.
+3) If *(nanopb).fixed_length* is set to *true* and *(nanopb).max_size* is also set, then bytes map to an inline byte array of fixed size.
4) If there is a special option *(nanopb).max_count* specified on a repeated field, it maps to an array of whatever type is being repeated. Another field will be created for the actual number of entries stored.
=============================================================================== =======================
@@ -164,7 +164,7 @@ required bytes data = 1 [(nanopb).max_size = 40];
| pb_byte_t bytes[40];
| } Person_data_t;
| Person_data_t data;
-required bytes data = 1 [(nanopb).max_size = 40, (nanopb).type = FT_INLINE]; | pb_byte_t data[40];
+required bytes data = 1 [(nanopb).max_size = 40, (nanopb).fixed_length = true]; | pb_byte_t data[40];
=============================================================================== =======================
The maximum lengths are checked in runtime. If string/bytes/array exceeds the allocated length, *pb_decode* will return false.