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

Unified Diff: base/pickle.cc

Issue 297011: Add Pickle::Read/WriteUint64. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
===================================================================
--- base/pickle.cc (revision 29613)
+++ base/pickle.cc (working copy)
@@ -6,8 +6,8 @@
#include <stdlib.h>
+#include <algorithm> // for max()
#include <limits>
-#include <string>
//------------------------------------------------------------------------------
@@ -181,6 +181,20 @@
return true;
}
+bool Pickle::ReadUInt64(void** iter, uint64* result) const {
+ DCHECK(iter);
+ if (!*iter)
+ *iter = const_cast<char*>(payload());
+
+ if (!IteratorHasRoomFor(*iter, sizeof(*result)))
+ return false;
+
+ memcpy(result, *iter, sizeof(*result));
+
+ UpdateIter(iter, sizeof(*result));
+ return true;
+}
+
bool Pickle::ReadIntPtr(void** iter, intptr_t* result) const {
DCHECK(iter);
if (!*iter)
@@ -355,7 +369,7 @@
}
void Pickle::TrimWriteData(int new_length) {
- DCHECK(variable_buffer_offset_ != 0);
+ DCHECK_NE(variable_buffer_offset_, 0);
// Fetch the the variable buffer size
int* cur_length = reinterpret_cast<int*>(
« 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