| Index: base/pickle.cc
|
| diff --git a/base/pickle.cc b/base/pickle.cc
|
| index 489c7f890a7168868a018248ef4fd912079cec22..6fcdece39ec2cd4a1b7be947989a22f68725dc1e 100644
|
| --- a/base/pickle.cc
|
| +++ b/base/pickle.cc
|
| @@ -30,7 +30,7 @@ inline bool PickleIterator::ReadBuiltinType(Type* result) {
|
| const char* read_from = GetReadPointerAndAdvance<Type>();
|
| if (!read_from)
|
| return false;
|
| - if (sizeof(Type) > sizeof(uint32))
|
| + if (sizeof(Type) > sizeof(uint32_t))
|
| memcpy(result, read_from, sizeof(*result));
|
| else
|
| *result = *reinterpret_cast<const Type*>(read_from);
|
| @@ -72,9 +72,9 @@ inline const char* PickleIterator::GetReadPointerAndAdvance(
|
| int num_elements,
|
| size_t size_element) {
|
| // Check for int32 overflow.
|
| - int64 num_bytes = static_cast<int64>(num_elements) * size_element;
|
| + int64_t num_bytes = static_cast<int64_t>(num_elements) * size_element;
|
| int num_bytes32 = static_cast<int>(num_bytes);
|
| - if (num_bytes != static_cast<int64>(num_bytes32))
|
| + if (num_bytes != static_cast<int64_t>(num_bytes32))
|
| return NULL;
|
| return GetReadPointerAndAdvance(num_bytes32);
|
| }
|
| @@ -91,26 +91,26 @@ bool PickleIterator::ReadLong(long* result) {
|
| return ReadBuiltinType(result);
|
| }
|
|
|
| -bool PickleIterator::ReadUInt16(uint16* result) {
|
| +bool PickleIterator::ReadUInt16(uint16_t* result) {
|
| return ReadBuiltinType(result);
|
| }
|
|
|
| -bool PickleIterator::ReadUInt32(uint32* result) {
|
| +bool PickleIterator::ReadUInt32(uint32_t* result) {
|
| return ReadBuiltinType(result);
|
| }
|
|
|
| -bool PickleIterator::ReadInt64(int64* result) {
|
| +bool PickleIterator::ReadInt64(int64_t* result) {
|
| return ReadBuiltinType(result);
|
| }
|
|
|
| -bool PickleIterator::ReadUInt64(uint64* result) {
|
| +bool PickleIterator::ReadUInt64(uint64_t* result) {
|
| return ReadBuiltinType(result);
|
| }
|
|
|
| bool PickleIterator::ReadSizeT(size_t* result) {
|
| // Always read size_t as a 64-bit value to ensure compatibility between 32-bit
|
| // and 64-bit processes.
|
| - uint64 result_uint64 = 0;
|
| + uint64_t result_uint64 = 0;
|
| bool success = ReadBuiltinType(&result_uint64);
|
| *result = static_cast<size_t>(result_uint64);
|
| // Fail if the cast above truncates the value.
|
| @@ -207,7 +207,7 @@ bool PickleIterator::ReadBytes(const char** data, int length) {
|
| return true;
|
| }
|
|
|
| -// Payload is uint32 aligned.
|
| +// Payload is uint32_t aligned.
|
|
|
| Pickle::Pickle()
|
| : header_(NULL),
|
| @@ -222,7 +222,7 @@ Pickle::Pickle()
|
|
|
| Pickle::Pickle(int header_size)
|
| : header_(NULL),
|
| - header_size_(bits::Align(header_size, sizeof(uint32))),
|
| + header_size_(bits::Align(header_size, sizeof(uint32_t))),
|
| capacity_after_header_(0),
|
| write_offset_(0) {
|
| DCHECK_GE(static_cast<size_t>(header_size), sizeof(Header));
|
| @@ -242,7 +242,7 @@ Pickle::Pickle(const char* data, int data_len)
|
| if (header_size_ > static_cast<unsigned int>(data_len))
|
| header_size_ = 0;
|
|
|
| - if (header_size_ != bits::Align(header_size_, sizeof(uint32)))
|
| + if (header_size_ != bits::Align(header_size_, sizeof(uint32_t)))
|
| header_size_ = 0;
|
|
|
| // If there is anything wrong with the data, we're not going to use it.
|
| @@ -310,12 +310,12 @@ bool Pickle::WriteBytes(const void* data, int length) {
|
| }
|
|
|
| void Pickle::Reserve(size_t length) {
|
| - size_t data_len = bits::Align(length, sizeof(uint32));
|
| + size_t data_len = bits::Align(length, sizeof(uint32_t));
|
| DCHECK_GE(data_len, length);
|
| #ifdef ARCH_CPU_64_BITS
|
| - DCHECK_LE(data_len, kuint32max);
|
| + DCHECK_LE(data_len, std::numeric_limits<uint32_t>::max());
|
| #endif
|
| - DCHECK_LE(write_offset_, kuint32max - data_len);
|
| + DCHECK_LE(write_offset_, std::numeric_limits<uint32_t>::max() - data_len);
|
| size_t new_size = write_offset_ + data_len;
|
| if (new_size > capacity_after_header_)
|
| Resize(capacity_after_header_ * 2 + new_size);
|
| @@ -354,7 +354,7 @@ bool Pickle::PeekNext(size_t header_size,
|
| const char* start,
|
| const char* end,
|
| size_t* pickle_size) {
|
| - DCHECK_EQ(header_size, bits::Align(header_size, sizeof(uint32)));
|
| + DCHECK_EQ(header_size, bits::Align(header_size, sizeof(uint32_t)));
|
| DCHECK_GE(header_size, sizeof(Header));
|
| DCHECK_LE(header_size, static_cast<size_t>(kPayloadUnit));
|
|
|
| @@ -388,12 +388,12 @@ inline void Pickle::WriteBytesCommon(const void* data, size_t length) {
|
| DCHECK_NE(kCapacityReadOnly, capacity_after_header_)
|
| << "oops: pickle is readonly";
|
| MSAN_CHECK_MEM_IS_INITIALIZED(data, length);
|
| - size_t data_len = bits::Align(length, sizeof(uint32));
|
| + size_t data_len = bits::Align(length, sizeof(uint32_t));
|
| DCHECK_GE(data_len, length);
|
| #ifdef ARCH_CPU_64_BITS
|
| - DCHECK_LE(data_len, kuint32max);
|
| + DCHECK_LE(data_len, std::numeric_limits<uint32_t>::max());
|
| #endif
|
| - DCHECK_LE(write_offset_, kuint32max - data_len);
|
| + DCHECK_LE(write_offset_, std::numeric_limits<uint32_t>::max() - data_len);
|
| size_t new_size = write_offset_ + data_len;
|
| if (new_size > capacity_after_header_) {
|
| size_t new_capacity = capacity_after_header_ * 2;
|
| @@ -406,7 +406,7 @@ inline void Pickle::WriteBytesCommon(const void* data, size_t length) {
|
| char* write = mutable_payload() + write_offset_;
|
| memcpy(write, data, length);
|
| memset(write + length, 0, data_len - length);
|
| - header_->payload_size = static_cast<uint32>(new_size);
|
| + header_->payload_size = static_cast<uint32_t>(new_size);
|
| write_offset_ = new_size;
|
| }
|
|
|
|
|