summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-17 19:03:06 +0000
committerPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-17 19:03:06 +0000
commit7f53c3f7484679c1e38607f59542d43be1387650 (patch)
tree396198a24a1661eb7af87d0364a936d8df98a5ae /docs
parent2cefaeaf61f38f1566293e53b4708e9ceff2d945 (diff)
Example
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@957 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'docs')
-rw-r--r--docs/concepts.rst4
-rw-r--r--docs/index.rst2
-rw-r--r--docs/reference.rst2
3 files changed, 4 insertions, 4 deletions
diff --git a/docs/concepts.rst b/docs/concepts.rst
index 58620a85..fac9061f 100644
--- a/docs/concepts.rst
+++ b/docs/concepts.rst
@@ -164,7 +164,7 @@ Field callbacks
===============
When a field has dynamic length, nanopb cannot statically allocate storage for it. Instead, it allows you to handle the field in whatever way you want, using a callback function.
-The `pb_callback_t`_ structure contains a function pointer and a *void* pointer you can use for passing data to the callback. The actual behavior of the callback function is different in encoding and decoding modes.
+The `pb_callback_t`_ structure contains a function pointer and a *void* pointer you can use for passing data to the callback. If the function pointer is NULL, the field will be skipped. The actual behavior of the callback function is different in encoding and decoding modes.
.. _`pb_callback_t`: reference.html#pb-callback-t
@@ -176,7 +176,7 @@ Encoding callbacks
When encoding, the callback should write out complete fields, including the wire type and field number tag. It can write as many or as few fields as it likes. For example, if you want to write out an array as *repeated* field, you should do it all in a single call.
-The callback may be called multiple times during a single call to `pb_encode`_. It must produce the same amount of data every time.
+If the callback is used in a submessage, it will be called multiple times during a single call to `pb_encode`_. It must produce the same amount of data every time. If the callback is directly in the main message, it is called only once.
.. _`pb_encode`: reference.html#pb-encode
diff --git a/docs/index.rst b/docs/index.rst
index 93f04c6c..ea891237 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -42,7 +42,7 @@ Features and limitations
**Limitations**
-#) User must provide callbacks when decoding arrays or strings without maximum size.
+#) User must provide callbacks when decoding arrays or strings without maximum size. Malloc support could be added as a separate module.
#) Some speed has been sacrificed for code size. For example varint calculations are always done in 64 bits.
#) Encoding is focused on writing to streams. For memory buffers only it could be made more efficient.
#) The deprecated Protocol Buffers feature called "groups" is not supported.
diff --git a/docs/reference.rst b/docs/reference.rst
index b8f9454e..2812958f 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -94,7 +94,7 @@ Part of a message structure, for fields with type PB_HTYPE_CALLBACK::
The *arg* is passed to the callback when calling. It can be used to store any information that the callback might need.
-When calling `pb_encode`_, *funcs.encode* must be set, and similarly when calling `pb_decode`_, *funcs.decode* must be set. The function pointers are stored in the same memory location but are of incompatible types.
+When calling `pb_encode`_, *funcs.encode* is used, and similarly when calling `pb_decode`_, *funcs.decode* is used. The function pointers are stored in the same memory location but are of incompatible types. You can set the function pointer to NULL to skip the field.
pb_wire_type_t
--------------