@@ -801,8 +801,8 @@ bool EDP::unpairWriterProxy(
801801#endif // if HAVE_SECURITY
802802
803803 // MATCHED AND ADDED CORRECTLY:
804- ReaderListener* listener = nullptr ;
805- if (nullptr != ( listener = r. get_listener ()) )
804+ ReaderListener* listener = r. get_listener () ;
805+ if (nullptr != listener)
806806 {
807807 MatchingInfo info;
808808 info.status = REMOVED_MATCHING ;
@@ -836,8 +836,8 @@ bool EDP::unpairReaderProxy(
836836 participant_guid, reader_guid);
837837#endif // if HAVE_SECURITY
838838 // MATCHED AND ADDED CORRECTLY:
839- WriterListener* listener = nullptr ;
840- if (nullptr != ( listener = w. get_listener ()) )
839+ WriterListener* listener = w. get_listener () ;
840+ if (nullptr != listener)
841841 {
842842 MatchingInfo info;
843843 info.status = REMOVED_MATCHING ;
@@ -1167,40 +1167,40 @@ bool EDP::pairingReader(
11671167 " WP:" << wdatait->guid << " match R:" << reader_guid << " . RLoc:"
11681168 << wdatait->remote_locators );
11691169 // MATCHED AND ADDED CORRECTLY:
1170- if (reader->get_listener () != nullptr )
1170+ ReaderListener* listener = reader->get_listener ();
1171+ if (nullptr != listener)
11711172 {
11721173 MatchingInfo info;
11731174 info.status = MATCHED_MATCHING ;
11741175 info.remoteEndpointGuid = writer_guid;
1175- reader-> get_listener () ->on_reader_matched (reader, info);
1176+ listener ->on_reader_matched (reader, info);
11761177 }
11771178 }
11781179#endif // if HAVE_SECURITY
11791180 }
11801181 else
11811182 {
1182- if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && reader->get_listener () != nullptr )
1183+ ReaderListener* listener = reader->get_listener ();
1184+ if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && (nullptr != listener))
11831185 {
1184- reader-> get_listener () ->on_requested_incompatible_qos (reader, incompatible_qos);
1186+ listener ->on_requested_incompatible_qos (reader, incompatible_qos);
11851187 mp_PDP->notify_incompatible_qos_matching (R->getGuid (), wdatait->guid , incompatible_qos);
11861188 }
11871189
1188- // EPROSIMA_LOG_INFO(RTPS_EDP,RTPS_CYAN<<"Valid Matching to writerProxy: "<<wdatait->guid<<RTPS_DEF<<endl);
1189- if (reader->matched_writer_is_matched (wdatait->guid )
1190- && reader->matched_writer_remove (wdatait->guid ))
1190+ if (reader->matched_writer_is_matched (wdatait->guid ) && reader->matched_writer_remove (wdatait->guid ))
11911191 {
11921192#if HAVE_SECURITY
1193- mp_RTPSParticipant->security_manager ().remove_writer (reader_guid, participant_guid,
1194- wdatait->guid );
1193+ mp_RTPSParticipant->security_manager ().remove_writer (reader_guid, participant_guid, wdatait->guid );
11951194#endif // if HAVE_SECURITY
11961195
11971196 // MATCHED AND ADDED CORRECTLY:
1198- if (reader->get_listener () != nullptr )
1197+ ReaderListener* listener = reader->get_listener ();
1198+ if (nullptr != listener)
11991199 {
12001200 MatchingInfo info;
12011201 info.status = REMOVED_MATCHING ;
12021202 info.remoteEndpointGuid = writer_guid;
1203- reader-> get_listener () ->on_reader_matched (reader, info);
1203+ listener ->on_reader_matched (reader, info);
12041204 }
12051205 }
12061206 }
@@ -1261,21 +1261,23 @@ bool EDP::pairingWriter(
12611261 " RP:" << rdatait->guid << " match W:" << writer_guid << " . WLoc:"
12621262 << rdatait->remote_locators );
12631263 // MATCHED AND ADDED CORRECTLY:
1264- if (writer->get_listener () != nullptr )
1264+ WriterListener* listener = writer->get_listener ();
1265+ if (nullptr != listener)
12651266 {
12661267 MatchingInfo info;
12671268 info.status = MATCHED_MATCHING ;
12681269 info.remoteEndpointGuid = reader_guid;
1269- writer-> get_listener () ->on_writer_matched (writer, info);
1270+ listener ->on_writer_matched (writer, info);
12701271 }
12711272 }
12721273#endif // if HAVE_SECURITY
12731274 }
12741275 else
12751276 {
1276- if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && writer->get_listener () != nullptr )
1277+ WriterListener* listener = writer->get_listener ();
1278+ if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && (nullptr != listener))
12771279 {
1278- writer-> get_listener () ->on_offered_incompatible_qos (writer, incompatible_qos);
1280+ listener ->on_offered_incompatible_qos (writer, incompatible_qos);
12791281 mp_PDP->notify_incompatible_qos_matching (W->getGuid (), rdatait->guid , incompatible_qos);
12801282 }
12811283
@@ -1286,12 +1288,13 @@ bool EDP::pairingWriter(
12861288 mp_RTPSParticipant->security_manager ().remove_reader (writer_guid, participant_guid, reader_guid);
12871289#endif // if HAVE_SECURITY
12881290 // MATCHED AND ADDED CORRECTLY:
1289- if (writer->get_listener () != nullptr )
1291+ WriterListener* listener = writer->get_listener ();
1292+ if (nullptr != listener)
12901293 {
12911294 MatchingInfo info;
12921295 info.status = REMOVED_MATCHING ;
12931296 info.remoteEndpointGuid = reader_guid;
1294- writer-> get_listener () ->on_writer_matched (writer, info);
1297+ listener ->on_writer_matched (writer, info);
12951298 }
12961299 }
12971300 }
@@ -1338,38 +1341,40 @@ bool EDP::pairing_reader_proxy_with_any_local_writer(
13381341 " RP:" << rdata->guid << " match W:" << w.getGuid () << " . RLoc:"
13391342 << rdata->remote_locators );
13401343 // MATCHED AND ADDED CORRECTLY:
1341- if (w.get_listener () != nullptr )
1344+ WriterListener* listener = w.get_listener ();
1345+ if (nullptr != listener)
13421346 {
13431347 MatchingInfo info;
13441348 info.status = MATCHED_MATCHING ;
13451349 info.remoteEndpointGuid = reader_guid;
1346- w. get_listener () ->on_writer_matched (&w, info);
1350+ listener ->on_writer_matched (&w, info);
13471351 }
13481352 }
13491353#endif // if HAVE_SECURITY
13501354 }
13511355 else
13521356 {
1353- if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && w.get_listener () != nullptr )
1357+ WriterListener* listener = w.get_listener ();
1358+ if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && (nullptr != listener))
13541359 {
1355- w. get_listener () ->on_offered_incompatible_qos (&w, incompatible_qos);
1360+ listener ->on_offered_incompatible_qos (&w, incompatible_qos);
13561361 mp_PDP->notify_incompatible_qos_matching (w.getGuid (), rdata->guid , incompatible_qos);
13571362 }
13581363
1359- if (w.matched_reader_is_matched (reader_guid)
1360- && w.matched_reader_remove (reader_guid))
1364+ if (w.matched_reader_is_matched (reader_guid) && w.matched_reader_remove (reader_guid))
13611365 {
13621366#if HAVE_SECURITY
13631367 mp_RTPSParticipant->security_manager ().remove_reader (
13641368 w.getGuid (), participant_guid, reader_guid);
13651369#endif // if HAVE_SECURITY
13661370 // MATCHED AND ADDED CORRECTLY:
1367- if (w.get_listener () != nullptr )
1371+ WriterListener* listener = w.get_listener ();
1372+ if (nullptr != listener)
13681373 {
13691374 MatchingInfo info;
13701375 info.status = REMOVED_MATCHING ;
13711376 info.remoteEndpointGuid = reader_guid;
1372- w. get_listener () ->on_writer_matched (&w, info);
1377+ listener ->on_writer_matched (&w, info);
13731378 }
13741379 }
13751380 }
@@ -1419,25 +1424,25 @@ bool EDP::pairing_reader_proxy_with_local_writer(
14191424 }
14201425 else
14211426 {
1422- if (no_match_reason. test (MatchingFailureMask::incompatible_qos) &&
1423- w. get_listener () != nullptr )
1427+ WriterListener* listener = w. get_listener ();
1428+ if (no_match_reason. test (MatchingFailureMask::incompatible_qos) && ( nullptr != listener) )
14241429 {
1425- w. get_listener () ->on_offered_incompatible_qos (&w, incompatible_qos);
1430+ listener ->on_offered_incompatible_qos (&w, incompatible_qos);
14261431 mp_PDP->notify_incompatible_qos_matching (local_writer, rdata.guid , incompatible_qos);
14271432 }
14281433
1429- if (w.matched_reader_is_matched (reader_guid)
1430- && w.matched_reader_remove (reader_guid))
1434+ if (w.matched_reader_is_matched (reader_guid) && w.matched_reader_remove (reader_guid))
14311435 {
14321436 mp_RTPSParticipant->security_manager ().remove_reader (w.getGuid (),
14331437 remote_participant_guid, reader_guid);
14341438 // MATCHED AND ADDED CORRECTLY:
1435- if (w.get_listener () != nullptr )
1439+ WriterListener* listener = w.get_listener ();
1440+ if (nullptr != listener)
14361441 {
14371442 MatchingInfo info;
14381443 info.status = REMOVED_MATCHING ;
14391444 info.remoteEndpointGuid = reader_guid;
1440- w. get_listener () ->on_writer_matched (&w, info);
1445+ listener ->on_writer_matched (&w, info);
14411446 }
14421447 }
14431448 }
@@ -1474,12 +1479,13 @@ bool EDP::pairing_remote_reader_with_local_writer_after_security(
14741479 matched = true ;
14751480
14761481 // MATCHED AND ADDED CORRECTLY:
1477- if (w.get_listener () != nullptr )
1482+ WriterListener* listener = w.get_listener ();
1483+ if (nullptr != listener)
14781484 {
14791485 MatchingInfo info;
14801486 info.status = MATCHED_MATCHING ;
14811487 info.remoteEndpointGuid = reader_guid;
1482- w. get_listener () ->on_writer_matched (&w, info);
1488+ listener ->on_writer_matched (&w, info);
14831489 }
14841490 }
14851491 // don't look anymore
@@ -1533,38 +1539,40 @@ bool EDP::pairing_writer_proxy_with_any_local_reader(
15331539 " WP:" << wdata->guid << " match R:" << r.getGuid () << " . WLoc:"
15341540 << wdata->remote_locators );
15351541 // MATCHED AND ADDED CORRECTLY:
1536- if (r.get_listener () != nullptr )
1542+ ReaderListener* listener = r.get_listener ();
1543+ if (nullptr != listener)
15371544 {
15381545 MatchingInfo info;
15391546 info.status = MATCHED_MATCHING ;
15401547 info.remoteEndpointGuid = writer_guid;
1541- r. get_listener () ->on_reader_matched (&r, info);
1548+ listener ->on_reader_matched (&r, info);
15421549 }
15431550 }
15441551#endif // if HAVE_SECURITY
15451552 }
15461553 else
15471554 {
1548- if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && r.get_listener () != nullptr )
1555+ ReaderListener* listener = r.get_listener ();
1556+ if (no_match_reason.test (MatchingFailureMask::incompatible_qos) && (nullptr != listener))
15491557 {
1550- r. get_listener () ->on_requested_incompatible_qos (&r, incompatible_qos);
1558+ listener ->on_requested_incompatible_qos (&r, incompatible_qos);
15511559 mp_PDP->notify_incompatible_qos_matching (r.getGuid (), wdata->guid , incompatible_qos);
15521560 }
15531561
1554- if (r.matched_writer_is_matched (writer_guid)
1555- && r.matched_writer_remove (writer_guid))
1562+ if (r.matched_writer_is_matched (writer_guid) && r.matched_writer_remove (writer_guid))
15561563 {
15571564#if HAVE_SECURITY
15581565 mp_RTPSParticipant->security_manager ().remove_writer (readerGUID, participant_guid,
15591566 writer_guid);
15601567#endif // if HAVE_SECURITY
15611568 // MATCHED AND ADDED CORRECTLY:
1562- if (r.get_listener () != nullptr )
1569+ ReaderListener* listener = r.get_listener ();
1570+ if (nullptr != listener)
15631571 {
15641572 MatchingInfo info;
15651573 info.status = REMOVED_MATCHING ;
15661574 info.remoteEndpointGuid = writer_guid;
1567- r. get_listener () ->on_reader_matched (&r, info);
1575+ listener ->on_reader_matched (&r, info);
15681576 }
15691577 }
15701578 }
@@ -1614,25 +1622,25 @@ bool EDP::pairing_writer_proxy_with_local_reader(
16141622 }
16151623 else
16161624 {
1617- if (no_match_reason. test (MatchingFailureMask::incompatible_qos) &&
1618- r. get_listener () != nullptr )
1625+ ReaderListener* listener = r. get_listener ();
1626+ if (no_match_reason. test (MatchingFailureMask::incompatible_qos) && ( nullptr != listener) )
16191627 {
1620- r. get_listener () ->on_requested_incompatible_qos (&r, incompatible_qos);
1628+ listener ->on_requested_incompatible_qos (&r, incompatible_qos);
16211629 mp_PDP->notify_incompatible_qos_matching (local_reader, wdata.guid , incompatible_qos);
16221630 }
16231631
1624- if (r.matched_writer_is_matched (writer_guid)
1625- && r.matched_writer_remove (writer_guid))
1632+ if (r.matched_writer_is_matched (writer_guid) && r.matched_writer_remove (writer_guid))
16261633 {
16271634 mp_RTPSParticipant->security_manager ().remove_writer (readerGUID,
16281635 remote_participant_guid, writer_guid);
16291636 // MATCHED AND ADDED CORRECTLY:
1630- if (r.get_listener () != nullptr )
1637+ ReaderListener* listener = r.get_listener ();
1638+ if (nullptr != listener)
16311639 {
16321640 MatchingInfo info;
16331641 info.status = REMOVED_MATCHING ;
16341642 info.remoteEndpointGuid = writer_guid;
1635- r. get_listener () ->on_reader_matched (&r, info);
1643+ listener ->on_reader_matched (&r, info);
16361644 }
16371645 }
16381646 }
@@ -1671,13 +1679,13 @@ bool EDP::pairing_remote_writer_with_local_reader_after_security(
16711679 matched = true ;
16721680
16731681 // MATCHED AND ADDED CORRECTLY:
1674- if (r.get_listener () != nullptr )
1682+ ReaderListener* listener = r.get_listener ();
1683+ if (nullptr != listener)
16751684 {
16761685 MatchingInfo info;
16771686 info.status = MATCHED_MATCHING ;
16781687 info.remoteEndpointGuid = writer_guid;
1679- r.get_listener ()->on_reader_matched (&r, info);
1680-
1688+ listener->on_reader_matched (&r, info);
16811689 }
16821690 }
16831691 // dont' look anymore
0 commit comments