diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-08-18 20:09:52 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-08-18 20:09:52 +0300 |
commit | 1dd9f1900fca0c137324c05a9421f1ba180b2470 (patch) | |
tree | f0788fa698b0c49bc06dfea181a1d062a4feb09f /generator | |
parent | 0b517b07789049089e19b714311c596399d53f8e (diff) |
Change the _count fields to use pb_size_t datatype.
Update issue 82
Status: FixedInGit
Diffstat (limited to 'generator')
-rwxr-xr-x | generator/nanopb_generator.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 1d12ae3c..88e9798d 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -261,7 +261,7 @@ class Field: result = '' if self.allocation == 'POINTER': if self.rules == 'REPEATED': - result += ' size_t ' + self.name + '_count;\n' + result += ' pb_size_t ' + self.name + '_count;\n' if self.pbtype == 'MESSAGE': # Use struct definition, so recursive submessages are possible @@ -277,17 +277,14 @@ class Field: if self.rules == 'OPTIONAL' and self.allocation == 'STATIC': result += ' bool has_' + self.name + ';\n' elif self.rules == 'REPEATED' and self.allocation == 'STATIC': - result += ' size_t ' + self.name + '_count;\n' + result += ' pb_size_t ' + self.name + '_count;\n' result += ' %s %s%s;' % (self.ctype, self.name, self.array_decl) return result def types(self): '''Return definitions for any special types this field might need.''' if self.pbtype == 'BYTES' and self.allocation == 'STATIC': - result = 'typedef struct {\n' - result += ' size_t size;\n' - result += ' uint8_t bytes[%d];\n' % self.max_size - result += '} %s;\n' % self.ctype + result = 'typedef PB_BYTES_ARRAY_T(%d) %s;\n' % (self.max_size, self.ctype) else: result = None return result |