Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: mojo/system/memory.h

Issue 417113010: Convert ReadData...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/system/local_data_pipe_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/memory.h
diff --git a/mojo/system/memory.h b/mojo/system/memory.h
index 65ccd291c0e72951a333f16d9ee2efc93516e9d8..1a6f7ec20fa8790eeefb4b1cda08e990cc6778a4 100644
--- a/mojo/system/memory.h
+++ b/mojo/system/memory.h
@@ -181,11 +181,10 @@ class UserPointer {
memcpy(pointer_, source, count * sizeof(NonVoidType));
}
- // Gets a |UserPointer| at offset |i| (in |Type|s) relative to this. This
- // method is not valid if |Type| is |void| (TODO(vtl): Maybe I should make it
- // valid, with the offset in bytes?).
+ // Gets a |UserPointer| at offset |i| (in |Type|s) relative to this.
UserPointer At(size_t i) const {
- return UserPointer(pointer_ + i);
+ return UserPointer(static_cast<Type*>(
+ static_cast<NonVoidType*>(pointer_) + i));
}
// TODO(vtl): This is temporary. Get rid of this. (We should pass
« no previous file with comments | « mojo/system/local_data_pipe_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698