@@ -340,8 +340,8 @@ CANARD_PRIVATE struct CanardTxQueueItem* txAllocateQueueItem(struct CanardTxQueu
340340/// Frames with identical CAN ID that are added later always compare greater than their counterparts with same CAN ID.
341341/// This ensures that CAN frames with the same CAN ID are transmitted in the FIFO order.
342342/// Frames that should be transmitted earlier compare smaller (i.e., put on the left side of the tree).
343- CANARD_PRIVATE int8_t txAVLPriorityPredicate ( //
344- void * const user_reference , // NOSONAR Cavl API requires pointer to non-const.
343+ CANARD_PRIVATE ptrdiff_t txAVLPriorityPredicate ( //
344+ const void * user_reference , // NOSONAR Cavl API requires pointer to non-const.
345345 const struct CanardTreeNode * const node )
346346{
347347 typedef struct CanardTxQueueItem TxItem ;
@@ -356,8 +356,8 @@ CANARD_PRIVATE int8_t txAVLPriorityPredicate( //
356356/// that are added later always compare greater than their counterparts with the same deadline.
357357/// This ensures that CAN frames with the same deadline are, when timed out, dropped in the FIFO order.
358358/// Frames that should be dropped earlier compare smaller (i.e., put on the left side of the tree).
359- CANARD_PRIVATE int8_t txAVLDeadlinePredicate ( //
360- void * const user_reference , // NOSONAR Cavl API requires pointer to non-const.
359+ CANARD_PRIVATE ptrdiff_t txAVLDeadlinePredicate ( //
360+ const void * user_reference , // NOSONAR Cavl API requires pointer to non-const.
361361 const struct CanardTreeNode * const node )
362362{
363363 typedef struct CanardTxQueueItem TxItem ;
@@ -404,18 +404,17 @@ CANARD_PRIVATE int32_t txPushSingleFrame(struct CanardTxQueue* const que,
404404 const struct CanardTreeNode * const priority_queue_res = cavl2_find_or_insert (& que -> priority_root ,
405405 & tqi -> priority_base ,
406406 & txAVLPriorityPredicate ,
407- & tqi -> priority_base ,
407+ tqi ,
408408 & avlTrivialFactory );
409409 (void ) priority_queue_res ;
410410 CANARD_ASSERT (priority_queue_res == & tqi -> priority_base );
411411
412412 // Insert the newly created TX item into the deadline queue.
413413 const struct CanardTreeNode * const deadline_queue_res = cavl2_find_or_insert (& que -> priority_root ,
414- & tqi -> priority_base ,
414+ & tqi -> deadline_base ,
415415 & txAVLPriorityPredicate ,
416- & tqi -> priority_base ,
416+ tqi ,
417417 & avlTrivialFactory );
418- (& que -> priority_root , & tqi -> priority_base , & txAVLPriorityPredicate , & tqi -> priority_base , & avlTrivialFactory );
419418 (void ) deadline_queue_res ;
420419 CANARD_ASSERT (deadline_queue_res == & tqi -> deadline_base );
421420
@@ -562,7 +561,7 @@ CANARD_PRIVATE int32_t txPushMultiFrame(struct CanardTxQueue* const que,
562561 const struct CanardTreeNode * const priority_queue_res = cavl2_find_or_insert (& que -> priority_root ,
563562 & next -> priority_base ,
564563 & txAVLPriorityPredicate ,
565- & next -> priority_base ,
564+ next ,
566565 & avlTrivialFactory );
567566 (void ) priority_queue_res ;
568567 CANARD_ASSERT (priority_queue_res == & next -> priority_base );
@@ -571,7 +570,7 @@ CANARD_PRIVATE int32_t txPushMultiFrame(struct CanardTxQueue* const que,
571570 const struct CanardTreeNode * const deadline_queue_res = cavl2_find_or_insert (& que -> deadline_root ,
572571 & next -> deadline_base ,
573572 & txAVLDeadlinePredicate ,
574- next -> priority_base ,
573+ next ,
575574 & avlTrivialFactory );
576575 (void ) deadline_queue_res ;
577576 CANARD_ASSERT (deadline_queue_res == & next -> deadline_base );
@@ -1113,8 +1112,8 @@ CANARD_PRIVATE int8_t rxAcceptFrame(struct CanardInstance* const ins,
11131112 return out ;
11141113}
11151114
1116- CANARD_PRIVATE int8_t
1117- rxSubscriptionPredicateOnPortID (void * const user_reference , // NOSONAR Cavl API requires pointer to non-const.
1115+ CANARD_PRIVATE ptrdiff_t
1116+ rxSubscriptionPredicateOnPortID (const void * user_reference , // NOSONAR Cavl API requires pointer to non-const.
11181117 const struct CanardTreeNode * const node )
11191118{
11201119 CANARD_ASSERT ((user_reference != NULL ) && (node != NULL ));
@@ -1125,8 +1124,8 @@ rxSubscriptionPredicateOnPortID(void* const user_reference, // NOSONAR Cavl API
11251124 return (sought == other ) ? 0 : NegPos [sought > other ]; // NOLINT no narrowing conversion is taking place here
11261125}
11271126
1128- CANARD_PRIVATE int8_t
1129- rxSubscriptionPredicateOnStruct (void * const user_reference , // NOSONAR Cavl API requires pointer to non-const.
1127+ CANARD_PRIVATE ptrdiff_t
1128+ rxSubscriptionPredicateOnStruct (const void * user_reference , // NOSONAR Cavl API requires pointer to non-const.
11301129 const struct CanardTreeNode * const node )
11311130{
11321131 return rxSubscriptionPredicateOnPortID ( //
@@ -1358,7 +1357,8 @@ int8_t canardRxAccept(struct CanardInstance* const ins,
13581357 cavl2_find_or_insert (& ins -> rx_subscriptions [(size_t ) model .transfer_kind ],
13591358 & model .port_id ,
13601359 & rxSubscriptionPredicateOnPortID ,
1361- NULL );
1360+ ins ,
1361+ & avlTrivialFactory );
13621362 struct CanardRxSubscription * const sub =
13631363 MUTABLE_CONTAINER_OF (struct CanardRxSubscription , sub_node , base );
13641364 if (out_subscription != NULL )
@@ -1419,7 +1419,8 @@ int8_t canardRxSubscribe(struct CanardInstance* const ins,
14191419 const struct CanardTreeNode * const res = cavl2_find_or_insert (& ins -> rx_subscriptions [tk ],
14201420 & out_subscription -> base ,
14211421 & rxSubscriptionPredicateOnStruct ,
1422- & avlTrivialFactory );
1422+ (struct CanardTreeNode * ) & out_subscription ,
1423+ avlTrivialFactory );
14231424 (void ) res ;
14241425 CANARD_ASSERT (res == & out_subscription -> base );
14251426 out = (out > 0 ) ? 0 : 1 ;
@@ -1442,6 +1443,7 @@ int8_t canardRxUnsubscribe(struct CanardInstance* const ins,
14421443 & ins -> rx_subscriptions [tk ],
14431444 & port_id_mutable ,
14441445 & rxSubscriptionPredicateOnPortID ,
1446+ NULL ,
14451447 NULL );
14461448 if (sub_node != NULL )
14471449 {
@@ -1481,11 +1483,11 @@ int8_t canardRxGetSubscription(struct CanardInstance* const ins,
14811483 {
14821484 CanardPortID port_id_mutable = port_id ;
14831485
1484- struct CanardTreeNode * const sub_node = cavl2_find_or_insert ( //
1485- & ins -> rx_subscriptions [ tk ] ,
1486- & port_id_mutable ,
1487- & rxSubscriptionPredicateOnPortID ,
1488- NULL );
1486+ struct CanardTreeNode * const sub_node = cavl2_find_or_insert (& ins -> rx_subscriptions [ tk ],
1487+ & port_id_mutable ,
1488+ & rxSubscriptionPredicateOnPortID ,
1489+ NULL ,
1490+ NULL );
14891491 if (sub_node != NULL )
14901492 {
14911493 struct CanardRxSubscription * const sub = MUTABLE_CONTAINER_OF (struct CanardRxSubscription , sub_node , base );
0 commit comments