From ca74746e23b5a9e7916e8fde6632d71d61603f50 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Mon, 20 Feb 2017 15:47:44 +0200 Subject: 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. --- tests/options/options.expected | 1 + tests/options/options.proto | 1 + 2 files changed, 2 insertions(+) (limited to 'tests/options') diff --git a/tests/options/options.expected b/tests/options/options.expected index 0769880a..9e47e6a4 100644 --- a/tests/options/options.expected +++ b/tests/options/options.expected @@ -1,6 +1,7 @@ char filesize\[20\]; char msgsize\[30\]; char fieldsize\[40\]; +char fieldlen\[41\]; pb_callback_t int32_callback; \sEnumValue1 = 1 Message5_EnumValue1 diff --git a/tests/options/options.proto b/tests/options/options.proto index 89bb086f..c6ca5e25 100644 --- a/tests/options/options.proto +++ b/tests/options/options.proto @@ -26,6 +26,7 @@ message Message3 { option (nanopb_msgopt).msgid = 103; required string fieldsize = 1 [(nanopb).max_size = 40]; + required string fieldlen = 2 [(nanopb).max_length = 40]; } // Forced callback field -- cgit