Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
protobuf-c
Commits
9a6b35e1
Commit
9a6b35e1
authored
Feb 08, 2025
by
Robert Edmonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cater to Microsoft Visual C++
Apparently MSVC doesn't support designated initializers for some reason.
parent
4ebd5cd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
+3
-8
protoc-gen-c/c_enum.cc
protoc-gen-c/c_enum.cc
+2
-7
protoc-gen-c/c_message.cc
protoc-gen-c/c_message.cc
+1
-1
No files found.
protoc-gen-c/c_enum.cc
View file @
9a6b35e1
...
@@ -195,14 +195,9 @@ void EnumGenerator::GenerateEnumDescriptor(google::protobuf::io::Printer* printe
...
@@ -195,14 +195,9 @@ void EnumGenerator::GenerateEnumDescriptor(google::protobuf::io::Printer* printe
// Sort by name and value, dropping duplicate values if they appear later.
// Sort by name and value, dropping duplicate values if they appear later.
// TODO: use a c++ paradigm for this!
// TODO: use a c++ paradigm for this!
std
::
vector
<
ValueIndex
>
value_index
;
std
::
vector
<
ValueIndex
>
value_index
;
for
(
unsigned
j
=
0
;
j
<
descriptor_
->
value_count
();
j
++
)
{
for
(
int
j
=
0
;
j
<
descriptor_
->
value_count
();
j
++
)
{
const
google
::
protobuf
::
EnumValueDescriptor
*
vd
=
descriptor_
->
value
(
j
);
const
google
::
protobuf
::
EnumValueDescriptor
*
vd
=
descriptor_
->
value
(
j
);
value_index
.
push_back
({
value_index
.
push_back
({
vd
->
number
(),
(
unsigned
)
j
,
0
,
vd
->
name
()
});
.
value
=
vd
->
number
(),
.
index
=
j
,
.
final_index
=
0
,
.
name
=
vd
->
name
(),
});
}
}
qsort
(
&
value_index
[
0
],
qsort
(
&
value_index
[
0
],
value_index
.
size
(),
value_index
.
size
(),
...
...
protoc-gen-c/c_message.cc
View file @
9a6b35e1
...
@@ -581,7 +581,7 @@ GenerateMessageDescriptor(google::protobuf::io::Printer* printer, bool gen_init)
...
@@ -581,7 +581,7 @@ GenerateMessageDescriptor(google::protobuf::io::Printer* printer, bool gen_init)
if
(
!
optimize_code_size
)
{
if
(
!
optimize_code_size
)
{
std
::
vector
<
NameIndex
>
field_indices
;
std
::
vector
<
NameIndex
>
field_indices
;
for
(
unsigned
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
field_indices
.
push_back
({
.
index
=
i
,
.
name
=
sorted_fields
[
i
]
->
name
()
});
field_indices
.
push_back
({
i
,
sorted_fields
[
i
]
->
name
()
});
}
}
qsort
(
&
field_indices
[
0
],
qsort
(
&
field_indices
[
0
],
field_indices
.
size
(),
field_indices
.
size
(),
...
...
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