Publishing nanopb-0.2.1
[apps/agl-service-can-low-level.git] / generator / nanopb_generator.py
index 5ef4ab7..c772c8b 100644 (file)
@@ -1,5 +1,5 @@
 '''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
-nanopb_version = "nanopb-0.2.1-dev"
+nanopb_version = "nanopb-0.2.1"
 
 try:
     import google.protobuf.descriptor_pb2 as descriptor
@@ -186,7 +186,7 @@ class Field:
         return cmp(self.tag, other.tag)
     
     def __str__(self):
-        if self.rules == 'OPTIONAL':
+        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'