| Index: mojom/generators/c/templates/struct.tmpl.go
|
| diff --git a/mojom/generators/c/templates/struct.tmpl.go b/mojom/generators/c/templates/struct.tmpl.go
|
| index 9bdc77819386e067f654ddcb5c7ab70c2506160b..7cefe7824c66dc78fe74c3fbfdc295b1e72ab203 100644
|
| --- a/mojom/generators/c/templates/struct.tmpl.go
|
| +++ b/mojom/generators/c/templates/struct.tmpl.go
|
| @@ -51,6 +51,10 @@ void {{$struct.Name}}_DecodePointersAndHandles(
|
| struct {{$struct.Name}}* inout_struct, uint32_t in_struct_size,
|
| MojoHandle inout_handles[], uint32_t in_num_handles);
|
|
|
| +MojomValidationResult {{$struct.Name}}_Validate(
|
| + const struct {{$struct.Name}}* in_struct, uint32_t in_struct_size,
|
| + uint32_t in_num_handles);
|
| +
|
| {{end}}
|
| `
|
|
|
| @@ -89,5 +93,18 @@ void {{$struct.Name}}_DecodePointersAndHandles(
|
| inout_handles, in_num_handles);
|
| }
|
|
|
| +MojomValidationResult {{$struct.Name}}_Validate(
|
| + const struct {{$struct.Name}}* in_struct, uint32_t in_struct_size,
|
| + uint32_t in_num_handles) {
|
| + struct MojomValidationContext context = {
|
| + .next_handle_index = 0,
|
| + .next_pointer = (char*)in_struct + in_struct->header_.num_bytes,
|
| + };
|
| + return MojomStruct_Validate(
|
| + &{{$struct.Name}}__TypeDesc,
|
| + (struct MojomStructHeader*)in_struct, in_struct_size, in_num_handles,
|
| + &context);
|
| +}
|
| +
|
| {{end}}
|
| `
|
|
|