OLD | NEW |
1 {%- macro validate(struct, class_name) %} | 1 {%- macro validate(struct, class_name) %} |
2 if (!data) | 2 if (!data) |
3 return true; | 3 return true; |
4 | 4 |
5 if (!ValidateStructHeader( | 5 if (!ValidateStructHeader( |
6 data, sizeof({{class_name}}), | 6 data, sizeof({{class_name}}), |
7 {{struct.packed.packed_fields|length}}, bounds_checker)) { | 7 {{struct.packed.packed_fields|length}}, bounds_checker)) { |
8 return false; | 8 return false; |
9 } | 9 } |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind -%} | 71 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind -%} |
72 mojo::internal::Encode(&{{pf.field.name}}, handles); | 72 mojo::internal::Encode(&{{pf.field.name}}, handles); |
73 {% endfor %} | 73 {% endfor %} |
74 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_handle_kind -%} | 74 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_handle_kind -%} |
75 mojo::internal::EncodeHandle(&{{pf.field.name}}, handles); | 75 mojo::internal::EncodeHandle(&{{pf.field.name}}, handles); |
76 {% endfor %} | 76 {% endfor %} |
77 {%- endmacro -%} | 77 {%- endmacro -%} |
78 | 78 |
79 {%- macro decodes(struct) -%} | 79 {%- macro decodes(struct) -%} |
80 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind -%} | 80 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind -%} |
81 if (!mojo::internal::Decode(&{{pf.field.name}}, message)) | 81 mojo::internal::Decode(&{{pf.field.name}}, handles); |
82 return false; | |
83 {% endfor %} | 82 {% endfor %} |
84 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_handle_kind -%} | 83 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_handle_kind -%} |
85 if (!mojo::internal::DecodeHandle(&{{pf.field.name}}, | 84 mojo::internal::DecodeHandle(&{{pf.field.name}}, handles); |
86 message->mutable_handles())) | |
87 return false; | |
88 {% endfor %} | 85 {% endfor %} |
89 {%- endmacro -%} | 86 {%- endmacro -%} |
OLD | NEW |