aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-14 20:11:05 +0000
committerPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-14 20:11:05 +0000
commit842d52633d650286ce62490362f8dfa356e17800 (patch)
tree6597bc4dc16ac13d129901fd42e76fb776e86a7d /generator
parent6dfba365b00175eae7e8b83aaf5d29ce190fd9eb (diff)
More documentation, small improvements
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@955 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'generator')
-rw-r--r--generator/nanopb_generator.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 6aff315..e62d04f 100644
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -204,7 +204,7 @@ class Field:
if prev_field_name is None:
result += ' offsetof(%s, %s),' % (self.struct_name, self.name)
else:
- result += ' pb_delta(%s, %s, %s),' % (self.struct_name, self.name, prev_field_name)
+ result += ' pb_delta_end(%s, %s, %s),' % (self.struct_name, self.name, prev_field_name)
if self.htype == 'PB_HTYPE_OPTIONAL':
result += '\n pb_delta(%s, has_%s, %s),' % (self.struct_name, self.name, self.name)
@@ -279,11 +279,11 @@ class Message:
return result
def fields_declaration(self):
- result = 'extern const pb_field_t %s_fields[%d];' % (self.name, len(self.fields))
+ result = 'extern const pb_field_t %s_fields[%d];' % (self.name, len(self.fields) + 1)
return result
def fields_definition(self):
- result = 'const pb_field_t %s_fields[%d] = {\n' % (self.name, len(self.fields))
+ result = 'const pb_field_t %s_fields[%d] = {\n' % (self.name, len(self.fields) + 1)
prev = None
for field in self.ordered_fields:
@@ -291,7 +291,7 @@ class Message:
result += ',\n\n'
prev = field.name
- result = result[:-3] + '\n};'
+ result += ' PB_LAST_FIELD\n};'
return result
def iterate_messages(desc, names = Names()):