summaryrefslogtreecommitdiffstats
path: root/base/pickle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/pickle.cc')
-rw-r--r--base/pickle.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/base/pickle.cc b/base/pickle.cc
index 73a764a..83efaf1 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -130,6 +130,22 @@ bool Pickle::ReadInt(void** iter, int* result) const {
return true;
}
+bool Pickle::ReadLong(void** iter, long* result) const {
+ DCHECK(iter);
+ if (!*iter)
+ *iter = const_cast<char*>(payload());
+
+ if (!IteratorHasRoomFor(*iter, sizeof(*result)))
+ return false;
+
+ // TODO(jar) bug 1129285: Pickle should be cleaned up, and not dependent on
+ // alignment.
+ memcpy(result, *iter, sizeof(*result));
+
+ UpdateIter(iter, sizeof(*result));
+ return true;
+}
+
bool Pickle::ReadLength(void** iter, int* result) const {
if (!ReadInt(iter, result))
return false;