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

Unified Diff: base/pickle.cc

Issue 601563003: Add Read/WriteSizeT() functions to the pickle layer, plus one consumer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « base/pickle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle.cc
diff --git a/base/pickle.cc b/base/pickle.cc
index 2d7a051b20077e20d86346867f414cb3ab961ea6..a0933fb7b91ce469f403225614afca3db6384c6e 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -106,6 +106,15 @@ bool PickleIterator::ReadUInt64(uint64* result) {
return ReadBuiltinType(result);
}
+bool PickleIterator::ReadSizeT(size_t* result) {
+ // Always read size_t as a 64-bit value to ensure compatibility between 32-bit
+ // and 64-bit processes.
+ uint64 result_uint64 = 0;
+ bool success = ReadBuiltinType(&result_uint64);
+ *result = static_cast<size_t>(result_uint64);
Tom Sepez 2014/10/01 19:12:45 I'd be OK with this so long as we did a check that
Peter Kasting 2014/10/01 19:42:08 Sure. Changed static_cast to checked_cast to achi
+ return success;
+}
+
bool PickleIterator::ReadFloat(float* result) {
// crbug.com/315213
// The source data may not be properly aligned, and unaligned float reads
« no previous file with comments | « base/pickle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698