Commit c86884c3 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Change unsigned long to uint32_t/wtf_size_t/uint64_t in third_party/blink/*

- unsigned long -> uint32_t/wtf_size_t/uint64_t
- Reference: https://google.github.io/styleguide/cppguide.html#Integer_Types

Bug: 930252
Change-Id: Id05e83f486d1d11cac16ff17fbcd72b33ca986d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1530502Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642398}
parent d83b07da
......@@ -55,8 +55,8 @@ bool IsResourceHotForCaching(const SingleCachedMetadataHandler* cache_handler,
if (!cached_metadata)
return false;
double time_stamp;
const int size = sizeof(time_stamp);
DCHECK_EQ(cached_metadata->size(), static_cast<unsigned long>(size));
const uint32_t size = sizeof(time_stamp);
DCHECK_EQ(cached_metadata->size(), size);
memcpy(&time_stamp, cached_metadata->Data(), size);
return (WTF::CurrentTime() - time_stamp) < hot_seconds;
}
......
......@@ -1647,7 +1647,7 @@ bool XMLDocumentParser::AppendFragmentSource(const String& chunk) {
// the chunk has been processed.
long bytes_processed = xmlByteConsumed(Context());
if (bytes_processed == -1 ||
static_cast<unsigned long>(bytes_processed) != chunk_as_utf8.length()) {
static_cast<wtf_size_t>(bytes_processed) != chunk_as_utf8.length()) {
// FIXME: I don't believe we can hit this case without also having seen
// an error or a null byte. If we hit this DCHECK, we've found a test
// case which demonstrates the need for this code.
......
......@@ -46,8 +46,8 @@ struct CORE_EXPORT EvaluationContext {
explicit EvaluationContext(Node&);
Member<Node> node;
unsigned long size;
unsigned long position;
wtf_size_t size;
wtf_size_t position;
HashMap<String, String> variable_bindings;
bool had_type_conversion_error;
......
......@@ -75,8 +75,7 @@ class CORE_EXPORT Value {
enum Type { kNodeSetValue, kBooleanValue, kNumberValue, kStringValue };
Value(unsigned value) : type_(kNumberValue), bool_(false), number_(value) {}
Value(unsigned long value)
: type_(kNumberValue), bool_(false), number_(value) {}
Value(uint64_t value) : type_(kNumberValue), bool_(false), number_(value) {}
Value(double value) : type_(kNumberValue), bool_(false), number_(value) {}
Value(const char* value)
......
......@@ -2432,7 +2432,7 @@ void WebGLRenderingContextBase::deleteTexture(WebGLTexture* texture) {
// If the deleted was bound to the the current maximum index, trace backwards
// to find the new max texture index.
if (one_plus_max_non_default_texture_unit_ ==
static_cast<unsigned long>(max_bound_texture_index + 1)) {
static_cast<wtf_size_t>(max_bound_texture_index + 1)) {
FindNewMaxNonDefaultTextureUnit();
}
}
......
......@@ -256,7 +256,7 @@ bool PNGImageDecoder::ImageIsHighBitDepth() {
bool PNGImageDecoder::SetSize(unsigned width, unsigned height) {
DCHECK(!IsDecodedSizeAvailable());
// Protect against large PNGs. See http://bugzil.la/251381 for more details.
const unsigned long kMaxPNGSize = 1000000UL;
const uint32_t kMaxPNGSize = 1000000;
return (width <= kMaxPNGSize) && (height <= kMaxPNGSize) &&
ImageDecoder::SetSize(width, height);
}
......
......@@ -179,12 +179,12 @@ TEST(MathExtrasText, clampToUnsignedLongLongDouble) {
clampTo<uint64_t>(-overflow_ull));
}
TEST(MathExtrasTest, clampToUnsignedUnsignedLong) {
if (sizeof(unsigned long) == sizeof(unsigned))
TEST(MathExtrasTest, clampToUnsignedUint32) {
if (sizeof(uint32_t) == sizeof(unsigned))
return;
unsigned long max_unsigned = std::numeric_limits<unsigned>::max();
unsigned long overflow_unsigned = max_unsigned + 1;
uint32_t max_unsigned = std::numeric_limits<unsigned>::max();
uint32_t overflow_unsigned = max_unsigned + 1;
EXPECT_GT(overflow_unsigned, max_unsigned);
......@@ -194,7 +194,7 @@ TEST(MathExtrasTest, clampToUnsignedUnsignedLong) {
EXPECT_EQ(0u, clampTo<unsigned>(-1));
}
TEST(MathExtrasTest, clampToUnsignedUnsignedLongLong) {
TEST(MathExtrasTest, clampToUnsignedUint64) {
uint64_t max_unsigned = std::numeric_limits<unsigned>::max();
uint64_t overflow_unsigned = max_unsigned + 1;
......
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