qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [3/3] qpid-proton git commit: PROTON-144: Encode zore length lists as LIST0 type - Fix some interop tests to expect this - Fix message overflow test to use an smaller buffer - The previous size no longer overfows
Date Thu, 01 Mar 2018 18:54:22 GMT
PROTON-144: Encode zore length lists as LIST0 type
- Fix some interop tests to expect this
- Fix message overflow test to use an smaller buffer
  - The previous size no longer overfows


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1b9c0958
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1b9c0958
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1b9c0958

Branch: refs/heads/master
Commit: 1b9c095828a00fb9a2206c8fe455bc88a1fb9490
Parents: edb3aaa
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Thu Mar 1 10:56:32 2018 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Thu Mar 1 11:36:35 2018 -0500

----------------------------------------------------------------------
 proton-c/src/core/encoder.c          |   8 ++++++++
 proton-c/src/tests/message.c         |   4 ++--
 tests/interop/lists.amqp             | Bin 26 -> 18 bytes
 tests/python/proton_tests/interop.py |   2 ++
 4 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1b9c0958/proton-c/src/core/encoder.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/encoder.c b/proton-c/src/core/encoder.c
index 26bc613..505db47 100644
--- a/proton-c/src/core/encoder.c
+++ b/proton-c/src/core/encoder.c
@@ -349,6 +349,14 @@ 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)
{
+    encoder->position = node->start-1; // position of list opcode
+    pn_encoder_writef8(encoder, PNE_LIST0);
+    encoder->null_count = 0;
+    return 0;
+  }
+
   switch (node->atom.type) {
   case PN_ARRAY:
     if ((node->described && node->children == 1) || (!node->described &&
node->children == 0)) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1b9c0958/proton-c/src/tests/message.c
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/message.c b/proton-c/src/tests/message.c
index 272e25f..5362b7d 100644
--- a/proton-c/src/tests/message.c
+++ b/proton-c/src/tests/message.c
@@ -31,8 +31,8 @@
 static void test_overflow_error(void)
 {
   pn_message_t *message = pn_message();
-  char buf[8];
-  size_t size = 8;
+  char buf[6];
+  size_t size = 6;
 
   int err = pn_message_encode(message, buf, &size);
   assert(err == PN_OVERFLOW);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1b9c0958/tests/interop/lists.amqp
----------------------------------------------------------------------
diff --git a/tests/interop/lists.amqp b/tests/interop/lists.amqp
index db12fcf..f32bf4b 100644
Binary files a/tests/interop/lists.amqp and b/tests/interop/lists.amqp differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1b9c0958/tests/python/proton_tests/interop.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/interop.py b/tests/python/proton_tests/interop.py
index b56298b..b330f22 100644
--- a/tests/python/proton_tests/interop.py
+++ b/tests/python/proton_tests/interop.py
@@ -63,6 +63,8 @@ class InteropTest(common.Test):
         # Re-encode and verify pre-computed and actual encoded size match.
         reencoded = self.data.encode()
         assert encoded_size == len(reencoded), "%d != %d" % (encoded_size, len(reencoded))
+        # verify round trip bytes
+        assert reencoded == encoded, "Value mismatch: %s != %s" % (reencoded, encoded)
 
     def decode_message_file(self, name):
         self.message.decode(self.get_data(name))


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


Mime
View raw message