From a2f8112166d73aaf7e8fc877f0310202319d4639 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Tue, 4 Feb 2014 20:24:44 +0200 Subject: Add proper suffixes for integer default values. Update issue 102 Status: FixedInGit --- generator/nanopb_generator.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'generator') diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 094f8e85..4f8ed94c 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -315,6 +315,12 @@ class Field: data = self.default.decode('string_escape') data = ['0x%02x' % ord(c) for c in data] default = '{%d, {%s}}' % (len(data), ','.join(data)) + elif self.pbtype in ['FIXED32', 'UINT32']: + default += 'u' + elif self.pbtype in ['FIXED64', 'UINT64']: + default += 'ull' + elif self.pbtype in ['SFIXED64', 'INT64']: + default += 'll' if declaration_only: return 'extern const %s %s_default%s;' % (ctype, self.struct_name + self.name, array_decl) -- cgit 1.2.3-korg