Code Review
/
apps
/
low-level-can-service.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
|
inline
| side by side (parent:
9dd81c5
)
Zero-valued extension fields were mistakenly ignored by encoder. (issue #242)
author
Petteri Aimonen
<jpa@git.mail.kapsi.fi>
Sun, 12 Feb 2017 08:48:51 +0000
(10:48 +0200)
committer
Petteri Aimonen
<jpa@git.mail.kapsi.fi>
Sun, 12 Feb 2017 08:50:10 +0000
(10:50 +0200)
pb.h
patch
|
blob
|
history
diff --git
a/pb.h
b/pb.h
index
f68d1d6
..
f68a1cc
100644
(file)
--- a/
pb.h
+++ b/
pb.h
@@
-478,9
+478,14
@@
struct pb_extension_s {
{tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \
fd, 0, pb_membersize(st, m), 0, ptr}
{tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \
fd, 0, pb_membersize(st, m), 0, ptr}
-/* Optional extensions don't have the has_ field, as that would be redundant. */
+/* Optional extensions don't have the has_ field, as that would be redundant.
+ * Furthermore, the combination of OPTIONAL without has_ field is used
+ * for indicating proto3 style fields. Extensions exist in proto2 mode only,
+ * so they should be encoded according to proto2 rules. To avoid the conflict,
+ * extensions are marked as REQUIRED instead.
+ */
#define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \
#define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \
- {tag, PB_ATYPE_STATIC | PB_HTYPE_
OPTIONAL
| ltype, \
+ {tag, PB_ATYPE_STATIC | PB_HTYPE_
REQUIRED
| ltype, \
0, \
0, \
pb_membersize(st, m), 0, ptr}
0, \
0, \
pb_membersize(st, m), 0, ptr}