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
1a23e2ab
Commit
1a23e2ab
authored
Apr 12, 2019
by
Hao Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace SimpleItoa with StrCat
parent
5b232b8e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
18 deletions
+18
-18
objectivec_enum.cc
src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+1
-1
objectivec_extension.cc
...ogle/protobuf/compiler/objectivec/objectivec_extension.cc
+1
-1
objectivec_field.cc
src/google/protobuf/compiler/objectivec/objectivec_field.cc
+3
-3
objectivec_file.cc
src/google/protobuf/compiler/objectivec/objectivec_file.cc
+1
-1
objectivec_helpers.cc
...google/protobuf/compiler/objectivec/objectivec_helpers.cc
+5
-5
objectivec_message.cc
...google/protobuf/compiler/objectivec/objectivec_message.cc
+3
-3
objectivec_oneof.cc
src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
+3
-3
objectivec_primitive_field.cc
...rotobuf/compiler/objectivec/objectivec_primitive_field.cc
+1
-1
No files found.
src/google/protobuf/compiler/objectivec/objectivec_enum.cc
View file @
1a23e2ab
...
@@ -142,7 +142,7 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) {
...
@@ -142,7 +142,7 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) {
"$name$$deprecated_attribute$ = $value$,
\n
"
,
"$name$$deprecated_attribute$ = $value$,
\n
"
,
"name"
,
EnumValueName
(
all_values_
[
i
]),
"name"
,
EnumValueName
(
all_values_
[
i
]),
"deprecated_attribute"
,
GetOptionalDeprecatedAttribute
(
all_values_
[
i
]),
"deprecated_attribute"
,
GetOptionalDeprecatedAttribute
(
all_values_
[
i
]),
"value"
,
S
impleItoa
(
all_values_
[
i
]
->
number
()));
"value"
,
S
trCat
(
all_values_
[
i
]
->
number
()));
}
}
printer
->
Outdent
();
printer
->
Outdent
();
printer
->
Print
(
printer
->
Print
(
...
...
src/google/protobuf/compiler/objectivec/objectivec_extension.cc
View file @
1a23e2ab
...
@@ -85,7 +85,7 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
...
@@ -85,7 +85,7 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
std
::
map
<
string
,
string
>
vars
;
std
::
map
<
string
,
string
>
vars
;
vars
[
"root_class_and_method_name"
]
=
root_class_and_method_name_
;
vars
[
"root_class_and_method_name"
]
=
root_class_and_method_name_
;
vars
[
"extended_type"
]
=
ClassName
(
descriptor_
->
containing_type
());
vars
[
"extended_type"
]
=
ClassName
(
descriptor_
->
containing_type
());
vars
[
"number"
]
=
S
impleItoa
(
descriptor_
->
number
());
vars
[
"number"
]
=
S
trCat
(
descriptor_
->
number
());
std
::
vector
<
string
>
options
;
std
::
vector
<
string
>
options
;
if
(
descriptor_
->
is_repeated
())
options
.
push_back
(
"GPBExtensionRepeated"
);
if
(
descriptor_
->
is_repeated
())
options
.
push_back
(
"GPBExtensionRepeated"
);
...
...
src/google/protobuf/compiler/objectivec/objectivec_field.cc
View file @
1a23e2ab
...
@@ -75,7 +75,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
...
@@ -75,7 +75,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
(
*
variables
)[
"raw_field_name"
]
=
raw_field_name
;
(
*
variables
)[
"raw_field_name"
]
=
raw_field_name
;
(
*
variables
)[
"field_number_name"
]
=
(
*
variables
)[
"field_number_name"
]
=
classname
+
"_FieldNumber_"
+
capitalized_name
;
classname
+
"_FieldNumber_"
+
capitalized_name
;
(
*
variables
)[
"field_number"
]
=
S
impleItoa
(
descriptor
->
number
());
(
*
variables
)[
"field_number"
]
=
S
trCat
(
descriptor
->
number
());
(
*
variables
)[
"field_type"
]
=
GetCapitalizedType
(
descriptor
);
(
*
variables
)[
"field_type"
]
=
GetCapitalizedType
(
descriptor
);
(
*
variables
)[
"deprecated_attribute"
]
=
GetOptionalDeprecatedAttribute
(
descriptor
);
(
*
variables
)[
"deprecated_attribute"
]
=
GetOptionalDeprecatedAttribute
(
descriptor
);
std
::
vector
<
string
>
field_flags
;
std
::
vector
<
string
>
field_flags
;
...
@@ -213,7 +213,7 @@ void FieldGenerator::GenerateFieldDescription(
...
@@ -213,7 +213,7 @@ void FieldGenerator::GenerateFieldDescription(
}
}
void
FieldGenerator
::
SetRuntimeHasBit
(
int
has_index
)
{
void
FieldGenerator
::
SetRuntimeHasBit
(
int
has_index
)
{
variables_
[
"has_index"
]
=
S
impleItoa
(
has_index
);
variables_
[
"has_index"
]
=
S
trCat
(
has_index
);
}
}
void
FieldGenerator
::
SetNoHasBit
(
void
)
{
void
FieldGenerator
::
SetNoHasBit
(
void
)
{
...
@@ -236,7 +236,7 @@ void FieldGenerator::SetOneofIndexBase(int index_base) {
...
@@ -236,7 +236,7 @@ void FieldGenerator::SetOneofIndexBase(int index_base) {
if
(
descriptor_
->
containing_oneof
()
!=
NULL
)
{
if
(
descriptor_
->
containing_oneof
()
!=
NULL
)
{
int
index
=
descriptor_
->
containing_oneof
()
->
index
()
+
index_base
;
int
index
=
descriptor_
->
containing_oneof
()
->
index
()
+
index_base
;
// Flip the sign to mark it as a oneof.
// Flip the sign to mark it as a oneof.
variables_
[
"has_index"
]
=
S
impleItoa
(
-
index
);
variables_
[
"has_index"
]
=
S
trCat
(
-
index
);
}
}
}
}
...
...
src/google/protobuf/compiler/objectivec/objectivec_file.cc
View file @
1a23e2ab
...
@@ -241,7 +241,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
...
@@ -241,7 +241,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
"#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
\n
"
"#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
\n
"
"#endif
\n
"
"#endif
\n
"
"
\n
"
,
"
\n
"
,
"google_protobuf_objc_version"
,
S
impleItoa
(
GOOGLE_PROTOBUF_OBJC_VERSION
));
"google_protobuf_objc_version"
,
S
trCat
(
GOOGLE_PROTOBUF_OBJC_VERSION
));
// #import any headers for "public imports" in the proto file.
// #import any headers for "public imports" in the proto file.
{
{
...
...
src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
View file @
1a23e2ab
...
@@ -805,17 +805,17 @@ string DefaultValue(const FieldDescriptor* field) {
...
@@ -805,17 +805,17 @@ string DefaultValue(const FieldDescriptor* field) {
if
(
field
->
default_value_int32
()
==
INT_MIN
)
{
if
(
field
->
default_value_int32
()
==
INT_MIN
)
{
return
"-0x80000000"
;
return
"-0x80000000"
;
}
}
return
S
impleItoa
(
field
->
default_value_int32
());
return
S
trCat
(
field
->
default_value_int32
());
case
FieldDescriptor
:
:
CPPTYPE_UINT32
:
case
FieldDescriptor
:
:
CPPTYPE_UINT32
:
return
S
impleItoa
(
field
->
default_value_uint32
())
+
"U"
;
return
S
trCat
(
field
->
default_value_uint32
())
+
"U"
;
case
FieldDescriptor
:
:
CPPTYPE_INT64
:
case
FieldDescriptor
:
:
CPPTYPE_INT64
:
// gcc and llvm reject the decimal form of kint32min and kint64min.
// gcc and llvm reject the decimal form of kint32min and kint64min.
if
(
field
->
default_value_int64
()
==
LLONG_MIN
)
{
if
(
field
->
default_value_int64
()
==
LLONG_MIN
)
{
return
"-0x8000000000000000LL"
;
return
"-0x8000000000000000LL"
;
}
}
return
S
impleItoa
(
field
->
default_value_int64
())
+
"LL"
;
return
S
trCat
(
field
->
default_value_int64
())
+
"LL"
;
case
FieldDescriptor
:
:
CPPTYPE_UINT64
:
case
FieldDescriptor
:
:
CPPTYPE_UINT64
:
return
S
impleItoa
(
field
->
default_value_uint64
())
+
"ULL"
;
return
S
trCat
(
field
->
default_value_uint64
())
+
"ULL"
;
case
FieldDescriptor
:
:
CPPTYPE_DOUBLE
:
case
FieldDescriptor
:
:
CPPTYPE_DOUBLE
:
return
HandleExtremeFloatingPoint
(
return
HandleExtremeFloatingPoint
(
SimpleDtoa
(
field
->
default_value_double
()),
false
);
SimpleDtoa
(
field
->
default_value_double
()),
false
);
...
@@ -1547,7 +1547,7 @@ bool ParseSimpleFile(
...
@@ -1547,7 +1547,7 @@ bool ParseSimpleFile(
if
(
!
parser
.
ParseChunk
(
StringPiece
(
static_cast
<
const
char
*>
(
buf
),
buf_len
)))
{
if
(
!
parser
.
ParseChunk
(
StringPiece
(
static_cast
<
const
char
*>
(
buf
),
buf_len
)))
{
*
out_error
=
*
out_error
=
string
(
"error: "
)
+
path
+
string
(
"error: "
)
+
path
+
" Line "
+
S
impleItoa
(
parser
.
last_line
())
+
", "
+
parser
.
error_str
();
" Line "
+
S
trCat
(
parser
.
last_line
())
+
", "
+
parser
.
error_str
();
return
false
;
return
false
;
}
}
}
}
...
...
src/google/protobuf/compiler/objectivec/objectivec_message.cc
View file @
1a23e2ab
...
@@ -461,7 +461,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
...
@@ -461,7 +461,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
"typedef struct $classname$__storage_ {
\n
"
"typedef struct $classname$__storage_ {
\n
"
" uint32_t _has_storage_[$sizeof_has_storage$];
\n
"
,
" uint32_t _has_storage_[$sizeof_has_storage$];
\n
"
,
"classname"
,
class_name_
,
"classname"
,
class_name_
,
"sizeof_has_storage"
,
S
impleItoa
(
sizeof_has_storage
));
"sizeof_has_storage"
,
S
trCat
(
sizeof_has_storage
));
printer
->
Indent
();
printer
->
Indent
();
for
(
int
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
...
@@ -582,8 +582,8 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
...
@@ -582,8 +582,8 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
" static const GPBExtensionRange ranges[] = {
\n
"
);
" static const GPBExtensionRange ranges[] = {
\n
"
);
for
(
int
i
=
0
;
i
<
sorted_extensions
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
sorted_extensions
.
size
();
i
++
)
{
printer
->
Print
(
" { .start = $start$, .end = $end$ },
\n
"
,
printer
->
Print
(
" { .start = $start$, .end = $end$ },
\n
"
,
"start"
,
S
impleItoa
(
sorted_extensions
[
i
]
->
start
),
"start"
,
S
trCat
(
sorted_extensions
[
i
]
->
start
),
"end"
,
S
impleItoa
(
sorted_extensions
[
i
]
->
end
));
"end"
,
S
trCat
(
sorted_extensions
[
i
]
->
end
));
}
}
printer
->
Print
(
printer
->
Print
(
" };
\n
"
" };
\n
"
...
...
src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
View file @
1a23e2ab
...
@@ -46,7 +46,7 @@ OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor)
...
@@ -46,7 +46,7 @@ OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor)
variables_
[
"enum_name"
]
=
OneofEnumName
(
descriptor_
);
variables_
[
"enum_name"
]
=
OneofEnumName
(
descriptor_
);
variables_
[
"name"
]
=
OneofName
(
descriptor_
);
variables_
[
"name"
]
=
OneofName
(
descriptor_
);
variables_
[
"capitalized_name"
]
=
OneofNameCapitalized
(
descriptor_
);
variables_
[
"capitalized_name"
]
=
OneofNameCapitalized
(
descriptor_
);
variables_
[
"raw_index"
]
=
S
impleItoa
(
descriptor_
->
index
());
variables_
[
"raw_index"
]
=
S
trCat
(
descriptor_
->
index
());
const
Descriptor
*
msg_descriptor
=
descriptor_
->
containing_type
();
const
Descriptor
*
msg_descriptor
=
descriptor_
->
containing_type
();
variables_
[
"owning_message_class"
]
=
ClassName
(
msg_descriptor
);
variables_
[
"owning_message_class"
]
=
ClassName
(
msg_descriptor
);
...
@@ -65,7 +65,7 @@ OneofGenerator::~OneofGenerator() {}
...
@@ -65,7 +65,7 @@ OneofGenerator::~OneofGenerator() {}
void
OneofGenerator
::
SetOneofIndexBase
(
int
index_base
)
{
void
OneofGenerator
::
SetOneofIndexBase
(
int
index_base
)
{
int
index
=
descriptor_
->
index
()
+
index_base
;
int
index
=
descriptor_
->
index
()
+
index_base
;
// Flip the sign to mark it as a oneof.
// Flip the sign to mark it as a oneof.
variables_
[
"index"
]
=
S
impleItoa
(
-
index
);
variables_
[
"index"
]
=
S
trCat
(
-
index
);
}
}
void
OneofGenerator
::
GenerateCaseEnum
(
io
::
Printer
*
printer
)
{
void
OneofGenerator
::
GenerateCaseEnum
(
io
::
Printer
*
printer
)
{
...
@@ -84,7 +84,7 @@ void OneofGenerator::GenerateCaseEnum(io::Printer* printer) {
...
@@ -84,7 +84,7 @@ void OneofGenerator::GenerateCaseEnum(io::Printer* printer) {
"$enum_name$_$field_name$ = $field_number$,
\n
"
,
"$enum_name$_$field_name$ = $field_number$,
\n
"
,
"enum_name"
,
enum_name
,
"enum_name"
,
enum_name
,
"field_name"
,
field_name
,
"field_name"
,
field_name
,
"field_number"
,
S
impleItoa
(
field
->
number
()));
"field_number"
,
S
trCat
(
field
->
number
()));
}
}
printer
->
Outdent
();
printer
->
Outdent
();
printer
->
Print
(
printer
->
Print
(
...
...
src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
View file @
1a23e2ab
...
@@ -152,7 +152,7 @@ int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded(void) const {
...
@@ -152,7 +152,7 @@ int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded(void) const {
void
PrimitiveFieldGenerator
::
SetExtraRuntimeHasBitsBase
(
int
has_base
)
{
void
PrimitiveFieldGenerator
::
SetExtraRuntimeHasBitsBase
(
int
has_base
)
{
if
(
GetObjectiveCType
(
descriptor_
)
==
OBJECTIVECTYPE_BOOLEAN
)
{
if
(
GetObjectiveCType
(
descriptor_
)
==
OBJECTIVECTYPE_BOOLEAN
)
{
// Set into the offset the has bit to use for the actual value.
// Set into the offset the has bit to use for the actual value.
variables_
[
"storage_offset_value"
]
=
S
impleItoa
(
has_base
);
variables_
[
"storage_offset_value"
]
=
S
trCat
(
has_base
);
variables_
[
"storage_offset_comment"
]
=
variables_
[
"storage_offset_comment"
]
=
" // Stored in _has_storage_ to save space."
;
" // Stored in _has_storage_ to save space."
;
}
}
...
...
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