| Index: mojo/public/cpp/bindings/lib/serialization.h
|
| diff --git a/mojo/public/cpp/bindings/lib/serialization.h b/mojo/public/cpp/bindings/lib/serialization.h
|
| index 5274adf1a57f32667b5353a9bf3b2b2f188ba339..6d7dd8e5cde032a783c2167d2ef5849de60afce1 100644
|
| --- a/mojo/public/cpp/bindings/lib/serialization.h
|
| +++ b/mojo/public/cpp/bindings/lib/serialization.h
|
| @@ -67,7 +67,7 @@ DataArrayType StructSerializeImpl(UserType* input) {
|
| }
|
|
|
| template <typename MojomType, typename DataArrayType, typename UserType>
|
| -bool StructDeserializeImpl(DataArrayType input, UserType* output) {
|
| +bool StructDeserializeImpl(const DataArrayType& input, UserType* output) {
|
| static_assert(BelongsTo<MojomType, MojomTypeCategory::STRUCT>::value,
|
| "Unexpected type.");
|
| using DataType = typename MojomType::Struct::Data_;
|
| @@ -75,7 +75,10 @@ bool StructDeserializeImpl(DataArrayType input, UserType* output) {
|
| if (input.is_null())
|
| return false;
|
|
|
| - void* input_buffer = input.empty() ? nullptr : &input.front();
|
| + void* input_buffer =
|
| + input.empty()
|
| + ? nullptr
|
| + : const_cast<void*>(reinterpret_cast<const void*>(&input.front()));
|
|
|
| // Please see comments in StructSerializeImpl.
|
| bool need_copy = !IsAligned(input_buffer);
|
|
|