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
ded3c23e
Commit
ded3c23e
authored
Apr 25, 2019
by
Hao Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only replace SimpleItoa with StrCat
parent
bbd6dc6d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
35 deletions
+35
-35
csharp_enum.cc
src/google/protobuf/compiler/csharp/csharp_enum.cc
+2
-2
csharp_field_base.cc
src/google/protobuf/compiler/csharp/csharp_field_base.cc
+17
-17
csharp_message.cc
src/google/protobuf/compiler/csharp/csharp_message.cc
+9
-9
csharp_message_field.cc
src/google/protobuf/compiler/csharp/csharp_message_field.cc
+3
-3
csharp_primitive_field.cc
...google/protobuf/compiler/csharp/csharp_primitive_field.cc
+1
-1
php_generator.cc
src/google/protobuf/compiler/php/php_generator.cc
+3
-3
No files found.
src/google/protobuf/compiler/csharp/csharp_enum.cc
View file @
ded3c23e
...
...
@@ -79,12 +79,12 @@ void EnumGenerator::Generate(io::Printer* printer) {
printer
->
Print
(
"[pbr::OriginalName(
\"
$original_name$
\"
, PreferredAlias = false)] $name$ = $number$,
\n
"
,
"original_name"
,
original_name
,
"name"
,
name
,
"number"
,
S
impleItoa
(
number
));
"number"
,
S
trCat
(
number
));
}
else
{
printer
->
Print
(
"[pbr::OriginalName(
\"
$original_name$
\"
)] $name$ = $number$,
\n
"
,
"original_name"
,
original_name
,
"name"
,
name
,
"number"
,
S
impleItoa
(
number
));
"number"
,
S
trCat
(
number
));
}
}
printer
->
Outdent
();
...
...
src/google/protobuf/compiler/csharp/csharp_field_base.cc
View file @
ded3c23e
...
...
@@ -62,14 +62,14 @@ void FieldGeneratorBase::SetCommonFieldVariables(
uint
tag
=
internal
::
WireFormat
::
MakeTag
(
descriptor_
);
uint8
tag_array
[
5
];
io
::
CodedOutputStream
::
WriteTagToArray
(
tag
,
tag_array
);
string
tag_bytes
=
S
impleItoa
(
tag_array
[
0
]);
string
tag_bytes
=
S
trCat
(
tag_array
[
0
]);
for
(
int
i
=
1
;
i
<
tag_size
;
i
++
)
{
tag_bytes
+=
", "
+
S
impleItoa
(
tag_array
[
i
]);
tag_bytes
+=
", "
+
S
trCat
(
tag_array
[
i
]);
}
(
*
variables
)[
"access_level"
]
=
"public"
;
(
*
variables
)[
"tag"
]
=
S
impleItoa
(
tag
);
(
*
variables
)[
"tag_size"
]
=
S
impleItoa
(
tag_size
);
(
*
variables
)[
"tag"
]
=
S
trCat
(
tag
);
(
*
variables
)[
"tag_size"
]
=
S
trCat
(
tag_size
);
(
*
variables
)[
"tag_bytes"
]
=
tag_bytes
;
(
*
variables
)[
"property_name"
]
=
property_name
();
...
...
@@ -91,8 +91,8 @@ void FieldGeneratorBase::SetCommonFieldVariables(
(
*
variables
)[
"has_not_property_check"
]
=
"!"
+
(
*
variables
)[
"has_property_check"
];
(
*
variables
)[
"other_has_not_property_check"
]
=
"!"
+
(
*
variables
)[
"other_has_property_check"
];
if
(
presenceIndex_
!=
-
1
)
{
string
hasBitsNumber
=
S
impleItoa
(
presenceIndex_
/
32
);
string
hasBitsMask
=
S
impleItoa
(
1
<<
(
presenceIndex_
%
32
));
string
hasBitsNumber
=
S
trCat
(
presenceIndex_
/
32
);
string
hasBitsMask
=
S
trCat
(
1
<<
(
presenceIndex_
%
32
));
(
*
variables
)[
"has_field_check"
]
=
"(_hasBits"
+
hasBitsNumber
+
" & "
+
hasBitsMask
+
") != 0"
;
(
*
variables
)[
"set_has_field"
]
=
"_hasBits"
+
hasBitsNumber
+
" |= "
+
hasBitsMask
;
(
*
variables
)[
"clear_has_field"
]
=
"_hasBits"
+
hasBitsNumber
+
" &= ~"
+
hasBitsMask
;
...
...
@@ -339,15 +339,15 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor)
return
SimpleFtoa
(
value
)
+
"F"
;
}
case
FieldDescriptor
:
:
TYPE_INT64
:
return
S
impleItoa
(
descriptor
->
default_value_int64
())
+
"L"
;
return
S
trCat
(
descriptor
->
default_value_int64
())
+
"L"
;
case
FieldDescriptor
:
:
TYPE_UINT64
:
return
S
impleItoa
(
descriptor
->
default_value_uint64
())
+
"UL"
;
return
S
trCat
(
descriptor
->
default_value_uint64
())
+
"UL"
;
case
FieldDescriptor
:
:
TYPE_INT32
:
return
S
impleItoa
(
descriptor
->
default_value_int32
());
return
S
trCat
(
descriptor
->
default_value_int32
());
case
FieldDescriptor
:
:
TYPE_FIXED64
:
return
S
impleItoa
(
descriptor
->
default_value_uint64
())
+
"UL"
;
return
S
trCat
(
descriptor
->
default_value_uint64
())
+
"UL"
;
case
FieldDescriptor
:
:
TYPE_FIXED32
:
return
S
impleItoa
(
descriptor
->
default_value_uint32
());
return
S
trCat
(
descriptor
->
default_value_uint32
());
case
FieldDescriptor
:
:
TYPE_BOOL
:
if
(
descriptor
->
default_value_bool
())
{
return
"true"
;
...
...
@@ -359,15 +359,15 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor)
case
FieldDescriptor
:
:
TYPE_BYTES
:
return
GetBytesDefaultValueInternal
(
descriptor
);
case
FieldDescriptor
:
:
TYPE_UINT32
:
return
S
impleItoa
(
descriptor
->
default_value_uint32
());
return
S
trCat
(
descriptor
->
default_value_uint32
());
case
FieldDescriptor
:
:
TYPE_SFIXED32
:
return
S
impleItoa
(
descriptor
->
default_value_int32
());
return
S
trCat
(
descriptor
->
default_value_int32
());
case
FieldDescriptor
:
:
TYPE_SFIXED64
:
return
S
impleItoa
(
descriptor
->
default_value_int64
())
+
"L"
;
return
S
trCat
(
descriptor
->
default_value_int64
())
+
"L"
;
case
FieldDescriptor
:
:
TYPE_SINT32
:
return
S
impleItoa
(
descriptor
->
default_value_int32
());
return
S
trCat
(
descriptor
->
default_value_int32
());
case
FieldDescriptor
:
:
TYPE_SINT64
:
return
S
impleItoa
(
descriptor
->
default_value_int64
())
+
"L"
;
return
S
trCat
(
descriptor
->
default_value_int64
())
+
"L"
;
default
:
GOOGLE_LOG
(
FATAL
)
<<
"Unknown field type."
;
return
""
;
...
...
@@ -375,7 +375,7 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor)
}
std
::
string
FieldGeneratorBase
::
number
()
{
return
S
impleItoa
(
descriptor_
->
number
());
return
S
trCat
(
descriptor_
->
number
());
}
std
::
string
FieldGeneratorBase
::
capitalized_type_name
()
{
...
...
src/google/protobuf/compiler/csharp/csharp_message.cc
View file @
ded3c23e
...
...
@@ -137,7 +137,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
for
(
int
i
=
0
;
i
<
has_bit_field_count_
;
i
++
)
{
// don't use arrays since all arrays are heap allocated, saving allocations
// use ints instead of bytes since bytes lack bitwise operators, saving casts
printer
->
Print
(
"private int _hasBits$i$;
\n
"
,
"i"
,
S
impleItoa
(
i
));
printer
->
Print
(
"private int _hasBits$i$;
\n
"
,
"i"
,
S
trCat
(
i
));
}
WriteGeneratedCodeAttributes
(
printer
);
...
...
@@ -149,10 +149,10 @@ void MessageGenerator::Generate(io::Printer* printer) {
// Access the message descriptor via the relevant file descriptor or containing message descriptor.
if
(
!
descriptor_
->
containing_type
())
{
vars
[
"descriptor_accessor"
]
=
GetReflectionClassName
(
descriptor_
->
file
())
+
".Descriptor.MessageTypes["
+
S
impleItoa
(
descriptor_
->
index
())
+
"]"
;
+
".Descriptor.MessageTypes["
+
S
trCat
(
descriptor_
->
index
())
+
"]"
;
}
else
{
vars
[
"descriptor_accessor"
]
=
GetClassName
(
descriptor_
->
containing_type
())
+
".Descriptor.NestedTypes["
+
S
impleItoa
(
descriptor_
->
index
())
+
"]"
;
+
".Descriptor.NestedTypes["
+
S
trCat
(
descriptor_
->
index
())
+
"]"
;
}
WriteGeneratedCodeAttributes
(
printer
);
...
...
@@ -198,7 +198,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
"public const int $field_constant_name$ = $index$;
\n
"
,
"field_name"
,
fieldDescriptor
->
name
(),
"field_constant_name"
,
GetFieldConstantName
(
fieldDescriptor
),
"index"
,
S
impleItoa
(
fieldDescriptor
->
number
()));
"index"
,
S
trCat
(
fieldDescriptor
->
number
()));
std
::
unique_ptr
<
FieldGeneratorBase
>
generator
(
CreateFieldGeneratorInternal
(
fieldDescriptor
));
generator
->
GenerateMembers
(
printer
);
...
...
@@ -221,7 +221,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
const
FieldDescriptor
*
field
=
descriptor_
->
oneof_decl
(
i
)
->
field
(
j
);
printer
->
Print
(
"$field_property_name$ = $index$,
\n
"
,
"field_property_name"
,
GetPropertyName
(
field
),
"index"
,
S
impleItoa
(
field
->
number
()));
"index"
,
S
trCat
(
field
->
number
()));
}
printer
->
Outdent
();
printer
->
Print
(
"}
\n
"
);
...
...
@@ -306,7 +306,7 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
"public $class_name$($class_name$ other) : this() {
\n
"
);
printer
->
Indent
();
for
(
int
i
=
0
;
i
<
has_bit_field_count_
;
i
++
)
{
printer
->
Print
(
"_hasBits$i$ = other._hasBits$i$;
\n
"
,
"i"
,
S
impleItoa
(
i
));
printer
->
Print
(
"_hasBits$i$ = other._hasBits$i$;
\n
"
,
"i"
,
S
trCat
(
i
));
}
// Clone non-oneof fields first
for
(
int
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
...
...
@@ -545,7 +545,7 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
printer
->
Print
(
"$end_tag$:
\n
"
" return;
\n
"
,
"end_tag"
,
S
impleItoa
(
end_tag_
));
"end_tag"
,
S
trCat
(
end_tag_
));
}
}
for
(
int
i
=
0
;
i
<
fields_by_number
().
size
();
i
++
)
{
...
...
@@ -562,13 +562,13 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
printer
->
Print
(
"case $packed_tag$:
\n
"
,
"packed_tag"
,
S
impleItoa
(
S
trCat
(
internal
::
WireFormatLite
::
MakeTag
(
field
->
number
(),
internal
::
WireFormatLite
::
WIRETYPE_LENGTH_DELIMITED
)));
}
printer
->
Print
(
"case $tag$: {
\n
"
,
"tag"
,
S
impleItoa
(
tag
));
printer
->
Print
(
"case $tag$: {
\n
"
,
"tag"
,
S
trCat
(
tag
));
printer
->
Indent
();
std
::
unique_ptr
<
FieldGeneratorBase
>
generator
(
CreateFieldGeneratorInternal
(
field
));
...
...
src/google/protobuf/compiler/csharp/csharp_message_field.cc
View file @
ded3c23e
...
...
@@ -65,11 +65,11 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor,
internal
::
WireFormatLite
::
WIRETYPE_END_GROUP
);
uint8
tag_array
[
5
];
io
::
CodedOutputStream
::
WriteTagToArray
(
tag
,
tag_array
);
string
tag_bytes
=
S
impleItoa
(
tag_array
[
0
]);
string
tag_bytes
=
S
trCat
(
tag_array
[
0
]);
for
(
int
i
=
1
;
i
<
tag_size
;
i
++
)
{
tag_bytes
+=
", "
+
S
impleItoa
(
tag_array
[
i
]);
tag_bytes
+=
", "
+
S
trCat
(
tag_array
[
i
]);
}
variables_
[
"end_tag"
]
=
S
impleItoa
(
tag
);
variables_
[
"end_tag"
]
=
S
trCat
(
tag
);
variables_
[
"end_tag_bytes"
]
=
tag_bytes
;
}
}
...
...
src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
View file @
ded3c23e
...
...
@@ -186,7 +186,7 @@ void PrimitiveFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) {
}
else
{
printer
->
Print
(
"size += $tag_size$ + $fixed_size$;
\n
"
,
"fixed_size"
,
S
impleItoa
(
fixedSize
),
"fixed_size"
,
S
trCat
(
fixedSize
),
"tag_size"
,
variables_
[
"tag_size"
]);
}
printer
->
Outdent
();
...
...
src/google/protobuf/compiler/php/php_generator.cc
View file @
ded3c23e
...
...
@@ -879,7 +879,7 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message,
"field"
,
field
->
name
(),
"key"
,
ToUpper
(
key
->
type_name
()),
"value"
,
ToUpper
(
val
->
type_name
()),
"number"
,
S
impleItoa
(
field
->
number
()),
"number"
,
S
trCat
(
field
->
number
()),
"other"
,
EnumOrMessageSuffix
(
val
,
true
));
}
else
if
(
!
field
->
containing_oneof
())
{
printer
->
Print
(
...
...
@@ -888,7 +888,7 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message,
"field"
,
field
->
name
(),
"label"
,
LabelForField
(
field
),
"type"
,
ToUpper
(
field
->
type_name
()),
"number"
,
S
impleItoa
(
field
->
number
()),
"number"
,
S
trCat
(
field
->
number
()),
"other"
,
EnumOrMessageSuffix
(
field
,
true
));
}
}
...
...
@@ -906,7 +906,7 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message,
"
\\
Google
\\
Protobuf
\\
Internal
\\
GPBType::^type^, ^number^^other^)
\n
"
,
"field"
,
field
->
name
(),
"type"
,
ToUpper
(
field
->
type_name
()),
"number"
,
S
impleItoa
(
field
->
number
()),
"number"
,
S
trCat
(
field
->
number
()),
"other"
,
EnumOrMessageSuffix
(
field
,
true
));
}
printer
->
Print
(
"->finish()
\n
"
);
...
...
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