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
Libraries
protobuf-c
Commits
8bfe9602
Commit
8bfe9602
authored
Jul 04, 2016
by
Robert Edmonds
Committed by
GitHub
Jul 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #221 from protobuf-c/issue220
protoc-c/c_message.cc: Force int size on oneof enums
parents
651ec8f5
bb6553c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
protoc-c/c_message.cc
protoc-c/c_message.cc
+7
-1
No files found.
protoc-c/c_message.cc
View file @
8bfe9602
...
...
@@ -148,6 +148,7 @@ GenerateStructDefinition(io::Printer* printer) {
}
// Generate the case enums for unions
vars
[
"opt_comma"
]
=
","
;
for
(
int
i
=
0
;
i
<
descriptor_
->
oneof_decl_count
();
i
++
)
{
const
OneofDescriptor
*
oneof
=
descriptor_
->
oneof_decl
(
i
);
vars
[
"oneofname"
]
=
FullNameToUpper
(
oneof
->
name
());
...
...
@@ -160,8 +161,13 @@ GenerateStructDefinition(io::Printer* printer) {
const
FieldDescriptor
*
field
=
oneof
->
field
(
j
);
vars
[
"fieldname"
]
=
FullNameToUpper
(
field
->
name
());
vars
[
"fieldnum"
]
=
SimpleItoa
(
field
->
number
());
printer
->
Print
(
vars
,
"$ucclassname$__$oneofname$_$fieldname$ = $fieldnum$,
\n
"
);
bool
isLast
=
j
==
oneof
->
field_count
()
-
1
;
if
(
isLast
)
{
vars
[
"opt_comma"
]
=
""
;
}
printer
->
Print
(
vars
,
"$ucclassname$__$oneofname$_$fieldname$ = $fieldnum$$opt_comma$
\n
"
);
}
printer
->
Print
(
vars
,
" PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE($ucclassname$)
\n
"
);
printer
->
Outdent
();
printer
->
Print
(
vars
,
"} $foneofname$Case;
\n\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