aboutsummaryrefslogtreecommitdiffstats
path: root/generator/proto
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-20 15:47:44 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-20 15:47:44 +0200
commitca74746e23b5a9e7916e8fde6632d71d61603f50 (patch)
tree7f52b0d716c54f55532c90aa931d8305b1a88ba9 /generator/proto
parent473816c66b559be6850fc1ef753a7141d1848300 (diff)
Add new option max_length for strings (issue #107)
Max_size is the allocated size, so users had to add +1 for the null terminator. Max_length does the +1 automatically in the generator.
Diffstat (limited to 'generator/proto')
-rw-r--r--generator/proto/nanopb.proto5
1 files changed, 5 insertions, 0 deletions
diff --git a/generator/proto/nanopb.proto b/generator/proto/nanopb.proto
index f6fe4a20..7d39e1c3 100644
--- a/generator/proto/nanopb.proto
+++ b/generator/proto/nanopb.proto
@@ -32,8 +32,13 @@ enum IntSize {
// fields.
message NanoPBOptions {
// Allocated size for 'bytes' and 'string' fields.
+ // For string fields, this should include the space for null terminator.
optional int32 max_size = 1;
+ // Maximum length for 'string' fields. Setting this is equivalent
+ // to setting max_size to a value of length+1.
+ optional int32 max_length = 14;
+
// Allocated number of entries in arrays ('repeated' fields)
optional int32 max_count = 2;