summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--c++/src/CMakeLists.txt7
-rw-r--r--c++/src/H5ArrayType.h6
-rw-r--r--c++/src/H5AtomType.h4
-rw-r--r--c++/src/H5Attribute.cpp18
-rw-r--r--c++/src/H5Attribute.h18
-rw-r--r--c++/src/H5CommonFG.cpp1
-rw-r--r--c++/src/H5CompType.h6
-rw-r--r--c++/src/H5Cpp.h10
-rw-r--r--c++/src/H5DaccProp.cpp3
-rw-r--r--c++/src/H5DaccProp.h4
-rw-r--r--c++/src/H5DataSet.cpp8
-rw-r--r--c++/src/H5DataSet.h18
-rw-r--r--c++/src/H5DataSpace.cpp3
-rw-r--r--c++/src/H5DataSpace.h2
-rw-r--r--c++/src/H5DataType.cpp16
-rw-r--r--c++/src/H5DataType.h10
-rw-r--r--c++/src/H5DcreatProp.cpp3
-rw-r--r--c++/src/H5DcreatProp.h4
-rw-r--r--c++/src/H5DxferProp.cpp11
-rw-r--r--c++/src/H5DxferProp.h4
-rw-r--r--c++/src/H5EnumType.cpp4
-rw-r--r--c++/src/H5EnumType.h6
-rw-r--r--c++/src/H5FaccProp.cpp7
-rw-r--r--c++/src/H5FaccProp.h4
-rw-r--r--c++/src/H5FcreatProp.cpp3
-rw-r--r--c++/src/H5FcreatProp.h4
-rw-r--r--c++/src/H5File.h2
-rw-r--r--c++/src/H5FloatType.h6
-rw-r--r--c++/src/H5IdComponent.cpp11
-rw-r--r--c++/src/H5Include.h3
-rw-r--r--c++/src/H5IntType.h6
-rw-r--r--c++/src/H5LaccProp.cpp3
-rw-r--r--c++/src/H5LaccProp.h4
-rw-r--r--c++/src/H5LcreatProp.cpp7
-rw-r--r--c++/src/H5LcreatProp.h4
-rw-r--r--c++/src/H5Library.cpp2
-rw-r--r--c++/src/H5Location.cpp22
-rw-r--r--c++/src/H5Location.h2
-rw-r--r--c++/src/H5Object.cpp27
-rw-r--r--c++/src/H5OcreatProp.cpp3
-rw-r--r--c++/src/H5OcreatProp.h4
-rw-r--r--c++/src/H5PredType.cpp176
-rw-r--r--c++/src/H5PredType.h77
-rw-r--r--c++/src/H5PropList.cpp13
-rw-r--r--c++/src/H5PropList.h10
-rw-r--r--c++/src/H5StrType.cpp6
-rw-r--r--c++/src/H5StrType.h6
-rw-r--r--c++/src/H5VarLenType.h6
-rw-r--r--c++/test/dsets.cpp68
-rw-r--r--c++/test/tarray.cpp43
-rw-r--r--c++/test/tattr.cpp214
-rw-r--r--c++/test/tcompound.cpp90
-rw-r--r--c++/test/tdspl.cpp18
-rw-r--r--c++/test/tfile.cpp63
-rw-r--r--c++/test/th5s.cpp18
-rw-r--r--c++/test/titerate.cpp17
-rw-r--r--c++/test/tlinks.cpp12
-rw-r--r--c++/test/tobject.cpp38
-rw-r--r--c++/test/trefer.cpp171
-rw-r--r--c++/test/ttypes.cpp12
-rw-r--r--c++/test/tvlstr.cpp60
-rw-r--r--config/clang-warnings/developer-general1
-rw-r--r--config/clang-warnings/general16
-rw-r--r--config/cmake/H5cxx_config.h.in16
-rw-r--r--config/cmake/H5pubconf.h.in3
-rw-r--r--config/cmake/HDFCXXCompilerFlags.cmake2
-rw-r--r--config/cmake/libh5cc.in2
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake111
-rw-r--r--config/cmake_ext_mod/HDFCXXTests.cpp46
-rw-r--r--config/cmake_ext_mod/HDFUseCXX.cmake47
-rw-r--r--config/gnu-warnings/cxx-general1
-rw-r--r--config/gnu-warnings/developer-general3
-rw-r--r--config/gnu-warnings/error-51
-rw-r--r--config/gnu-warnings/error-general1
-rw-r--r--config/gnu-warnings/general14
-rw-r--r--configure.ac14
-rw-r--r--hl/c++/src/H5PacketTable.cpp15
-rw-r--r--hl/c++/src/H5PacketTable.h5
-rw-r--r--hl/c++/test/ptableTest.cpp6
-rw-r--r--m4/aclocal_cxx.m479
-rw-r--r--src/H5FDdirect.c2
-rw-r--r--src/H5FDmirror.c2
-rw-r--r--src/H5FDros3.c2
-rw-r--r--src/H5FL.c84
-rw-r--r--src/H5FLprivate.h18
-rw-r--r--src/H5Opublic.h4
-rw-r--r--src/H5Tmodule.h11
-rw-r--r--src/H5Tpublic.h6
-rw-r--r--src/H5private.h4
-rw-r--r--src/H5public.h14
-rw-r--r--test/h5test.h6
-rw-r--r--test/testframe.c22
-rw-r--r--testpar/t_2Gio.c4
-rw-r--r--testpar/t_bigio.c41
-rw-r--r--testpar/t_cache.c4
-rw-r--r--testpar/t_dset.c4
-rw-r--r--testpar/t_filters_parallel.c4
-rw-r--r--testpar/t_mpi.c4
-rw-r--r--testpar/t_pflush2.c2
-rw-r--r--testpar/t_pread.c52
101 files changed, 903 insertions, 1179 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11a5bb3..eed592d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1119,7 +1119,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
endif ()
endif ()
- include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake)
include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake)
add_subdirectory (c++)
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 835d422..2a37dea 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -2,13 +2,6 @@ cmake_minimum_required (VERSION 3.12)
project (HDF5_CPP_SRC CXX)
#-----------------------------------------------------------------------------
-# Generate configure file
-#-----------------------------------------------------------------------------
-configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in
- ${HDF5_SRC_BINARY_DIR}/H5cxx_pubconf.h
-)
-
-#-----------------------------------------------------------------------------
# Define cpp Library
#-----------------------------------------------------------------------------
set (CPP_SOURCES
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index 4302352..b93ae4a 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -37,7 +37,7 @@ class H5_DLLCPP ArrayType : public DataType {
// Returns an ArrayType object via DataType* by decoding the
// binary object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
// Returns the number of dimensions of this array datatype.
int getArrayNDims() const;
@@ -49,7 +49,7 @@ class H5_DLLCPP ArrayType : public DataType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("ArrayType");
}
@@ -61,7 +61,7 @@ class H5_DLLCPP ArrayType : public DataType {
ArrayType(const hid_t existing_id);
// Noop destructor
- virtual ~ArrayType();
+ virtual ~ArrayType() H5_OVERRIDE;
// Default constructor
ArrayType();
diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h
index 84da5e9..e00a308 100644
--- a/c++/src/H5AtomType.h
+++ b/c++/src/H5AtomType.h
@@ -58,7 +58,7 @@ class H5_DLLCPP AtomType : public DataType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("AtomType");
}
@@ -68,7 +68,7 @@ class H5_DLLCPP AtomType : public DataType {
AtomType(const AtomType &original);
// Noop destructor
- virtual ~AtomType();
+ virtual ~AtomType() H5_OVERRIDE;
#endif // DOXYGEN_SHOULD_SKIP_THIS
protected:
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index fbb4ad6..d26bc25 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -11,10 +11,11 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <string>
-#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -313,7 +314,7 @@ Attribute::getName() const
H5std_string attr_name; // attribute name to return
// Preliminary call to get the size of the attribute name
- ssize_t name_size = H5Aget_name(id, static_cast<size_t>(0), NULL);
+ ssize_t name_size = H5Aget_name(id, 0, NULL);
// If H5Aget_name failed, throw exception
if (name_size < 0) {
@@ -324,8 +325,9 @@ Attribute::getName() const
}
// Attribute's name exists, retrieve it
else if (name_size > 0) {
- char *name_C = new char[name_size + 1]; // temporary C-string
- HDmemset(name_C, 0, name_size + 1); // clear buffer
+ // Create buffer for C string
+ char *name_C = new char[name_size + 1];
+ memset(name_C, 0, name_size + 1);
// Use overloaded function
name_size = getName(name_C, name_size + 1);
@@ -336,6 +338,7 @@ Attribute::getName() const
// Clean up resource
delete[] name_C;
}
+
// Return attribute's name
return (attr_name);
}
@@ -393,8 +396,9 @@ Attribute::getName(H5std_string &attr_name, size_t len) const
}
// If length is provided, get that number of characters in name
else {
- char *name_C = new char[len + 1]; // temporary C-string
- HDmemset(name_C, 0, len + 1); // clear buffer
+ // Create buffer for C string
+ char *name_C = new char[len + 1];
+ memset(name_C, 0, len + 1);
// Use overloaded function
name_size = getName(name_C, len + 1);
@@ -551,7 +555,7 @@ Attribute::p_read_variable_len(const DataType &mem_type, H5std_string &strg) con
// Get string from the C char* and release resource allocated by C API
strg = strg_C;
- HDfree(strg_C);
+ free(strg_C);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index 41e5a31..71bfa14 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -38,7 +38,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
Attribute(const hid_t attr_id);
// Closes this attribute.
- virtual void close();
+ virtual void close() H5_OVERRIDE;
// Gets the name of this attribute.
ssize_t getName(char *attr_name, size_t buf_size = 0) const;
@@ -50,13 +50,13 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
ssize_t getName(size_t buf_size, H5std_string &attr_name) const;
// Gets a copy of the dataspace for this attribute.
- virtual DataSpace getSpace() const;
+ virtual DataSpace getSpace() const H5_OVERRIDE;
// Returns the amount of storage size required for this attribute.
- virtual hsize_t getStorageSize() const;
+ virtual hsize_t getStorageSize() const H5_OVERRIDE;
// Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
+ virtual size_t getInMemDataSize() const H5_OVERRIDE;
// Reads data from this attribute.
void read(const DataType &mem_type, void *buf) const;
@@ -68,21 +68,21 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("Attribute");
}
// Gets the attribute id.
- virtual hid_t getId() const;
+ virtual hid_t getId() const H5_OVERRIDE;
// Destructor: properly terminates access to this attribute.
- virtual ~Attribute();
+ virtual ~Attribute() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
// Sets the attribute id.
- virtual void p_setId(const hid_t new_id);
+ virtual void p_setId(const hid_t new_id) H5_OVERRIDE;
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
@@ -92,7 +92,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
// sub-types
- virtual hid_t p_get_type() const;
+ virtual hid_t p_get_type() const H5_OVERRIDE;
// Reads variable or fixed len strings from this attribute.
void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const;
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index fb602d9..8401b9c 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -13,7 +13,6 @@
#include <string>
-#include "H5private.h" // for HDstrcpy
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index 6a4c093..4424d89 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -45,7 +45,7 @@ class H5_DLLCPP CompType : public DataType {
// Returns a CompType object via DataType* by decoding the binary
// object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
// Returns the type class of the specified member of this compound
// datatype. It provides to the user a way of knowing what type
@@ -108,13 +108,13 @@ class H5_DLLCPP CompType : public DataType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("CompType");
}
// Noop destructor.
- virtual ~CompType();
+ virtual ~CompType() H5_OVERRIDE;
private:
// Contains common code that is used by the member functions
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 9272bdb..202d584 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -48,14 +48,4 @@
#include "H5File.h"
#include "H5Library.h"
-/* Some C++ compilers do not have offsetof macro; define to bypass the problem
- - BMR- -EIP- 2007/08/01
-*/
-#ifndef H5_CXX_HAVE_OFFSETOF
-#ifdef HOFFSET
-#undef HOFFSET
-#endif
-#define HOFFSET(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER)
-#endif
-
#endif // H5Cpp_H
diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp
index 35c071a..1905f27 100644
--- a/c++/src/H5DaccProp.cpp
+++ b/c++/src/H5DaccProp.cpp
@@ -72,8 +72,7 @@ DSetAccPropList::getConstant()
void
DSetAccPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h
index 7d6b250..398918d 100644
--- a/c++/src/H5DaccProp.h
+++ b/c++/src/H5DaccProp.h
@@ -38,7 +38,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("DSetAccPropList");
}
@@ -51,7 +51,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList {
DSetAccPropList(const hid_t plist_id);
// Noop destructor.
- virtual ~DSetAccPropList();
+ virtual ~DSetAccPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 791cd67..53e8166 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -11,10 +11,11 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <string>
-#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -717,8 +718,9 @@ DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, con
// If there is data, allocate buffer and read it.
if (data_size > 0) {
+ // Create buffer for C string
char *strg_C = new char[data_size + 1];
- HDmemset(strg_C, 0, data_size + 1); // clear buffer
+ memset(strg_C, 0, data_size + 1);
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
@@ -759,7 +761,7 @@ DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id,
// Get string from the C char* and release resource allocated by C API
strg = strg_C;
- HDfree(strg_C);
+ free(strg_C);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index 333ed7a..d50b2c5 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -28,7 +28,7 @@ namespace H5 {
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
public:
// Close this dataset.
- virtual void close();
+ virtual void close() H5_OVERRIDE;
// Extends the dataset with unlimited dimension.
void extend(const hsize_t *size) const;
@@ -53,16 +53,16 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
haddr_t getOffset() const;
// Gets the dataspace of this dataset.
- virtual DataSpace getSpace() const;
+ virtual DataSpace getSpace() const H5_OVERRIDE;
// Determines whether space has been allocated for a dataset.
void getSpaceStatus(H5D_space_status_t &status) const;
// Returns the amount of storage size required for this dataset.
- virtual hsize_t getStorageSize() const;
+ virtual hsize_t getStorageSize() const H5_OVERRIDE;
// Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
+ virtual size_t getInMemDataSize() const H5_OVERRIDE;
// Returns the number of bytes required to store VL data.
hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const;
@@ -100,7 +100,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("DataSet");
}
@@ -124,15 +124,15 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
DataSet(const hid_t existing_id);
// Gets the dataset id.
- virtual hid_t getId() const;
+ virtual hid_t getId() const H5_OVERRIDE;
// Destructor: properly terminates access to this dataset.
- virtual ~DataSet();
+ virtual ~DataSet() H5_OVERRIDE;
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Sets the dataset id.
- virtual void p_setId(const hid_t new_id);
+ virtual void p_setId(const hid_t new_id) H5_OVERRIDE;
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
@@ -142,7 +142,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
// sub-types
- virtual hid_t p_get_type() const;
+ virtual hid_t p_get_type() const H5_OVERRIDE;
// Reads variable or fixed len strings from this dataset.
void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index be64a17..5dfeb81 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -69,8 +69,7 @@ DataSpace::getConstant()
void
DataSpace::deleteConstants()
{
- if (ALL_ != 0)
- delete ALL_;
+ delete ALL_;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index 470de74..5583baa 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -127,7 +127,7 @@ class H5_DLLCPP DataSpace : public IdComponent {
static void deleteConstants();
// Destructor: properly terminates access to this dataspace.
- virtual ~DataSpace();
+ virtual ~DataSpace() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 07a1463..7bb4bd6 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -11,6 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstdlib>
#include <iostream>
#include <string>
@@ -32,7 +33,6 @@
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5PredType.h"
-#include "H5private.h"
#include "H5AbstractDs.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
@@ -78,7 +78,6 @@ DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id), encod
//--------------------------------------------------------------------------
DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), encoded_buf(NULL), buf_size(0)
{
- // Call C routine to create the new datatype
id = H5Tcreate(type_class, size);
if (id < 0) {
throw DataTypeIException("DataType constructor", "H5Tcreate failed");
@@ -148,7 +147,6 @@ DataType::DataType(const DataType &original) : H5Object(), id(original.id), enco
//--------------------------------------------------------------------------
DataType::DataType(const PredType &pred_type) : H5Object(), encoded_buf(NULL), buf_size(0)
{
- // Call C routine to copy the datatype
id = H5Tcopy(pred_type.getId());
if (id < 0)
throw DataTypeIException("DataType constructor", "H5Tcopy failed");
@@ -318,8 +316,9 @@ DataType::encode()
// Allocate buffer and call C function again to encode
if (buf_size > 0) {
- encoded_buf = (unsigned char *)HDcalloc((size_t)1, buf_size);
- ret_value = H5Tencode(id, encoded_buf, &buf_size);
+ encoded_buf = (unsigned char *)calloc((size_t)1, buf_size);
+
+ ret_value = H5Tencode(id, encoded_buf, &buf_size);
if (ret_value < 0) {
throw DataTypeIException("DataType::encode", "H5Tencode failed");
}
@@ -340,10 +339,7 @@ DataType::encode()
bool
DataType::hasBinaryDesc() const
{
- if (encoded_buf != NULL)
- return true;
- else
- return false;
+ return encoded_buf != NULL;
}
//--------------------------------------------------------------------------
@@ -972,7 +968,7 @@ DataType::close()
// Free and reset buffer of encoded object description if it's been used
if (encoded_buf != NULL) {
- HDfree(encoded_buf);
+ free(encoded_buf);
buf_size = 0;
}
}
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 49f5348..7dd371b 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -47,7 +47,7 @@ class H5_DLLCPP DataType : public H5Object {
// PropList& plist = PropList::DEFAULT);
// Closes this datatype.
- virtual void close();
+ virtual void close() H5_OVERRIDE;
// Copies an existing datatype to this datatype object.
void copy(const DataType &like_type);
@@ -133,7 +133,7 @@ class H5_DLLCPP DataType : public H5Object {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("DataType");
}
@@ -148,10 +148,10 @@ class H5_DLLCPP DataType : public H5Object {
bool hasBinaryDesc() const;
// Gets the datatype id.
- virtual hid_t getId() const;
+ virtual hid_t getId() const H5_OVERRIDE;
// Destructor: properly terminates access to this datatype.
- virtual ~DataType();
+ virtual ~DataType() H5_OVERRIDE;
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -162,7 +162,7 @@ class H5_DLLCPP DataType : public H5Object {
hid_t p_decode() const;
// Sets the datatype id.
- virtual void p_setId(const hid_t new_id);
+ virtual void p_setId(const hid_t new_id) H5_OVERRIDE;
// Opens a datatype and returns the id.
hid_t p_opentype(const H5Location &loc, const char *dtype_name) const;
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 5d07943..da19d8d 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -78,8 +78,7 @@ DSetCreatPropList::getConstant()
void
DSetCreatPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 3c032ee..b822c25 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -128,7 +128,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("DSetCreatPropList");
}
@@ -141,7 +141,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
DSetCreatPropList(const hid_t plist_id);
// Noop destructor.
- virtual ~DSetCreatPropList();
+ virtual ~DSetCreatPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 2b50de4..1728e8e 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -11,9 +11,9 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstring>
#include <string>
-#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -72,8 +72,7 @@ DSetMemXferPropList::getConstant()
void
DSetMemXferPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
@@ -176,7 +175,7 @@ DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const
void
DSetMemXferPropList::setPreserve(bool status) const
{
- herr_t ret_value = H5Pset_preserve(id, (hbool_t)status);
+ herr_t ret_value = H5Pset_preserve(id, static_cast<hbool_t>(status));
if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::setPreserve", "H5Pset_preserve failed");
}
@@ -315,7 +314,7 @@ DSetMemXferPropList::getDataTransform() const
H5std_string expression;
// Preliminary call to get the expression's length
- ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0);
+ ssize_t exp_len = H5Pget_data_transform(id, NULL, 0);
// If H5Pget_data_transform returns a negative value, raise an exception
if (exp_len < 0) {
@@ -326,7 +325,7 @@ DSetMemXferPropList::getDataTransform() const
else if (exp_len > 0) {
// Temporary buffer for char* expression
char *exp_C = new char[exp_len + 1];
- HDmemset(exp_C, 0, exp_len + 1); // clear buffer
+ memset(exp_C, 0, exp_len + 1);
// Used overloaded function
exp_len = getDataTransform(exp_C, exp_len + 1);
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 1e4d668..3925a57 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -100,7 +100,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("DSetMemXferPropList");
}
@@ -113,7 +113,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
DSetMemXferPropList(const hid_t plist_id);
// Noop destructor
- virtual ~DSetMemXferPropList();
+ virtual ~DSetMemXferPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 6c7b533..36eebf6 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -11,9 +11,9 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstring>
#include <string>
-#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -220,7 +220,7 @@ H5std_string
EnumType::nameOf(void *value, size_t size) const
{
char *name_C = new char[size + 1]; // temporary C-string for C API
- HDmemset(name_C, 0, size + 1); // clear buffer
+ memset(name_C, 0, size + 1);
// Calls C routine H5Tenum_nameof to get the name of the specified enum type
herr_t ret_value = H5Tenum_nameof(id, value, name_C, size);
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 484405a..2501e4b 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -41,7 +41,7 @@ class H5_DLLCPP EnumType : public DataType {
// Returns an EnumType object via DataType* by decoding the
// binary object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
// Returns the number of members in this enumeration datatype.
int getNmembers() const;
@@ -68,7 +68,7 @@ class H5_DLLCPP EnumType : public DataType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("EnumType");
}
@@ -82,7 +82,7 @@ class H5_DLLCPP EnumType : public DataType {
// Copy constructor: same as the original EnumType.
EnumType(const EnumType &original);
- virtual ~EnumType();
+ virtual ~EnumType() H5_OVERRIDE;
}; // end of EnumType
} // namespace H5
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index 005e599..f2c9295 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -17,8 +17,6 @@
using std::cerr;
using std::endl;
-//#include <string>
-
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -76,8 +74,7 @@ FileAccPropList::getConstant()
void
FileAccPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
@@ -157,7 +154,7 @@ FileAccPropList::getDriver() const
// Function: FileAccPropList::setDriver
///\brief Set file driver for this property list.
///\param new_driver_id - IN: File driver
-///\param new_driver_info - IN: Struct containing the driver-specific properites
+///\param new_driver_info - IN: Struct containing the driver-specific properties
///\exception H5::PropListIException
///\par Description
/// For information, please refer to the H5Pset_driver API in
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index 998f870..53c7799 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -137,7 +137,7 @@ class H5_DLLCPP FileAccPropList : public PropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("FileAccPropList");
}
@@ -150,7 +150,7 @@ class H5_DLLCPP FileAccPropList : public PropList {
FileAccPropList(const hid_t plist_id);
// Noop destructor
- virtual ~FileAccPropList();
+ virtual ~FileAccPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index b9be563..b51ba10 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -68,8 +68,7 @@ FileCreatPropList::getConstant()
void
FileCreatPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index 00ae0b1..65daf8f 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -78,7 +78,7 @@ class H5_DLLCPP FileCreatPropList : public PropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("FileCreatPropList");
}
@@ -91,7 +91,7 @@ class H5_DLLCPP FileCreatPropList : public PropList {
FileCreatPropList(const hid_t plist_id);
// Noop destructor
- virtual ~FileCreatPropList();
+ virtual ~FileCreatPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 6126eec..bdd7b84 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -117,7 +117,7 @@ class H5_DLLCPP H5File : public Group {
virtual hid_t getId() const H5_OVERRIDE;
// H5File destructor.
- virtual ~H5File();
+ virtual ~H5File() H5_OVERRIDE;
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index c76be95..e8df757 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -36,7 +36,7 @@ class H5_DLLCPP FloatType : public AtomType {
// Returns an FloatType object via DataType* by decoding the
// binary object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
// Retrieves the exponent bias of a floating-point type.
size_t getEbias() const;
@@ -64,7 +64,7 @@ class H5_DLLCPP FloatType : public AtomType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("FloatType");
}
@@ -79,7 +79,7 @@ class H5_DLLCPP FloatType : public AtomType {
FloatType(const FloatType &original);
// Noop destructor.
- virtual ~FloatType();
+ virtual ~FloatType() H5_OVERRIDE;
}; // end of FloatType
} // namespace H5
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 18bcbd3..63af728 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -11,9 +11,9 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstring>
#include <string>
-#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5Library.h"
@@ -399,8 +399,8 @@ IdComponent::p_get_file_name() const
}
// Call H5Fget_name again to get the actual file name
- char *name_C = new char[name_size + 1]; // temporary C-string for C API
- HDmemset(name_C, 0, name_size + 1); // clear buffer
+ char *name_C = new char[name_size + 1];
+ memset(name_C, 0, name_size + 1);
name_size = H5Fget_name(temp_id, name_C, name_size + 1);
@@ -434,10 +434,7 @@ IdComponent::p_valid_id(const hid_t obj_id)
return false;
H5I_type_t id_type = H5Iget_type(obj_id);
- if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
- return false;
- else
- return true;
+ return (id_type > H5I_BADID && id_type < H5I_NTYPES);
}
// Notes about IdComponent::id
diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h
index 0dc930d..f479eeb 100644
--- a/c++/src/H5Include.h
+++ b/c++/src/H5Include.h
@@ -25,7 +25,8 @@
*/
#define H5O_VERSION_2 2
-// Define H5_OVERRIDE to override for C++11.
+// H5_OVERRIDE enables using the override keyword with C++11
+// (HDF5 1.12.x and earlier do not require C++11)
#if defined(__cplusplus) && (201103L <= __cplusplus)
#define H5_OVERRIDE override
#else
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 185c8f0..f0f30ac 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -36,7 +36,7 @@ class H5_DLLCPP IntType : public AtomType {
// Returns an IntType object via DataType* by decoding the
// binary object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
// Retrieves the sign type for an integer type
H5T_sign_t getSign() const;
@@ -46,7 +46,7 @@ class H5_DLLCPP IntType : public AtomType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("IntType");
}
@@ -61,7 +61,7 @@ class H5_DLLCPP IntType : public AtomType {
IntType(const IntType &original);
// Noop destructor.
- virtual ~IntType();
+ virtual ~IntType() H5_OVERRIDE;
}; // end of IntType
} // namespace H5
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
index feaa555..acdaa13 100644
--- a/c++/src/H5LaccProp.cpp
+++ b/c++/src/H5LaccProp.cpp
@@ -70,8 +70,7 @@ LinkAccPropList::getConstant()
void
LinkAccPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 4fa516c..65a9673 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -32,7 +32,7 @@ class H5_DLLCPP LinkAccPropList : public PropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("LinkAccPropList");
}
@@ -52,7 +52,7 @@ class H5_DLLCPP LinkAccPropList : public PropList {
size_t getNumLinks() const;
// Noop destructor
- virtual ~LinkAccPropList();
+ virtual ~LinkAccPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
index 29721c1..3851d56 100644
--- a/c++/src/H5LcreatProp.cpp
+++ b/c++/src/H5LcreatProp.cpp
@@ -70,8 +70,7 @@ LinkCreatPropList::getConstant()
void
LinkCreatPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
@@ -122,7 +121,7 @@ LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id)
void
LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
{
- herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group);
+ herr_t ret_value = H5Pset_create_intermediate_group(id, static_cast<unsigned>(crt_intmd_group));
// Throw exception if H5Pset_create_intermediate_group returns failure
if (ret_value < 0) {
throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed");
@@ -147,7 +146,7 @@ LinkCreatPropList::getCreateIntermediateGroup() const
throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed");
}
- return ((bool)crt_intmd_group);
+ return static_cast<bool>(crt_intmd_group);
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
index aea38e7..c0c66a4 100644
--- a/c++/src/H5LcreatProp.h
+++ b/c++/src/H5LcreatProp.h
@@ -32,7 +32,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("LinkCreatPropList");
}
@@ -59,7 +59,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList {
H5T_cset_t getCharEncoding() const;
// Noop destructor
- virtual ~LinkCreatPropList();
+ virtual ~LinkCreatPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index 37516be..19c7ee7 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -11,8 +11,8 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <string>
#include <cstdlib>
+#include <string>
#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
#include "H5Include.h"
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 3436a5b..31bfc26 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -11,11 +11,11 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <string>
+#include <cstring>
#include <iostream>
+#include <string>
using namespace std;
-#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -351,7 +351,7 @@ H5Location::getComment(const char *name, size_t buf_size) const
H5std_string comment;
// Preliminary call to get the comment's length
- ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, (size_t)0, H5P_DEFAULT);
+ ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, 0, H5P_DEFAULT);
// If H5Oget_comment_by_name returns a negative value, raise an exception
if (comment_len < 0) {
@@ -368,7 +368,7 @@ H5Location::getComment(const char *name, size_t buf_size) const
// Temporary buffer for char* comment
char *comment_C = new char[tmp_len + 1];
- HDmemset(comment_C, 0, tmp_len + 1); // clear buffer
+ memset(comment_C, 0, tmp_len + 1);
// Used overloaded function
ssize_t temp_len = getComment(name, tmp_len + 1, comment_C);
@@ -1835,8 +1835,9 @@ H5Location::getLinkval(const char *name, size_t size) const
// if link has value, retrieve the value, otherwise, return null string
if (val_size > 0) {
- value_C = new char[val_size + 1]; // temporary C-string for C API
- HDmemset(value_C, 0, val_size + 1); // clear buffer
+ // Create buffer for C string
+ value_C = new char[val_size + 1];
+ memset(value_C, 0, val_size + 1);
ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
if (ret_value < 0) {
@@ -2046,9 +2047,9 @@ H5Location::getObjnameByIdx(hsize_t idx) const
if (name_len < 0)
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- // now, allocate C buffer to get the name
+ // Create buffer for C string
char *name_C = new char[name_len + 1];
- HDmemset(name_C, 0, name_len + 1); // clear buffer
+ memset(name_C, 0, name_len + 1);
name_len =
H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len + 1, H5P_DEFAULT);
@@ -2102,8 +2103,9 @@ H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const
ssize_t
H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const
{
- char *name_C = new char[size + 1]; // temporary C-string for object name
- HDmemset(name_C, 0, size + 1); // clear buffer
+ // Create buffer for C string
+ char *name_C = new char[size + 1];
+ memset(name_C, 0, size + 1);
// call overloaded function to get the name
ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1);
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index e990ec8..eb9fc74 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -334,7 +334,7 @@ class H5_DLLCPP H5Location : public IdComponent {
#endif // DOXYGEN_SHOULD_SKIP_THIS
// Noop destructor.
- virtual ~H5Location();
+ virtual ~H5Location() H5_OVERRIDE;
}; // end of H5Location
} // namespace H5
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 71109d3..6873d67 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -11,9 +11,9 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstring>
#include <string>
-#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -45,9 +45,12 @@ namespace H5 {
extern "C" {
static herr_t
-userAttrOpWrpr(H5_ATTR_UNUSED hid_t loc_id, const char *attr_name, H5_ATTR_UNUSED const H5A_info_t *ainfo,
- void *op_data)
+userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data)
{
+ // Unused
+ (void)loc_id;
+ (void)ainfo;
+
H5std_string s_attr_name = H5std_string(attr_name);
UserData4Aiterate *myData = reinterpret_cast<UserData4Aiterate *>(op_data);
myData->op(*myData->location, s_attr_name, myData->opData);
@@ -57,9 +60,11 @@ userAttrOpWrpr(H5_ATTR_UNUSED hid_t loc_id, const char *attr_name, H5_ATTR_UNUSE
// userVisitOpWrpr interfaces between the user's function and the
// C library function H5Ovisit3
static herr_t
-userVisitOpWrpr(H5_ATTR_UNUSED hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info,
- void *op_data)
+userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, void *op_data)
{
+ // Unused
+ (void)obj_id;
+
H5std_string s_attr_name = H5std_string(attr_name);
UserData4Visit *myData = reinterpret_cast<UserData4Visit *>(op_data);
int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
@@ -482,7 +487,7 @@ H5Object::getObjName() const
H5std_string obj_name; // object name to return
// Preliminary call to get the size of the object name
- ssize_t name_size = H5Iget_name(getId(), NULL, static_cast<size_t>(0));
+ ssize_t name_size = H5Iget_name(getId(), NULL, 0);
// If H5Iget_name failed, throw exception
if (name_size < 0) {
@@ -493,8 +498,9 @@ H5Object::getObjName() const
}
// Object's name exists, retrieve it
else if (name_size > 0) {
- char *name_C = new char[name_size + 1]; // temporary C-string
- HDmemset(name_C, 0, name_size + 1); // clear buffer
+ // Create buffer for C string
+ char *name_C = new char[name_size + 1];
+ memset(name_C, 0, name_size + 1);
// Use overloaded function
name_size = getObjName(name_C, name_size + 1);
@@ -534,8 +540,9 @@ H5Object::getObjName(H5std_string &obj_name, size_t len) const
}
// If length is provided, get that number of characters in name
else {
- char *name_C = new char[len + 1]; // temporary C-string
- HDmemset(name_C, 0, len + 1); // clear buffer
+ // Create buffer for C string
+ char *name_C = new char[len + 1];
+ memset(name_C, 0, len + 1);
// Use overloaded function
name_size = getObjName(name_C, len + 1);
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
index 81dae31..dffdeb1 100644
--- a/c++/src/H5OcreatProp.cpp
+++ b/c++/src/H5OcreatProp.cpp
@@ -70,8 +70,7 @@ ObjCreatPropList::getConstant()
void
ObjCreatPropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h
index 7f6d411..0aa825b 100644
--- a/c++/src/H5OcreatProp.h
+++ b/c++/src/H5OcreatProp.h
@@ -44,7 +44,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("ObjCreatPropList");
}
@@ -57,7 +57,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList {
ObjCreatPropList(const hid_t plist_id);
// Noop destructor
- virtual ~ObjCreatPropList();
+ virtual ~ObjCreatPropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index fb44961..9458fb7 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -27,7 +27,6 @@
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5PredType.h"
-#include "H5private.h"
namespace H5 {
@@ -90,8 +89,12 @@ PredType::operator=(const PredType &rhs)
// These dummy functions do not inherit from DataType - they'll
// throw an DataTypeIException if invoked.
void
-PredType::commit(H5_ATTR_UNUSED H5Location &loc, H5_ATTR_UNUSED const char *name)
+PredType::commit(H5Location &loc, const char *name)
{
+ // Unused
+ (void)loc;
+ (void)name;
+
throw DataTypeIException("PredType::commit",
"Error: Attempted to commit a predefined datatype. Invalid operation!");
}
@@ -246,63 +249,32 @@ PredType *PredType::NATIVE_INT32_;
PredType *PredType::NATIVE_UINT32_;
PredType *PredType::NATIVE_INT64_;
PredType *PredType::NATIVE_UINT64_;
+
// LEAST types
-#if H5_SIZEOF_INT_LEAST8_T != 0
PredType *PredType::NATIVE_INT_LEAST8_;
-#endif /* H5_SIZEOF_INT_LEAST8_T */
-#if H5_SIZEOF_UINT_LEAST8_T != 0
PredType *PredType::NATIVE_UINT_LEAST8_;
-#endif /* H5_SIZEOF_UINT_LEAST8_T */
-#if H5_SIZEOF_INT_LEAST16_T != 0
PredType *PredType::NATIVE_INT_LEAST16_;
-#endif /* H5_SIZEOF_INT_LEAST16_T */
-#if H5_SIZEOF_UINT_LEAST16_T != 0
PredType *PredType::NATIVE_UINT_LEAST16_;
-#endif /* H5_SIZEOF_UINT_LEAST16_T */
-#if H5_SIZEOF_INT_LEAST32_T != 0
PredType *PredType::NATIVE_INT_LEAST32_;
-#endif /* H5_SIZEOF_INT_LEAST32_T */
-#if H5_SIZEOF_UINT_LEAST32_T != 0
PredType *PredType::NATIVE_UINT_LEAST32_;
-#endif /* H5_SIZEOF_UINT_LEAST32_T */
-#if H5_SIZEOF_INT_LEAST64_T != 0
PredType *PredType::NATIVE_INT_LEAST64_;
-#endif /* H5_SIZEOF_INT_LEAST64_T */
-#if H5_SIZEOF_UINT_LEAST64_T != 0
PredType *PredType::NATIVE_UINT_LEAST64_;
-#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
-#if H5_SIZEOF_INT_FAST8_T != 0
PredType *PredType::NATIVE_INT_FAST8_;
-#endif /* H5_SIZEOF_INT_FAST8_T */
-#if H5_SIZEOF_UINT_FAST8_T != 0
PredType *PredType::NATIVE_UINT_FAST8_;
-#endif /* H5_SIZEOF_UINT_FAST8_T */
-#if H5_SIZEOF_INT_FAST16_T != 0
PredType *PredType::NATIVE_INT_FAST16_;
-#endif /* H5_SIZEOF_INT_FAST16_T */
-#if H5_SIZEOF_UINT_FAST16_T != 0
PredType *PredType::NATIVE_UINT_FAST16_;
-#endif /* H5_SIZEOF_UINT_FAST16_T */
-#if H5_SIZEOF_INT_FAST32_T != 0
PredType *PredType::NATIVE_INT_FAST32_;
-#endif /* H5_SIZEOF_INT_FAST32_T */
-#if H5_SIZEOF_UINT_FAST32_T != 0
PredType *PredType::NATIVE_UINT_FAST32_;
-#endif /* H5_SIZEOF_UINT_FAST32_T */
-#if H5_SIZEOF_INT_FAST64_T != 0
PredType *PredType::NATIVE_INT_FAST64_;
-#endif /* H5_SIZEOF_INT_FAST64_T */
-#if H5_SIZEOF_UINT_FAST64_T != 0
PredType *PredType::NATIVE_UINT_FAST64_;
-#endif /* H5_SIZEOF_UINT_FAST64_T */
//--------------------------------------------------------------------------
// Function: PredType::getPredTypes
@@ -467,63 +439,31 @@ PredType::makePredTypes()
NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64);
NATIVE_UINT64_ = new PredType(H5T_NATIVE_UINT64);
-// LEAST types
-#if H5_SIZEOF_INT_LEAST8_T != 0
- NATIVE_INT_LEAST8_ = new PredType(H5T_NATIVE_INT_LEAST8);
-#endif /* H5_SIZEOF_INT_LEAST8_T */
-#if H5_SIZEOF_UINT_LEAST8_T != 0
+ // LEAST types
+ NATIVE_INT_LEAST8_ = new PredType(H5T_NATIVE_INT_LEAST8);
NATIVE_UINT_LEAST8_ = new PredType(H5T_NATIVE_UINT_LEAST8);
-#endif /* H5_SIZEOF_UINT_LEAST8_T */
-#if H5_SIZEOF_INT_LEAST16_T != 0
- NATIVE_INT_LEAST16_ = new PredType(H5T_NATIVE_INT_LEAST16);
-#endif /* H5_SIZEOF_INT_LEAST16_T */
-#if H5_SIZEOF_UINT_LEAST16_T != 0
+ NATIVE_INT_LEAST16_ = new PredType(H5T_NATIVE_INT_LEAST16);
NATIVE_UINT_LEAST16_ = new PredType(H5T_NATIVE_UINT_LEAST16);
-#endif /* H5_SIZEOF_UINT_LEAST16_T */
-#if H5_SIZEOF_INT_LEAST32_T != 0
- NATIVE_INT_LEAST32_ = new PredType(H5T_NATIVE_INT_LEAST32);
-#endif /* H5_SIZEOF_INT_LEAST32_T */
-#if H5_SIZEOF_UINT_LEAST32_T != 0
+ NATIVE_INT_LEAST32_ = new PredType(H5T_NATIVE_INT_LEAST32);
NATIVE_UINT_LEAST32_ = new PredType(H5T_NATIVE_UINT_LEAST32);
-#endif /* H5_SIZEOF_UINT_LEAST32_T */
-#if H5_SIZEOF_INT_LEAST64_T != 0
- NATIVE_INT_LEAST64_ = new PredType(H5T_NATIVE_INT_LEAST64);
-#endif /* H5_SIZEOF_INT_LEAST64_T */
-#if H5_SIZEOF_UINT_LEAST64_T != 0
+ NATIVE_INT_LEAST64_ = new PredType(H5T_NATIVE_INT_LEAST64);
NATIVE_UINT_LEAST64_ = new PredType(H5T_NATIVE_UINT_LEAST64);
-#endif /* H5_SIZEOF_UINT_LEAST64_T */
-// FAST types
-#if H5_SIZEOF_INT_FAST8_T != 0
- NATIVE_INT_FAST8_ = new PredType(H5T_NATIVE_INT_FAST8);
-#endif /* H5_SIZEOF_INT_FAST8_T */
-#if H5_SIZEOF_UINT_FAST8_T != 0
+ // FAST types
+ NATIVE_INT_FAST8_ = new PredType(H5T_NATIVE_INT_FAST8);
NATIVE_UINT_FAST8_ = new PredType(H5T_NATIVE_UINT_FAST8);
-#endif /* H5_SIZEOF_UINT_FAST8_T */
-#if H5_SIZEOF_INT_FAST16_T != 0
- NATIVE_INT_FAST16_ = new PredType(H5T_NATIVE_INT_FAST16);
-#endif /* H5_SIZEOF_INT_FAST16_T */
-#if H5_SIZEOF_UINT_FAST16_T != 0
+ NATIVE_INT_FAST16_ = new PredType(H5T_NATIVE_INT_FAST16);
NATIVE_UINT_FAST16_ = new PredType(H5T_NATIVE_UINT_FAST16);
-#endif /* H5_SIZEOF_UINT_FAST16_T */
-#if H5_SIZEOF_INT_FAST32_T != 0
- NATIVE_INT_FAST32_ = new PredType(H5T_NATIVE_INT_FAST32);
-#endif /* H5_SIZEOF_INT_FAST32_T */
-#if H5_SIZEOF_UINT_FAST32_T != 0
+ NATIVE_INT_FAST32_ = new PredType(H5T_NATIVE_INT_FAST32);
NATIVE_UINT_FAST32_ = new PredType(H5T_NATIVE_UINT_FAST32);
-#endif /* H5_SIZEOF_UINT_FAST32_T */
-#if H5_SIZEOF_INT_FAST64_T != 0
- NATIVE_INT_FAST64_ = new PredType(H5T_NATIVE_INT_FAST64);
-#endif /* H5_SIZEOF_INT_FAST64_T */
-#if H5_SIZEOF_UINT_FAST64_T != 0
+ NATIVE_INT_FAST64_ = new PredType(H5T_NATIVE_INT_FAST64);
NATIVE_UINT_FAST64_ = new PredType(H5T_NATIVE_UINT_FAST64);
-#endif /* H5_SIZEOF_UINT_FAST64_T */
} // makePredTypes
@@ -653,63 +593,31 @@ PredType::deleteConstants()
delete NATIVE_INT64_;
delete NATIVE_UINT64_;
-// LEAST types
-#if H5_SIZEOF_INT_LEAST8_T != 0
+ // LEAST types
delete NATIVE_INT_LEAST8_;
-#endif /* H5_SIZEOF_INT_LEAST8_T */
-#if H5_SIZEOF_UINT_LEAST8_T != 0
delete NATIVE_UINT_LEAST8_;
-#endif /* H5_SIZEOF_UINT_LEAST8_T */
-#if H5_SIZEOF_INT_LEAST16_T != 0
delete NATIVE_INT_LEAST16_;
-#endif /* H5_SIZEOF_INT_LEAST16_T */
-#if H5_SIZEOF_UINT_LEAST16_T != 0
delete NATIVE_UINT_LEAST16_;
-#endif /* H5_SIZEOF_UINT_LEAST16_T */
-#if H5_SIZEOF_INT_LEAST32_T != 0
delete NATIVE_INT_LEAST32_;
-#endif /* H5_SIZEOF_INT_LEAST32_T */
-#if H5_SIZEOF_UINT_LEAST32_T != 0
delete NATIVE_UINT_LEAST32_;
-#endif /* H5_SIZEOF_UINT_LEAST32_T */
-#if H5_SIZEOF_INT_LEAST64_T != 0
delete NATIVE_INT_LEAST64_;
-#endif /* H5_SIZEOF_INT_LEAST64_T */
-#if H5_SIZEOF_UINT_LEAST64_T != 0
delete NATIVE_UINT_LEAST64_;
-#endif /* H5_SIZEOF_UINT_LEAST64_T */
-// FAST types
-#if H5_SIZEOF_INT_FAST8_T != 0
+ // FAST types
delete NATIVE_INT_FAST8_;
-#endif /* H5_SIZEOF_INT_FAST8_T */
-#if H5_SIZEOF_UINT_FAST8_T != 0
delete NATIVE_UINT_FAST8_;
-#endif /* H5_SIZEOF_UINT_FAST8_T */
-#if H5_SIZEOF_INT_FAST16_T != 0
delete NATIVE_INT_FAST16_;
-#endif /* H5_SIZEOF_INT_FAST16_T */
-#if H5_SIZEOF_UINT_FAST16_T != 0
delete NATIVE_UINT_FAST16_;
-#endif /* H5_SIZEOF_UINT_FAST16_T */
-#if H5_SIZEOF_INT_FAST32_T != 0
delete NATIVE_INT_FAST32_;
-#endif /* H5_SIZEOF_INT_FAST32_T */
-#if H5_SIZEOF_UINT_FAST32_T != 0
delete NATIVE_UINT_FAST32_;
-#endif /* H5_SIZEOF_UINT_FAST32_T */
-#if H5_SIZEOF_INT_FAST64_T != 0
delete NATIVE_INT_FAST64_;
-#endif /* H5_SIZEOF_INT_FAST64_T */
-#if H5_SIZEOF_UINT_FAST64_T != 0
delete NATIVE_UINT_FAST64_;
-#endif /* H5_SIZEOF_UINT_FAST64_T */
delete PREDTYPE_CONST_;
PREDTYPE_CONST_ = 0;
@@ -843,62 +751,30 @@ const PredType &PredType::NATIVE_INT64 = *NATIVE_INT64_;
const PredType &PredType::NATIVE_UINT64 = *NATIVE_UINT64_;
// LEAST types
-#if H5_SIZEOF_INT_LEAST8_T != 0
-const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
-#endif /* H5_SIZEOF_INT_LEAST8_T */
-#if H5_SIZEOF_UINT_LEAST8_T != 0
+const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
const PredType &PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_;
-#endif /* H5_SIZEOF_UINT_LEAST8_T */
-#if H5_SIZEOF_INT_LEAST16_T != 0
-const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
-#endif /* H5_SIZEOF_INT_LEAST16_T */
-#if H5_SIZEOF_UINT_LEAST16_T != 0
+const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
const PredType &PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_;
-#endif /* H5_SIZEOF_UINT_LEAST16_T */
-#if H5_SIZEOF_INT_LEAST32_T != 0
-const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
-#endif /* H5_SIZEOF_INT_LEAST32_T */
-#if H5_SIZEOF_UINT_LEAST32_T != 0
+const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
const PredType &PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_;
-#endif /* H5_SIZEOF_UINT_LEAST32_T */
-#if H5_SIZEOF_INT_LEAST64_T != 0
-const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
-#endif /* H5_SIZEOF_INT_LEAST64_T */
-#if H5_SIZEOF_UINT_LEAST64_T != 0
+const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
const PredType &PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_;
-#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
-#if H5_SIZEOF_INT_FAST8_T != 0
-const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
-#endif /* H5_SIZEOF_INT_FAST8_T */
-#if H5_SIZEOF_UINT_FAST8_T != 0
+const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
const PredType &PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_;
-#endif /* H5_SIZEOF_UINT_FAST8_T */
-#if H5_SIZEOF_INT_FAST16_T != 0
-const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
-#endif /* H5_SIZEOF_INT_FAST16_T */
-#if H5_SIZEOF_UINT_FAST16_T != 0
+const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
const PredType &PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_;
-#endif /* H5_SIZEOF_UINT_FAST16_T */
-#if H5_SIZEOF_INT_FAST32_T != 0
-const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
-#endif /* H5_SIZEOF_INT_FAST32_T */
-#if H5_SIZEOF_UINT_FAST32_T != 0
+const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
const PredType &PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_;
-#endif /* H5_SIZEOF_UINT_FAST32_T */
-#if H5_SIZEOF_INT_FAST64_T != 0
-const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
-#endif /* H5_SIZEOF_INT_FAST64_T */
-#if H5_SIZEOF_UINT_FAST64_T != 0
+const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
const PredType &PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
-#endif /* H5_SIZEOF_UINT_FAST64_T */
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h
index b40d2b3..6ae225d 100644
--- a/c++/src/H5PredType.h
+++ b/c++/src/H5PredType.h
@@ -29,7 +29,7 @@ class H5_DLLCPP PredType : public AtomType {
public:
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("PredType");
}
@@ -42,7 +42,7 @@ class H5_DLLCPP PredType : public AtomType {
PredType(const PredType &original);
// Noop destructor
- virtual ~PredType();
+ virtual ~PredType() H5_OVERRIDE;
/*! \brief This dummy function do not inherit from DataType - it will
throw a DataTypeIException if invoked.
@@ -176,63 +176,31 @@ class H5_DLLCPP PredType : public AtomType {
static const PredType &NATIVE_INT64;
static const PredType &NATIVE_UINT64;
-// LEAST types
-#if H5_SIZEOF_INT_LEAST8_T != 0
+ // LEAST types
static const PredType &NATIVE_INT_LEAST8;
-#endif /* H5_SIZEOF_INT_LEAST8_T */
-#if H5_SIZEOF_UINT_LEAST8_T != 0
static const PredType &NATIVE_UINT_LEAST8;
-#endif /* H5_SIZEOF_UINT_LEAST8_T */
-#if H5_SIZEOF_INT_LEAST16_T != 0
static const PredType &NATIVE_INT_LEAST16;
-#endif /* H5_SIZEOF_INT_LEAST16_T */
-#if H5_SIZEOF_UINT_LEAST16_T != 0
static const PredType &NATIVE_UINT_LEAST16;
-#endif /* H5_SIZEOF_UINT_LEAST16_T */
-#if H5_SIZEOF_INT_LEAST32_T != 0
static const PredType &NATIVE_INT_LEAST32;
-#endif /* H5_SIZEOF_INT_LEAST32_T */
-#if H5_SIZEOF_UINT_LEAST32_T != 0
static const PredType &NATIVE_UINT_LEAST32;
-#endif /* H5_SIZEOF_UINT_LEAST32_T */
-#if H5_SIZEOF_INT_LEAST64_T != 0
static const PredType &NATIVE_INT_LEAST64;
-#endif /* H5_SIZEOF_INT_LEAST64_T */
-#if H5_SIZEOF_UINT_LEAST64_T != 0
static const PredType &NATIVE_UINT_LEAST64;
-#endif /* H5_SIZEOF_UINT_LEAST64_T */
-// FAST types
-#if H5_SIZEOF_INT_FAST8_T != 0
+ // FAST types
static const PredType &NATIVE_INT_FAST8;
-#endif /* H5_SIZEOF_INT_FAST8_T */
-#if H5_SIZEOF_UINT_FAST8_T != 0
static const PredType &NATIVE_UINT_FAST8;
-#endif /* H5_SIZEOF_UINT_FAST8_T */
-#if H5_SIZEOF_INT_FAST16_T != 0
static const PredType &NATIVE_INT_FAST16;
-#endif /* H5_SIZEOF_INT_FAST16_T */
-#if H5_SIZEOF_UINT_FAST16_T != 0
static const PredType &NATIVE_UINT_FAST16;
-#endif /* H5_SIZEOF_UINT_FAST16_T */
-#if H5_SIZEOF_INT_FAST32_T != 0
static const PredType &NATIVE_INT_FAST32;
-#endif /* H5_SIZEOF_INT_FAST32_T */
-#if H5_SIZEOF_UINT_FAST32_T != 0
static const PredType &NATIVE_UINT_FAST32;
-#endif /* H5_SIZEOF_UINT_FAST32_T */
-#if H5_SIZEOF_INT_FAST64_T != 0
static const PredType &NATIVE_INT_FAST64;
-#endif /* H5_SIZEOF_INT_FAST64_T */
-#if H5_SIZEOF_UINT_FAST64_T != 0
static const PredType &NATIVE_UINT_FAST64;
-#endif /* H5_SIZEOF_UINT_FAST64_T */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -378,64 +346,31 @@ class H5_DLLCPP PredType : public AtomType {
static PredType *NATIVE_INT64_;
static PredType *NATIVE_UINT64_;
-// LEAST types
-#if H5_SIZEOF_INT_LEAST8_T != 0
+ // LEAST types
static PredType *NATIVE_INT_LEAST8_;
-#endif /* H5_SIZEOF_INT_LEAST8_T */
-#if H5_SIZEOF_UINT_LEAST8_T != 0
static PredType *NATIVE_UINT_LEAST8_;
-#endif /* H5_SIZEOF_UINT_LEAST8_T */
-#if H5_SIZEOF_INT_LEAST16_T != 0
static PredType *NATIVE_INT_LEAST16_;
-#endif /* H5_SIZEOF_INT_LEAST16_T */
-#if H5_SIZEOF_UINT_LEAST16_T != 0
static PredType *NATIVE_UINT_LEAST16_;
-#endif /* H5_SIZEOF_UINT_LEAST16_T */
-#if H5_SIZEOF_INT_LEAST32_T != 0
static PredType *NATIVE_INT_LEAST32_;
-#endif /* H5_SIZEOF_INT_LEAST32_T */
-#if H5_SIZEOF_UINT_LEAST32_T != 0
static PredType *NATIVE_UINT_LEAST32_;
-#endif /* H5_SIZEOF_UINT_LEAST32_T */
-#if H5_SIZEOF_INT_LEAST64_T != 0
static PredType *NATIVE_INT_LEAST64_;
-#endif /* H5_SIZEOF_INT_LEAST64_T */
-#if H5_SIZEOF_UINT_LEAST64_T != 0
static PredType *NATIVE_UINT_LEAST64_;
-#endif /* H5_SIZEOF_UINT_LEAST64_T */
-// FAST types
-#if H5_SIZEOF_INT_FAST8_T != 0
+ // FAST types
static PredType *NATIVE_INT_FAST8_;
-#endif /* H5_SIZEOF_INT_FAST8_T */
-#if H5_SIZEOF_UINT_FAST8_T != 0
static PredType *NATIVE_UINT_FAST8_;
-#endif /* H5_SIZEOF_UINT_FAST8_T */
-#if H5_SIZEOF_INT_FAST16_T != 0
static PredType *NATIVE_INT_FAST16_;
-#endif /* H5_SIZEOF_INT_FAST16_T */
-#if H5_SIZEOF_UINT_FAST16_T != 0
static PredType *NATIVE_UINT_FAST16_;
-#endif /* H5_SIZEOF_UINT_FAST16_T */
-#if H5_SIZEOF_INT_FAST32_T != 0
static PredType *NATIVE_INT_FAST32_;
-#endif /* H5_SIZEOF_INT_FAST32_T */
-#if H5_SIZEOF_UINT_FAST32_T != 0
static PredType *NATIVE_UINT_FAST32_;
-#endif /* H5_SIZEOF_UINT_FAST32_T */
-#if H5_SIZEOF_INT_FAST64_T != 0
static PredType *NATIVE_INT_FAST64_;
-#endif /* H5_SIZEOF_INT_FAST64_T */
-#if H5_SIZEOF_UINT_FAST64_T != 0
static PredType *NATIVE_UINT_FAST64_;
-#endif /* H5_SIZEOF_UINT_FAST64_T */
- // End of Declaration of pointers
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 9c149bf..0ff1afb 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -11,11 +11,10 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <cstring>
#include <iostream>
-
#include <string>
-#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -71,8 +70,7 @@ PropList::getConstant()
void
PropList::deleteConstants()
{
- if (DEFAULT_ != 0)
- delete DEFAULT_;
+ delete DEFAULT_;
}
//--------------------------------------------------------------------------
@@ -461,8 +459,8 @@ PropList::getProperty(const char *name) const
size_t size = getPropSize(name);
// Allocate buffer then get the property
- char *prop_strg_C = new char[size + 1]; // temporary C-string for C API
- HDmemset(prop_strg_C, 0, size + 1); // clear buffer
+ char *prop_strg_C = new char[size + 1];
+ memset(prop_strg_C, 0, size + 1);
herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API
@@ -634,11 +632,12 @@ PropList::setProperty(const char *name, void *value) const
void
PropList::setProperty(const char *name, const char *charptr) const
{
- herr_t ret_value = H5Pset(id, name, (const void *)charptr);
+ herr_t ret_value = H5Pset(id, name, static_cast<const void *>(charptr));
if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
+
//--------------------------------------------------------------------------
// Function: PropList::setProperty
///\brief This is an overloaded member function, provided for convenience.
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index 12c8b4b..2df326b 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -38,7 +38,7 @@ class H5_DLLCPP PropList : public IdComponent {
bool operator==(const PropList &rhs) const;
// Close this property list.
- virtual void close();
+ virtual void close() H5_OVERRIDE;
// Close a property list class.
void closeClass() const;
@@ -102,7 +102,7 @@ class H5_DLLCPP PropList : public IdComponent {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("PropList");
}
@@ -114,10 +114,10 @@ class H5_DLLCPP PropList : public IdComponent {
PropList(const PropList &original);
// Gets the property list id.
- virtual hid_t getId() const;
+ virtual hid_t getId() const H5_OVERRIDE;
// Destructor: properly terminates access to this property list.
- virtual ~PropList();
+ virtual ~PropList() H5_OVERRIDE;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -128,7 +128,7 @@ class H5_DLLCPP PropList : public IdComponent {
hid_t id; // HDF5 property list id
// Sets the property list id.
- virtual void p_setId(const hid_t new_id);
+ virtual void p_setId(const hid_t new_id) H5_OVERRIDE;
private:
static PropList *DEFAULT_;
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 5df48f3..57bb2c9 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -32,7 +32,6 @@
#include "H5StrType.h"
#include "H5DataSet.h"
#include "H5PredType.h"
-#include "H5private.h"
namespace H5 {
@@ -105,8 +104,11 @@ StrType::StrType(const PredType &pred_type, const size_t &size) : AtomType()
// This constructor replaced the previous one.
// Programmer Binh-Minh Ribler - Nov 28, 2005
//--------------------------------------------------------------------------
-StrType::StrType(H5_ATTR_UNUSED const int dummy, const size_t &size) : AtomType()
+StrType::StrType(const int dummy, const size_t &size) : AtomType()
{
+ // Unused
+ (void)dummy;
+
// use DataType::copy to make a copy of the string predefined type
// then set its length
copy(PredType::C_S1);
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index d272c53..3e4013a 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -42,7 +42,7 @@ class H5_DLLCPP StrType : public AtomType {
// Returns an StrType object via DataType* by decoding the
// binary object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
// Retrieves the character set type of this string datatype.
H5T_cset_t getCset() const;
@@ -58,7 +58,7 @@ class H5_DLLCPP StrType : public AtomType {
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("StrType");
}
@@ -73,7 +73,7 @@ class H5_DLLCPP StrType : public AtomType {
StrType(const StrType &original);
// Noop destructor.
- virtual ~StrType();
+ virtual ~StrType() H5_OVERRIDE;
}; // end of StrType
} // namespace H5
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index f767e0e..583b9cd 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -33,11 +33,11 @@ class H5_DLLCPP VarLenType : public DataType {
// Returns an VarLenType object via DataType* by decoding the
// binary object description of this type.
- virtual DataType *decode() const;
+ virtual DataType *decode() const H5_OVERRIDE;
///\brief Returns this class name.
virtual H5std_string
- fromClass() const
+ fromClass() const H5_OVERRIDE
{
return ("VarLenType");
}
@@ -53,7 +53,7 @@ class H5_DLLCPP VarLenType : public DataType {
VarLenType(const H5Location &loc, const H5std_string &name);
// Noop destructor
- virtual ~VarLenType();
+ virtual ~VarLenType() H5_OVERRIDE;
// Default constructor
VarLenType();
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 52e3e73..e2189a3 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -23,6 +23,8 @@
***************************************************************************/
+#include <cfloat>
+#include <cmath>
#include <iostream>
using std::cerr;
using std::endl;
@@ -158,8 +160,7 @@ test_create(H5File &file)
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
- if (dataset != NULL)
- delete dataset;
+ delete dataset;
return -1;
}
// catch all other exceptions
@@ -167,8 +168,7 @@ test_create(H5File &file)
issue_fail_msg("test_create", __LINE__, __FILE__);
// clean up and return with failure
- if (dataset != NULL)
- delete dataset;
+ delete dataset;
return -1;
}
} // test_create
@@ -245,8 +245,7 @@ test_simple_io(H5File &file)
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
- if (tconv_buf)
- delete[] tconv_buf;
+ delete[] tconv_buf;
return -1;
}
} // test_simple_io
@@ -409,8 +408,14 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
static size_t
filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes,
size_t *buf_size, void **buf)
-// H5_ATTR_UNUSED variables caused warning, but taking them out caused failure.
{
+ // Unused
+ (void)flags;
+ (void)cd_nelmts;
+ (void)cd_values;
+ (void)buf_size;
+ (void)buf;
+
return nbytes;
}
@@ -679,10 +684,8 @@ test_compression(H5File &file)
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
- if (dataset != NULL)
- delete dataset;
- if (tconv_buf)
- delete[] tconv_buf;
+ delete dataset;
+ delete[] tconv_buf;
return -1;
}
} // test_compression
@@ -718,6 +721,9 @@ test_nbit_compression(H5File &file)
SUBTEST("N-bit compression (setup)");
+ HDmemset(orig_data, 0, DIM1 * DIM2 * sizeof(s1_t));
+ HDmemset(new_data, 0, DIM1 * DIM2 * sizeof(s1_t));
+
try {
// Define datatypes of members of compound datatype
IntType i_type(PredType::NATIVE_INT);
@@ -865,8 +871,7 @@ test_multiopen(H5File &file)
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
- if (space != NULL)
- delete space;
+ delete space;
return -1;
}
} // test_multiopen
@@ -941,8 +946,7 @@ test_types(H5File &file)
cerr << " <<< "
<< "bitfield_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
<< endl;
- if (dset != NULL)
- delete dset;
+ delete dset;
return -1;
}
@@ -973,8 +977,7 @@ test_types(H5File &file)
cerr << " <<< "
<< "bitfield_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
<< endl;
- if (dset != NULL)
- delete dset;
+ delete dset;
throw E; // propagate the exception
}
@@ -1008,10 +1011,8 @@ test_types(H5File &file)
cerr << " <<< "
<< "opaque_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
<< endl;
- if (dset != NULL)
- delete dset;
- if (optype != NULL)
- delete optype;
+ delete dset;
+ delete optype;
throw E; // propagate the exception
}
@@ -1044,10 +1045,8 @@ test_types(H5File &file)
cerr << " <<< "
<< "opaque_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
<< endl;
- if (dset != NULL)
- delete dset;
- if (optype != NULL)
- delete optype;
+ delete dset;
+ delete optype;
throw E; // propagate the exception
}
@@ -1091,7 +1090,7 @@ test_getnativeinfo(H5File &file)
H5O_native_info_t ninfo;
HDmemset(&ninfo, 0, sizeof(ninfo));
dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
- verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__);
dataset.close();
// Open the dataset we created above and then close it. This is one
@@ -1099,7 +1098,7 @@ test_getnativeinfo(H5File &file)
dataset = file.openDataSet(DSET_DEFAULT_NAME);
HDmemset(&ninfo, 0, sizeof(ninfo));
dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_ALL);
- verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__);
dataset.close();
PASSED();
@@ -1151,12 +1150,15 @@ test_chunk_cache(const FileAccPropList &fapl)
dapl.getChunkCache(nslots_4, nbytes_4, w0_4);
verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
- verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ if (abs(w0_1 - w0_4) > DBL_EPSILON)
+ TestErrPrintf("%d: w0_1 and w0_4 different: w0_1=%f, "
+ "w0_4=%f\n",
+ __LINE__, w0_1, w0_4);
// Set a link access property on dapl to verify property list inheritance
- dapl.setNumLinks((size_t)134);
+ dapl.setNumLinks(134);
size_t nlinks = dapl.getNumLinks();
- verify_val(nlinks, (size_t)134, "DSetAccPropList::getNumLinks", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nlinks), 134, "DSetAccPropList::getNumLinks", __LINE__, __FILE__);
// Make a copy of the external fapl
FileAccPropList fapl_local(fapl);
@@ -1267,7 +1269,8 @@ test_virtual()
// Get the current layout, should be default, H5D_CONTIGUOUS
H5D_layout_t layout = dcpl.getLayout();
- verify_val(layout, H5D_CONTIGUOUS, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
+ verify_val(static_cast<long>(layout), static_cast<long>(H5D_CONTIGUOUS),
+ "DSetCreatPropList::getLayout", __LINE__, __FILE__);
// Create fixed mapping
hsize_t dims[RANK];
@@ -1289,7 +1292,8 @@ test_virtual()
// Get and verify the new layout
layout = dcpl.getLayout();
- verify_val(layout, H5D_VIRTUAL, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
+ verify_val(static_cast<long>(layout), static_cast<long>(H5D_VIRTUAL), "DSetCreatPropList::getLayout",
+ __LINE__, __FILE__);
PASSED();
return 0;
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index 7525c5f..8a976ce 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -83,7 +83,8 @@ test_array_compound_array()
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = static_cast<int>(idxi * 10 + idxj);
for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
- float temp = idxi * 10.0 + idxj * 2.5 + idxk;
+ float temp = static_cast<float>(idxi) * 10.0F + static_cast<float>(idxj) * 2.5F +
+ static_cast<float>(idxk);
wdata[idxi][idxj].f[idxk] = temp;
}
} // end for
@@ -178,9 +179,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf(
- "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
- rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
+ ", tdims1[%d]=%" PRIuHSIZE "\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -197,9 +198,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf(
- "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
- rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
+ ", tdims1[%d]=%" PRIuHSIZE "\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -242,15 +243,15 @@ test_array_compound_array()
verify_val(ndims, ARRAY1_RANK, "f2_atype_check.getArrayNDims", __LINE__, __FILE__);
// Get the array dimensions
- HDmemset(rdims1, 0, H5S_MAX_RANK);
+ HDmemset(rdims1, 0, sizeof(rdims1));
f2_atype_check.getArrayDims(rdims1);
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf(
- "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
- rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
+ ", tdims1[%d]=%" PRIuHSIZE "\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -265,8 +266,9 @@ test_array_compound_array()
for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, "
- "rdata[%lld][%lld].i=%d\n",
+ TestErrPrintf("Array data information doesn't match!, wdata[%" PRIuHSIZE "][%" PRIuHSIZE
+ "].i=%d, "
+ "rdata[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n",
idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i);
continue;
} // end if
@@ -288,7 +290,7 @@ test_array_compound_array()
/*
* Helper routine to demonstrate the issue in HDFFV-9562
*/
-H5::DataType
+static H5::DataType
getArr()
{
hsize_t *dims = new hsize_t;
@@ -388,10 +390,11 @@ test_array_info()
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = static_cast<int>(idxi * 10 + idxj);
for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
- float temp = idxi * 10.0 + idxj * 2.5 + idxk;
+ float temp = static_cast<float>(idxi) * 10.0F + static_cast<float>(idxj) * 2.5F +
+ static_cast<float>(idxk);
wdata[idxi][idxj].f[idxk] = temp;
}
- } // end for
+ }
try {
// Create File
@@ -457,11 +460,11 @@ test_array_info()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf(
- "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii,
- rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
+ ", tdims1[%d]=%" PRIuHSIZE "\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
continue;
- } // end if
+ }
}
// Close all
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index bd6a8c0..dc968f9 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -17,6 +17,8 @@
C attribute interface (H5A)
***************************************************************************/
+#include <cfloat>
+#include <cmath>
#include <iostream>
using std::cerr;
using std::endl;
@@ -169,7 +171,8 @@ test_attr_basic_write()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
+ "]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);
// Create two more attributes for this dataset, but only write to one.
@@ -185,7 +188,8 @@ test_attr_basic_write()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1a[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1a[%" PRIuHSIZE
+ "]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close both attributes
@@ -208,7 +212,7 @@ test_attr_basic_write()
// Check storage size for attribute
hsize_t attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
+ verify_val(static_cast<long>(attr_size), static_cast<long>(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
"Attribute::getStorageSize", __LINE__, __FILE__);
// Try to create the same attribute again (should fail)
@@ -227,7 +231,7 @@ test_attr_basic_write()
// Check storage size for attribute
attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
+ verify_val(static_cast<long>(attr_size), static_cast<long>(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
"Attribute::getStorageSize", __LINE__, __FILE__);
PASSED();
@@ -281,7 +285,7 @@ test_attr_getname()
// Check for existence of attribute FATTR1_NAME
bool attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Open attribute
@@ -298,8 +302,10 @@ test_attr_getname()
ssize_t name_size = 0; // actual length of attribute name
name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
- verify_val((size_t)name_size, FATTR1_NAME.length(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char *)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ verify_val(static_cast<size_t>(name_size), FATTR1_NAME.length(), "Attribute::getName", __LINE__,
+ __FILE__);
+ verify_val(const_cast<const char *>(fattr1_name), FATTR1_NAME, "Attribute::getName", __LINE__,
+ __FILE__);
delete[] fattr1_name;
// 2. With arbitrary buf_size that is smaller than the name's length.
@@ -310,9 +316,10 @@ test_attr_getname()
HDmemset(fattr1_name, 0, buf_size + 1);
name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
- verify_val((size_t)name_size, FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char *)fattr1_name, (const char *)short_name, "Attribute::getName", __LINE__,
+ verify_val(static_cast<size_t>(name_size), FATTR1_NAME.size(), "Attribute::getName", __LINE__,
__FILE__);
+ verify_val(const_cast<const char *>(fattr1_name), const_cast<const char *>(short_name),
+ "Attribute::getName", __LINE__, __FILE__);
delete[] fattr1_name;
// 3. With a buf_size that equals the name's length.
@@ -354,7 +361,7 @@ test_attr_getname()
// Check for existence of attribute
attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Open attribute
@@ -403,7 +410,7 @@ test_attr_rename()
// Check for existence of attribute
bool attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Change attribute name
@@ -429,7 +436,7 @@ test_attr_rename()
// Check for existence of attribute
attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Change attribute name
@@ -448,7 +455,8 @@ test_attr_rename()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
+ "]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);
// Close attribute
@@ -456,7 +464,7 @@ test_attr_rename()
// Check for existence of second attribute
attr_exists = dataset.attrExists(ATTR2_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
// Open the second attribute
@@ -472,7 +480,8 @@ test_attr_rename()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1a[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1a[%" PRIuHSIZE
+ "]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close attribute
@@ -483,7 +492,7 @@ test_attr_rename()
// Check for existence of attribute after renaming
attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
PASSED();
@@ -525,7 +534,7 @@ test_attr_basic_read()
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS);
- verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(oinfo.num_attrs), 3, "DataSet::getObjinfo", __LINE__, __FILE__);
// Open an attribute for the dataset
Attribute ds_attr = dataset.openAttribute(ATTR1_NAME);
@@ -537,7 +546,8 @@ test_attr_basic_read()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
+ "]=%d, read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);
/*
@@ -553,7 +563,7 @@ test_attr_basic_read()
// Verify the correct number of attributes another way
HDmemset(&oinfo, 0, sizeof(oinfo));
group.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS);
- verify_val(oinfo.num_attrs, 1, "Group::getObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(oinfo.num_attrs), 1, "Group::getObjinfo", __LINE__, __FILE__);
// Open an attribute for the group
Attribute gr_attr = group.openAttribute(ATTR2_NAME);
@@ -568,8 +578,9 @@ test_attr_basic_read()
for (i = 0; i < ATTR2_DIM1; i++)
for (j = 0; j < ATTR2_DIM2; j++)
if (attr_data2[i][j] != read_data2[i][j]) {
- TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, "
- "read_data2[%llu][%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data2[%" PRIuHSIZE "][%" PRIuHSIZE
+ "]=%d, "
+ "read_data2[%" PRIuHSIZE "][%" PRIuHSIZE "]=%d\n",
__LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
}
PASSED();
@@ -678,10 +689,10 @@ test_attr_compound_read()
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS);
- verify_val(oinfo.num_attrs, 1, "DataSet::getObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(oinfo.num_attrs), 1, "DataSet::getObjinfo", __LINE__, __FILE__);
// Open 1st attribute for the dataset
- Attribute attr = dataset.openAttribute((unsigned)0);
+ Attribute attr = dataset.openAttribute(static_cast<unsigned>(0));
/* Verify Dataspace */
@@ -695,14 +706,17 @@ test_attr_compound_read()
// Get the dims of the dataspace and verify them
int ndims = space.getSimpleExtentDims(dims);
verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(static_cast<long>(dims[0]), static_cast<long>(ATTR4_DIM1),
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(static_cast<long>(dims[1]), static_cast<long>(ATTR4_DIM2),
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Get the class of the datatype that is used by attr
H5T_class_t type_class = attr.getTypeClass();
// Verify that the type is of compound datatype
- verify_val(type_class, H5T_COMPOUND, "Attribute::getTypeClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_COMPOUND), "Attribute::getTypeClass",
+ __LINE__, __FILE__);
// Get the compound datatype
CompType datatype = attr.getCompType();
@@ -734,11 +748,13 @@ test_attr_compound_read()
// Get and verify the type class of the first member
type_class = datatype.getMemberClass(0);
- verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_INTEGER), "DataType::getMemberClass",
+ __LINE__, __FILE__);
// Get and verify the order of this member's type
IntType i_type = datatype.getMemberIntType(0);
H5T_order_t order = i_type.getOrder();
- verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(order), static_cast<long>(PredType::NATIVE_INT.getOrder()),
+ "DataType::getOrder", __LINE__, __FILE__);
// Get and verify the size of this member's type
size = i_type.getSize();
@@ -746,21 +762,25 @@ test_attr_compound_read()
// Get and verify class, order, and size of the second member's type
type_class = datatype.getMemberClass(1);
- verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_FLOAT), "DataType::getMemberClass",
+ __LINE__, __FILE__);
FloatType f_type = datatype.getMemberFloatType(1);
order = f_type.getOrder();
- verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(order), static_cast<long>(PredType::NATIVE_DOUBLE.getOrder()),
+ "DataType::getOrder", __LINE__, __FILE__);
size = f_type.getSize();
verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
// Get and verify class, order, and size of the third member's type
type_class = datatype.getMemberClass(2);
- verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_INTEGER), "DataType::getMemberClass",
+ __LINE__, __FILE__);
// Note: H5T_INTEGER is correct here!
StrType s_type = datatype.getMemberStrType(2);
order = s_type.getOrder();
- verify_val(order, PredType::NATIVE_SCHAR.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(order), static_cast<long>(PredType::NATIVE_SCHAR.getOrder()),
+ "DataType::getOrder", __LINE__, __FILE__);
size = s_type.getSize();
verify_val(size, PredType::NATIVE_SCHAR.getSize(), "DataType::getSize", __LINE__, __FILE__);
@@ -772,14 +792,17 @@ test_attr_compound_read()
for (ii = 0; ii < ATTR4_DIM1; ii++)
for (jj = 0; jj < ATTR4_DIM2; jj++)
if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) {
- TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].i=%d, "
- "read_data4[%llu][%llu].i=%d\n",
+ TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
+ "].i=%d, "
+ "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n",
__LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i);
- TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].d=%f, "
- "read_data4[%llu][%llu].d=%f\n",
+ TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
+ "].d=%f, "
+ "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].d=%f\n",
__LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d);
- TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].c=%c, "
- "read_data4[%llu][%llu].c=%c\n",
+ TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
+ "].c=%c, "
+ "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].c=%c\n",
__LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c);
} /* end if */
@@ -902,15 +925,18 @@ test_attr_scalar_read()
// Read attribute information
float read_data2 = 0.0; // Buffer for reading 1st attribute
ds_attr.read(PredType::NATIVE_FLOAT, &read_data2);
- if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
- verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
+ if (abs(read_data2 - attr_data5) > FLT_EPSILON)
+ TestErrPrintf("%d: attribute data different: read_data2=%f, "
+ "attr_data5=%f\n",
+ __LINE__, static_cast<double>(read_data2), static_cast<double>(attr_data5));
// Get the dataspace of the attribute
DataSpace att_space = ds_attr.getSpace();
// Make certain the dataspace is scalar
H5S_class_t space_type = att_space.getSimpleExtentType();
- verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(space_type), static_cast<long>(H5S_SCALAR),
+ "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
PASSED();
} // end try block
@@ -1029,7 +1055,7 @@ test_attr_mult_read()
verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open 1st attribute for the dataset
- Attribute attr = dataset.openAttribute((unsigned)0);
+ Attribute attr = dataset.openAttribute(static_cast<unsigned>(0));
/* Verify Dataspace */
@@ -1042,10 +1068,10 @@ test_attr_mult_read()
// Get the dims of the dataspace and verify them
hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
- int ndims = space.getSimpleExtentDims(dims);
- if ((long)dims[0] != (long)ATTR1_DIM1)
- TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__,
- (int)dims[0], ATTR1_DIM1);
+ (void)space.getSimpleExtentDims(dims);
+ if (dims[0] != ATTR1_DIM1)
+ TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %" PRIuHSIZE "\n",
+ __LINE__, static_cast<int>(dims[0]), ATTR1_DIM1);
/* Verify Datatype */
@@ -1053,14 +1079,16 @@ test_attr_mult_read()
H5T_class_t type_class = attr.getTypeClass();
// Verify that the type is of integer datatype
- verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_INTEGER), "Attribute::getTypeClass",
+ __LINE__, __FILE__);
// Get the integer datatype
IntType i_type1 = attr.getIntType();
// Get and verify the order of this type
H5T_order_t order = i_type1.getOrder();
- verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(order), static_cast<long>(PredType::NATIVE_INT.getOrder()),
+ "DataType::getOrder", __LINE__, __FILE__);
// Get and verify the size of this type
size_t size = i_type1.getSize();
@@ -1072,7 +1100,8 @@ test_attr_mult_read()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
+ "]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);
// Verify Name
@@ -1083,7 +1112,7 @@ test_attr_mult_read()
space.close();
// Open 2nd attribute for the dataset
- attr = dataset.openAttribute((unsigned)1);
+ attr = dataset.openAttribute(static_cast<unsigned>(1));
/* Verify Dataspace */
@@ -1095,10 +1124,12 @@ test_attr_mult_read()
verify_val(rank, ATTR2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Get the dims of the dataspace and verify them
- ndims = space.getSimpleExtentDims(dims);
+ (void)space.getSimpleExtentDims(dims);
- verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(static_cast<long>(dims[0]), static_cast<long>(ATTR2_DIM1),
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(static_cast<long>(dims[1]), static_cast<long>(ATTR2_DIM2),
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
/* Verify Datatype */
@@ -1106,14 +1137,16 @@ test_attr_mult_read()
type_class = attr.getTypeClass();
// Verify that the type is of integer datatype
- verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_INTEGER), "Attribute::getTypeClass",
+ __LINE__, __FILE__);
// Get the integer datatype
IntType i_type2 = attr.getIntType();
// Get and verify the order of this type
order = i_type2.getOrder();
- verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(order), static_cast<long>(PredType::NATIVE_INT.getOrder()),
+ "DataType::getOrder", __LINE__, __FILE__);
// Get and verify the size of this type
size = i_type2.getSize();
@@ -1127,8 +1160,9 @@ test_attr_mult_read()
for (i = 0; i < ATTR2_DIM1; i++)
for (j = 0; j < ATTR2_DIM2; j++)
if (attr_data2[i][j] != read_data2[i][j])
- TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, "
- "read_data2[%llu][%llu]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data2[%" PRIuHSIZE "][%" PRIuHSIZE
+ "]=%d, "
+ "read_data2[%" PRIuHSIZE "][%" PRIuHSIZE "]=%d\n",
__LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
// Verify Name
@@ -1138,7 +1172,7 @@ test_attr_mult_read()
space.close();
// Open 3rd attribute for the dataset
- attr = dataset.openAttribute((unsigned)2);
+ attr = dataset.openAttribute(static_cast<unsigned>(2));
/* Verify Dataspace */
@@ -1150,10 +1184,13 @@ test_attr_mult_read()
verify_val(rank, ATTR3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Get the dims of the dataspace and verify them
- ndims = space.getSimpleExtentDims(dims);
- verify_val((long)dims[0], (long)ATTR3_DIM1, "attribute dimensions", __FILE__, __LINE__);
- verify_val((long)dims[1], (long)ATTR3_DIM2, "attribute dimensions", __FILE__, __LINE__);
- verify_val((long)dims[2], (long)ATTR3_DIM3, "attribute dimensions", __FILE__, __LINE__);
+ (void)space.getSimpleExtentDims(dims);
+ verify_val(static_cast<long>(dims[0]), static_cast<long>(ATTR3_DIM1), "attribute dimensions",
+ __FILE__, __LINE__);
+ verify_val(static_cast<long>(dims[1]), static_cast<long>(ATTR3_DIM2), "attribute dimensions",
+ __FILE__, __LINE__);
+ verify_val(static_cast<long>(dims[2]), static_cast<long>(ATTR3_DIM3), "attribute dimensions",
+ __FILE__, __LINE__);
/* Verify Datatype */
@@ -1161,14 +1198,16 @@ test_attr_mult_read()
type_class = attr.getTypeClass();
// Verify that the type is of compound datatype
- verify_val(type_class, H5T_FLOAT, "Attribute::getTypeClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_FLOAT), "Attribute::getTypeClass",
+ __LINE__, __FILE__);
// Get the double datatype
FloatType f_type = attr.getFloatType();
// Get and verify the order of this type
order = f_type.getOrder();
- verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(order), static_cast<long>(PredType::NATIVE_DOUBLE.getOrder()),
+ "DataType::getOrder", __LINE__, __FILE__);
// Get and verify the size of this type
size = f_type.getSize();
@@ -1181,9 +1220,10 @@ test_attr_mult_read()
for (i = 0; i < ATTR3_DIM1; i++)
for (j = 0; j < ATTR3_DIM2; j++)
for (k = 0; k < ATTR3_DIM3; k++)
- if (attr_data3[i][j][k] != read_data3[i][j][k])
- TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, "
- "read_data3[%llu][%llu][%llu]=%f\n",
+ if (abs(attr_data3[i][j][k] - read_data3[i][j][k]) > DBL_EPSILON)
+ TestErrPrintf("%d: attribute data different: attr_data3[%" PRIuHSIZE "][%" PRIuHSIZE
+ "][%" PRIuHSIZE "]=%f, "
+ "read_data3[%" PRIuHSIZE "][%" PRIuHSIZE "][%" PRIuHSIZE "]=%f\n",
__LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
// Verify Name
@@ -1230,7 +1270,7 @@ test_attr_delete()
verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__);
// Verify the name of the only file attribute left
- Attribute fattr = fid1.openAttribute((unsigned)0);
+ Attribute fattr = fid1.openAttribute(static_cast<unsigned>(0));
attr_name = fattr.getName();
verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
fattr.close();
@@ -1270,7 +1310,7 @@ test_attr_delete()
verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open 1st attribute for the dataset
- Attribute attr = dataset.openAttribute((unsigned)0);
+ Attribute attr = dataset.openAttribute(static_cast<unsigned>(0));
// Verify Name
attr_name = attr.getName();
@@ -1280,7 +1320,7 @@ test_attr_delete()
attr.close();
// Open last (formally 3rd) attribute for the dataset
- attr = dataset.openAttribute((unsigned)1);
+ attr = dataset.openAttribute(static_cast<unsigned>(1));
// Verify Name
attr_name = attr.getName();
@@ -1296,7 +1336,7 @@ test_attr_delete()
verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open the only attribute for the dataset (formally 3rd)
- attr = dataset.openAttribute((unsigned)0);
+ attr = dataset.openAttribute(static_cast<unsigned>(0));
// Verify Name
attr_name = attr.getName();
@@ -1370,7 +1410,7 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 1, "DataType::getObjinfo", __LINE__, __FILE__);
#endif
// Create dataspace for dataset
@@ -1381,7 +1421,7 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 2, "H5File::getObjinfo", __LINE__, __FILE__);
#endif
// Create attribute on dataset
@@ -1390,7 +1430,7 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 3, "DataSet::getObjinfo", __LINE__, __FILE__);
#endif
// Close attribute
@@ -1402,8 +1442,8 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__,
- __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 2, "DataSet::getObjinfo after DataSet::removeAttr",
+ __LINE__, __FILE__);
#endif
// Create attribute on dataset
@@ -1412,7 +1452,7 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 3, "DataSet::createAttribute", __LINE__, __FILE__);
#endif
// Write data into the attribute
@@ -1449,7 +1489,7 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 3, "DataSet::openAttribute", __LINE__, __FILE__);
#endif
} // end of second enclosing
@@ -1459,7 +1499,7 @@ test_attr_dtype_shared()
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__);
+ verify_val(static_cast<int>(statbuf.nlink), 1, "H5File::unlink", __LINE__, __FILE__);
#endif
// Unlink the named datatype
@@ -1470,7 +1510,8 @@ test_attr_dtype_shared()
// Check size of file
filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
- verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__);
+ verify_val(static_cast<long>(filesize), static_cast<long>(empty_filesize), "Checking file size",
+ __LINE__, __FILE__);
PASSED();
} // end try block
@@ -1640,13 +1681,13 @@ test_attr_exists()
// Check for existence of attribute
bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists",
"fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
// Check for existence of attribute
attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists",
"fid1,FATTR2_NAMEAttribute should exist but does not");
@@ -1655,7 +1696,7 @@ test_attr_exists()
// Check for existence of attribute
attr_exists = group.attrExists(ATTR2_NAME);
- if (attr_exists == false)
+ if (!attr_exists)
throw InvalidActionException("H5File::attrExists",
"group, ATTR2_NAMEAttribute should exist but does not");
@@ -1806,7 +1847,8 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl)
// Get creation order indexing on object
unsigned crt_order_flags = 0;
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
+ verify_val(static_cast<long>(crt_order_flags), 0, "DSetCreatPropList::getAttrCrtOrder", __LINE__,
+ __FILE__);
// Setting invalid combination of a attribute order creation order
// indexing on should fail
@@ -1825,7 +1867,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl)
// verify them
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
+ verify_val(crt_order_flags, static_cast<unsigned>(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
"DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
// Create dataspace for dataset
@@ -1861,7 +1903,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl)
// Query the attribute creation properties
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
+ verify_val(crt_order_flags, static_cast<unsigned>(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
"DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
PASSED();
diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp
index 82c21e8..c27171b 100644
--- a/c++/test/tcompound.cpp
+++ b/c++/test/tcompound.cpp
@@ -101,11 +101,11 @@ test_compound_2()
SUBTEST("Compound Element Reordering");
try {
// Sizes should be the same, but be careful just in case
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))));
+ bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t)));
+ orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t)));
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
s_ptr->a = i * 8 + 0;
s_ptr->b = i * 8 + 1;
s_ptr->c[0] = i * 8 + 2;
@@ -115,7 +115,7 @@ test_compound_2()
s_ptr->d = i * 8 + 6;
s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts * sizeof(src_typ_t));
+ HDmemcpy(buf, orig, nelmts * sizeof(src_typ_t));
// Build hdf5 datatypes
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -142,12 +142,12 @@ test_compound_2()
array_dt->close();
// Perform the conversion
- st.convert(dt, (size_t)nelmts, buf, bkg);
+ st.convert(dt, static_cast<size_t>(nelmts), buf, bkg);
// Compare results
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
- d_ptr = ((dst_typ_t *)buf) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
+ d_ptr = (reinterpret_cast<dst_typ_t *>(buf)) + i;
if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
@@ -176,8 +176,7 @@ test_compound_2()
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if (array_dt)
- delete array_dt;
+ delete array_dt;
} // test_compound_2()
/*-------------------------------------------------------------------------
@@ -215,11 +214,11 @@ test_compound_3()
SUBTEST("Compound Datatype Subset Conversions");
try {
/* Initialize */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))));
+ bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t)));
+ orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t)));
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
s_ptr->a = i * 8 + 0;
s_ptr->b = i * 8 + 1;
s_ptr->c[0] = i * 8 + 2;
@@ -254,12 +253,12 @@ test_compound_3()
array_dt->close();
/* Perform the conversion */
- st.convert(dt, (size_t)nelmts, buf, bkg);
+ st.convert(dt, static_cast<size_t>(nelmts), buf, bkg);
/* Compare results */
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
- d_ptr = ((dst_typ_t *)buf) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
+ d_ptr = (reinterpret_cast<dst_typ_t *>(buf)) + i;
if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] ||
s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->e != d_ptr->e) {
H5_FAILED();
@@ -269,8 +268,8 @@ test_compound_3()
<< ", e=" << s_ptr->e << "}" << endl;
cerr << " dst={a=" << d_ptr->a << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
<< d_ptr->c[2] << "," << d_ptr->c[3] << "], e=" << d_ptr->e << "}" << endl;
- } // if
- } // for
+ }
+ }
/* Release resources */
HDfree(buf);
@@ -287,8 +286,7 @@ test_compound_3()
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if (array_dt)
- delete array_dt;
+ delete array_dt;
} // test_compound_3()
/*-------------------------------------------------------------------------
@@ -331,11 +329,11 @@ test_compound_4()
SUBTEST("Compound Element Shrinking & Reordering");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))));
+ bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t)));
+ orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t)));
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
s_ptr->a = i * 8 + 0;
s_ptr->b = (i * 8 + 1) & 0x7fff;
s_ptr->c[0] = i * 8 + 2;
@@ -372,12 +370,12 @@ test_compound_4()
array_dt->close();
/* Perform the conversion */
- st.convert(dt, (size_t)nelmts, buf, bkg);
+ st.convert(dt, static_cast<size_t>(nelmts), buf, bkg);
/* Compare results */
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
- d_ptr = ((dst_typ_t *)buf) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
+ d_ptr = (reinterpret_cast<dst_typ_t *>(buf)) + i;
if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
@@ -407,8 +405,7 @@ test_compound_4()
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if (array_dt)
- delete array_dt;
+ delete array_dt;
} // test_compound_4()
/*-------------------------------------------------------------------------
@@ -476,8 +473,8 @@ test_compound_5()
/* Convert data */
memcpy(buf, src, sizeof(src));
- src_type.convert(dst_type, (size_t)2, buf, bkg);
- dst = (dst_typ_t *)buf;
+ src_type.convert(dst_type, 2, buf, bkg);
+ dst = static_cast<dst_typ_t *>(buf);
/* Cleanup */
src_type.close();
@@ -504,8 +501,7 @@ test_compound_5()
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if (array_dt)
- delete array_dt;
+ delete array_dt;
} // test_compound_5()
/*-------------------------------------------------------------------------
@@ -544,11 +540,11 @@ test_compound_6()
SUBTEST("Compound Element Growing");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))));
+ bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t)));
+ orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t)));
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
s_ptr->b = (i * 8 + 1) & 0x7fff;
s_ptr->d = (i * 8 + 6) & 0x7fff;
}
@@ -564,19 +560,19 @@ test_compound_6()
dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_LONG);
/* Perform the conversion */
- st.convert(dt, (size_t)nelmts, buf, bkg);
+ st.convert(dt, static_cast<size_t>(nelmts), buf, bkg);
/* Compare results */
for (i = 0; i < nelmts; i++) {
- s_ptr = ((src_typ_t *)orig) + i;
- d_ptr = ((dst_typ_t *)buf) + i;
+ s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i;
+ d_ptr = (reinterpret_cast<dst_typ_t *>(buf)) + i;
if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) {
H5_FAILED();
cerr << " i=" << i << endl;
cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d << "}" << endl;
cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d << "}" << endl;
- } // if
- } // for
+ }
+ }
/* Release resources */
HDfree(buf);
@@ -719,22 +715,22 @@ test_compound_set_size()
// verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
// Expand the type, and verify that it became unpacked
- dtype.setSize((size_t)33);
+ dtype.setSize(33);
// packed = dtype.packed(); // not until C library provides API
// verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
// Verify setSize() actually set size
size_t new_size = dtype.getSize();
- verify_val(new_size, (size_t)33, "DataType::getSize", __LINE__, __FILE__);
+ verify_val(static_cast<long>(new_size), 33, "DataType::getSize", __LINE__, __FILE__);
// Shrink the type, and verify that it became packed
- dtype.setSize((size_t)32);
+ dtype.setSize(32);
// packed = dtype.packed(); // not until C library provides API
// verify_val(packed, TRUE, "DataType::packed", __LINE__, __FILE__);
// Verify setSize() actually set size again
new_size = dtype.getSize();
- verify_val(new_size, (size_t)32, "DataType::getSize", __LINE__, __FILE__);
+ verify_val(static_cast<long>(new_size), 32, "DataType::getSize", __LINE__, __FILE__);
/* Close types and file */
dtype_tmp.close();
diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp
index 257233e..5a78133 100644
--- a/c++/test/tdspl.cpp
+++ b/c++/test/tdspl.cpp
@@ -61,11 +61,11 @@ test_transfplist()
// Find out the length of the transform expression, allocate the buffer
// for it, then read and verify the expression from the copied plist
ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
- char * c_to_f_read = (char *)HDmalloc(tran_len + 1);
+ char * c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1));
HDmemset(c_to_f_read, 0, tran_len + 1);
dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1);
- verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform",
- __LINE__, __FILE__);
+ verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f),
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
HDfree(c_to_f_read);
//
@@ -76,26 +76,26 @@ test_transfplist()
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
tran_len = dxpl_c_to_f.getDataTransform(NULL);
- c_to_f_read = (char *)HDmalloc(tran_len + 1);
+ c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1));
HDmemset(c_to_f_read, 0, tran_len + 1);
dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1);
- verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform",
- __LINE__, __FILE__);
+ verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f),
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
HDfree(c_to_f_read);
// Get and verify the expression with:
// H5std_string DSetMemXferPropList::getDataTransform()
H5std_string simple_read = dxpl_simple.getDataTransform();
- verify_val((const char *)simple_read.c_str(), (const char *)simple,
+ verify_val(const_cast<const char *>(simple_read.c_str()), const_cast<const char *>(simple),
"DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size)
tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
- char *utrans_inv_read = (char *)HDmalloc(tran_len + 1);
+ char *utrans_inv_read = static_cast<char *>(HDmalloc(tran_len + 1));
HDmemset(utrans_inv_read, 0, tran_len + 1);
dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1);
- verify_val((const char *)utrans_inv_read, (const char *)utrans_inv,
+ verify_val(const_cast<const char *>(utrans_inv_read), const_cast<const char *>(utrans_inv),
"DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
HDfree(utrans_inv_read);
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 5e4e91b..15bad64 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -31,14 +31,14 @@ using namespace H5;
#include "h5test.h"
#include "h5cpputil.h" // C++ utilility header file
-const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0;
+const hsize_t F1_USERBLOCK_SIZE = 0;
const size_t F1_OFFSET_SIZE = sizeof(haddr_t);
const size_t F1_LENGTH_SIZE = sizeof(hsize_t);
const unsigned F1_SYM_LEAF_K = 4;
const unsigned F1_SYM_INTERN_K = 16;
const H5std_string FILE1("tfile1.h5");
-const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
+const hsize_t F2_USERBLOCK_SIZE = 512;
const size_t F2_OFFSET_SIZE = 8;
const size_t F2_LENGTH_SIZE = 8;
const unsigned F2_SYM_LEAF_K = 8;
@@ -46,7 +46,7 @@ const unsigned F2_SYM_INTERN_K = 32;
const unsigned F2_ISTORE = 64;
const H5std_string FILE2("tfile2.h5");
-const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0;
+const hsize_t F3_USERBLOCK_SIZE = 0;
const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE;
const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE;
const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
@@ -153,8 +153,8 @@ test_file_create()
FileCreatPropList tmpl1 = file1->getCreatePlist();
hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
- __FILE__);
+ verify_val(static_cast<long>(ublock), static_cast<long>(F1_USERBLOCK_SIZE),
+ "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; // file-creation parameters
tmpl1.getSizes(parm1, parm2);
@@ -175,14 +175,14 @@ test_file_create()
catch (InvalidActionException &E) {
cerr << " *FAILED*" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- if (file1 != NULL) // clean up
- delete file1;
+ // clean up
+ delete file1;
}
// catch all other exceptions
catch (Exception &E) {
issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
- if (file1 != NULL) // clean up
- delete file1;
+ // clean up
+ delete file1;
}
// Setting this to NULL for cleaning up in failure situations
@@ -209,8 +209,8 @@ test_file_create()
// Get the file-creation parameters
hsize_t ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
- __FILE__);
+ verify_val(static_cast<long>(ublock), static_cast<long>(F2_USERBLOCK_SIZE),
+ "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; // file-creation parameters
tmpl1->getSizes(parm1, parm2);
@@ -242,8 +242,8 @@ test_file_create()
// Get the file-creation parameters
ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
- __FILE__);
+ verify_val(static_cast<long>(ublock), static_cast<long>(F3_USERBLOCK_SIZE),
+ "FileCreatPropList::getUserblock", __LINE__, __FILE__);
tmpl1->getSizes(parm1, parm2);
verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
@@ -260,8 +260,8 @@ test_file_create()
// catch all exceptions
catch (Exception &E) {
issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
- if (tmpl1 != NULL) // clean up
- delete tmpl1;
+ // clean up
+ delete tmpl1;
}
} // test_file_create()
@@ -300,8 +300,8 @@ test_file_open()
// Get the file-creation parameters
hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
- __FILE__);
+ verify_val(static_cast<long>(ublock), static_cast<long>(F2_USERBLOCK_SIZE),
+ "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; // file-creation parameters
tmpl1.getSizes(parm1, parm2);
@@ -645,7 +645,8 @@ test_file_attribute()
// Get the class of a file attribute's datatype
H5T_class_t atclass = fattr1.getTypeClass();
- verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__);
+ verify_val(static_cast<long>(atclass), static_cast<long>(H5T_FLOAT), "Attribute::getTypeClass()",
+ __LINE__, __FILE__);
// Get and verify the number of attributes attached to a file
int n_attrs = file5.getNumAttrs();
@@ -896,9 +897,9 @@ test_file_info()
// Get the file's version information.
H5F_info2_t finfo;
tempfile.getFileInfo(finfo);
- verify_val(finfo.super.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.super.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
// Close the file.
tempfile.close();
@@ -910,9 +911,10 @@ test_file_info()
fcpl.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
// Verify file space information.
- verify_val(out_strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(out_strategy), static_cast<long>(H5F_FSPACE_STRATEGY_FSM_AGGR),
+ "H5File::getFileInfo", __LINE__, __FILE__);
verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(out_threshold, 1, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(out_threshold), 1, "H5File::getFileInfo", __LINE__, __FILE__);
/* Retrieve file space page size */
hsize_t out_fsp_psize = fcpl.getFileSpacePagesize();
@@ -943,9 +945,9 @@ test_file_info()
// Get the file's version information.
file7.getFileInfo(finfo);
- verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.super.version), 2, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
// Close the file.
file7.close();
@@ -958,9 +960,9 @@ test_file_info()
// Get the file's version information.
file7.getFileInfo(finfo);
- verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.super.version), 2, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(static_cast<long>(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__);
// Retrieve the property values & check them.
hsize_t userblock = fcpl2.getUserblock();
@@ -986,7 +988,8 @@ test_file_info()
// Get and verify the file space info from the creation property list */
fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
- verify_val(out_strategy, strategy, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
+ verify_val(static_cast<long>(out_strategy), static_cast<long>(strategy),
+ "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
verify_val(out_persist, persist, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
verify_val(out_threshold, threshold, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index 9dd92fa..461d258 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -118,7 +118,7 @@ test_h5s_basic()
// Get simple extent npoints of the dataspace sid1 and verify it
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3),
+ verify_val(static_cast<long>(n), SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
"DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid1 and verify it
@@ -140,7 +140,7 @@ test_h5s_basic()
// Get simple extent npoints of dataspace sid2 and verify it
n = sid2.getSimpleExtentNpoints();
- verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4),
+ verify_val(static_cast<long>(n), SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4,
"DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid2 and verify it
@@ -200,6 +200,7 @@ test_h5s_basic()
// CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure
// in the p_close see how this will handle it. - BMR
+ // When running in valgrind, this PASSED macro will be missed
PASSED();
} // end of try block
@@ -248,7 +249,7 @@ test_h5s_scalar_write()
// n = H5Sget_simple_extent_npoints(sid1);
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
int rank; // Logical rank of dataspace
rank = sid1.getSimpleExtentNdims();
@@ -263,7 +264,8 @@ test_h5s_scalar_write()
// Verify extent type
H5S_class_t ext_type; // Extent type
ext_type = sid1.getSimpleExtentType();
- verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(ext_type), static_cast<long>(H5S_SCALAR),
+ "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
// Create and write a dataset
DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
@@ -314,7 +316,7 @@ test_h5s_scalar_read()
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
@@ -371,7 +373,7 @@ test_h5s_null()
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(n), 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Create a dataset
DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
@@ -436,7 +438,7 @@ test_h5s_compound_scalar_write()
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
@@ -496,7 +498,7 @@ test_h5s_compound_scalar_read()
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(n), 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp
index 5b8039f..57761ea 100644
--- a/c++/test/titerate.cpp
+++ b/c++/test/titerate.cpp
@@ -79,7 +79,7 @@ static void printelems(const Group &group, const H5std_string &dsname, const H5s
static int
iter_strcmp(const void *s1, const void *s2)
{
- return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2));
+ return (HDstrcmp(*reinterpret_cast<const char *const *>(s1), *reinterpret_cast<const char *const *>(s2)));
}
/*-------------------------------------------------------------------------
@@ -92,7 +92,7 @@ static herr_t
liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
void *op_data)
{
- iter_info *info = (iter_info *)op_data;
+ iter_info *info = static_cast<iter_info *>(op_data);
static int count = 0;
static int count2 = 0;
@@ -134,7 +134,6 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR
static void
test_iter_group(FileAccPropList &fapl)
{
- int i; /* counting variable */
hsize_t idx; /* Index in the group */
char name[NAMELEN]; /* temporary name buffer */
char * lnames[NDATASETS + 2]; /* Names of the links created */
@@ -160,7 +159,7 @@ test_iter_group(FileAccPropList &fapl)
// Create a scalar file space
DataSpace filespace;
- for (i = 0; i < NDATASETS; i++) {
+ for (int i = 0; i < NDATASETS; i++) {
snprintf(name, sizeof(name), "Dataset %d", i);
// Create a dataset in the file
@@ -181,7 +180,7 @@ test_iter_group(FileAccPropList &fapl)
check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
/* Sort the dataset names */
- HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
+ HDqsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp);
/* Iterate through the datasets in the root group in various ways */
@@ -193,10 +192,10 @@ test_iter_group(FileAccPropList &fapl)
// Get the number of object in the root group
hsize_t nobjs = root_group.getNumObjs();
- verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nobjs), NDATASETS + 2, "H5Gget_info", __LINE__, __FILE__);
H5std_string obj_name;
- for (i = 0; i < nobjs; i++) {
+ for (hsize_t i = 0; i < nobjs; i++) {
// H5O_info2_t oinfo; /* Object info */
obj_name = root_group.getObjnameByIdx(i);
@@ -222,7 +221,7 @@ test_iter_group(FileAccPropList &fapl)
// Attempted to iterate with negative index, should fail
try {
info.command = RET_ZERO;
- idx = (hsize_t)-1;
+ idx = HSIZE_UNDEF;
obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
@@ -268,7 +267,7 @@ test_iter_group(FileAccPropList &fapl)
} // do nothing, exception expected
/* Free the dataset names */
- for (i = 0; i < (NDATASETS + 2); i++)
+ for (int i = 0; i < NDATASETS + 2; i++)
HDfree(lnames[i]);
// Everything will be closed as they go out of scope
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index e8dad5b..8c7f0cd 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -201,7 +201,8 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Check that its character encoding is the default.
linfo = file.getLinkInfo("/type");
- verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__);
+ verify_val(static_cast<long>(linfo.cset), static_cast<long>(H5T_CSET_ASCII),
+ "Character encoding is not default", __LINE__, __FILE__);
// Create a simple dataspace.
dims[0] = H5L_DIM1;
@@ -214,7 +215,8 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Check that its character encoding is the default.
linfo = file.getLinkInfo("/dataset");
- verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__);
+ verify_val(static_cast<long>(linfo.cset), static_cast<long>(H5T_CSET_ASCII),
+ "Character encoding is not default", __LINE__, __FILE__);
// Create a link creation property list with the UTF-8 character encoding.
LinkCreatPropList lcpl;
@@ -226,7 +228,8 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Check that its character encoding is UTF-8.
linfo = file.getLinkInfo(GROUP2NAME);
- verify_val(linfo.cset, H5T_CSET_UTF8, "Character encoding is not UTF-8", __LINE__, __FILE__);
+ verify_val(static_cast<long>(linfo.cset), static_cast<long>(H5T_CSET_UTF8),
+ "Character encoding is not UTF-8", __LINE__, __FILE__);
PASSED();
} // end of try block
@@ -580,12 +583,13 @@ const H5std_string GROUP_NAME("/Data");
const H5std_string DSET1_NAME("/Data/Compressed_Data");
const H5std_string DSET2_NAME("/Data/Float_Data");
const int RANK = 2;
-const int DIM1 = 2;
// Operator function
static int
visit_obj_cb(H5Object &obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data)
{
+ (void)obj; // Unused
+
ovisit_ud_t *op_data = static_cast<ovisit_ud_t *>(_op_data);
// Check for correct object information
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index ecf7f7e..f040007 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -87,7 +87,7 @@ test_get_objname()
if (name_len > 4) {
char *grp1_name = new char[5];
name_len = grp1.getObjName(grp1_name, 5);
- verify_val((const char *)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
+ verify_val(const_cast<const char *>(grp1_name), "/Top", "Group::getObjName", __LINE__, __FILE__);
delete[] grp1_name;
}
@@ -317,8 +317,8 @@ test_get_objname_ontypes()
// Name this datatype
new_int_type.commit(grp, "IntType NATIVE_INT");
ssize_t name_len = new_int_type.getObjName(type_name); // default len
- verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName",
- __LINE__, __FILE__);
+ verify_val(name_len, static_cast<ssize_t>(HDstrlen("/typetests/IntType NATIVE_INT")),
+ "DataType::getObjName", __LINE__, __FILE__);
verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__);
// Close everything or they can be closed when objects go out of scope
@@ -366,25 +366,29 @@ test_get_objtype()
// Get and verify object type with
// H5O_type_t childObjType(const H5std_string& objname)
H5O_type_t objtype = file.childObjType(DSET_IN_FILE);
- verify_val(objtype, H5O_TYPE_DATASET, "DataSet::childObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(objtype), static_cast<long>(H5O_TYPE_DATASET), "DataSet::childObjType",
+ __LINE__, __FILE__);
// Get and verify object type with
// H5O_type_t childObjType(const char* objname)
objtype = grp1.childObjType(GROUP1_1.c_str());
- verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(objtype), static_cast<long>(H5O_TYPE_GROUP), "DataSet::childObjType",
+ __LINE__, __FILE__);
// Get and verify object type with
// H5O_type_t childObjType(hsize_t index, H5_index_t index_type,
// H5_iter_order_t order, const char* objname=".")
- objtype = grp1.childObjType((hsize_t)1, H5_INDEX_NAME, H5_ITER_INC);
- verify_val(objtype, H5O_TYPE_NAMED_DATATYPE, "DataSet::childObjType", __LINE__, __FILE__);
+ objtype = grp1.childObjType(1, H5_INDEX_NAME, H5_ITER_INC);
+ verify_val(static_cast<long>(objtype), static_cast<long>(H5O_TYPE_NAMED_DATATYPE),
+ "DataSet::childObjType", __LINE__, __FILE__);
// Get and verify object type with
// H5O_type_t childObjType(hsize_t index,
// H5_index_t index_type=H5_INDEX_NAME,
// H5_iter_order_t order=H5_ITER_INC, const char* objname=".")
- objtype = grp1.childObjType((hsize_t)2);
- verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__);
+ objtype = grp1.childObjType(2);
+ verify_val(static_cast<long>(objtype), static_cast<long>(H5O_TYPE_GROUP), "DataSet::childObjType",
+ __LINE__, __FILE__);
// Everything will be closed as they go out of scope
@@ -455,17 +459,20 @@ test_open_object_header()
// Make sure that each is the right kind of ID
H5I_type_t id_type = IdComponent::getHDFObjType(obj_grp);
- verify_val(id_type, H5I_GROUP, "H5Iget_type for group ID", __LINE__, __FILE__);
+ verify_val(static_cast<long>(id_type), static_cast<long>(H5I_GROUP), "H5Iget_type for group ID",
+ __LINE__, __FILE__);
id_type = IdComponent::getHDFObjType(obj_dtype);
- verify_val(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID", __LINE__, __FILE__);
+ verify_val(static_cast<long>(id_type), static_cast<long>(H5I_DATATYPE), "H5Iget_type for datatype ID",
+ __LINE__, __FILE__);
id_type = IdComponent::getHDFObjType(obj_dset);
- verify_val(id_type, H5I_DATASET, "H5Iget_type for dataset ID", __LINE__, __FILE__);
+ verify_val(static_cast<long>(id_type), static_cast<long>(H5I_DATASET), "H5Iget_type for dataset ID",
+ __LINE__, __FILE__);
/* Do something more complex with each of the IDs to make sure */
Group grp2(obj_grp);
hsize_t num_objs = grp2.getNumObjs();
- verify_val(num_objs, 1, "H5Gget_info", __LINE__, __FILE__);
+ verify_val(static_cast<long>(num_objs), 1, "H5Gget_info", __LINE__, __FILE__);
// There should be one object, the datatype
// Close datatype object opened from the file
@@ -482,7 +489,8 @@ test_open_object_header()
dtype.setId(obj_dtype);
H5T_class_t type_class = dtype.getClass();
- verify_val(type_class, H5T_INTEGER, "H5Tget_class", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_INTEGER), "H5Tget_class", __LINE__,
+ __FILE__);
dtype.close();
// Close datatype object
@@ -493,7 +501,7 @@ test_open_object_header()
// Try doing something with group, the ID should still work
num_objs = grp2.getNumObjs();
- verify_val(num_objs, 1, "H5Gget_info", __LINE__, __FILE__);
+ verify_val(static_cast<long>(num_objs), 1, "H5Gget_info", __LINE__, __FILE__);
// Close the cloned group
grp2.close();
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index 939b0ee..53a4ed3 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -81,9 +81,9 @@ test_reference_params()
// Allocate write & read buffers
int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
- wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
- rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
- tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
// Create file FILE1
file1 = new H5File(FILE1, H5F_ACC_TRUNC);
@@ -103,7 +103,7 @@ test_reference_params()
unsigned *tu32; // Temporary pointer to uint32 data
int i;
- for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ for (tu32 = reinterpret_cast<unsigned *>(wbuf), i = 0; i < SPACE1_DIM1; i++)
*tu32++ = i * 3; // from C test
// Write selection to disk
@@ -179,8 +179,7 @@ test_reference_params()
issue_fail_msg("test_reference_param()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if (file1)
- delete file1;
+ delete file1;
} /* test_reference_param() */
/*-------------------------------------------------------------------------
@@ -209,9 +208,9 @@ test_reference_obj()
// Allocate write & read buffers
int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
- wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
- rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
- tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
// Create file FILE1
file1 = new H5File(FILE1, H5F_ACC_TRUNC);
@@ -233,7 +232,7 @@ test_reference_obj()
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
unsigned *tu32; // Temporary pointer to uint32 data
- for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ for (tu32 = reinterpret_cast<unsigned *>(wbuf), i = 0; i < SPACE1_DIM1; i++)
*tu32++ = i * 3; // from C test
// Write selection to disk
@@ -269,22 +268,26 @@ test_reference_obj()
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[0], "/Group1/Dataset1");
H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(refobj_type), static_cast<long>(H5O_TYPE_DATASET),
+ "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[1], "/Group1/Dataset2");
refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(refobj_type), static_cast<long>(H5O_TYPE_DATASET),
+ "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to group
file1->reference(&wbuf[2], "/Group1");
refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(refobj_type), static_cast<long>(H5O_TYPE_GROUP),
+ "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to named datatype
file1->reference(&wbuf[3], "/Group1/Datatype1");
refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(refobj_type), static_cast<long>(H5O_TYPE_NAMED_DATATYPE),
+ "DataSet::getRefObjType", __LINE__, __FILE__);
// Write selection to disk
dataset.write(wbuf, PredType::STD_REF_OBJ);
@@ -310,13 +313,14 @@ test_reference_obj()
// Check information in the referenced dataset
sid1 = dset2.getSpace();
hssize_t n_elements = sid1.getSimpleExtentNpoints();
- verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(n_elements), 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Read from disk
dset2.read(tbuf, PredType::NATIVE_UINT);
- for (tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- verify_val(*tu32, (uint32_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ for (tu32 = reinterpret_cast<unsigned *>(tbuf), i = 0; i < SPACE1_DIM1; i++, tu32++)
+ verify_val(*tu32, static_cast<uint32_t>(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__,
+ __FILE__);
// Close dereferenced dataset
dset2.close();
@@ -354,7 +358,8 @@ test_reference_obj()
H5T_class_t tclass;
tclass = dtype1.getClass();
- verify_val(tclass, H5T_COMPOUND, "DataType::getClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(tclass), static_cast<long>(H5T_COMPOUND), "DataType::getClass", __LINE__,
+ __FILE__);
int n_members = dtype1.getNmembers();
verify_val(n_members, 3, "CompType::getNmembers", __LINE__, __FILE__);
@@ -374,8 +379,7 @@ test_reference_obj()
issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if (file1)
- delete file1;
+ delete file1;
} // test_reference_obj()
/*-------------------------------------------------------------------------
@@ -470,11 +474,11 @@ test_reference_group()
// Check number of objects in the group dereferenced by constructor
hsize_t nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nobjs), 3, "H5Group::getNumObjs", __LINE__, __FILE__);
// Check number of objects in the group dereferenced by ::reference
nobjs = group.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nobjs), 3, "H5Group::getNumObjs", __LINE__, __FILE__);
// Check getting file name given the group dereferenced via constructor
H5std_string fname = refgroup.getFileName();
@@ -487,13 +491,14 @@ test_reference_group()
// Check object type using Group::getObjinfo()
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
- group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo);
- verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo", __LINE__, __FILE__);
+ group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 0, oinfo);
+ verify_val(static_cast<long>(oinfo.type), static_cast<long>(H5O_TYPE_DATASET), "Group::getObjinfo",
+ __LINE__, __FILE__);
// Check for out of bound query by index
try {
HDmemset(&oinfo, 0, sizeof(oinfo));
- group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)9, oinfo);
+ group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 9, oinfo);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjinfo", "Out of bound index.");
@@ -504,7 +509,7 @@ test_reference_group()
// Unlink one of the objects in the dereferenced group, and re-check
refgroup.unlink(GROUPNAME2);
nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nobjs), 2, "H5Group::getNumObjs", __LINE__, __FILE__);
// Close resources
group.close();
@@ -518,8 +523,7 @@ test_reference_group()
issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if (file1)
- delete file1;
+ delete file1;
} /* test_reference_group() */
/*-------------------------------------------------------------------------
@@ -553,10 +557,10 @@ test_reference_region_1D()
*drbuf; // Buffer for reading numeric data from disk
// Allocate write & read buffers
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
- drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
+ wbuf = static_cast<hdset_reg_ref_t *>(HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1));
+ rbuf = static_cast<hdset_reg_ref_t *>(HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1));
+ dwbuf = static_cast<uint8_t *>(HDmalloc(sizeof(uint8_t) * SPACE3_DIM1));
+ drbuf = static_cast<uint8_t *>(HDcalloc(sizeof(uint8_t), SPACE3_DIM1));
// Create file FILE1
H5File file1(FILE2, H5F_ACC_TRUNC);
@@ -573,7 +577,7 @@ test_reference_region_1D()
uint8_t *tu8; // Temporary pointer to uint8 data
for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
- *tu8++ = i * 3; // from C test
+ *tu8++ = static_cast<uint8_t>(i); // from C test
// Write selection to disk
dset3.write(dwbuf, PredType::STD_U8LE);
@@ -610,7 +614,8 @@ test_reference_region_1D()
// Get and verify object type
H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(obj_type), static_cast<long>(H5O_TYPE_DATASET), "DataSet::getRefObjType",
+ __LINE__, __FILE__);
/* Select sequence of ten points for second reference */
coord1[0][0] = 16;
@@ -625,7 +630,7 @@ test_reference_region_1D()
coord1[9][0] = 3;
// Selects array elements to be included in the selection for sid3
- sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ sid3.selectElements(H5S_SELECT_SET, POINT1_NPOINTS, reinterpret_cast<const hsize_t *>(coord1));
// Get and verify the number of elements in a dataspace selection
nelms = sid3.getSelectNpoints();
@@ -661,12 +666,14 @@ test_reference_region_1D()
// Get and verify object type
obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
+ verify_val(static_cast<long>(obj_type), static_cast<long>(H5O_TYPE_DATASET),
+ "DataSet::getRefObjType", __LINE__, __FILE__);
// Get dataspace of dset3 the verify number of elements
sid1 = dset3.getSpace();
nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nelms), 100, "DataSpace::getSimpleExtentNpoints", __LINE__,
+ __FILE__);
} // End of test DataSet::dereference
{ // Test DataSet constructor -by dereference
@@ -677,7 +684,8 @@ test_reference_region_1D()
// Get dataspace of newds then verify number of elements
sid1 = newds.getSpace();
nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nelms), 100, "DataSpace::getSimpleExtentNpoints", __LINE__,
+ __FILE__);
// Close objects for this mini test
newds.close();
@@ -687,8 +695,9 @@ test_reference_region_1D()
// Read from disk
dset3.read(drbuf, PredType::STD_U8LE);
- for (tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
- verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ for (tu8 = static_cast<uint8_t *>(drbuf), i = 0; i < SPACE3_DIM1; i++, tu8++)
+ verify_val(*tu8, static_cast<uint8_t>(i), "DataSpace::getSimpleExtentNpoints", __LINE__,
+ __FILE__);
/*
* Test getting the referenced region
@@ -699,56 +708,56 @@ test_reference_region_1D()
// Get and verify number of elements in a dataspace selection
nelms = reg_sp.getSelectNpoints();
- verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nelms), 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
// Get and verify number of hyperslab blocks
nelms = reg_sp.getSelectHyperNblocks();
- verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nelms), 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
- coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2);
+ coords = static_cast<hsize_t *>(HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2));
// Get the list of hyperslab blocks currently selected
- reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords);
+ reg_sp.getSelectHyperBlocklist(0, static_cast<hsize_t>(nelms), coords);
// Verify values in the list
- verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[4], (hsize_t)12, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[5], (hsize_t)13, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[6], (hsize_t)17, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[7], (hsize_t)18, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[8], (hsize_t)22, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[9], (hsize_t)23, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[10], (hsize_t)27, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[11], (hsize_t)28, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[12], (hsize_t)32, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[13], (hsize_t)33, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[14], (hsize_t)37, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[15], (hsize_t)38, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[16], (hsize_t)42, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[17], (hsize_t)43, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[18], (hsize_t)47, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[19], (hsize_t)48, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[20], (hsize_t)52, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[21], (hsize_t)53, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[22], (hsize_t)57, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[23], (hsize_t)58, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[24], (hsize_t)62, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[25], (hsize_t)63, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[26], (hsize_t)67, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[27], (hsize_t)68, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[28], (hsize_t)72, "Hyperslab Coordinates", __LINE__, __FILE__);
- verify_val(coords[29], (hsize_t)73, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[0]), 2, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[1]), 3, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[2]), 7, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[3]), 8, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[4]), 12, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[5]), 13, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[6]), 17, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[7]), 18, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[8]), 22, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[9]), 23, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[10]), 27, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[11]), 28, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[12]), 32, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[13]), 33, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[14]), 37, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[15]), 38, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[16]), 42, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[17]), 43, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[18]), 47, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[19]), 48, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[20]), 52, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[21]), 53, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[22]), 57, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[23]), 58, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[24]), 62, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[25]), 63, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[26]), 67, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[27]), 68, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[28]), 72, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(static_cast<long>(coords[29]), 73, "Hyperslab Coordinates", __LINE__, __FILE__);
HDfree(coords);
// Check boundaries
reg_sp.getSelectBounds(low, high);
- verify_val(low[0], (hsize_t)2, "DataSpace::getSelectBounds", __LINE__, __FILE__);
- verify_val(high[0], (hsize_t)73, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(static_cast<long>(low[0]), 2, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(static_cast<long>(high[0]), 73, "DataSpace::getSelectBounds", __LINE__, __FILE__);
/* Close region space */
reg_sp.close();
@@ -762,13 +771,13 @@ test_reference_region_1D()
// Get and verify number of element points in the current selection
hssize_t nelmspts = elm_sp.getSelectElemNpoints();
- verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
+ verify_val(static_cast<long>(nelmspts), 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
- coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t));
+ coords = static_cast<hsize_t *>(HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)));
// Get the list of element points currently selected
- elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords);
+ elm_sp.getSelectElemPointlist(0, static_cast<hsize_t>(nelmspts), coords);
// Verify points
verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__);
@@ -786,8 +795,8 @@ test_reference_region_1D()
// Check boundaries
elm_sp.getSelectBounds(low, high);
- verify_val(low[0], (hsize_t)3, "DataSpace::getSelectBounds", __LINE__, __FILE__);
- verify_val(high[0], (hsize_t)97, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(static_cast<long>(low[0]), 3, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(static_cast<long>(high[0]), 97, "DataSpace::getSelectBounds", __LINE__, __FILE__);
// Close element space
elm_sp.close();
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index ae98927..8afb4bb 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -110,8 +110,8 @@ test_classes()
// PredType::NATIVE_DOUBLE should be in H5T_FLOAT class
tcls = PredType::NATIVE_DOUBLE.getClass();
if (H5T_FLOAT != tcls) {
- verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__,
- __FILE__);
+ verify_val(static_cast<long>(tcls), static_cast<long>(H5T_FLOAT),
+ "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__);
}
PASSED();
} // end of try block
@@ -699,7 +699,7 @@ test_named()
}
// Check that it is committed.
- if (itype.committed() == false)
+ if (!itype.committed())
cerr << "IntType::committed() returned false" << endl;
// We should not be able to modify a type after it has been committed.
@@ -804,8 +804,7 @@ test_named()
issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg());
}
- if (ds_type)
- delete ds_type;
+ delete ds_type;
} // test_named
/*-------------------------------------------------------------------------
@@ -990,7 +989,8 @@ test_encode_decode()
// Create an IntType instance from the decoded pointer and verify it
IntType * decoded_int_ptr(static_cast<IntType *>(inttyp.decode()));
H5T_sign_t int_sign = decoded_int_ptr->getSign();
- verify_val(int_sign, H5T_SGN_NONE, "DataType::decode", __LINE__, __FILE__);
+ verify_val(static_cast<long>(int_sign), static_cast<long>(H5T_SGN_NONE), "DataType::decode", __LINE__,
+ __FILE__);
verify_val(inttyp == *decoded_int_ptr, true, "DataType::decode", __LINE__, __FILE__);
delete decoded_int_ptr;
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index 7a7b854..405ca07 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -183,7 +183,7 @@ test_vlstring_dataset()
// Test scalar type dataset with 1 value.
dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);
- dynstring_ds_write = (char *)HDcalloc(2, sizeof(char));
+ dynstring_ds_write = static_cast<char *>(HDcalloc(2, sizeof(char)));
HDmemset(dynstring_ds_write, 'A', 1);
// Write data to the dataset, then read it back.
@@ -285,7 +285,7 @@ test_vlstring_array_dataset()
// Create and write another dataset.
DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space));
- char * wdata2 = (char *)HDcalloc(65534, sizeof(char));
+ char * wdata2 = static_cast<char *>(HDcalloc(65534, sizeof(char)));
HDmemset(wdata2, 'A', 65533);
dataset2.write(&wdata2, vlst);
@@ -313,8 +313,7 @@ test_vlstring_array_dataset()
issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if (file1)
- delete file1;
+ delete file1;
} // end test_vlstring_array_dataset()
/*-------------------------------------------------------------------------
@@ -361,7 +360,7 @@ test_vlstrings_special()
hsize_t ii; // counting variable
for (ii = 0; ii < SPACE1_DIM1; ii++)
if (rdata[ii] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast<int>(ii), rdata[ii]);
// Write dataset to disk, then read it back.
dataset.write(wdata, vlst);
@@ -373,18 +372,19 @@ test_vlstrings_special()
size_t rlen = HDstrlen(rdata[ii]);
if (wlen != rlen) {
TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n",
- (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
+ static_cast<int>(ii), static_cast<unsigned>(wlen), static_cast<int>(ii),
+ static_cast<unsigned>(rlen));
continue;
- } // end if
+ }
if (HDstrcmp(wdata[ii], rdata[ii]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii],
- (int)ii, rdata[ii]);
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
+ static_cast<int>(ii), wdata[ii], static_cast<int>(ii), rdata[ii]);
continue;
- } // end if
- } // end for
+ }
+ }
// Reclaim the read VL data.
- DataSet::vlenReclaim((void *)rdata, vlst, sid1);
+ DataSet::vlenReclaim(static_cast<void *>(rdata), vlst, sid1);
// Close Dataset.
dataset.close();
@@ -409,7 +409,7 @@ test_vlstrings_special()
// Check data read in.
for (ii = 0; ii < SPACE1_DIM1; ii++)
if (rdata[ii] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast<int>(ii), rdata[ii]);
// Try to write nil strings to disk.
dataset.write(wdata2, vlst);
@@ -420,7 +420,7 @@ test_vlstrings_special()
// Check data read in.
for (ii = 0; ii < SPACE1_DIM1; ii++)
if (rdata[ii] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast<int>(ii), rdata[ii]);
// Close objects and file.
dataset.close();
@@ -468,22 +468,26 @@ test_vlstring_type()
// Change padding and verify it.
vlst.setStrpad(H5T_STR_NULLPAD);
H5T_str_t pad = vlst.getStrpad();
- verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+ verify_val(static_cast<long>(pad), static_cast<long>(H5T_STR_NULLPAD), "StrType::getStrpad", __LINE__,
+ __FILE__);
// Convert to variable-length string.
vlst.setSize(H5T_VARIABLE);
// Check if datatype is VL string.
H5T_class_t type_class = vlst.getClass();
- verify_val(type_class, H5T_STRING, "DataType::getClass", __LINE__, __FILE__);
+ verify_val(static_cast<long>(type_class), static_cast<long>(H5T_STRING), "DataType::getClass",
+ __LINE__, __FILE__);
bool is_variable_str = vlst.isVariableStr();
verify_val(is_variable_str, true, "DataType::isVariableStr", __LINE__, __FILE__);
// Check default character set and padding.
H5T_cset_t cset = vlst.getCset();
- verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
+ verify_val(static_cast<long>(cset), static_cast<long>(H5T_CSET_ASCII), "StrType::getCset", __LINE__,
+ __FILE__);
pad = vlst.getStrpad();
- verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+ verify_val(static_cast<long>(pad), static_cast<long>(H5T_STR_NULLPAD), "StrType::getStrpad", __LINE__,
+ __FILE__);
// Commit variable-length string datatype to storage.
vlst.commit(*file1, VLSTR_TYPE);
@@ -511,9 +515,11 @@ test_vlstring_type()
// Verify character set and padding
cset = vlst2.getCset();
- verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
+ verify_val(static_cast<long>(cset), static_cast<long>(H5T_CSET_ASCII), "StrType::getCset", __LINE__,
+ __FILE__);
pad = vlst2.getStrpad();
- verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+ verify_val(static_cast<long>(pad), static_cast<long>(H5T_STR_NULLPAD), "StrType::getStrpad", __LINE__,
+ __FILE__);
// Close datatype and file
vlst2.close();
@@ -527,8 +533,7 @@ test_vlstring_type()
issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if (file1)
- delete file1;
+ delete file1;
} // end test_vlstring_type()
/*-------------------------------------------------------------------------
@@ -580,18 +585,19 @@ test_compact_vlstring()
for (i = 0; i < SPACE1_DIM1; i++) {
if (HDstrlen(wdata[i]) != strlen(rdata[i])) {
TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
+ static_cast<int>(i), static_cast<int>(HDstrlen(wdata[i])), static_cast<int>(i),
+ static_cast<int>(HDstrlen(rdata[i])));
continue;
} // end if
if (HDstrcmp(wdata[i], rdata[i]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
- (int)i, rdata[i]);
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
+ static_cast<int>(i), wdata[i], static_cast<int>(i), rdata[i]);
continue;
} // end if
} // end for
// Reclaim the read VL data
- DataSet::vlenReclaim((void *)rdata, vlst, sid1);
+ DataSet::vlenReclaim(static_cast<void *>(rdata), vlst, sid1);
// Close objects and file
dataset.close();
@@ -672,7 +678,7 @@ test_vlstring_attribute()
// Test creating a "large" sized string attribute
gr_attr = root.createAttribute("test_scalar_large", vlst, att_space);
- string_att_write = (char *)HDcalloc(8192, sizeof(char));
+ string_att_write = static_cast<char *>(HDcalloc(8192, sizeof(char)));
HDmemset(string_att_write, 'A', 8191);
// Write data to the attribute, then read it back.
diff --git a/config/clang-warnings/developer-general b/config/clang-warnings/developer-general
index 74d8404..b80552f 100644
--- a/config/clang-warnings/developer-general
+++ b/config/clang-warnings/developer-general
@@ -1,4 +1,3 @@
--Wformat-nonliteral
-Wmissing-noreturn
-Wsometimes-uninitialized
-Wswitch-enum
diff --git a/config/clang-warnings/general b/config/clang-warnings/general
index f0c9b93..433dff9 100644
--- a/config/clang-warnings/general
+++ b/config/clang-warnings/general
@@ -8,19 +8,13 @@
-Wformat=2
-Wframe-larger-than=16384
-Wimplicit-fallthrough
-#
-# NOTE: Due to the divergence in the C and C++, we're dropping support for
-# compiling the C library with a C++ compiler and dropping the -Wc++-compat
-# warning.
-#
--Wno-c++-compat
-#
-# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add
-# it to the developer flags.
-#
--Wno-format-nonliteral
-Wnull-dereference
-Wunused-const-variable
-Wwrite-strings
-Wpedantic
-Wvolatile-register-var
+# NOTE: Due to the divergence in the C and C++, we're dropping support for
+# compiling the C library with a C++ compiler and dropping the -Wc++-compat
+# warning.
+#
+-Wno-c++-compat
diff --git a/config/cmake/H5cxx_config.h.in b/config/cmake/H5cxx_config.h.in
deleted file mode 100644
index b5ae8ce..0000000
--- a/config/cmake/H5cxx_config.h.in
+++ /dev/null
@@ -1,16 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://www.hdfgroup.org/licenses. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* src/H5cxx_config.h.in Created manually. */
-
-/* Define if offsetof extension is present */
-#cmakedefine H5_HAVE_OFFSETOF ${H5_HAVE_OFFSETOF}
-
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 8b12d5d..761717d 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -26,9 +26,6 @@
/* Define if using a Windows compiler (i.e. Visual Studio) */
#cmakedefine H5_HAVE_VISUAL_STUDIO @H5_HAVE_VISUAL_STUDIO@
-/* Define if C++ compiler recognizes offsetof */
-#cmakedefine H5_CXX_HAVE_OFFSETOF @CXX_HAVE_OFFSETOF@
-
/* Define the default plugins path to compile */
#cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@"
diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake
index 958fe73..dcc96cf 100644
--- a/config/cmake/HDFCXXCompilerFlags.cmake
+++ b/config/cmake/HDFCXXCompilerFlags.cmake
@@ -9,6 +9,8 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
+ENABLE_LANGUAGE (CXX)
+
set (CMAKE_CXX_STANDARD 98)
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
diff --git a/config/cmake/libh5cc.in b/config/cmake/libh5cc.in
index 6d54088..f5d8d4c 100644
--- a/config/cmake/libh5cc.in
+++ b/config/cmake/libh5cc.in
@@ -29,7 +29,7 @@ printf 'dir is %s\n' "$dir"
# Show the configuration summary of the library recorded in the
-# libhdf5.settings file residing in the lib directory.
+# libhdf5.settings file reside in the lib directory.
showconfigure()
{
cat $dir/lib/libhdf5.settings
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 56957f9..7b2c4eb 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -254,61 +254,61 @@ set (HDF_EXTRA_C_FLAGS)
set (HDF_EXTRA_FLAGS)
if (MINGW OR NOT WINDOWS)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
- # Linux Specific flags
- # This was originally defined as _POSIX_SOURCE which was updated to
- # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
- # functionality so clock_gettime and CLOCK_MONOTONIC are defined
- # correctly. This was later updated to 200112L so that
- # posix_memalign() is visible for the direct VFD code on Linux
- # systems.
- # POSIX feature information can be found in the gcc manual at:
- # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L)
-
- # Need to add this so that O_DIRECT is visible for the direct
- # VFD on Linux systems.
- set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE)
-
- option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
- if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN)
- set (msg "Performing TEST_LFS_WORKS")
- try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
- COMPILE_DEFINITIONS "-DTEST_LFS_WORKS"
- )
-
- # The LARGEFILE definitions were from the transition period
- # and are probably no longer needed. The FILE_OFFSET_BITS
- # check should be generalized for all POSIX systems as it
- # is in the Autotools.
- if (TEST_LFS_WORKS_COMPILE)
- if (TEST_LFS_WORKS_RUN MATCHES 0)
- set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
- set (LARGEFILE 1)
- set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
- message (VERBOSE "${msg}... yes")
- endif ()
- else ()
- set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
- message (VERBOSE "${msg}... no")
- endif ()
- file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n"
- )
- endif ()
- else ()
- set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
- message (VERBOSE "${msg}... no")
- endif ()
- file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Test TEST_LFS_WORKS Compile failed\n"
- )
- endif ()
- endif ()
+ # Linux Specific flags
+ # This was originally defined as _POSIX_SOURCE which was updated to
+ # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
+ # functionality so clock_gettime and CLOCK_MONOTONIC are defined
+ # correctly. This was later updated to 200112L so that
+ # posix_memalign() is visible for the direct VFD code on Linux
+ # systems.
+ # POSIX feature information can be found in the gcc manual at:
+ # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
+ set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L)
+
+ # Need to add this so that O_DIRECT is visible for the direct
+ # VFD on Linux systems.
+ set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE)
+
+ option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
+ if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN)
+ set (msg "Performing TEST_LFS_WORKS")
+ try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE
+ ${CMAKE_BINARY_DIR}
+ ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
+ COMPILE_DEFINITIONS "-DTEST_LFS_WORKS"
+ )
+
+ # The LARGEFILE definitions were from the transition period
+ # and are probably no longer needed. The FILE_OFFSET_BITS
+ # check should be generalized for all POSIX systems as it
+ # is in the Autotools.
+ if (TEST_LFS_WORKS_COMPILE)
+ if (TEST_LFS_WORKS_RUN MATCHES 0)
+ set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
+ set (LARGEFILE 1)
+ set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
+ message (VERBOSE "${msg}... yes")
+ endif ()
+ else ()
+ set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
+ message (VERBOSE "${msg}... no")
+ endif ()
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n"
+ )
+ endif ()
+ else ()
+ set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
+ message (VERBOSE "${msg}... no")
+ endif ()
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Test TEST_LFS_WORKS Compile failed\n"
+ )
+ endif ()
+ endif ()
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS})
endif ()
endif ()
@@ -557,7 +557,6 @@ if (MINGW OR NOT WINDOWS)
foreach (other_test
HAVE_ATTRIBUTE
HAVE_C99_FUNC
-# STDC_HEADERS
HAVE_FUNCTION
HAVE_C99_DESIGNATED_INITIALIZER
SYSTEM_SCOPE_THREADS
diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp
deleted file mode 100644
index 08ccb34..0000000
--- a/config/cmake_ext_mod/HDFCXXTests.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://www.hdfgroup.org/licenses. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifdef CXX_HAVE_OFFSETOF
-
-#include <stdio.h>
-#include <stddef.h>
-
-#ifdef FC_DUMMY_MAIN
-#ifndef FC_DUMMY_MAIN_EQ_F77
-# ifdef __cplusplus
-extern "C"
-# endif
-int FC_DUMMY_MAIN()
-{ return 1;}
-#endif
-#endif
-int
-main ()
-{
-
- struct index_st
- {
- unsigned char type;
- unsigned char num;
- unsigned int len;
- };
- typedef struct index_st index_t;
- int x,y;
- x = offsetof(struct index_st, len);
- y = offsetof(index_t, num)
-
- ;
- return 0;
-}
-
-#endif
diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake
deleted file mode 100644
index 6788773..0000000
--- a/config/cmake_ext_mod/HDFUseCXX.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://www.hdfgroup.org/licenses.
-# If you do not have access to either file, you may request a copy from
-# help@hdfgroup.org.
-#
-#
-# This file provides functions for C++ support.
-#
-#-------------------------------------------------------------------------------
-ENABLE_LANGUAGE (CXX)
-set (HDF_PREFIX "H5")
-
-#-------------------------------------------------------------------------------
-# Fix CXX flags if we are compiling statically on Windows using
-# Windows_MT.cmake from config/cmake/UserMacros
-#-------------------------------------------------------------------------------
-if (BUILD_STATIC_CRT_LIBS)
- TARGET_STATIC_CRT_FLAGS ()
-endif ()
-
-#-----------------------------------------------------------------------------
-# Configure Checks which require CXX compilation must go in here
-# not in the main ConfigureChecks.cmake files, because if the user has
-# no CXX compiler, problems arise.
-#-----------------------------------------------------------------------------
-include (CheckIncludeFileCXX)
-include (TestForSTDNamespace)
-
-# IF the c compiler found stdint, check the C++ as well. On some systems this
-# file will be found by C but not C++, only do this test IF the C++ compiler
-# has been initialized (e.g. the project also includes some c++)
-if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
- CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX)
- if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX)
- set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H")
- set (USE_INCLUDES ${USE_INCLUDES} "stdint.h")
- endif ()
-endif ()
-
-#Always define
-set (${HDF_PREFIX}_CXX_HAVE_OFFSETOF 1)
diff --git a/config/gnu-warnings/cxx-general b/config/gnu-warnings/cxx-general
index 9548cc0..1626524 100644
--- a/config/gnu-warnings/cxx-general
+++ b/config/gnu-warnings/cxx-general
@@ -17,7 +17,6 @@
-Winit-self
-Winvalid-pch
-Wmissing-include-dirs
--Wno-format-nonliteral
-Wnon-virtual-dtor
-Wold-style-cast
-Woverloaded-virtual
diff --git a/config/gnu-warnings/developer-general b/config/gnu-warnings/developer-general
index b34c4b7..460b874 100644
--- a/config/gnu-warnings/developer-general
+++ b/config/gnu-warnings/developer-general
@@ -1,9 +1,6 @@
# (suggestions from gcc, not code problems)
-# NOTE: -Wformat-nonliteral added back in here (from being disabled in
-# H5_CFLAGS)
-Waggregate-return
-Wdisabled-optimization
--Wformat-nonliteral
-Winline
-Wmissing-format-attribute
-Wmissing-noreturn
diff --git a/config/gnu-warnings/error-5 b/config/gnu-warnings/error-5
index f7e1138..282ee3f 100644
--- a/config/gnu-warnings/error-5
+++ b/config/gnu-warnings/error-5
@@ -1,4 +1,5 @@
-Werror=incompatible-pointer-types
+-Werror=int-conversion
#
# In GCC 4.4.7, the compiler gripes about shadowed global
# declarations when a local variable uses the name of a
diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general
index 8405c40..a66d284 100644
--- a/config/gnu-warnings/error-general
+++ b/config/gnu-warnings/error-general
@@ -11,6 +11,7 @@
-Werror=packed
-Werror=pointer-sign
-Werror=pointer-to-int-cast
+-Werror=int-to-pointer-cast
-Werror=redundant-decls
-Werror=strict-prototypes
-Werror=switch
diff --git a/config/gnu-warnings/general b/config/gnu-warnings/general
index a7a20b7..df4c613 100644
--- a/config/gnu-warnings/general
+++ b/config/gnu-warnings/general
@@ -15,18 +15,12 @@
-Winit-self
-Winvalid-pch
-Wmissing-include-dirs
-#
+-Wshadow
+-Wundef
+-Wwrite-strings
+-pedantic
# NOTE: Due to the divergence in the C and C++, we're dropping support for
# compiling the C library with a C++ compiler and dropping the -Wc++-compat
# warning.
#
-Wno-c++-compat
-#
-# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add
-# it to the developer flags.
-#
--Wno-format-nonliteral
--Wshadow
--Wundef
--Wwrite-strings
--pedantic
diff --git a/configure.ac b/configure.ac
index bbb4cfa..a5925a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -808,20 +808,6 @@ if test "X$HDF_CXX" = "Xyes"; then
## Change to the C++ language
AC_LANG_PUSH(C++)
- ## Checking if C++ needs old style header files in includes
- PAC_PROG_CXX_HEADERS
-
- ## Checking if C++ can handle namespaces
- PAC_PROG_CXX_NAMESPACE
-
- ## if C++ can handle static cast
- PAC_PROG_CXX_STATIC_CAST
-
- ## Checking if C++ has offsetof extension,
- ## note: this test has to be the last of the C++ tests because it sets a definition
- ## which would be used in the other tests, causing them to fail.
- PAC_PROG_CXX_OFFSETOF
-
else
CXX="no"
fi
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp
index 0f47b0d..07b82c5 100644
--- a/hl/c++/src/H5PacketTable.cpp
+++ b/hl/c++/src/H5PacketTable.cpp
@@ -28,6 +28,14 @@
/* PacketTable superclass */
/********************************/
+/* Null constructor
+ * Sets table_id to "invalid"
+ */
+PacketTable::PacketTable()
+{
+ table_id = H5I_INVALID_HID;
+}
+
/* "Open" Constructor
* Opens an existing packet table, which can contain either fixed-length or
* variable-length packets.
@@ -59,10 +67,7 @@ PacketTable::~PacketTable()
bool
PacketTable::IsValid()
{
- if (H5PTis_valid(table_id) == 0)
- return true;
- else
- return false;
+ return H5PTis_valid(table_id) == 0;
}
/* IsVariableLength
@@ -271,7 +276,7 @@ FL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, void *data)
if (startIndex > endIndex)
return -1;
- return H5PTread_packets(table_id, startIndex, (size_t)(endIndex - startIndex + 1), data);
+ return H5PTread_packets(table_id, startIndex, static_cast<size_t>(endIndex - startIndex + 1), data);
}
/* GetNextPacket (single packet)
diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h
index 95e53e3..eae66f1 100644
--- a/hl/c++/src/H5PacketTable.h
+++ b/hl/c++/src/H5PacketTable.h
@@ -33,10 +33,7 @@ class H5_HLCPPDLL PacketTable {
/* Null constructor
* Sets table_id to H5I_INVALID_HID
*/
- PacketTable()
- {
- table_id = H5I_INVALID_HID;
- }
+ PacketTable();
/* "Open" Constructor
* Opens an existing packet table, which can contain either fixed-length or
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp
index 651f057..33199f1 100644
--- a/hl/c++/test/ptableTest.cpp
+++ b/hl/c++/test/ptableTest.cpp
@@ -307,7 +307,7 @@ TestCompress()
if (HDstrncmp(filter_name, "deflate", 7) != 0)
H5_FAILED()
}
- catch (Exception e) {
+ catch (Exception const &) {
H5_FAILED();
return 1;
}
@@ -605,8 +605,8 @@ const int STRING_LENGTH = 19; // including terminating NULL
int
TestHDFFV_9758()
{
- hid_t strtype;
- hid_t compound_type;
+ hid_t strtype = H5I_INVALID_HID;
+ hid_t compound_type = H5I_INVALID_HID;
herr_t err;
struct s1_t {
int a;
diff --git a/m4/aclocal_cxx.m4 b/m4/aclocal_cxx.m4
deleted file mode 100644
index 188f7ca..0000000
--- a/m4/aclocal_cxx.m4
+++ /dev/null
@@ -1,79 +0,0 @@
-dnl -------------------------------------------------------------------------
-dnl -------------------------------------------------------------------------
-dnl
-dnl Copyright by the Board of Trustees of the University of Illinois.
-dnl All rights reserved.
-dnl
-dnl This file is part of HDF5. The full HDF5 copyright notice, including
-dnl terms governing use, modification, and redistribution, is contained in
-dnl the COPYING file, which can be found at the root of the source code
-dnl distribution tree, or in https://www.hdfgroup.org/licenses.
-dnl If you do not have access to either file, you may request a copy from
-dnl help@hdfgroup.org
-dnl
-dnl -------------------------------------------------------------------------
-dnl -------------------------------------------------------------------------
-
-dnl *********************************
-dnl PURPOSE
-dnl Contains Macros for HDF5 C++
-dnl *********************************
-dnl
-dnl Special characteristics that have no autoconf counterpart but that
-dnl we need as part of the C++ support. To distinguish these, they
-dnl have a [PAC] prefix.
-
-dnl Checking if C++ needs old style header files in includes
-AC_DEFUN([PAC_PROG_CXX_HEADERS],[
- AC_MSG_CHECKING([if $CXX needs old style header files in includes])
- TEST_SRC="`(echo \"#define OLD_HEADER_FILENAME 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-
- AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
- [AC_MSG_RESULT([no])],
- [AC_MSG_RESULT([yes])
- CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME"
- AM_CXXFLAGS="${AM_CXXFLAGS} -DOLD_HEADER_FILENAME"])
-])
-
-dnl Checking if ++ can handle namespaces
-AC_DEFUN([PAC_PROG_CXX_NAMESPACE],[
- AC_MSG_CHECKING([if $CXX can handle namespaces])
- TEST_SRC="`(echo \"#define HDF_NO_NAMESPACE 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-
- AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- CXXFLAGS="${CXXFLAGS} -DHDF_NO_NAMESPACE"
- AM_CXXFLAGS="${AM_CXXFLAGS} -DHDF_NO_NAMESPACE"])
-])
-
-dnl Checking if C++ supports std
-AC_DEFUN([PAC_PROG_CXX_STD],[
- AC_MSG_CHECKING([if $CXX supports std])
- TEST_SRC="`(echo \"#define HDF_NO_STD 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-
- AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- CXXFLAGS="${CXXFLAGS} -DH5_NO_STD"
- AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD"])
-])
-
-dnl Checking if C++ has offsetof extension
-AC_DEFUN([PAC_PROG_CXX_OFFSETOF],[
- AC_MSG_CHECKING([if $CXX has offsetof extension])
- TEST_SRC="`(echo \"#define CXX_HAVE_OFFSETOF 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-
- AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],[AC_MSG_RESULT([yes])
- AC_DEFINE([CXX_HAVE_OFFSETOF], [1], [Define if C++ compiler recognizes offsetof])],
- AC_MSG_RESULT([no]))
-])
-
-dnl Checking if C++ can handle static cast
-AC_DEFUN([PAC_PROG_CXX_STATIC_CAST],[
- AC_MSG_CHECKING([if $CXX can handle static cast])
- TEST_SRC="`(echo \"#define NO_STATIC_CAST 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`"
-
- AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST"
- AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST"])
-])
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 367a613..9ecae5e 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -236,7 +236,7 @@ H5FD_direct_init(void)
if (H5I_VFL != H5I_get_type(H5FD_DIRECT_g)) {
H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g, sizeof(H5FD_class_t), FALSE);
if (H5I_INVALID_HID == H5FD_DIRECT_g)
- HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register direct");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register direct");
}
/* Set return value */
diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c
index e0e240c..a933bb0 100644
--- a/src/H5FDmirror.c
+++ b/src/H5FDmirror.c
@@ -249,7 +249,7 @@ H5FD_mirror_init(void)
if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) {
H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE);
if (H5I_INVALID_HID == H5FD_MIRROR_g)
- HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register mirror");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register mirror");
}
ret_value = H5FD_MIRROR_g;
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index f6765d5..5819ed9 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -329,7 +329,7 @@ H5FD_ros3_init(void)
if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) {
H5FD_ROS3_g = H5FD_register(&H5FD_ros3_g, sizeof(H5FD_class_t), FALSE);
if (H5I_INVALID_HID == H5FD_ROS3_g) {
- HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register ros3");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register ros3");
}
}
diff --git a/src/H5FL.c b/src/H5FL.c
index a1041e3..b92fcae 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -337,8 +337,11 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -443,8 +446,11 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -908,8 +914,11 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -1007,8 +1016,11 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk.stack);
- trk.file = H5MM_xfree(trk.file);
- trk.func = H5MM_xfree(trk.func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk.file = NULL;
+ trk.func = NULL;
/* Remove from "outstanding allocations" list */
if ((void *)block_ptr == (void *)H5FL_out_head_g) {
@@ -1128,14 +1140,20 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_
/* Release previous tracking information */
H5CS_close_stack(trk.stack);
- trk.file = H5MM_xfree(trk.file);
- trk.func = H5MM_xfree(trk.func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk.file = NULL;
+ trk.func = NULL;
/* Store new tracking information */
trk.stack = H5CS_copy_stack();
HDassert(trk.stack);
- trk.file = H5MM_strdup(call_file);
- trk.func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ trk.file = call_file;
+ trk.func = call_func;
trk.line = call_line;
HDmemcpy(block_ptr, &trk, sizeof(H5FL_track_t));
@@ -1435,8 +1453,11 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk.stack);
- trk.file = H5MM_xfree(trk.file);
- trk.func = H5MM_xfree(trk.func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk.file = NULL;
+ trk.func = NULL;
/* Remove from "outstanding allocations" list */
if ((void *)block_ptr == H5FL_out_head_g) {
@@ -1573,8 +1594,11 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -1689,14 +1713,20 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA
/* Release previous tracking information */
H5CS_close_stack(trk.stack);
- trk.file = H5MM_xfree(trk.file);
- trk.func = H5MM_xfree(trk.func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk.file = NULL;
+ trk.func = NULL;
/* Store new tracking information */
trk.stack = H5CS_copy_stack();
HDassert(trk.stack);
- trk.file = H5MM_strdup(call_file);
- trk.func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ trk.file = call_file;
+ trk.func = call_func;
trk.line = call_line;
HDmemcpy(block_ptr, &trk, sizeof(H5FL_track_t));
@@ -2098,8 +2128,11 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -2201,8 +2234,11 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 504c385..82e2e7f 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -50,6 +50,11 @@
*/
/* #define H5FL_TRACK */
#ifdef H5FL_TRACK
+
+#ifndef H5_HAVE_CODESTACK
+#error "Free list tracking requires code stack to be enabled"
+#endif
+
/* Macro for inclusion in the free list allocation calls */
#define H5FL_TRACK_INFO , __FILE__, FUNC, __LINE__
@@ -273,16 +278,17 @@ typedef struct H5FL_arr_head_t {
#define H5FL_BARR_DEFINE_STATIC(b, t, m) static H5FL_ARR_DEFINE_COMMON(sizeof(b), t, m)
/* Allocate an array of type 't' */
-#define H5FL_ARR_MALLOC(t, elem) H5FL_arr_malloc(&(H5FL_ARR_NAME(t)), elem)
+#define H5FL_ARR_MALLOC(t, elem) H5FL_arr_malloc(&(H5FL_ARR_NAME(t)), elem H5FL_TRACK_INFO)
/* Allocate an array of type 't' and clear it to all zeros */
-#define H5FL_ARR_CALLOC(t, elem) H5FL_arr_calloc(&(H5FL_ARR_NAME(t)), elem)
+#define H5FL_ARR_CALLOC(t, elem) H5FL_arr_calloc(&(H5FL_ARR_NAME(t)), elem H5FL_TRACK_INFO)
/* Free an array of type 't' */
#define H5FL_ARR_FREE(t, obj) (t *)H5FL_arr_free(&(H5FL_ARR_NAME(t)), obj)
/* Re-allocate an array of type 't' */
-#define H5FL_ARR_REALLOC(t, obj, new_elem) H5FL_arr_realloc(&(H5FL_ARR_NAME(t)), obj, new_elem)
+#define H5FL_ARR_REALLOC(t, obj, new_elem) \
+ H5FL_arr_realloc(&(H5FL_ARR_NAME(t)), obj, new_elem H5FL_TRACK_INFO)
#else /* H5_NO_ARR_FREE_LISTS */
/* Common macro for H5FL_ARR_DEFINE & H5FL_ARR_DEFINE_STATIC (and H5FL_BARR variants) */
@@ -405,10 +411,10 @@ H5_DLL void *H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS);
H5_DLL void *H5FL_reg_free(H5FL_reg_head_t *head, void *obj);
/* Array free lists */
-H5_DLL void *H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem);
-H5_DLL void *H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem);
+H5_DLL void *H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS);
+H5_DLL void *H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS);
H5_DLL void *H5FL_arr_free(H5FL_arr_head_t *head, void *obj);
-H5_DLL void *H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem);
+H5_DLL void *H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS);
/* Sequence free lists */
H5_DLL void *H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 05da432..ec2d97a 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -284,10 +284,6 @@ H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
* \details H5Oopen_by_token() opens an object specified by the object
* identifier, \p loc_id and object token, \p token.
*
- * \par Example
- * An example snippet from examples/h5_extlink.c:
- * \snippet h5_extlink.c H5Open_by_token_snip
- *
* \since 1.12.0
*
*/
diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h
index 73424fb..30ac702 100644
--- a/src/H5Tmodule.h
+++ b/src/H5Tmodule.h
@@ -66,17 +66,20 @@
* \ingroup H5T
* \defgroup ATOM Atomic Datatypes
* \ingroup H5T
- * \defgroup COMPOUND Compound Datatypes
- * \ingroup H5T
* \defgroup CONV Conversion Function
* \ingroup H5T
- * \defgroup ENUM Enumeration Datatypes
- * \ingroup H5T
* \defgroup OPAQUE Opaque Datatypes
* \ingroup H5T
* \defgroup VLEN Variable-length Sequence Datatypes
* \ingroup H5T
*
+ * \defgroup COMPENUM Compound and Enumeration Datatypes
+ * \ingroup H5T
+ * \defgroup COMPOUND Compound Datatypes
+ * \ingroup COMPENUM
+ * \defgroup ENUM Enumeration Datatypes
+ * \ingroup COMPENUM
+ *
* \defgroup PDT Predefined Datatypes
* \ingroup H5T
* \details What is a predefined HDF5 datatype?
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 145af51..b87c167 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -2061,7 +2061,7 @@ H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id);
*/
H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
/**
- * \ingroup COMPOUND ENUM
+ * \ingroup COMPENUM
*
* \brief Retrieves the number of elements in a compound or enumeration datatype
*
@@ -2078,7 +2078,7 @@ H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
*/
H5_DLL int H5Tget_nmembers(hid_t type_id);
/**
- * \ingroup COMPOUND ENUM
+ * \ingroup COMPENUM
*
* \brief Retrieves the name of a compound or enumeration datatype member
*
@@ -2105,7 +2105,7 @@ H5_DLL int H5Tget_nmembers(hid_t type_id);
*/
H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno);
/**
- * \ingroup COMPOUND ENUM
+ * \ingroup COMPENUM
*
* \brief Retrieves the index of a compound or enumeration datatype member
*
diff --git a/src/H5private.h b/src/H5private.h
index 1bbdc52..bc00f12 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -166,8 +166,8 @@
#include <dirent.h>
#endif
-/* Define the default VFD for this platform.
- * Since the removal of the Windows VFD, this is sec2 for all platforms.
+/* Define the default VFD for this platform. Since the removal of the
+ * Windows VFD, this is sec2 for all platforms.
*/
#define H5_DEFAULT_VFD H5FD_SEC2
diff --git a/src/H5public.h b/src/H5public.h
index 87a282c..f7b27fc 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -71,13 +71,6 @@
#endif
#endif
-/* Include the Windows API adapter header early */
-#include "H5api_adpt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Macros for enabling/disabling particular GCC warnings */
/* (see the following web-sites for more info:
* http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
@@ -485,6 +478,13 @@ typedef struct H5_alloc_stats_t {
size_t peak_alloc_blocks_count; /**< Peak # of blocks allocated */
} H5_alloc_stats_t;
+/* API adapter header (defines H5_DLL, etc.) */
+#include "H5api_adpt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Functions in H5.c */
/**
* \ingroup H5
diff --git a/test/h5test.h b/test/h5test.h
index 0d7dade..ac251d6 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -162,12 +162,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
goto error; \
}
-/*
- * Alarm definitions to wait up (terminate) a test that runs too long.
- */
+/* Number of seconds to wait before killing a test (requires alarm(2)) */
#define H5_ALARM_SEC 1200 /* default is 20 minutes */
-#define ALARM_ON TestAlarmOn()
-#define ALARM_OFF HDalarm(0)
/* Flags for h5_fileaccess_flags() */
#define H5_FILEACCESS_VFD 0x01
diff --git a/test/testframe.c b/test/testframe.c
index f805997..d3f0211 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -320,9 +320,9 @@ PerformTests(void)
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
Test_parameters = Test[Loop].Parameters;
- ALARM_ON;
+ TestAlarmOn();
Test[Loop].Call();
- ALARM_OFF;
+ TestAlarmOff();
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
@@ -620,12 +620,15 @@ SetTest(const char *testname, int action)
}
}
-/*
- * Enable alarm on test execution, configurable by environment variable
+/* Enable a test timer that will kill long-running tests, the time is configurable
+ * via an environment variable.
+ *
+ * Only useful on POSIX systems where alarm(2) is present.
*/
void
TestAlarmOn(void)
{
+#ifdef H5_HAVE_ALARM
char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
@@ -635,4 +638,15 @@ TestAlarmOn(void)
/* Set the number of seconds before alarm goes off */
HDalarm((unsigned)alarm_sec);
+#endif
+}
+
+/* Disable the test timer */
+void
+TestAlarmOff(void)
+{
+#ifdef H5_HAVE_ALARM
+ /* Set the number of seconds to zero */
+ HDalarm(0);
+#endif
}
diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c
index 911be2c..4570fbc 100644
--- a/testpar/t_2Gio.c
+++ b/testpar/t_2Gio.c
@@ -3323,7 +3323,7 @@ none_selection_chunk(void)
* Simple independent I/O. This tests that the defaults are properly set.
*
* TEST_ACTUAL_IO_RESET:
- * Performs collective and then independent I/O with hthe same dxpl to
+ * Performs collective and then independent I/O with the same dxpl to
* make sure the peroperty is correctly reset to the default on each use.
* Specifically, this test runs TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE
* (The most complex case that works on all builds) and then performs
@@ -3644,7 +3644,7 @@ test_actual_io_mode(int selection_mode)
/* Set the threshold number of processes per chunk to twice mpi_size.
* This will prevent the threshold from ever being met, thus forcing
* multi chunk io instead of link chunk io.
- * This is via deault.
+ * This is via default.
*/
if (multi_chunk_io) {
/* force multi-chunk-io by threshold */
diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c
index c21d233..0a971c5 100644
--- a/testpar/t_bigio.c
+++ b/testpar/t_bigio.c
@@ -1107,13 +1107,15 @@ single_rank_independent_io(void)
HDprintf("\nSingle Rank Independent I/O\n");
if (MAIN_PROCESS) {
- hsize_t dims[] = {LARGE_DIM};
- hid_t file_id = -1;
- hid_t fapl_id = -1;
- hid_t dset_id = -1;
- hid_t fspace_id = -1;
- hid_t mspace_id = -1;
- void * data = NULL;
+ hsize_t dims[] = {LARGE_DIM};
+ hid_t file_id = -1;
+ hid_t fapl_id = -1;
+ hid_t dset_id = -1;
+ hid_t fspace_id = -1;
+ hid_t mspace_id = -1;
+ herr_t ret;
+ int * data = NULL;
+ uint64_t i;
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY_G((fapl_id >= 0), "H5P_FILE_ACCESS");
@@ -1135,6 +1137,10 @@ single_rank_independent_io(void)
data = malloc(LARGE_DIM * sizeof(int));
+ /* Initialize data */
+ for (i = 0; i < LARGE_DIM; i++)
+ data[i] = (int)(i % (uint64_t)DXFER_BIGCOUNT);
+
if (mpi_rank_g == 0)
H5Sselect_all(fspace_id);
else
@@ -1143,7 +1149,24 @@ single_rank_independent_io(void)
dims[0] = LARGE_DIM;
mspace_id = H5Screate_simple(1, dims, NULL);
VRFY_G((mspace_id >= 0), "H5Screate_simple mspace_id succeeded");
+
+ /* Write data */
H5Dwrite(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, H5P_DEFAULT, data);
+ VRFY_G((ret >= 0), "H5Dwrite succeeded");
+
+ /* Wipe buffer */
+ HDmemset(data, 0, LARGE_DIM * sizeof(int));
+
+ /* Read data back */
+ H5Dread(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, H5P_DEFAULT, data);
+ VRFY_G((ret >= 0), "H5Dread succeeded");
+
+ /* Verify data */
+ for (i = 0; i < LARGE_DIM; i++)
+ if (data[i] != (int)(i % (uint64_t)DXFER_BIGCOUNT)) {
+ HDfprintf(stderr, "verify failed\n");
+ exit(1);
+ }
free(data);
H5Sclose(mspace_id);
@@ -1861,7 +1884,7 @@ main(int argc, char **argv)
HDprintf("Failed to turn off atexit processing. Continue.\n");
/* set alarm. */
- ALARM_ON;
+ TestAlarmOn();
dataset_big_write();
MPI_Barrier(MPI_COMM_WORLD);
@@ -1878,7 +1901,7 @@ main(int argc, char **argv)
single_rank_independent_io();
/* turn off alarm */
- ALARM_OFF;
+ TestAlarmOff();
if (mpi_rank_g == 0)
HDremove(FILENAME[0]);
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 3ce5729..83c1dc3 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -6718,7 +6718,7 @@ smoke_check_6(int metadata_write_strategy)
if (FALSE != entry_ptr->header.coll_access) {
nerrors++;
if (verbose) {
- HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n",
+ HDfprintf(stdout, "%d:%s: Entry inserted independently marked as collective.\n",
world_mpi_rank, FUNC);
}
}
@@ -6774,7 +6774,7 @@ smoke_check_6(int metadata_write_strategy)
if (FALSE != entry_ptr->header.coll_access) {
nerrors++;
if (verbose) {
- HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n",
+ HDfprintf(stdout, "%d:%s: Entry inserted independently marked as collective.\n",
world_mpi_rank, FUNC);
}
}
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 8616bef..6b6be6f 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -2881,7 +2881,7 @@ none_selection_chunk(void)
* Simple independent I/O. This tests that the defaults are properly set.
*
* TEST_ACTUAL_IO_RESET:
- * Performs collective and then independent I/O with hthe same dxpl to
+ * Performs collective and then independent I/O with the same dxpl to
* make sure the peroperty is correctly reset to the default on each use.
* Specifically, this test runs TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE
* (The most complex case that works on all builds) and then performs
@@ -3202,7 +3202,7 @@ test_actual_io_mode(int selection_mode)
/* Set the threshold number of processes per chunk to twice mpi_size.
* This will prevent the threshold from ever being met, thus forcing
* multi chunk io instead of link chunk io.
- * This is via deault.
+ * This is via default.
*/
if (multi_chunk_io) {
/* force multi-chunk-io by threshold */
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index bfb5897..731f493 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -8792,7 +8792,7 @@ main(int argc, char **argv)
if (VERBOSE_MED)
h5_show_hostname();
- ALARM_ON;
+ TestAlarmOn();
num_filters = ARRAY_SIZE(filterIDs);
@@ -8960,7 +8960,7 @@ exit:
if (MAINPROCESS)
HDprintf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors, nerrors > 1 ? "S" : "");
- ALARM_OFF;
+ TestAlarmOff();
h5_clean_files(FILENAME, fapl_id);
fapl_id = H5I_INVALID_HID;
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index bb56f35..96cbc4b 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -1086,7 +1086,7 @@ main(int argc, char **argv)
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
/* set alarm. */
- ALARM_ON;
+ TestAlarmOn();
/*=======================================
* MPIO 1 write Many read test
@@ -1195,7 +1195,7 @@ finish:
}
/* turn off alarm */
- ALARM_OFF;
+ TestAlarmOff();
h5_clean_files(FILENAME, fapl);
H5close();
diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c
index 032d914..f4e6602 100644
--- a/testpar/t_pflush2.c
+++ b/testpar/t_pflush2.c
@@ -167,7 +167,7 @@ main(int argc, char *argv[])
HDputs(" Test not compatible with current Virtual File Driver");
}
MPI_Finalize();
- HDexit(EXIT_FAILURE);
+ HDexit(EXIT_SUCCESS);
}
if ((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
diff --git a/testpar/t_pread.c b/testpar/t_pread.c
index 97f6d99..d79130b 100644
--- a/testpar/t_pread.c
+++ b/testpar/t_pread.c
@@ -35,7 +35,7 @@ const char *FILENAMES[NFILENAME + 1] = {"reloc_t_pread_data_file", "reloc_t_prea
#define LIMIT_NPROC 6
-hbool_t pass = true;
+hbool_t pass = TRUE;
static const char *random_hdf5_text = "Now is the time for all first-time-users of HDF5 to read their \
manual or go thru the tutorials!\n\
While you\'re at it, now is also the time to read up on MPI-IO.";
@@ -112,7 +112,7 @@ generate_test_file(MPI_Comm comm, int mpi_rank, int group_id)
float nextValue;
float * data_slice = NULL;
- pass = true;
+ pass = TRUE;
HDassert(comm != MPI_COMM_NULL);
@@ -256,14 +256,14 @@ generate_test_file(MPI_Comm comm, int mpi_rank, int group_id)
if (pass) {
if ((dset_id = H5Dcreate2(file_id, "dataset0", H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT)) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dcreate2() failed.\n";
}
}
if (pass) {
if ((H5Dwrite(dset_id, H5T_NATIVE_FLOAT, memspace, filespace, dxpl_id, data_slice)) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dwrite() failed.\n";
}
}
@@ -273,14 +273,14 @@ generate_test_file(MPI_Comm comm, int mpi_rank, int group_id)
if (pass) {
if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pcreate() failed.\n";
}
}
if (pass) {
if ((H5Pset_chunk(dcpl_id, 1, chunk)) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pset_chunk() failed.\n";
}
}
@@ -289,27 +289,27 @@ generate_test_file(MPI_Comm comm, int mpi_rank, int group_id)
if ((dset_id_ch = H5Dcreate2(file_id, "dataset0_chunked", H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT,
dcpl_id, H5P_DEFAULT)) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dcreate2() failed.\n";
}
}
if (pass) {
if ((H5Dwrite(dset_id_ch, H5T_NATIVE_FLOAT, memspace, filespace, dxpl_id, data_slice)) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dwrite() failed.\n";
}
}
if (pass || (dcpl_id != -1)) {
if (H5Pclose(dcpl_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pclose(dcpl_id) failed.\n";
}
}
if (pass || (dset_id_ch != -1)) {
if (H5Dclose(dset_id_ch) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dclose(dset_id_ch) failed.\n";
}
}
@@ -317,49 +317,49 @@ generate_test_file(MPI_Comm comm, int mpi_rank, int group_id)
/* close file, etc. */
if (pass || (dset_id != -1)) {
if (H5Dclose(dset_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dclose(dset_id) failed.\n";
}
}
if (pass || (memspace != -1)) {
if (H5Sclose(memspace) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Sclose(memspace) failed.\n";
}
}
if (pass || (filespace != -1)) {
if (H5Sclose(filespace) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Sclose(filespace) failed.\n";
}
}
if (pass || (file_id != -1)) {
if (H5Fclose(file_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Fclose(file_id) failed.\n";
}
}
if (pass || (dxpl_id != -1)) {
if (H5Pclose(dxpl_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pclose(dxpl_id) failed.\n";
}
}
if (pass || (fapl_id != -1)) {
if (H5Pclose(fapl_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pclose(fapl_id) failed.\n";
}
}
if (pass || (fctmpl != -1)) {
if (H5Pclose(fctmpl) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pclose(fctmpl) failed.\n";
}
}
@@ -661,14 +661,14 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id)
if (pass || (memspace != -1)) {
if (H5Sclose(memspace) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Sclose(memspace) failed.\n";
}
}
if (pass || (filespace != -1)) {
if (H5Sclose(filespace) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Sclose(filespace) failed.\n";
}
}
@@ -859,7 +859,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id)
if (pass || (filespace != -1)) {
if (H5Sclose(filespace) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Sclose(filespace) failed.\n";
}
}
@@ -956,7 +956,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id)
if (pass || (memspace != -1)) {
if (H5Sclose(memspace) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Sclose(memspace) failed.\n";
}
}
@@ -969,7 +969,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id)
if (pass || (dxpl_id != -1)) {
if (H5Pclose(dxpl_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pclose(dxpl_id) failed.\n";
}
}
@@ -978,28 +978,28 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id)
/* close file, etc. */
if (pass || (dset_id != -1)) {
if (H5Dclose(dset_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dclose(dset_id) failed.\n";
}
}
if (pass || (dset_id_ch != -1)) {
if (H5Dclose(dset_id_ch) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Dclose(dset_id_ch) failed.\n";
}
}
if (pass || (file_id != -1)) {
if (H5Fclose(file_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Fclose(file_id) failed.\n";
}
}
if (pass || (fapl_id != -1)) {
if (H5Pclose(fapl_id) < 0) {
- pass = false;
+ pass = FALSE;
failure_mssg = "H5Pclose(fapl_id) failed.\n";
}
}