From 07375a126337916f3a34ea94f8085b8f89d789a1 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Wed, 22 Feb 2017 21:06:32 +0200 Subject: 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". --- generator/proto/nanopb.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'generator/proto') diff --git a/generator/proto/nanopb.proto b/generator/proto/nanopb.proto index 7d39e1c3..e4c1da79 100644 --- a/generator/proto/nanopb.proto +++ b/generator/proto/nanopb.proto @@ -16,7 +16,7 @@ enum FieldType { FT_POINTER = 4; // Always generate a dynamically allocated field. FT_STATIC = 2; // Generate a static field or raise an exception if not possible. FT_IGNORE = 3; // Ignore the field completely. - FT_INLINE = 5; // Always generate an inline array of fixed size. + FT_INLINE = 5; // Legacy option, use the separate 'fixed_length' option instead } enum IntSize { @@ -77,6 +77,9 @@ message NanoPBOptions { // Generate an enum->string mapping function (can take up lots of space). optional bool enum_to_string = 13 [default = false]; + + // Generate bytes arrays with fixed length + optional bool fixed_length = 15 [default = false]; } // Extensions to protoc 'Descriptor' type in order to define options -- cgit 1.2.3-korg