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_encode.c
diff --git
a/pb_encode.c
b/pb_encode.c
index
cef9886
..
cc372b8
100644
(file)
--- a/
pb_encode.c
+++ b/
pb_encode.c
@@
-250,6
+250,17
@@
static bool checkreturn encode_basic_field(pb_ostream_t *stream,
return false;
break;
return false;
break;
+ case PB_HTYPE_ONEOF:
+ if (*(const pb_size_t*)pSize == field->tag)
+ {
+ if (!pb_encode_tag_for_field(stream, field))
+ return false;
+
+ if (!func(stream, field, pData))
+ return false;
+ }
+ break;
+
default:
PB_RETURN_ERROR(stream, "invalid field type");
}
default:
PB_RETURN_ERROR(stream, "invalid field type");
}