From c0182c0827610f42821dac9c5ad12c3167c73d14 Mon Sep 17 00:00:00 2001 From: Daniel Garcia-Sanchez Date: Tue, 9 Oct 2018 21:27:35 +0200 Subject: [PATCH] Declare variables as const --- source/base/hdf5.cc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/source/base/hdf5.cc b/source/base/hdf5.cc index c0ad42de5a..84343ec9c3 100644 --- a/source/base/hdf5.cc +++ b/source/base/hdf5.cc @@ -41,7 +41,7 @@ namespace HDF5 // of std::shared_ptr doesn't have to be defined in the template argument. // In the other hand, the destructor of std::unique has to be defined in the // template argument. Native types such as H5T_NATIVE_DOUBLE does not - // require a constructor, but compound types such as std::complex + // require a destructor, but compound types such as std::complex // require a destructor to free the HDF5 resources. template std::shared_ptr @@ -407,9 +407,9 @@ namespace HDF5 T HDF5Object::get_attribute(const std::string &attr_name) { - std::shared_ptr t_type = internal::get_hdf5_datatype(); - T value; - hid_t attr; + const std::shared_ptr t_type = internal::get_hdf5_datatype(); + T value; + hid_t attr; attr = H5Aopen(*hdf5_reference, attr_name.data(), H5P_DEFAULT); @@ -495,9 +495,9 @@ namespace HDF5 void HDF5Object::set_attribute(const std::string &attr_name, const T value) { - hid_t attr; - hid_t aid; - std::shared_ptr t_type = internal::get_hdf5_datatype(); + hid_t attr; + hid_t aid; + const std::shared_ptr t_type = internal::get_hdf5_datatype(); /* @@ -681,7 +681,7 @@ namespace HDF5 Container DataSet::read() { - std::shared_ptr t_type = + const std::shared_ptr t_type = internal::get_hdf5_datatype(); hid_t plist; @@ -734,9 +734,9 @@ namespace HDF5 Assert(coordinates.size() % rank == 0, ExcMessage( "The dimension of coordinates has to be divisible by the rank")); - std::shared_ptr t_type = internal::get_hdf5_datatype(); - hid_t plist; - hid_t memory_dataspace; + const std::shared_ptr t_type = internal::get_hdf5_datatype(); + hid_t plist; + hid_t memory_dataspace; std::vector data_dimensions{ static_cast(coordinates.size() / rank)}; @@ -801,7 +801,7 @@ namespace HDF5 DataSet::read_hyperslab(const std::vector &offset, const std::vector &count) { - std::shared_ptr t_type = + const std::shared_ptr t_type = internal::get_hdf5_datatype(); hid_t plist; hid_t memory_dataspace; @@ -867,8 +867,8 @@ namespace HDF5 void DataSet::read_none() { - std::shared_ptr t_type = internal::get_hdf5_datatype(); - std::vector data_dimensions = {0}; + const std::shared_ptr t_type = internal::get_hdf5_datatype(); + const std::vector data_dimensions = {0}; hid_t memory_dataspace; hid_t plist; @@ -924,7 +924,7 @@ namespace HDF5 DataSet::write(const Container &data) { AssertDimension(size, internal::get_container_size(data)); - std::shared_ptr t_type = + const std::shared_ptr t_type = internal::get_hdf5_datatype(); hid_t plist; @@ -972,8 +972,8 @@ namespace HDF5 const std::vector &coordinates) { AssertDimension(coordinates.size(), data.size() * rank); - std::shared_ptr t_type = internal::get_hdf5_datatype(); - std::vector data_dimensions = {data.size()}; + const std::shared_ptr t_type = internal::get_hdf5_datatype(); + const std::vector data_dimensions = {data.size()}; hid_t memory_dataspace; hid_t plist; @@ -1039,11 +1039,11 @@ namespace HDF5 1, std::multiplies()), internal::get_container_size(data)); - std::shared_ptr t_type = + const std::shared_ptr t_type = internal::get_hdf5_datatype(); // In this particular overload of write_hyperslab the data_dimensions are // the same as count - std::vector data_dimensions = count; + const std::vector data_dimensions = count; hid_t memory_dataspace; hid_t plist; @@ -1104,7 +1104,7 @@ namespace HDF5 const std::vector &count, const std::vector &block) { - std::shared_ptr t_type = + const std::shared_ptr t_type = internal::get_hdf5_datatype(); hid_t memory_dataspace; -- 2.39.5