diff options
author | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-10 17:54:15 +0000 |
---|---|---|
committer | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-10 17:54:15 +0000 |
commit | 0c5bc4caf9cfb221822fead442b462be2f47b97b (patch) | |
tree | f8e86d3c0bde869bf93df4ec439f83936742c79e /pb_encode.h | |
parent | a8d0172507d59b73b95f766aa7644147fd060f20 (diff) |
Unittests for encode
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@952 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'pb_encode.h')
-rw-r--r-- | pb_encode.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pb_encode.h b/pb_encode.h index 95f3483a..17ba5b9a 100644 --- a/pb_encode.h +++ b/pb_encode.h @@ -21,7 +21,7 @@ * * 2) You can use state to store your own data (e.g. buffer pointer). * - * 3) pb_write will update bytes_written before your callback runs. + * 3) pb_write will update bytes_written after your callback runs. * * 4) Your callback will be always used with the same pb_ostream_t. * There are no substreams when encoding. @@ -50,8 +50,10 @@ bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_ bool pb_encode_varint(pb_ostream_t *stream, uint64_t value); bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, int field_number); +/* Encode tag based on LTYPE and field number defined in the field structure. */ bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field); -bool pb_encode_string(pb_ostream_t *stream, uint8_t *buffer, size_t size); +/* Write length as varint and then the contents of buffer. */ +bool pb_encode_string(pb_ostream_t *stream, const uint8_t *buffer, size_t size); /* --- Field encoders --- * Each encoder writes the content for the field. |