@@ -886,7 +886,7 @@ static inline void rxFragmentDestroyTree(RxFragment* const self, const RxMemory
886886 if (child != NULL )
887887 {
888888 UDPARD_ASSERT (child -> base .up == & self -> tree .base );
889- rxFragmentDestroyTree (child -> this , memory );
889+ rxFragmentDestroyTree (child -> this , memory ); // NOSONAR recursion
890890 }
891891 }
892892 memFree (memory .fragment , sizeof (RxFragment ), self ); // self-destruct
@@ -943,7 +943,7 @@ static inline int8_t rxSlotFragmentSearch(void* const user_reference, const stru
943943{
944944 UDPARD_ASSERT ((user_reference != NULL ) && (node != NULL ));
945945 const RxSlotUpdateContext * const ctx = (RxSlotUpdateContext * ) user_reference ;
946- RxFragment * const frag = ((RxFragmentTreeNode * ) node )-> this ;
946+ const RxFragment * const frag = ((const RxFragmentTreeNode * ) node )-> this ;
947947 UDPARD_ASSERT ((ctx != NULL ) && (frag != NULL ));
948948 int8_t out = 0 ;
949949 if (ctx -> frame_index > frag -> frame_index )
@@ -995,7 +995,7 @@ static inline void rxSlotEjectFragment(RxFragment* const frag, RxSlotEjectContex
995995 RxFragment * const child = ((RxFragmentTreeNode * ) frag -> tree .base .lr [0 ])-> this ;
996996 UDPARD_ASSERT (child -> frame_index < frag -> frame_index );
997997 UDPARD_ASSERT (child -> tree .base .up == & frag -> tree .base );
998- rxSlotEjectFragment (child , ctx );
998+ rxSlotEjectFragment (child , ctx ); // NOSONAR recursion
999999 }
10001000 const size_t fragment_size = frag -> base .view .size ;
10011001 frag -> base .next = NULL ; // Default state; may be overwritten.
@@ -1020,7 +1020,7 @@ static inline void rxSlotEjectFragment(RxFragment* const frag, RxSlotEjectContex
10201020 RxFragment * const child = ((RxFragmentTreeNode * ) frag -> tree .base .lr [1 ])-> this ;
10211021 UDPARD_ASSERT (child -> frame_index > frag -> frame_index );
10221022 UDPARD_ASSERT (child -> tree .base .up == & frag -> tree .base );
1023- rxSlotEjectFragment (child , ctx );
1023+ rxSlotEjectFragment (child , ctx ); // NOSONAR recursion
10241024 }
10251025 // Drop the unneeded fragments and their handles after the sub-tree is fully traversed.
10261026 if (!retain )
@@ -1107,15 +1107,15 @@ static inline int_fast8_t rxSlotAccept(RxSlot* const self,
11071107 if ((self -> eot_index != FRAME_INDEX_UNSET ) && (self -> eot_index != frame .index ))
11081108 {
11091109 restart = true; // Inconsistent EOT flag, could be a node-ID conflict.
1110- goto finish ;
1110+ goto finish ; // NOSONAR goto simplifies the control flow and is not prohibited by MISRA C:2012.
11111111 }
11121112 self -> eot_index = frame .index ;
11131113 }
11141114 UDPARD_ASSERT (frame .index <= self -> max_index );
11151115 if (self -> max_index > self -> eot_index )
11161116 {
11171117 restart = true; // Frames past EOT found, discard the entire transfer because we don't trust it anymore.
1118- goto finish ;
1118+ goto finish ; // NOSONAR goto simplifies the control flow and is not prohibited by MISRA C:2012.
11191119 }
11201120 // SECOND: Insert the fragment into the fragment tree. If it already exists, drop and free the duplicate.
11211121 UDPARD_ASSERT ((self -> max_index <= self -> eot_index ) && (self -> accepted_frames <= self -> eot_index ));
@@ -1132,7 +1132,7 @@ static inline int_fast8_t rxSlotAccept(RxSlot* const self,
11321132 UDPARD_ASSERT (release );
11331133 result = - UDPARD_ERROR_MEMORY ;
11341134 // No restart because there is hope that there will be enough memory when we receive a duplicate.
1135- goto finish ;
1135+ goto finish ; // NOSONAR goto simplifies the control flow and is not prohibited by MISRA C:2012.
11361136 }
11371137 UDPARD_ASSERT (self -> max_index <= self -> eot_index );
11381138 if (update_ctx .accepted )
@@ -1363,7 +1363,9 @@ static inline bool rxSessionDeduplicate(UdpardInternalRxSession* const self,
13631363 memFreePayload (memory .payload , transfer -> payload .origin );
13641364 rxFragmentDestroyList (transfer -> payload .next , memory );
13651365 transfer -> payload_size = 0 ;
1366- transfer -> payload = (struct UdpardFragment ){.next = NULL , .view = {0 }, .origin = {0 }};
1366+ transfer -> payload = (struct UdpardFragment ){.next = NULL ,
1367+ .view = {.size = 0 , .data = NULL },
1368+ .origin = {.size = 0 , .data = NULL }};
13671369 }
13681370 return accept ;
13691371}
@@ -1423,7 +1425,7 @@ static inline void rxSessionDestroyTree(UdpardInternalRxSession* const sel
14231425 if (child != NULL )
14241426 {
14251427 UDPARD_ASSERT (child -> base .up == & self -> base );
1426- rxSessionDestroyTree (child , memory );
1428+ rxSessionDestroyTree (child , memory ); // NOSONAR recursion
14271429 }
14281430 }
14291431 memFree (memory .session , sizeof (UdpardInternalRxSession ), self );
@@ -1437,11 +1439,12 @@ typedef struct
14371439 struct UdpardRxMemoryResources memory ;
14381440} RxPortSessionSearchContext ;
14391441
1440- static inline int8_t rxPortSessionSearch (void * const user_reference , const struct UdpardTreeNode * node )
1442+ static inline int8_t rxPortSessionSearch (void * const user_reference , // NOSONAR non-const API
1443+ const struct UdpardTreeNode * node )
14411444{
14421445 UDPARD_ASSERT ((user_reference != NULL ) && (node != NULL ));
1443- const RxPortSessionSearchContext * const ctx = (const RxPortSessionSearchContext * ) user_reference ;
1444- struct UdpardInternalRxSession * const session = (struct UdpardInternalRxSession * ) node ;
1446+ const RxPortSessionSearchContext * const ctx = (const RxPortSessionSearchContext * ) user_reference ;
1447+ const struct UdpardInternalRxSession * const session = (const struct UdpardInternalRxSession * ) ( const void * ) node ;
14451448 UDPARD_ASSERT ((ctx != NULL ) && (session != NULL ));
14461449 int8_t out = 0 ;
14471450 if (ctx -> remote_node_id > session -> remote_node_id )
@@ -1455,7 +1458,7 @@ static inline int8_t rxPortSessionSearch(void* const user_reference, const struc
14551458 return out ;
14561459}
14571460
1458- static inline struct UdpardTreeNode * rxPortSessionFactory (void * const user_reference )
1461+ static inline struct UdpardTreeNode * rxPortSessionFactory (void * const user_reference ) // NOSONAR non-const API
14591462{
14601463 const RxPortSessionSearchContext * const ctx = (const RxPortSessionSearchContext * ) user_reference ;
14611464 UDPARD_ASSERT ((ctx != NULL ) && (ctx -> remote_node_id <= UDPARD_NODE_ID_MAX ));
@@ -1487,7 +1490,7 @@ static inline int_fast8_t rxPortAccept(struct UdpardRxPort* const self
14871490 const bool anonymous = frame .meta .src_node_id == UDPARD_NODE_ID_UNSET ;
14881491 if (!anonymous )
14891492 {
1490- struct UdpardInternalRxSession * const session = (struct UdpardInternalRxSession * )
1493+ struct UdpardInternalRxSession * const session = (struct UdpardInternalRxSession * ) ( void * )
14911494 cavlSearch ((struct UdpardTreeNode * * ) & self -> sessions ,
14921495 & (RxPortSessionSearchContext ){.remote_node_id = frame .meta .src_node_id , .memory = memory },
14931496 & rxPortSessionSearch ,
@@ -1597,8 +1600,8 @@ int8_t udpardRxSubscriptionInit(struct UdpardRxSubscription* const self,
15971600 (void ) subject_id ;
15981601 (void ) extent ;
15991602 (void ) memory ;
1600- (void ) rxPortAcceptFrame ;
1601- (void ) rxPortInit ;
1602- (void ) rxPortFree ;
1603+ (void ) & rxPortAcceptFrame ;
1604+ (void ) & rxPortInit ;
1605+ (void ) & rxPortFree ;
16031606 return 0 ;
16041607}
0 commit comments