From 8af35f28f696b5fa70ec7cfb64111f87b45d55b7 Mon Sep 17 00:00:00 2001 From: Chris Kennelly Date: Tue, 31 Jan 2017 12:27:32 -0800 Subject: Keep loop bounds in a local variable for string fields. --- src/google/protobuf/type.pb.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/google/protobuf/type.pb.cc') diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 1eb23ff5..8bf57ecf 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -613,7 +613,7 @@ void Type::SerializeWithCachedSizes( } // repeated string oneofs = 3; - for (int i = 0; i < this->oneofs_size(); i++) { + for (int i = 0, n = this->oneofs_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->oneofs(i).data(), this->oneofs(i).length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, @@ -666,7 +666,7 @@ void Type::SerializeWithCachedSizes( } // repeated string oneofs = 3; - for (int i = 0; i < this->oneofs_size(); i++) { + for (int i = 0, n = this->oneofs_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->oneofs(i).data(), this->oneofs(i).length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, @@ -717,7 +717,7 @@ size_t Type::ByteSizeLong() const { // repeated string oneofs = 3; total_size += 1 * ::google::protobuf::internal::FromIntSize(this->oneofs_size()); - for (int i = 0; i < this->oneofs_size(); i++) { + for (int i = 0, n = this->oneofs_size(); i < n; i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->oneofs(i)); } -- cgit v1.2.3