Skip to content

Commit

Permalink
Merge pull request #108 from microavia/v1-missing-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTon authored Nov 28, 2024
2 parents fa54042 + eef30b0 commit 5aa0124
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions messgen/cpp_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ def _generate_type_struct(self, type_name: str):
code_ser.append("return _size;")

code_ser = ["",
"size_t serialize(uint8_t *_buf) const {",
"size_t serialize(uint8_t *" + ("_buf" if not is_empty else "") + ") const {",
] + _indent(code_ser) + [
"}"]
"}"]
code.extend(_indent(code_ser))

# Deserialize function
Expand Down Expand Up @@ -361,9 +361,9 @@ def _generate_type_struct(self, type_name: str):
if self._get_mode() == "nostl":
alloc = ", messgen::Allocator &_alloc"
code_deser = ["",
"size_t deserialize(const uint8_t *_buf%s) {" % alloc,
"size_t deserialize(const uint8_t *" + ("_buf" if not is_empty else "") + alloc + ") {",
] + _indent(code_deser) + [
"}"]
"}"]
code.extend(_indent(code_deser))

# Size function
Expand All @@ -386,7 +386,7 @@ def _generate_type_struct(self, type_name: str):
code_ss.append("return _size;")

code_ss = ["",
"size_t serialized_size() const {",
"[[nodiscard]] size_t serialized_size() const {",
_indent("// %s" % ", ".join(fixed_fields)),
_indent("size_t _size = %d;" % fixed_size),
"",
Expand Down

0 comments on commit 5aa0124

Please sign in to comment.