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

Unified Diff: ui/base/clipboard/custom_data_helper.cc

Issue 9688021: Avoid using Pickle::WriteSize(), which writes an architecture-dependent amount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « no previous file | ui/base/clipboard/custom_data_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/custom_data_helper.cc
===================================================================
--- ui/base/clipboard/custom_data_helper.cc (revision 125762)
+++ ui/base/clipboard/custom_data_helper.cc (working copy)
@@ -43,16 +43,16 @@
SkippablePickle pickle(data, data_length);
PickleIterator iter(pickle);
- size_t size = 0;
- if (!pickle.ReadSize(&iter, &size))
+ uint64 size = 0;
+ if (!pickle.ReadUInt64(&iter, &size))
return;
// Keep track of the original elements in the types vector. On failure, we
// truncate the vector to the original size since we want to ignore corrupt
// custom data pickles.
- size_t original_size = types->size();
+ uint64 original_size = types->size();
- for (size_t i = 0; i < size; ++i) {
+ for (uint64 i = 0; i < size; ++i) {
types->push_back(string16());
if (!pickle.ReadString16(&iter, &types->back()) ||
!pickle.SkipString16(&iter)) {
@@ -69,11 +69,11 @@
SkippablePickle pickle(data, data_length);
PickleIterator iter(pickle);
- size_t size = 0;
- if (!pickle.ReadSize(&iter, &size))
+ uint64 size = 0;
+ if (!pickle.ReadUInt64(&iter, &size))
return;
- for (size_t i = 0; i < size; ++i) {
+ for (uint64 i = 0; i < size; ++i) {
string16 deserialized_type;
if (!pickle.ReadString16(&iter, &deserialized_type))
return;
@@ -92,11 +92,11 @@
Pickle pickle(reinterpret_cast<const char*>(data), data_length);
PickleIterator iter(pickle);
- size_t size = 0;
- if (!pickle.ReadSize(&iter, &size))
+ uint64 size = 0;
+ if (!pickle.ReadUInt64(&iter, &size))
return;
- for (size_t i = 0; i < size; ++i) {
+ for (uint64 i = 0; i < size; ++i) {
string16 type;
if (!pickle.ReadString16(&iter, &type)) {
// Data is corrupt, return an empty map.
@@ -115,7 +115,7 @@
void WriteCustomDataToPickle(const std::map<string16, string16>& data,
Pickle* pickle) {
- pickle->WriteSize(data.size());
+ pickle->WriteUInt64(data.size());
for (std::map<string16, string16>::const_iterator it = data.begin();
it != data.end();
++it) {
« no previous file with comments | « no previous file | ui/base/clipboard/custom_data_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698