Commit 9bddb3ff authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix 64 bit truncation errors in mojo WTF traits.

Cast or use appropriate type where applicable.

BUG=879657

Change-Id: I94f2a425e14281978bce8bfaf256f69b90af7bda
Reviewed-on: https://chromium-review.googlesource.com/c/1347047Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610874}
parent 7dba38f4
......@@ -37,16 +37,18 @@ struct ArrayTraits<WTF::Vector<U, InlineCapacity>> {
}
static U& GetAt(WTF::Vector<U, InlineCapacity>& input, size_t index) {
return input[index];
return input[static_cast<wtf_size_t>(index)];
}
static const U& GetAt(const WTF::Vector<U, InlineCapacity>& input,
size_t index) {
return input[index];
return input[static_cast<wtf_size_t>(index)];
}
static bool Resize(WTF::Vector<U, InlineCapacity>& input, size_t size) {
input.resize(size);
if (!base::IsValueInRangeForNumericType<wtf_size_t>(size))
return false;
input.resize(static_cast<wtf_size_t>(size));
return true;
}
};
......
......@@ -43,7 +43,7 @@ struct EqualsTraits<WTF::Vector<T>, false> {
static bool Equals(const WTF::Vector<T>& a, const WTF::Vector<T>& b) {
if (a.size() != b.size())
return false;
for (size_t i = 0; i < a.size(); ++i) {
for (wtf_size_t i = 0; i < a.size(); ++i) {
if (!mojo::Equals(a[i], b[i]))
return false;
}
......
......@@ -60,7 +60,7 @@ size_t WTFHash(size_t seed, const T& value) {
template <typename T>
struct StructPtrHashFn {
static unsigned GetHash(const StructPtr<T>& value) {
return value.Hash(kHashSeed);
return static_cast<unsigned>(value.Hash(kHashSeed));
}
static bool Equal(const StructPtr<T>& left, const StructPtr<T>& right) {
return left.Equals(right);
......@@ -71,7 +71,7 @@ struct StructPtrHashFn {
template <typename T>
struct InlinedStructPtrHashFn {
static unsigned GetHash(const InlinedStructPtr<T>& value) {
return value.Hash(kHashSeed);
return static_cast<unsigned>(value.Hash(kHashSeed));
}
static bool Equal(const InlinedStructPtr<T>& left,
const InlinedStructPtr<T>& right) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment