Code Review
/
apps
/
agl-service-can-low-level.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Implement support for oneofs (C unions).
[apps/agl-service-can-low-level.git]
/
pb_common.c
diff --git
a/pb_common.c
b/pb_common.c
index
a9cade6
..
9896485
100644
(file)
--- a/
pb_common.c
+++ b/
pb_common.c
@@
-54,6
+54,13
@@
bool pb_field_iter_next(pb_field_iter_t *iter)
* The data_size only applies to the dynamically allocated area. */
prev_size = sizeof(void*);
}
* The data_size only applies to the dynamically allocated area. */
prev_size = sizeof(void*);
}
+ else if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF &&
+ PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF)
+ {
+ /* Don't advance pointers inside unions */
+ prev_size = 0;
+ iter->pData = (char*)iter->pData - prev_field->data_offset;
+ }
if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED)
{
if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED)
{