From 5cd4c7c0f5d911a697f0e166a4f963bbd293330f Mon Sep 17 00:00:00 2001
From: rex-schilasky <49162693+rex-schilasky@users.noreply.github.com>
Date: Fri, 10 Nov 2023 19:01:47 +0100
Subject: [PATCH] clang tidy ecal/core/src/pubsub

---
 ecal/core/src/pubsub/ecal_pubgate.cpp    | 6 +++---
 ecal/core/src/pubsub/ecal_publisher.cpp  | 2 +-
 ecal/core/src/pubsub/ecal_subgate.cpp    | 6 +++---
 ecal/core/src/pubsub/ecal_subscriber.cpp | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ecal/core/src/pubsub/ecal_pubgate.cpp b/ecal/core/src/pubsub/ecal_pubgate.cpp
index e9324adfd9..3fbc58a6ce 100644
--- a/ecal/core/src/pubsub/ecal_pubgate.cpp
+++ b/ecal/core/src/pubsub/ecal_pubgate.cpp
@@ -117,7 +117,7 @@ namespace eCAL
     CDataWriter::SLocalSubscriptionInfo subscription_info;
     subscription_info.topic_id = ecal_sample.tid();
     subscription_info.process_id = std::to_string(ecal_sample.pid());
-    SDataTypeInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) };
+    const SDataTypeInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) };
 
     std::string reader_par;
     for (const auto& layer : ecal_sample.tlayer())
@@ -169,7 +169,7 @@ namespace eCAL
     subscription_info.host_name  = ecal_sample.hname();
     subscription_info.topic_id   = ecal_sample.tid();
     subscription_info.process_id = std::to_string(ecal_sample.pid());
-    SDataTypeInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) };
+    const SDataTypeInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) };
 
     std::string reader_par;
     for (const auto& layer : ecal_sample.tlayer())
@@ -218,7 +218,7 @@ namespace eCAL
 
     // refresh publisher registrations
     const std::shared_lock<std::shared_timed_mutex> lock(m_topic_name_datawriter_sync);
-    for (auto iter : m_topic_name_datawriter_map)
+    for (const auto& iter : m_topic_name_datawriter_map)
     {
       iter.second->RefreshRegistration();
     }
diff --git a/ecal/core/src/pubsub/ecal_publisher.cpp b/ecal/core/src/pubsub/ecal_publisher.cpp
index cf44221aee..bbb9611a2d 100644
--- a/ecal/core/src/pubsub/ecal_publisher.cpp
+++ b/ecal/core/src/pubsub/ecal_publisher.cpp
@@ -426,7 +426,7 @@ namespace eCAL
 
   std::string CPublisher::GetTypeName() const
   {
-    SDataTypeInformation info = GetDataTypeInformation();
+    const SDataTypeInformation info = GetDataTypeInformation();
     return(Util::CombinedTopicEncodingAndType(info.encoding, info.name));
   }
 
diff --git a/ecal/core/src/pubsub/ecal_subgate.cpp b/ecal/core/src/pubsub/ecal_subgate.cpp
index 757e4ac827..33b8bdccd7 100644
--- a/ecal/core/src/pubsub/ecal_subgate.cpp
+++ b/ecal/core/src/pubsub/ecal_subgate.cpp
@@ -234,7 +234,7 @@ namespace eCAL
     if (topic_name.empty()) return;
 
     const std::string& topic_id   = ecal_sample.tid();
-    SDataTypeInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) };
+    const SDataTypeInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) };
 
     // store description
     ApplyTopicToDescGate(topic_name, topic_info);
@@ -313,7 +313,7 @@ namespace eCAL
     const std::string& host_name  = ecal_sample.hname();
     const std::string& topic_name = ecal_sample.tname();
     const std::string& topic_id   = ecal_sample.tid();
-    SDataTypeInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) };
+    const SDataTypeInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) };
     const std::string  process_id = std::to_string(ecal_sample.pid());
 
     // store description
@@ -361,7 +361,7 @@ namespace eCAL
 
     // refresh reader registrations
     const std::shared_lock<std::shared_timed_mutex> lock(m_topic_name_datareader_sync);
-    for (auto iter : m_topic_name_datareader_map)
+    for (const auto& iter : m_topic_name_datareader_map)
     {
       iter.second->RefreshRegistration();
     }
diff --git a/ecal/core/src/pubsub/ecal_subscriber.cpp b/ecal/core/src/pubsub/ecal_subscriber.cpp
index f04edf78d4..2056bb1cd8 100644
--- a/ecal/core/src/pubsub/ecal_subscriber.cpp
+++ b/ecal/core/src/pubsub/ecal_subscriber.cpp
@@ -263,7 +263,7 @@ namespace eCAL
   std::string CSubscriber::GetTypeName() const
   {
     if(m_datareader == nullptr) return("");
-    SDataTypeInformation info = m_datareader->GetDataTypeInformation();
+    const SDataTypeInformation info = m_datareader->GetDataTypeInformation();
     return(Util::CombinedTopicEncodingAndType(info.encoding, info.name));
   }