OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return false; | 97 return false; |
98 } | 98 } |
99 | 99 |
100 return Array_Data<T>::Validate(DecodePointerRaw(&input.offset), | 100 return Array_Data<T>::Validate(DecodePointerRaw(&input.offset), |
101 bounds_checker, validate_params); | 101 bounds_checker, validate_params); |
102 } | 102 } |
103 | 103 |
104 template <typename T> | 104 template <typename T> |
105 bool ValidateMap(const Pointer<T>& input, | 105 bool ValidateMap(const Pointer<T>& input, |
106 BoundsChecker* bounds_checker, | 106 BoundsChecker* bounds_checker, |
107 const ArrayValidateParams* value_validate_params) { | 107 const ArrayValidateParams* validate_params) { |
108 if (!ValidateEncodedPointer(&input.offset)) { | 108 if (!ValidateEncodedPointer(&input.offset)) { |
109 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); | 109 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); |
110 return false; | 110 return false; |
111 } | 111 } |
112 | 112 |
113 return T::Validate(DecodePointerRaw(&input.offset), bounds_checker, | 113 return T::Validate(DecodePointerRaw(&input.offset), bounds_checker, |
114 value_validate_params); | 114 validate_params); |
115 } | 115 } |
116 | 116 |
117 template <typename T> | 117 template <typename T> |
118 bool ValidateStruct(const Pointer<T>& input, BoundsChecker* bounds_checker) { | 118 bool ValidateStruct(const Pointer<T>& input, BoundsChecker* bounds_checker) { |
119 if (!ValidateEncodedPointer(&input.offset)) { | 119 if (!ValidateEncodedPointer(&input.offset)) { |
120 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); | 120 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); |
121 return false; | 121 return false; |
122 } | 122 } |
123 | 123 |
124 return T::Validate(DecodePointerRaw(&input.offset), bounds_checker); | 124 return T::Validate(DecodePointerRaw(&input.offset), bounds_checker); |
(...skipping 16 matching lines...) Expand all Loading... |
141 } | 141 } |
142 | 142 |
143 bool ValidateHandle(const Handle_Data& input, BoundsChecker* bounds_checker); | 143 bool ValidateHandle(const Handle_Data& input, BoundsChecker* bounds_checker); |
144 | 144 |
145 bool ValidateAssociatedInterfaceId(InterfaceId input); | 145 bool ValidateAssociatedInterfaceId(InterfaceId input); |
146 | 146 |
147 } // namespace internal | 147 } // namespace internal |
148 } // namespace mojo | 148 } // namespace mojo |
149 | 149 |
150 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ | 150 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ |
OLD | NEW |