Skip to content

Commit 76c9a31

Browse files
committed
fix Sonar issue
1 parent 497fd2c commit 76c9a31

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/libcyphal/transport/udp/delegate.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,11 @@ class UdpardMemory final : public ScatteredBuffer::IStorage
168168
{
169169
CETL_DEBUG_ASSERT(nullptr != frag->view.data, "");
170170
// Next nolint-s are unavoidable: we need offset from the beginning of the buffer.
171-
// No Sonar `cpp:S5356` b/c we integrate here with libcanard raw C buffers.
171+
// No Sonar `cpp:S5356` & `cpp:S5357` b/c we integrate here with libcanard raw C buffers.
172172
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
173-
const PayloadFragment frag_span{static_cast<const cetl::byte*>(frag->view.data) +
174-
view_offset, // NOSONAR cpp:S5356
173+
const auto* const offset_data =
174+
static_cast<const cetl::byte*>(frag->view.data) + view_offset; // NOSONAR cpp:S5356 cpp:S5357
175+
const PayloadFragment frag_span{offset_data,
175176
std::min(frag->view.size - view_offset, length_bytes - dst_offset)};
176177
CETL_DEBUG_ASSERT(frag_span.size() <= (frag->view.size - view_offset), "");
177178

0 commit comments

Comments
 (0)