From 10eb95941e65c1348b7b80aaa33ae6fd1adb4d5c Mon Sep 17 00:00:00 2001
From: rinkk <karsten.rink@ufz.de>
Date: Wed, 7 Aug 2019 14:08:07 +0200
Subject: [PATCH] adjusting variable scope and default parameters

---
 Applications/FileIO/GocadIO/GocadAsciiReader.cpp | 15 +++++----------
 Applications/FileIO/GocadIO/GocadAsciiReader.h   |  6 ++----
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp
index 7756628ae1e..2d844fd03d3 100644
--- a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp
+++ b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp
@@ -28,9 +28,6 @@ namespace Gocad
 const std::string mat_id_name = "MaterialIDs";
 const std::string eof_error = "Error: Unexpected end of file.";
 
-GocadAsciiReader::GocadAsciiReader()
-: _export_type(GocadDataType::ALL) {}
-
 GocadAsciiReader::GocadAsciiReader(GocadDataType const t)
 : _export_type(t)
 {}
@@ -63,8 +60,7 @@ bool GocadAsciiReader::readFile(
     std::ifstream in(file_name.c_str());
     if (!in.is_open())
     {
-        ERR("GocadAsciiReader::readFile(): Could not open file %s.",
-            file_name.c_str());
+        ERR("GocadAsciiReader::readFile(): Could not open file %s.", file_name.c_str());
         return false;
     }
 
@@ -82,7 +78,7 @@ bool GocadAsciiReader::readFile(
             if (!skipToEND(in))
             {
                 std::string const t = (type == GocadDataType::VSET) ? "VSet" : "Model3D";
-                ERR("Parsing of type %s is not implemented. Skipping section.", t);
+                ERR("Parsing of type %s is not implemented. Skipping section.", t.c_str());
                 return false;
             }
             continue;
@@ -174,8 +170,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
         }
         else
         {
-            WARN("GocadAsciiReader::readData() - Unknown keyword found: %s",
-                 line.c_str());
+            WARN("GocadAsciiReader::readData() - Unknown keyword found: %s", line.c_str());
         }
     }
     ERR("%s", eof_error.c_str());
@@ -492,7 +487,6 @@ bool GocadAsciiReader::parseLineSegments(
     std::map<std::size_t, std::size_t> const& node_id_map,
     MeshLib::Properties& mesh_prop)
 {
-    std::array<std::size_t, 3> data;
     MeshLib::PropertyVector<int>& mat_ids =
         *mesh_prop.getPropertyVector<int>(mat_id_name);
     int current_mat_id(0);
@@ -513,6 +507,7 @@ bool GocadAsciiReader::parseLineSegments(
         {
             std::stringstream sstr(line);
             std::string keyword;
+            std::array<std::size_t, 2> data;
             sstr >> keyword >> data[0] >> data[1];
             std::array<MeshLib::Node*, 2> elem_nodes;
             for (std::size_t i = 0; i < 2; ++i)
@@ -547,7 +542,6 @@ bool GocadAsciiReader::parseElements(
     std::map<std::size_t, std::size_t> const& node_id_map,
     MeshLib::Properties& mesh_prop)
 {
-    std::array<std::size_t, 3> data;
     MeshLib::PropertyVector<int>& mat_ids =
         *mesh_prop.getPropertyVector<int>(mat_id_name);
     int current_mat_id(0);
@@ -568,6 +562,7 @@ bool GocadAsciiReader::parseElements(
         {
             std::stringstream sstr(line);
             std::string keyword;
+            std::array<std::size_t, 3> data;
             sstr >> keyword >> data[0] >> data[1] >> data[2];
             std::array<MeshLib::Node*, 3> elem_nodes;
             for (std::size_t i = 0; i < 3; ++i)
diff --git a/Applications/FileIO/GocadIO/GocadAsciiReader.h b/Applications/FileIO/GocadIO/GocadAsciiReader.h
index 943e490889c..174cf51c7ed 100644
--- a/Applications/FileIO/GocadIO/GocadAsciiReader.h
+++ b/Applications/FileIO/GocadIO/GocadAsciiReader.h
@@ -40,10 +40,8 @@ enum class GocadDataType
 class GocadAsciiReader final
 {
 public:
-    explicit GocadAsciiReader();
-
-    /// Constructor taking a specific data type (will only export that type)
-    explicit GocadAsciiReader(GocadDataType const t);
+    /// Constructor
+    explicit GocadAsciiReader(GocadDataType const t = GocadDataType::ALL);
 
     /// Reads the specified file and writes data into internal mesh vector
     bool readFile(std::string const& file_name,
-- 
GitLab