| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/public/c/bindings/map.h" | 5 #include <mojo/bindings/map.h> |
| 6 |
| 7 #include <mojo/macros.h> |
| 6 | 8 |
| 7 struct MojomMapLayout { | 9 struct MojomMapLayout { |
| 8 struct MojomStructHeader header_; | 10 struct MojomStructHeader header_; |
| 9 union MojomArrayHeaderPtr keys; | 11 union MojomArrayHeaderPtr keys; |
| 10 union MojomArrayHeaderPtr values; | 12 union MojomArrayHeaderPtr values; |
| 11 }; | 13 }; |
| 12 MOJO_STATIC_ASSERT(sizeof(struct MojomMapLayout) == 24u, | 14 MOJO_STATIC_ASSERT(sizeof(struct MojomMapLayout) == 24u, |
| 13 "MojomMapLayout is an invalid size."); | 15 "MojomMapLayout is an invalid size."); |
| 14 | 16 |
| 15 MojomValidationResult MojomMap_Validate( | 17 MojomValidationResult MojomMap_Validate( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 27 struct MojomArrayHeader* values_arr = | 29 struct MojomArrayHeader* values_arr = |
| 28 (struct MojomArrayHeader*)((char*)map + | 30 (struct MojomArrayHeader*)((char*)map + |
| 29 (offsetof(struct MojomMapLayout, values) + | 31 (offsetof(struct MojomMapLayout, values) + |
| 30 map->values.offset)); | 32 map->values.offset)); |
| 31 | 33 |
| 32 if (keys_arr->num_elements != values_arr->num_elements) | 34 if (keys_arr->num_elements != values_arr->num_elements) |
| 33 return MOJOM_VALIDATION_DIFFERENT_SIZED_ARRAYS_IN_MAP; | 35 return MOJOM_VALIDATION_DIFFERENT_SIZED_ARRAYS_IN_MAP; |
| 34 | 36 |
| 35 return MOJOM_VALIDATION_ERROR_NONE; | 37 return MOJOM_VALIDATION_ERROR_NONE; |
| 36 } | 38 } |
| OLD | NEW |