From a544ee05dd7b82744e005f0f093d85c6a4a7150e Mon Sep 17 00:00:00 2001
From: William F Godoy <williamfgc@yahoo.com>
Date: Tue, 8 Aug 2017 17:52:35 -0400
Subject: [PATCH] Fixing errors from github merged version

Fixed conflicts for clean compilation
Fixed clang-format
Adding free in C example
---
 examples/hello/bpWriter/helloBPWriter.c | 2 ++
 source/adios2/core/IO.cpp               | 3 ++-
 source/adios2/core/IO.h                 | 6 +++---
 source/adios2/core/IO.tcc               | 2 +-
 source/adios2/core/Variable.tcc         | 2 +-
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/examples/hello/bpWriter/helloBPWriter.c b/examples/hello/bpWriter/helloBPWriter.c
index 796accca5..1c805a09f 100644
--- a/examples/hello/bpWriter/helloBPWriter.c
+++ b/examples/hello/bpWriter/helloBPWriter.c
@@ -53,6 +53,8 @@ int main(int argc, char *argv[])
     adios2_close(engineH);
     adios2_finalize(adiosH);
 
+    free(myFloats);
+
     MPI_Finalize();
 
     return 0;
diff --git a/source/adios2/core/IO.cpp b/source/adios2/core/IO.cpp
index 1dee549c8..55146f100 100644
--- a/source/adios2/core/IO.cpp
+++ b/source/adios2/core/IO.cpp
@@ -91,7 +91,8 @@ IO::DefineVariableCompound(const std::string &name, const size_t sizeOfVariable,
 {
     if (m_DebugMode)
     {
-        if (VariableExists(name))
+        auto itVariable = m_Variables.find(name);
+        if (!IsEnd(itVariable, m_Variables))
         {
             throw std::invalid_argument("ERROR: variable " + name +
                                         " exists in IO object " + m_Name +
diff --git a/source/adios2/core/IO.h b/source/adios2/core/IO.h
index f0a7b4536..01c7ad427 100644
--- a/source/adios2/core/IO.h
+++ b/source/adios2/core/IO.h
@@ -140,7 +140,7 @@ public:
     template <class T>
     Variable<T> &DefineVariable(const std::string &name, const Dims &shape = {},
                                 const Dims &start = {}, const Dims &count = {},
-                                const bool constantShape = false);
+                                const bool constantDims = false);
 
     /**
      * Define a Variable of primitive data type for I/O.
@@ -159,8 +159,8 @@ public:
                                              const Dims &shape = Dims{},
                                              const Dims &start = Dims{},
                                              const Dims &count = Dims{},
-                                             const bool constantShape = false);
-  
+                                             const bool constantDims = false);
+
     VariableCompound &DefineVariableCompound(const std::string &name,
                                              const size_t sizeOfVariable,
                                              const Dims &shape = Dims{},
diff --git a/source/adios2/core/IO.tcc b/source/adios2/core/IO.tcc
index eb11fc874..c73ed1ce7 100644
--- a/source/adios2/core/IO.tcc
+++ b/source/adios2/core/IO.tcc
@@ -28,7 +28,7 @@ namespace adios2
 template <class T>
 Variable<T> &IO::DefineVariable(const std::string &name, const Dims &shape,
                                 const Dims &start, const Dims &count,
-                                const bool constantShape)
+                                const bool constantDims)
 {
     if (m_DebugMode)
     {
diff --git a/source/adios2/core/Variable.tcc b/source/adios2/core/Variable.tcc
index d6241f856..0de077a2e 100644
--- a/source/adios2/core/Variable.tcc
+++ b/source/adios2/core/Variable.tcc
@@ -24,7 +24,7 @@ namespace adios2
     template <>                                                                \
     Variable<T>::Variable(const std::string &name, const Dims &shape,          \
                           const Dims &start, const Dims &count,                \
-                          const bool constantShape, const bool debugMode)      \
+                          const bool constantDims, const bool debugMode)       \
     : VariableBase(name, GetType<T>(), sizeof(T), shape, start, count,         \
                    constantDims, debugMode)                                    \
     {                                                                          \
-- 
GitLab