summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generator/nanopb_generator.py6
-rw-r--r--pb.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 9e2a30ed..1925167f 100644
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -217,10 +217,10 @@ class Field:
prev_field_name is the name of the previous field or None.
'''
result = ' {%d, ' % self.tag
- result += self.htype
+ result += '(pb_type_t) ((int) ' + self.htype
if self.ltype is not None:
- result += ' | ' + self.ltype
- result += ',\n'
+ result += ' | (int) ' + self.ltype
+ result += '),\n'
if prev_field_name is None:
result += ' offsetof(%s, %s),' % (self.struct_name, self.name)
diff --git a/pb.h b/pb.h
index d030d9e3..61696a4f 100644
--- a/pb.h
+++ b/pb.h
@@ -195,7 +195,7 @@ typedef enum {
#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0]))
#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2))
#define pb_delta_end(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2))
-#define PB_LAST_FIELD {0,0,0,0}
+#define PB_LAST_FIELD {0,(pb_type_t) 0,0,0}
#endif