Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
8af35f28
Commit
8af35f28
authored
Jan 31, 2017
by
Chris Kennelly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep loop bounds in a local variable for string fields.
parent
a6c30d97
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
21 deletions
+21
-21
cpp_string_field.cc
src/google/protobuf/compiler/cpp/cpp_string_field.cc
+3
-3
plugin.pb.cc
src/google/protobuf/compiler/plugin.pb.cc
+3
-3
descriptor.pb.cc
src/google/protobuf/descriptor.pb.cc
+9
-9
field_mask.pb.cc
src/google/protobuf/field_mask.pb.cc
+3
-3
type.pb.cc
src/google/protobuf/type.pb.cc
+3
-3
No files found.
src/google/protobuf/compiler/cpp/cpp_string_field.cc
View file @
8af35f28
...
...
@@ -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
"
);
...
...
src/google/protobuf/compiler/plugin.pb.cc
View file @
8af35f28
...
...
@@ -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
));
}
...
...
src/google/protobuf/descriptor.pb.cc
View file @
8af35f28
...
...
@@ -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
));
}
...
...
src/google/protobuf/field_mask.pb.cc
View file @
8af35f28
...
...
@@ -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
));
}
...
...
src/google/protobuf/type.pb.cc
View file @
8af35f28
...
...
@@ -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
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment