You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2020/07/01 16:17:47 UTC

[qpid-proton] 01/01: PROTON-2244: Fix for Array of lists with first list empty encoding

This is an automated email from the ASF dual-hosted git repository.

kpvdr pushed a commit to branch array-of-lists-first-list-empty
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit a19cace4db2c9ab8beceae00328620aee22ff168
Author: Kim van der Riet <kp...@apache.org>
AuthorDate: Wed Jul 1 12:15:04 2020 -0400

    PROTON-2244: Fix for Array of lists with first list empty encoding
---
 c/src/core/encoder.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/c/src/core/encoder.c b/c/src/core/encoder.c
index 2be808c..f38c24d 100644
--- a/c/src/core/encoder.c
+++ b/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))) {
     encoder->position = node->start-1; // position of list opcode
     pn_encoder_writef8(encoder, PNE_LIST0);
     encoder->null_count = 0;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org