diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 9c4a117b6d..664a277946 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -969,7 +969,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { void RepeatedStringFieldGenerator:: GenerateSerializeWithCachedSizes(io::Printer* printer) const { printer->Print(variables_, - "for (int i = 0; i < this->$name$_size(); i++) {\n"); + "for (int i = 0, n = this->$name$_size(); i < n; i++) {\n"); printer->Indent(); if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( @@ -986,7 +986,7 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { void RepeatedStringFieldGenerator:: GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { printer->Print(variables_, - "for (int i = 0; i < this->$name$_size(); i++) {\n"); + "for (int i = 0, n = this->$name$_size(); i < n; i++) {\n"); printer->Indent(); if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { GenerateUtf8CheckCodeForString( @@ -1005,7 +1005,7 @@ GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "total_size += $tag_size$ *\n" " ::google::protobuf::internal::FromIntSize(this->$name$_size());\n" - "for (int i = 0; i < this->$name$_size(); i++) {\n" + "for (int i = 0, n = this->$name$_size(); i < n; i++) {\n" " total_size += ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n" " this->$name$(i));\n" "}\n"); diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index f806392a39..686ee477a6 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -887,7 +887,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:google.protobuf.compiler.CodeGeneratorRequest) // repeated string file_to_generate = 1; - for (int i = 0; i < this->file_to_generate_size(); i++) { + for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->file_to_generate(i).data(), this->file_to_generate(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -930,7 +930,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest) // repeated string file_to_generate = 1; - for (int i = 0; i < this->file_to_generate_size(); i++) { + for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->file_to_generate(i).data(), this->file_to_generate(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -984,7 +984,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { // repeated string file_to_generate = 1; total_size += 1 * ::google::protobuf::internal::FromIntSize(this->file_to_generate_size()); - for (int i = 0; i < this->file_to_generate_size(); i++) { + for (int i = 0, n = this->file_to_generate_size(); i < n; i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->file_to_generate(i)); } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 59777b1189..15c97d0b96 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1576,7 +1576,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( } // repeated string dependency = 3; - for (int i = 0; i < this->dependency_size(); i++) { + for (int i = 0, n = this->dependency_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->dependency(i).data(), this->dependency(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -1677,7 +1677,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( } // repeated string dependency = 3; - for (int i = 0; i < this->dependency_size(); i++) { + for (int i = 0, n = this->dependency_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->dependency(i).data(), this->dependency(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -1771,7 +1771,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { // repeated string dependency = 3; total_size += 1 * ::google::protobuf::internal::FromIntSize(this->dependency_size()); - for (int i = 0; i < this->dependency_size(); i++) { + for (int i = 0, n = this->dependency_size(); i < n; i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->dependency(i)); } @@ -3511,7 +3511,7 @@ void DescriptorProto::SerializeWithCachedSizes( } // repeated string reserved_name = 10; - for (int i = 0; i < this->reserved_name_size(); i++) { + for (int i = 0, n = this->reserved_name_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->reserved_name(i).data(), this->reserved_name(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -3599,7 +3599,7 @@ void DescriptorProto::SerializeWithCachedSizes( } // repeated string reserved_name = 10; - for (int i = 0; i < this->reserved_name_size(); i++) { + for (int i = 0, n = this->reserved_name_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->reserved_name(i).data(), this->reserved_name(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -3705,7 +3705,7 @@ size_t DescriptorProto::ByteSizeLong() const { // repeated string reserved_name = 10; total_size += 1 * ::google::protobuf::internal::FromIntSize(this->reserved_name_size()); - for (int i = 0; i < this->reserved_name_size(); i++) { + for (int i = 0, n = this->reserved_name_size(); i < n; i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->reserved_name(i)); } @@ -14137,7 +14137,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( } // repeated string leading_detached_comments = 6; - for (int i = 0; i < this->leading_detached_comments_size(); i++) { + for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -14208,7 +14208,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( } // repeated string leading_detached_comments = 6; - for (int i = 0; i < this->leading_detached_comments_size(); i++) { + for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE, @@ -14267,7 +14267,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { // repeated string leading_detached_comments = 6; total_size += 1 * ::google::protobuf::internal::FromIntSize(this->leading_detached_comments_size()); - for (int i = 0; i < this->leading_detached_comments_size(); i++) { + for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->leading_detached_comments(i)); } diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index dc639e4263..c9409fe537 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -232,7 +232,7 @@ void FieldMask::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:google.protobuf.FieldMask) // repeated string paths = 1; - for (int i = 0; i < this->paths_size(); i++) { + for (int i = 0, n = this->paths_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->paths(i).data(), this->paths(i).length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, @@ -249,7 +249,7 @@ void FieldMask::SerializeWithCachedSizes( (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask) // repeated string paths = 1; - for (int i = 0; i < this->paths_size(); i++) { + for (int i = 0, n = this->paths_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->paths(i).data(), this->paths(i).length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, @@ -269,7 +269,7 @@ size_t FieldMask::ByteSizeLong() const { // repeated string paths = 1; total_size += 1 * ::google::protobuf::internal::FromIntSize(this->paths_size()); - for (int i = 0; i < this->paths_size(); i++) { + for (int i = 0, n = this->paths_size(); i < n; i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->paths(i)); } diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 1eb23ff565..8bf57ecf12 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)); }