kpvdr commented on a change in pull request #263:
URL: https://github.com/apache/qpid-proton/pull/263#discussion_r448993947
##########
File path: c/src/core/encoder.c
##########
@@ -336,8 +336,10 @@ static int pni_encoder_exit(void *ctx, pn_data_t *data,
pni_node_t *node)
pn_encoder_t *encoder = (pn_encoder_t *) ctx;
char *pos;
- // Special case 0 length list
- if (node->atom.type==PN_LIST && node->children-encoder->null_count==0) {
+ // Special case 0 length list, but not as first element in an array
+ pni_node_t *parent = pn_data_node(data, node->parent);
+ if (node->atom.type==PN_LIST && node->children-encoder->null_count==0 &&
+ !(pn_is_in_array(data, parent, node) && pn_is_first_in_array(data,
parent, node))) {
Review comment:
The type opcode for array elements is encoded only once, and is
determined by the type of the first element (hence the original check).
However, the size/count fields for each element (even empty lists) must also be
present as the data portion of each array element, and it is these that are
omitted for all empty lists if this patch update is not made. Thanks for
spotting that!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]