From e3c807d4e752b477b707f5d021264faf9b127304 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Fri, 23 Jun 2017 12:56:44 -0700 Subject: Fix more implicit type conversions in public headers and generated code. --- src/google/protobuf/repeated_field.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/google/protobuf/repeated_field.h') diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index a1013f63..02ee3cc9 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -1335,7 +1335,7 @@ void RepeatedField::Reserve(int new_size) { static_cast(new_size), (std::numeric_limits::max() - kRepHeaderSize) / sizeof(Element)) << "Requested size is too large to fit into size_t."; - size_t bytes = kRepHeaderSize + sizeof(Element) * new_size; + size_t bytes = kRepHeaderSize + sizeof(Element) * static_cast(new_size); if (arena == NULL) { rep_ = static_cast(::operator new(bytes)); } else { @@ -1399,7 +1399,7 @@ void ElementCopier::operator()( template struct ElementCopier { void operator()(Element* to, const Element* from, int array_size) { - memcpy(to, from, array_size * sizeof(Element)); + memcpy(to, from, static_cast(array_size) * sizeof(Element)); } }; @@ -1651,7 +1651,7 @@ inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { template inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const { - size_t allocated_bytes = total_size_ * sizeof(void*); + size_t allocated_bytes = static_cast(total_size_) * sizeof(void*); if (rep_ != NULL) { for (int i = 0; i < rep_->allocated_size; ++i) { allocated_bytes += TypeHandler::SpaceUsedLong( -- cgit v1.2.3