From ef3e9569b1ef8332acae8408bb9f564636aeb41b Mon Sep 17 00:00:00 2001 From: Pierre Avital Date: Tue, 4 Jul 2023 17:58:05 +0200 Subject: [PATCH] now to fix the tests [skip ci] --- include/zenoh-pico/protocol/core.h | 4 ++-- include/zenoh-pico/protocol/definitions/message.h | 4 ++-- include/zenoh-pico/protocol/definitions/network.h | 15 ++------------- src/protocol/definitions/message.c | 4 ++++ src/protocol/definitions/network.c | 12 ++++++++++++ tests/z_msgcodec_test.c | 4 +--- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/include/zenoh-pico/protocol/core.h b/include/zenoh-pico/protocol/core.h index 2500fb73b..bbf835d26 100644 --- a/include/zenoh-pico/protocol/core.h +++ b/include/zenoh-pico/protocol/core.h @@ -71,7 +71,7 @@ typedef struct { } _z_timestamp_t; _z_timestamp_t _z_timestamp_duplicate(const _z_timestamp_t *tstamp); -_z_timestamp_t _z_timestamp_null(); +_z_timestamp_t _z_timestamp_null(void); void _z_timestamp_clear(_z_timestamp_t *tstamp); _Bool _z_timestamp_check(const _z_timestamp_t *stamp); @@ -182,7 +182,7 @@ typedef struct { uint32_t _entity_id; uint32_t _source_sn; } _z_source_info_t; -_z_source_info_t _z_source_info_null(); +_z_source_info_t _z_source_info_null(void); typedef struct { uint32_t _request_id; diff --git a/include/zenoh-pico/protocol/definitions/message.h b/include/zenoh-pico/protocol/definitions/message.h index aa369fdb6..385ff7ba3 100644 --- a/include/zenoh-pico/protocol/definitions/message.h +++ b/include/zenoh-pico/protocol/definitions/message.h @@ -131,7 +131,7 @@ typedef struct { typedef struct { _z_source_info_t _ext_source_info; } _z_msg_pull_t; -static inline void _z_msg_pull_clear(_z_msg_pull_t *pull) {} +static inline void _z_msg_pull_clear(_z_msg_pull_t *pull) { (void)pull; } typedef struct { _z_timestamp_t _timestamp; @@ -141,7 +141,7 @@ typedef struct { typedef struct { _z_m_push_commons_t _commons; } _z_msg_del_t; -static inline void _z_msg_del_clear(_z_msg_del_t *del) {} +static inline void _z_msg_del_clear(_z_msg_del_t *del) { (void)del; } #define _Z_M_DEL_ID 0x02 #define _Z_FLAG_Z_D_T 0x20 diff --git a/include/zenoh-pico/protocol/definitions/network.h b/include/zenoh-pico/protocol/definitions/network.h index ffbdbee63..de992c5e8 100644 --- a/include/zenoh-pico/protocol/definitions/network.h +++ b/include/zenoh-pico/protocol/definitions/network.h @@ -125,7 +125,7 @@ typedef struct { _z_msg_put_t _put; } _body; } _z_push_body_t; -_z_push_body_t _z_push_body_null(); +_z_push_body_t _z_push_body_null(void); _z_push_body_t _z_push_body_steal(_z_push_body_t *msg); void _z_push_body_clear(_z_push_body_t *msg); @@ -231,18 +231,7 @@ _z_network_message_t _z_msg_make_pull(_z_keyexpr_t key, _z_zint_t pull_id); _z_network_message_t _z_msg_make_query(_Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_bytes_t) parameters, _z_zint_t qid, z_consolidation_mode_t consolidation, _Z_MOVE(_z_value_t) value); _z_network_message_t _z_n_msg_make_reply(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_value_t) value); -_z_network_message_t _z_n_msg_make_ack(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) key) { - return (_z_network_message_t){ - ._tag = _Z_N_RESPONSE, - ._body._response = - { - ._tag = _Z_RESPONSE_BODY_ACK, - ._request_id = rid, - ._key = _z_keyexpr_steal(key), - ._body._ack = {._timestamp = _z_timestamp_null(), ._ext_source_info = _z_source_info_null()}, - }, - }; -} +_z_network_message_t _z_n_msg_make_ack(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) key); _z_network_message_t _z_n_msg_make_response_final(_z_zint_t rid); _z_network_message_t _z_n_msg_make_declare(_z_declaration_t declaration); _z_network_message_t _z_n_msg_make_push(_Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_push_body_t) body); diff --git a/src/protocol/definitions/message.c b/src/protocol/definitions/message.c index a0587e6b5..677b20bdb 100644 --- a/src/protocol/definitions/message.c +++ b/src/protocol/definitions/message.c @@ -18,3 +18,7 @@ void _z_msg_query_clear(_z_msg_query_t *msg) { _z_bytes_clear(&msg->_parameters); _z_value_clear(&msg->_value); } +void _z_msg_err_clear(_z_msg_err_t *err) { + _z_timestamp_clear(&err->_timestamp); + _z_value_clear(&err->_ext_value); +} diff --git a/src/protocol/definitions/network.c b/src/protocol/definitions/network.c index 52d8031e2..f5d6938c8 100644 --- a/src/protocol/definitions/network.c +++ b/src/protocol/definitions/network.c @@ -226,3 +226,15 @@ _z_network_message_t _z_n_msg_make_reply(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) ke }; } +_z_network_message_t _z_n_msg_make_ack(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) key) { + return (_z_network_message_t){ + ._tag = _Z_N_RESPONSE, + ._body._response = + { + ._tag = _Z_RESPONSE_BODY_ACK, + ._request_id = rid, + ._key = _z_keyexpr_steal(key), + ._body._ack = {._timestamp = _z_timestamp_null(), ._ext_source_info = _z_source_info_null()}, + }, + }; +} diff --git a/tests/z_msgcodec_test.c b/tests/z_msgcodec_test.c index 5ad0c2650..678b221e2 100644 --- a/tests/z_msgcodec_test.c +++ b/tests/z_msgcodec_test.c @@ -26,12 +26,10 @@ #include "zenoh-pico/collections/bytes.h" #include "zenoh-pico/collections/string.h" +#include "zenoh-pico/protocol/codec/ext.h" #include "zenoh-pico/protocol/ext.h" -#include "zenoh-pico/protocol/extcodec.h" #include "zenoh-pico/protocol/iobuf.h" #include "zenoh-pico/protocol/keyexpr.h" -#include "zenoh-pico/protocol/msg.h" -#include "zenoh-pico/protocol/msgcodec.h" #include "zenoh-pico/system/platform.h" #define RUNS 1000