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/10 12:37:25 UTC

[qpid-proton] branch array-of-lists-first-list-empty updated: PROTON-2244: Further improvements to array check: fail if error during encoding or decoding

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


The following commit(s) were added to refs/heads/array-of-lists-first-list-empty by this push:
     new 2530f3e  PROTON-2244: Further improvements to array check: fail if error during encoding or decoding
2530f3e is described below

commit 2530f3e4e892e50c4b7cfd4338a27144617ae664
Author: Kim van der Riet <kp...@apache.org>
AuthorDate: Fri Jul 10 08:37:14 2020 -0400

    PROTON-2244: Further improvements to array check: fail if error during encoding or decoding
---
 c/tests/data_test.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/c/tests/data_test.cpp b/c/tests/data_test.cpp
index b2485d2..51c53a7 100644
--- a/c/tests/data_test.cpp
+++ b/c/tests/data_test.cpp
@@ -25,7 +25,6 @@
 
 #include <proton/codec.h>
 #include <proton/error.h>
-#include <proton/type_compat.h> // ssize_t
 
 #include <cstdarg> // va_start(), va_end()
 #include <ctime> // time()
@@ -126,13 +125,17 @@ static void check_array(const char *fmt, ...) {
 	va_end(ap);
 
 	// Encode src array to buf
-	ssize_t enc_size = pn_data_encode(src, buf, BUFSIZE - 1);
-	if (enc_size < 0) return;
+	int enc_size = pn_data_encode(src, buf, BUFSIZE - 1);
+	if (enc_size < 0) {
+		FAIL("pn_data_encode() error " << enc_size << ": " << pn_code(enc_size));
+	}
 
 	// Decode buf to data
-	ssize_t dec_size = pn_data_decode(data, buf, BUFSIZE - 1);
+	int dec_size = pn_data_decode(data, buf, BUFSIZE - 1);
 	pn_error_t *dec_err = pn_data_error(data);
-	if (dec_size < 0) return;
+	if (dec_size < 0) {
+		FAIL("pn_data_decode() error " << dec_size << ": " << pn_code(dec_size));
+	}
 
 	// Checks
 	CHECK(enc_size == dec_size);


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