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/struct.pb.cc | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src/google/protobuf/struct.pb.cc') diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 3905d891..26684c57 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -400,19 +400,19 @@ void Struct::SerializeWithCachedSizes( for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it, ++n) { - items[n] = SortItem(&*it); + items[static_cast(n)] = SortItem(&*it); } - ::std::sort(&items[0], &items[n], Less()); + ::std::sort(&items[0], &items[static_cast(n)], Less()); ::google::protobuf::scoped_ptr entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( - items[i]->first, items[i]->second)); + items[static_cast(i)]->first, items[static_cast(i)]->second)); ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 1, *entry, output); if (entry->GetArena() != NULL) { entry.release(); } - Utf8Check::Check(items[i]); + Utf8Check::Check(items[static_cast(i)]); } } else { ::google::protobuf::scoped_ptr entry; @@ -464,13 +464,13 @@ void Struct::SerializeWithCachedSizes( for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it, ++n) { - items[n] = SortItem(&*it); + items[static_cast(n)] = SortItem(&*it); } - ::std::sort(&items[0], &items[n], Less()); + ::std::sort(&items[0], &items[static_cast(n)], Less()); ::google::protobuf::scoped_ptr entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( - items[i]->first, items[i]->second)); + items[static_cast(i)]->first, items[static_cast(i)]->second)); target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( 1, *entry, deterministic, target); @@ -478,7 +478,7 @@ void Struct::SerializeWithCachedSizes( if (entry->GetArena() != NULL) { entry.release(); } - Utf8Check::Check(items[i]); + Utf8Check::Check(items[static_cast(i)]); } } else { ::google::protobuf::scoped_ptr entry; @@ -1673,9 +1673,10 @@ void ListValue::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.Value values = 1; - for (unsigned int i = 0, n = this->values_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->values_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->values(i), output); + 1, this->values(static_cast(i)), output); } // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue) @@ -1688,10 +1689,11 @@ void ListValue::SerializeWithCachedSizes( (void) cached_has_bits; // repeated .google.protobuf.Value values = 1; - for (unsigned int i = 0, n = this->values_size(); i < n; i++) { + for (unsigned int i = 0, + n = static_cast(this->values_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( - 1, this->values(i), deterministic, target); + 1, this->values(static_cast(i)), deterministic, target); } // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue) @@ -1704,12 +1706,12 @@ size_t ListValue::ByteSizeLong() const { // repeated .google.protobuf.Value values = 1; { - unsigned int count = this->values_size(); + unsigned int count = static_cast(this->values_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->values(i)); + this->values(static_cast(i))); } } -- cgit v1.2.3