summaryrefslogtreecommitdiffstats
path: root/ui/base/clipboard/custom_data_helper.cc
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 21:42:51 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 21:42:51 +0000
commitff4318b71c5d2f6fdb353327fbb02bf52095e8a3 (patch)
treea38aa50528dd1ba45005e14a26699f63bc1b5189 /ui/base/clipboard/custom_data_helper.cc
parent857b6007601c7865b8f51eb8173018dd566605cf (diff)
downloadchromium_src-ff4318b71c5d2f6fdb353327fbb02bf52095e8a3.zip
chromium_src-ff4318b71c5d2f6fdb353327fbb02bf52095e8a3.tar.gz
chromium_src-ff4318b71c5d2f6fdb353327fbb02bf52095e8a3.tar.bz2
Avoid using Pickle::WriteSize(), which writes an architecture-dependent amount
of data, in clipboard pickles. (The goal is to remove that method entirely. Uses that never persist or send pickles over the network are [probably] safe, but having the method around is waiting for accidental misuses.) Review URL: http://codereview.chromium.org/9688021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/clipboard/custom_data_helper.cc')
-rw-r--r--ui/base/clipboard/custom_data_helper.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/ui/base/clipboard/custom_data_helper.cc b/ui/base/clipboard/custom_data_helper.cc
index 5200de8..56458f9 100644
--- a/ui/base/clipboard/custom_data_helper.cc
+++ b/ui/base/clipboard/custom_data_helper.cc
@@ -43,16 +43,16 @@ void ReadCustomDataTypes(const void* data,
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 @@ void ReadCustomDataForType(const void* data,
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 @@ void ReadCustomDataIntoMap(const void* data,
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 ReadCustomDataIntoMap(const void* data,
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) {