aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/repeated_field.h
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 16:26:16 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 16:26:16 -0700
commit3af881c7e2db0553207876acbdb91c6e77974e44 (patch)
tree35e2a96cce802d4235bd29afa396e28ead892fa2 /src/google/protobuf/repeated_field.h
parent86975301f1876ce1934612777b8ca6c76520f5cc (diff)
parent942a29cecd36f2a4b22fdd2179635cd548e6bd27 (diff)
Merge master into 3.4.x
Diffstat (limited to 'src/google/protobuf/repeated_field.h')
-rw-r--r--src/google/protobuf/repeated_field.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 20743fa9..d8003b8f 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -1331,7 +1331,7 @@ void RepeatedField<Element>::Reserve(int new_size) {
static_cast<size_t>(new_size),
(std::numeric_limits<size_t>::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<size_t>(new_size);
if (arena == NULL) {
rep_ = static_cast<Rep*>(::operator new(bytes));
} else {
@@ -1395,7 +1395,7 @@ void ElementCopier<Element, HasTrivialCopy>::operator()(
template <typename Element>
struct ElementCopier<Element, true> {
void operator()(Element* to, const Element* from, int array_size) {
- memcpy(to, from, array_size * sizeof(Element));
+ memcpy(to, from, static_cast<size_t>(array_size) * sizeof(Element));
}
};
@@ -1647,7 +1647,7 @@ inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) {
template <typename TypeHandler>
inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const {
- size_t allocated_bytes = total_size_ * sizeof(void*);
+ size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*);
if (rep_ != NULL) {
for (int i = 0; i < rep_->allocated_size; ++i) {
allocated_bytes += TypeHandler::SpaceUsedLong(