From 36835f89509b4a1c3b4fe10248afe8b7c55eb163 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 8 Apr 2020 15:09:11 +0200
Subject: [PATCH] [MeL] Properties: Remove unnecessary c_str().

---
 MeshLib/Properties-impl.h | 30 ++++++++++++++----------------
 MeshLib/Properties.cpp    |  2 +-
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/MeshLib/Properties-impl.h b/MeshLib/Properties-impl.h
index 683288e8f3e..e535547114d 100644
--- a/MeshLib/Properties-impl.h
+++ b/MeshLib/Properties-impl.h
@@ -21,7 +21,7 @@ PropertyVector<T>* Properties::createNewPropertyVector(
     );
     if (it != _properties.end()) {
         ERR("A property of the name '{:s}' is already assigned to the mesh.",
-            name.c_str());
+            name);
         return nullptr;
     }
     auto entry_info(
@@ -49,7 +49,7 @@ PropertyVector<T>* Properties::createNewPropertyVector(
     );
     if (it != _properties.end()) {
         ERR("A property of the name '{:s}' already assigned to the mesh.",
-            name.c_str());
+            name);
         return nullptr;
     }
 
@@ -124,14 +124,14 @@ PropertyVector<T> const* Properties::getPropertyVector(
     if (it == _properties.end())
     {
         OGS_FATAL("The PropertyVector '{:s}' is not available in the mesh.",
-                  name.c_str());
+                  name);
     }
     if (!dynamic_cast<PropertyVector<T> const*>(it->second))
     {
         OGS_FATAL(
             "The PropertyVector '{:s}' has a different type than the requested "
             "PropertyVector.",
-            name.c_str());
+            name);
     }
     return dynamic_cast<PropertyVector<T> const*>(it->second);
 }
@@ -144,14 +144,14 @@ PropertyVector<T>* Properties::getPropertyVector(std::string const& name)
     {
         OGS_FATAL(
             "A PropertyVector with the specified name '{:s}' is not available.",
-            name.c_str());
+            name);
     }
     if (!dynamic_cast<PropertyVector<T>*>(it->second))
     {
         OGS_FATAL(
             "The PropertyVector '{:s}' has a different type than the requested "
             "PropertyVector.",
-            name.c_str());
+            name);
     }
     return dynamic_cast<PropertyVector<T>*>(it->second);
 }
@@ -166,7 +166,7 @@ PropertyVector<T> const* Properties::getPropertyVector(
     {
         OGS_FATAL(
             "A PropertyVector with name '{:s}' does not exist in the mesh.",
-            name.c_str());
+            name);
     }
 
     auto property = dynamic_cast<PropertyVector<T>*>(it->second);
@@ -175,22 +175,21 @@ PropertyVector<T> const* Properties::getPropertyVector(
         OGS_FATAL(
             "Could not cast the data type of the PropertyVector '{:s}' to "
             "requested data type.",
-            name.c_str());
+            name);
     }
     if (property->getMeshItemType() != item_type)
     {
         OGS_FATAL(
             "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
             "requested.",
-            name.c_str(), toString(property->getMeshItemType()),
-            toString(item_type));
+            name, toString(property->getMeshItemType()), toString(item_type));
     }
     if (property->getNumberOfComponents() != n_components)
     {
         OGS_FATAL(
             "PropertyVector '{:s}' has {:d} components, {:d} components are "
             "needed.",
-            name.c_str(), property->getNumberOfComponents(), n_components);
+            name, property->getNumberOfComponents(), n_components);
     }
     return property;
 }
@@ -205,7 +204,7 @@ PropertyVector<T>* Properties::getPropertyVector(std::string const& name,
     {
         OGS_FATAL(
             "A PropertyVector with name '{:s}' does not exist in the mesh.",
-            name.c_str());
+            name);
     }
 
     auto property = dynamic_cast<PropertyVector<T>*>(it->second);
@@ -214,22 +213,21 @@ PropertyVector<T>* Properties::getPropertyVector(std::string const& name,
         OGS_FATAL(
             "Could not cast the data type of the PropertyVector '{:s}' to "
             "requested data type.",
-            name.c_str());
+            name);
     }
     if (property->getMeshItemType() != item_type)
     {
         OGS_FATAL(
             "The PropertyVector '{:s}' has type '{:s}'. A '{:s}' field is "
             "requested.",
-            name.c_str(), toString(property->getMeshItemType()),
-            toString(item_type));
+            name, toString(property->getMeshItemType()), toString(item_type));
     }
     if (property->getNumberOfComponents() != n_components)
     {
         OGS_FATAL(
             "PropertyVector '{:s}' has {:d} components, {:d} components are "
             "needed.",
-            name.c_str(), property->getNumberOfComponents(), n_components);
+            name, property->getNumberOfComponents(), n_components);
     }
     return property;
 }
diff --git a/MeshLib/Properties.cpp b/MeshLib/Properties.cpp
index de11bb70a6c..2423ac01b8b 100644
--- a/MeshLib/Properties.cpp
+++ b/MeshLib/Properties.cpp
@@ -21,7 +21,7 @@ void Properties::removePropertyVector(std::string const& name)
         _properties.find(name)
     );
     if (it == _properties.end()) {
-        WARN("A property of the name '{:s}' does not exist.", name.c_str());
+        WARN("A property of the name '{:s}' does not exist.", name);
         return;
     }
     delete it->second;
-- 
GitLab