Index: mojo/public/cpp/bindings/lib/bindings_serialization.cc |
diff --git a/mojo/public/cpp/bindings/lib/bindings_serialization.cc b/mojo/public/cpp/bindings/lib/bindings_serialization.cc |
index 6f5fa3ded0dca33e9eefc13d8b02bc6c340e86e6..c1114c0edba51df01430f408915b7141ddca37e0 100644 |
--- a/mojo/public/cpp/bindings/lib/bindings_serialization.cc |
+++ b/mojo/public/cpp/bindings/lib/bindings_serialization.cc |
@@ -60,17 +60,6 @@ bool ValidateEncodedPointer(const uint64_t* offset) { |
reinterpret_cast<uintptr_t>(offset); |
} |
-bool ValidatePointer(const void* ptr, const Message& message) { |
- const uint8_t* data = static_cast<const uint8_t*>(ptr); |
- if (reinterpret_cast<uintptr_t>(data) % 8 != 0) |
- return false; |
- |
- const uint8_t* data_start = message.data(); |
- const uint8_t* data_end = data_start + message.data_num_bytes(); |
- |
- return data >= data_start && data < data_end; |
-} |
- |
void EncodeHandle(Handle* handle, std::vector<Handle>* handles) { |
if (handle->is_valid()) { |
handles->push_back(*handle); |
@@ -80,16 +69,14 @@ void EncodeHandle(Handle* handle, std::vector<Handle>* handles) { |
} |
} |
-bool DecodeHandle(Handle* handle, std::vector<Handle>* handles) { |
+void DecodeHandle(Handle* handle, std::vector<Handle>* handles) { |
if (handle->value() == kEncodedInvalidHandleValue) { |
*handle = Handle(); |
- return true; |
+ return; |
} |
- if (handle->value() >= handles->size()) |
- return false; |
+ assert(handle->value() < handles->size()); |
// Just leave holes in the vector so we don't screw up other indices. |
*handle = FetchAndReset(&handles->at(handle->value())); |
- return true; |
} |
bool ValidateStructHeader(const void* data, |