Skip to content

Commit

Permalink
fix lints for embedded compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
p-avital committed Aug 7, 2023
1 parent f10b806 commit 7773a43
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/zenoh-pico/protocol/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static inline _Bool _z_keyexpr_is_local(const _z_keyexpr_t *key) {
}
static inline _z_mapping_t _z_keyexpr_mapping(uint16_t id, _Bool owns_suffix) {
assert(id <= _Z_KEYEXPR_MAPPING_UNKNOWN_REMOTE);
return (_z_mapping_t){._val = (owns_suffix ? 0x8000 : 0) | id};
return (_z_mapping_t){._val = (owns_suffix ? (uint16_t)0x8000 : (uint16_t)0) | id};
}
static inline void _z_keyexpr_set_mapping(_z_keyexpr_t *ke, uint16_t id) {
assert(id <= _Z_KEYEXPR_MAPPING_UNKNOWN_REMOTE);
Expand Down
1 change: 1 addition & 0 deletions src/protocol/codec/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ int8_t _z_network_message_encode(_z_wbuf_t *wbf, const _z_network_message_t *msg
return _z_response_final_encode(wbf, &msg->_body._response_final);
} break;
}
return _Z_ERR_GENERIC;
}
int8_t _z_network_message_decode(_z_network_message_t *msg, _z_zbuf_t *zbf) {
uint8_t header;
Expand Down
14 changes: 7 additions & 7 deletions src/session/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int8_t _z_handle_zenoh_message(_z_session_t *zn, _z_zenoh_message_t *msg, uint16
_z_resource_t *res = (_z_resource_t *)z_malloc(sizeof(_z_resource_t));
res->_id = decl._decl._body._decl_kexpr._id;
res->_key = decl._decl._body._decl_kexpr._keyexpr;
_z_register_resource(zn, res);
ret = _z_register_resource(zn, res);
} break;
case _Z_UNDECL_KEXPR: {
_z_resource_t res = {._id = decl._decl._body._undecl_kexpr._id};
Expand Down Expand Up @@ -105,8 +105,8 @@ int8_t _z_handle_zenoh_message(_z_session_t *zn, _z_zenoh_message_t *msg, uint16
} break;
case _Z_REQUEST_DEL: {
_z_msg_del_t del = req._body._del;
int8_t result = _z_trigger_subscriptions(zn, req._key, _z_bytes_empty(), z_encoding_default(),
Z_SAMPLE_KIND_DELETE, del._commons._timestamp);
ret = _z_trigger_subscriptions(zn, req._key, _z_bytes_empty(), z_encoding_default(),
Z_SAMPLE_KIND_DELETE, del._commons._timestamp);
if (ret == _Z_RES_OK) {
_z_network_message_t ack = _z_n_msg_make_ack(req._rid, &req._key);
ret = _z_send_n_msg(zn, &ack, Z_RELIABILITY_RELIABLE, Z_CONGESTION_CONTROL_BLOCK);
Expand All @@ -124,8 +124,8 @@ int8_t _z_handle_zenoh_message(_z_session_t *zn, _z_zenoh_message_t *msg, uint16
switch (response._tag) {
case _Z_RESPONSE_BODY_REPLY: {
_z_msg_reply_t reply = response._body._reply;
_z_trigger_query_reply_partial(zn, response._request_id, response._key, reply._value.payload,
reply._value.encoding, Z_SAMPLE_KIND_PUT, reply._timestamp);
ret = _z_trigger_query_reply_partial(zn, response._request_id, response._key, reply._value.payload,
reply._value.encoding, Z_SAMPLE_KIND_PUT, reply._timestamp);
} break;
case _Z_RESPONSE_BODY_ERR: {
// @TODO: expose errors to the user
Expand All @@ -144,8 +144,8 @@ int8_t _z_handle_zenoh_message(_z_session_t *zn, _z_zenoh_message_t *msg, uint16
} break;
case _Z_RESPONSE_BODY_DEL: {
_z_msg_del_t del = response._body._del;
int8_t result = _z_trigger_subscriptions(zn, response._key, _z_bytes_empty(), z_encoding_default(),
Z_SAMPLE_KIND_DELETE, del._commons._timestamp);
ret = _z_trigger_subscriptions(zn, response._key, _z_bytes_empty(), z_encoding_default(),
Z_SAMPLE_KIND_DELETE, del._commons._timestamp);
} break;
}
} break;
Expand Down
3 changes: 0 additions & 3 deletions src/transport/multicast/link/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ int8_t _z_multicast_recv_t_msg_na(_z_transport_multicast_t *ztm, _z_transport_me
}
} while (false); // The 1-iteration loop to use continue to break the entire loop on error

// Wrap the main buffer for to_read bytes
_z_zbuf_t zbuf = _z_zbuf_view(&ztm->_zbuf, to_read);

if (ret == _Z_RES_OK) {
_Z_DEBUG(">> \t transport_message_decode\n");
ret = _z_transport_message_decode(t_msg, &ztm->_zbuf);
Expand Down
3 changes: 0 additions & 3 deletions src/transport/unicast/link/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ int8_t _z_unicast_recv_t_msg_na(_z_transport_unicast_t *ztu, _z_transport_messag
}
} while (false); // The 1-iteration loop to use continue to break the entire loop on error

// Wrap the main buffer for to_read bytes
_z_zbuf_t zbuf = _z_zbuf_view(&ztu->_zbuf, to_read);

if (ret == _Z_RES_OK) {
_Z_DEBUG(">> \t transport_message_decode\n");
ret = _z_transport_message_decode(t_msg, &ztu->_zbuf);
Expand Down
6 changes: 4 additions & 2 deletions src/transport/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "zenoh-pico/transport/utils.h"

#include "zenoh-pico/protocol/core.h"

#define U8_MAX 0xFF
#define U16_MAX 0xFFFF
#define U32_MAX 0xFFFFFFFF
Expand All @@ -35,7 +37,7 @@ _z_zint_t _z_sn_max(uint8_t bits) {
} break;

case 0x03: {
ret = U64_MAX >> 1;
ret = (_z_zint_t)(U64_MAX >> 1);
} break;

default: {
Expand Down Expand Up @@ -64,7 +66,7 @@ _z_zint_t _z_sn_modulo_mask(uint8_t bits) {
} break;

case 0x03: {
ret = U64_MAX >> 1;
ret = (_z_zint_t)(U64_MAX >> 1);
} break;

default: {
Expand Down

0 comments on commit 7773a43

Please sign in to comment.