diff options
-rw-r--r-- | ui/base/clipboard/custom_data_helper.cc | 22 | ||||
-rw-r--r-- | ui/base/clipboard/custom_data_helper_unittest.cc | 10 |
2 files changed, 16 insertions, 16 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) { diff --git a/ui/base/clipboard/custom_data_helper_unittest.cc b/ui/base/clipboard/custom_data_helper_unittest.cc index 05df47e..e5bb703 100644 --- a/ui/base/clipboard/custom_data_helper_unittest.cc +++ b/ui/base/clipboard/custom_data_helper_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -118,7 +118,7 @@ TEST(CustomDataHelperTest, BadReadTypes) { expected.push_back(ASCIIToUTF16("f")); Pickle malformed; - malformed.WriteSize(1000); + malformed.WriteUInt64(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); std::vector<string16> actual(expected); @@ -126,7 +126,7 @@ TEST(CustomDataHelperTest, BadReadTypes) { EXPECT_EQ(expected, actual); Pickle malformed2; - malformed2.WriteSize(1); + malformed2.WriteUInt64(1); malformed2.WriteString16(ASCIIToUTF16("hello")); std::vector<string16> actual2(expected); ReadCustomDataTypes(malformed2.data(), malformed2.size(), &actual2); @@ -138,7 +138,7 @@ TEST(CustomDataHelperTest, BadPickle) { std::map<string16, string16> result_map; Pickle malformed; - malformed.WriteSize(1000); + malformed.WriteUInt64(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); @@ -151,7 +151,7 @@ TEST(CustomDataHelperTest, BadPickle) { EXPECT_EQ(0u, result_map.size()); Pickle malformed2; - malformed2.WriteSize(1); + malformed2.WriteUInt64(1); malformed2.WriteString16(ASCIIToUTF16("hello")); ReadCustomDataForType(malformed2.data(), |