Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Jun 24, 2024
1 parent b955bd0 commit efdad63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
10 changes: 3 additions & 7 deletions src/collections/bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include "zenoh-pico/protocol/codec/core.h"
#include "zenoh-pico/system/platform.h"
#include "zenoh-pico/utils/result.h"
#include "zenoh-pico/utils/endianness.h"
#include "zenoh-pico/utils/result.h"

/*-------- Bytes --------*/
_Bool _z_bytes_check(const _z_bytes_t *bytes) { return !_z_bytes_is_empty(bytes); }
Expand Down Expand Up @@ -132,9 +132,7 @@ int8_t _z_bytes_to_slice(const _z_bytes_t *bytes, _z_slice_t *s) {
return _Z_RES_OK;
}

int8_t _z_bytes_append_slice(_z_bytes_t *dst, _z_arc_slice_t *s) {
return _z_arc_slice_svec_append(&dst->_slices, s);
}
int8_t _z_bytes_append_slice(_z_bytes_t *dst, _z_arc_slice_t *s) { return _z_arc_slice_svec_append(&dst->_slices, s); }

int8_t _z_bytes_append_inner(_z_bytes_t *dst, _z_bytes_t *src) {
_Bool success = true;
Expand Down Expand Up @@ -243,9 +241,7 @@ int8_t _z_bytes_to_double(const _z_bytes_t *bs, double *val) {
return _z_bytes_to_buf(bs, (uint8_t *)val, sizeof(double)) == sizeof(double) ? _Z_RES_OK : _Z_ERR_DID_NOT_READ;
}

int8_t _z_bytes_from_uint8(_z_bytes_t *b, uint8_t val) {
return _z_bytes_from_buf(b, &val, sizeof(val));
}
int8_t _z_bytes_from_uint8(_z_bytes_t *b, uint8_t val) { return _z_bytes_from_buf(b, &val, sizeof(val)); }

int8_t _z_bytes_from_uint16(_z_bytes_t *b, uint16_t val) {
uint8_t buf[sizeof(uint16_t)];
Expand Down
1 change: 1 addition & 0 deletions src/protocol/codec/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ int8_t _z_push_body_decode_extensions(_z_msg_ext_t *extension, void *ctx) {
_Z_RETURN_IF_ERR(_z_slice_copy(&s, &extension->_body._zbuf._val));
}
ret = _z_bytes_from_slice(&pshb->_body._put._attachment, s);
break;
}
default:
if (_Z_HAS_FLAG(extension->_header, _Z_MSG_EXT_FLAG_M)) {
Expand Down
20 changes: 10 additions & 10 deletions tests/z_channels_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
#undef NDEBUG
#include <assert.h>

#define SEND(closure, v) \
do { \
#define SEND(closure, v) \
do { \
_z_bytes_t payload; \
_z_bytes_from_slice(&payload, (_z_slice_t){.start = (const uint8_t *)v, .len = strlen(v)}); \
_z_sample_t s = {.keyexpr = _z_rname("key"), \
.payload = payload, \
.timestamp = _z_timestamp_null(), \
.encoding = _z_encoding_null(), \
.kind = 0, \
.qos = {0}}; \
z_loaned_sample_t sample = _z_sample_rc_new_from_val(s); \
z_call(closure, &sample); \
_z_sample_t s = {.keyexpr = _z_rname("key"), \
.payload = payload, \
.timestamp = _z_timestamp_null(), \
.encoding = _z_encoding_null(), \
.kind = 0, \
.qos = {0}}; \
z_loaned_sample_t sample = _z_sample_rc_new_from_val(s); \
z_call(closure, &sample); \
} while (0);

#define _RECV(handler, method, buf) \
Expand Down

0 comments on commit efdad63

Please sign in to comment.