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

Unified Diff: base/pickle.cc

Issue 388213002: add double support to base::Pickle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doc nit fix 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 | « base/pickle.h ('k') | base/pickle_unittest.cc » ('j') | 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 a9e9a0fdfbcb623c721082d9273fc2e10b2dd259..2d7a051b20077e20d86346867f414cb3ab961ea6 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -118,6 +118,18 @@ bool PickleIterator::ReadFloat(float* result) {
return true;
}
+bool PickleIterator::ReadDouble(double* result) {
+ // crbug.com/315213
+ // The source data may not be properly aligned, and unaligned double reads
+ // cause SIGBUS on some ARM platforms, so force using memcpy to copy the data
+ // into the result.
+ const char* read_from = GetReadPointerAndAdvance<double>();
+ if (!read_from)
+ return false;
+ memcpy(result, read_from, sizeof(*result));
+ return true;
+}
+
bool PickleIterator::ReadString(std::string* result) {
int len;
if (!ReadInt(&len))
« no previous file with comments | « base/pickle.h ('k') | base/pickle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698