From 0c6ff43fbccaf78196165db6660a30d37944ea78 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 5 Apr 2021 15:59:36 -0700 Subject: Normalizes C++ with develop --- c++/examples/chunks.cpp | 4 --- c++/examples/compound.cpp | 4 --- c++/examples/create.cpp | 4 --- c++/examples/extend_ds.cpp | 4 --- c++/examples/h5group.cpp | 4 --- c++/examples/readdata.cpp | 4 --- c++/examples/testh5c++.sh.in | 36 +++++--------------------- c++/examples/writedata.cpp | 4 --- c++/src/H5AbstractDs.h | 6 ++--- c++/src/H5ArrayType.h | 6 ++--- c++/src/H5AtomType.h | 6 ++--- c++/src/H5Attribute.cpp | 8 ++---- c++/src/H5Attribute.h | 6 ++--- c++/src/H5Classes.h | 6 ++--- c++/src/H5CommonFG.h | 6 ++--- c++/src/H5CompType.h | 6 ++--- c++/src/H5Cpp.h | 6 ++--- c++/src/H5CppDoc.h | 6 ++--- c++/src/H5DaccProp.cpp | 3 +-- c++/src/H5DaccProp.h | 6 ++--- c++/src/H5DataSet.cpp | 4 --- c++/src/H5DataSet.h | 6 ++--- c++/src/H5DataSpace.cpp | 7 +----- c++/src/H5DataSpace.h | 14 +++++------ c++/src/H5DataType.cpp | 4 --- c++/src/H5DataType.h | 6 ++--- c++/src/H5DcreatProp.cpp | 7 +++--- c++/src/H5DcreatProp.h | 8 +++--- c++/src/H5DxferProp.cpp | 5 ++-- c++/src/H5DxferProp.h | 6 ++--- c++/src/H5EnumType.h | 6 ++--- c++/src/H5Exception.cpp | 2 +- c++/src/H5Exception.h | 34 +++++++++++-------------- c++/src/H5FaccProp.cpp | 53 +++++++++++++++++++++++++++++++++----- c++/src/H5FaccProp.h | 12 ++++++--- c++/src/H5FcreatProp.cpp | 3 +-- c++/src/H5FcreatProp.h | 6 ++--- c++/src/H5File.cpp | 6 +---- c++/src/H5File.h | 18 ++++++------- c++/src/H5FloatType.h | 6 ++--- c++/src/H5Group.cpp | 4 --- c++/src/H5Group.h | 20 +++++++-------- c++/src/H5IdComponent.h | 6 ++--- c++/src/H5Include.h | 20 ++++++--------- c++/src/H5IntType.h | 6 ++--- c++/src/H5LaccProp.cpp | 3 +-- c++/src/H5LaccProp.h | 6 ++--- c++/src/H5LcreatProp.cpp | 3 +-- c++/src/H5LcreatProp.h | 6 ++--- c++/src/H5Library.h | 6 ++--- c++/src/H5Location.cpp | 11 ++++---- c++/src/H5Location.h | 6 ++--- c++/src/H5Object.cpp | 16 ++++++++---- c++/src/H5Object.h | 12 ++++----- c++/src/H5OcreatProp.cpp | 3 +-- c++/src/H5OcreatProp.h | 6 ++--- c++/src/H5PredType.cpp | 3 ++- c++/src/H5PredType.h | 8 +++--- c++/src/H5PropList.cpp | 7 +----- c++/src/H5PropList.h | 6 ++--- c++/src/H5StrType.cpp | 3 ++- c++/src/H5StrType.h | 6 ++--- c++/src/H5VarLenType.h | 6 ++--- c++/test/dsets.cpp | 56 +++++++++++++++-------------------------- c++/test/h5cpputil.cpp | 8 ++---- c++/test/h5cpputil.h | 8 +++--- c++/test/tarray.cpp | 31 +++++++++++------------ c++/test/tattr.cpp | 60 +++++++++++++++++++++----------------------- c++/test/tcompound.cpp | 18 ++++--------- c++/test/tdspl.cpp | 4 --- c++/test/testhdf5.cpp | 4 --- c++/test/tfile.cpp | 16 +++++------- c++/test/tfilter.cpp | 40 +++++++++++++---------------- c++/test/th5s.cpp | 6 +---- c++/test/titerate.cpp | 4 --- c++/test/tlinks.cpp | 6 +---- c++/test/tobject.cpp | 4 --- c++/test/trefer.cpp | 13 +++------- c++/test/ttypes.cpp | 7 +----- c++/test/tvlstr.cpp | 14 +++-------- 80 files changed, 346 insertions(+), 474 deletions(-) diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp index 365a7da..3717fcb 100644 --- a/c++/examples/chunks.cpp +++ b/c++/examples/chunks.cpp @@ -16,11 +16,7 @@ * We will read from the file created by extend.cpp */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp index 31a572a..8975845 100644 --- a/c++/examples/compound.cpp +++ b/c++/examples/compound.cpp @@ -17,11 +17,7 @@ * and read back fields' subsets. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp index ef2de36..e55230f 100644 --- a/c++/examples/create.cpp +++ b/c++/examples/create.cpp @@ -15,11 +15,7 @@ * This example writes a dataset to a new HDF5 file. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Cpp.h" diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp index e69c1c0..24f5f3e 100644 --- a/c++/examples/extend_ds.cpp +++ b/c++/examples/extend_ds.cpp @@ -18,11 +18,7 @@ * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include using std::cout; diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index 793ff8f..f9ec176 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -20,11 +20,7 @@ * the C version is used in this example. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 7441420..e247a8e 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -17,11 +17,7 @@ // information about the dataset in the SDS.h5 file is obtained. // -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in index 46fe5eb..44dc9e7 100644 --- a/c++/examples/testh5c++.sh.in +++ b/c++/examples/testh5c++.sh.in @@ -67,11 +67,7 @@ temp_FILES="a.out $applib" cat > $appmain < -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include "H5Cpp.h" @@ -95,19 +91,11 @@ EOF # generate prog1 cat > $prog1 < -#else - #include -#endif +#include #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cout; - using std::endl; -#endif // H5_NO_STD -#endif +using std::cout; +using std::endl; int sub1(void) { cout << "in sub1" << endl; @@ -117,19 +105,11 @@ EOF # generate prog2 cat > $prog2 < -#else - #include -#endif +#include #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cout; - using std::endl; -#endif // H5_NO_STD -#endif +using std::cout; +using std::endl; int sub2(void) { cout << "in sub2" << endl; @@ -142,11 +122,7 @@ EOF cat > $hdf5main < -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include "H5Cpp.h" diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp index ddd3460..f2b715a 100644 --- a/c++/examples/writedata.cpp +++ b/c++/examples/writedata.cpp @@ -20,11 +20,7 @@ * file is closed. Program reopens the file and reads and displays the result. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index fe6e033c..b84867b 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __AbstractDs_H -#define __AbstractDs_H +#ifndef H5AbstractDs_H +#define H5AbstractDs_H namespace H5 { @@ -81,4 +81,4 @@ class H5_DLLCPP AbstractDs { }; // end of AbstractDs } // namespace H5 -#endif // __AbstractDs_H +#endif // H5AbstractDs_H diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index c2a6493..4302352 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5ArrayType_H -#define __H5ArrayType_H +#ifndef H5ArrayType_H +#define H5ArrayType_H namespace H5 { @@ -69,4 +69,4 @@ class H5_DLLCPP ArrayType : public DataType { }; // end of ArrayType } // namespace H5 -#endif // __H5ArrayType_H +#endif // H5ArrayType_H diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index f5664b8..84da5e9 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5AtomType_H -#define __H5AtomType_H +#ifndef H5AtomType_H +#define H5AtomType_H namespace H5 { @@ -83,4 +83,4 @@ class H5_DLLCPP AtomType : public DataType { }; // end of AtomType } // namespace H5 -#endif // __H5AtomType_H +#endif // H5AtomType_H diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 3ce94a1..0e37c2b 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5private.h" // for HDfree @@ -41,7 +37,7 @@ namespace H5 { using std::cerr; using std::endl; -class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate +class H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor @@ -314,7 +310,7 @@ Attribute::getName(char *attr_name, size_t buf_size) const H5std_string Attribute::getName() const { - H5std_string attr_name(""); // attribute name to return + 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(0), NULL); diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 5a13c2e..41e5a31 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Attribute_H -#define __H5Attribute_H +#ifndef H5Attribute_H +#define H5Attribute_H namespace H5 { @@ -104,4 +104,4 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { }; // end of Attribute } // namespace H5 -#endif // __H5Attribute_H +#endif // H5Attribute_H diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h index 42e3d69..7820ce2 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Classes_H -#define __H5Classes_H +#ifndef H5Classes_H +#define H5Classes_H namespace H5 { class Exception; @@ -43,4 +43,4 @@ class H5File; class Attribute; class H5Library; } // namespace H5 -#endif // __H5Classes_H +#endif // H5Classes_H diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 2e5ccf3..d87f9ca 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __CommonFG_H -#define __CommonFG_H +#ifndef H5CommonFG_H +#define H5CommonFG_H namespace H5 { @@ -83,7 +83,7 @@ class H5_DLLCPP CommonFG { }; // end of CommonFG } // namespace H5 -#endif // __CommonFG_H +#endif // H5CommonFG_H /*************************************************************************** Design Note diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 6d2ce7e..6a4c093 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5CompType_H -#define __H5CompType_H +#ifndef H5CompType_H +#define H5CompType_H namespace H5 { @@ -124,4 +124,4 @@ class H5_DLLCPP CompType : public DataType { }; // end of CompType } // namespace H5 -#endif // __H5CompType_H +#endif // H5CompType_H diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index 8fea1f9..9272bdb 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Cpp_H -#define __H5Cpp_H +#ifndef H5Cpp_H +#define H5Cpp_H #include "H5Include.h" #include "H5Exception.h" @@ -58,4 +58,4 @@ #define HOFFSET(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER) #endif -#endif // __H5Cpp_H +#endif // H5Cpp_H diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index 29f3afc..4337a6f 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5CppDoc_H -#define __H5CppDoc_H +#ifndef H5CppDoc_H +#define H5CppDoc_H //------------------------------------------------------------------------- // The following section will be used to generate the 'Mainpage' @@ -92,4 +92,4 @@ /// This example shows how to work with groups. ///\example h5group.cpp -#endif // __H5CppDoc_H +#endif // H5CppDoc_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 627c4a4..7d6b250 100644 --- a/c++/src/H5DaccProp.h +++ b/c++/src/H5DaccProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5DSetAccPropList_H -#define __H5DSetAccPropList_H +#ifndef H5DSetAccPropList_H +#define H5DSetAccPropList_H namespace H5 { @@ -69,4 +69,4 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { }; // end of DSetAccPropList } // namespace H5 -#endif // __H5DSetAccPropList_H +#endif // H5DSetAccPropList_H diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index b080e9e..3a14975 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5private.h" // for HDfree diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index c07aad5..c745470 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5DataSet_H -#define __H5DataSet_H +#ifndef H5DataSet_H +#define H5DataSet_H namespace H5 { @@ -153,4 +153,4 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { }; // end of DataSet } // namespace H5 -#endif // __H5DataSet_H +#endif // H5DataSet_H diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 9c997d1..c20a88c 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" @@ -73,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 14d030f..470de74 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5DataSpace_H -#define __H5DataSpace_H +#ifndef H5DataSpace_H +#define H5DataSpace_H namespace H5 { @@ -43,7 +43,7 @@ class H5_DLLCPP DataSpace : public IdComponent { DataSpace &operator=(const DataSpace &rhs); // Closes this dataspace. - virtual void close(); + virtual void close() H5_OVERRIDE; // Makes copy of an existing dataspace. void copy(const DataSpace &like_space); @@ -115,13 +115,13 @@ class H5_DLLCPP DataSpace : public IdComponent { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("DataSpace"); } // Gets the dataspace id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Deletes the global constant static void deleteConstants(); @@ -133,7 +133,7 @@ class H5_DLLCPP DataSpace : public IdComponent { protected: // Sets the dataspace 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 @@ -155,4 +155,4 @@ class H5_DLLCPP DataSpace : public IdComponent { }; // end of DataSpace } // namespace H5 -#endif // __H5DataSpace_H +#endif // H5DataSpace_H diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 9db2732..3228dcb 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index f97f806..49f5348 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5DataType_H -#define __H5DataType_H +#ifndef H5DataType_H +#define H5DataType_H namespace H5 { @@ -183,4 +183,4 @@ class H5_DLLCPP DataType : public H5Object { }; // end of DataType } // namespace H5 -#endif // __H5DataType_H +#endif // H5DataType_H diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 4c71d5e..34be7ba 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_; } //-------------------------------------------------------------------------- @@ -775,8 +774,8 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, co // Programmer Binh-Minh Ribler - Mar, 2017 //-------------------------------------------------------------------------- void -DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname, - const H5std_string src_dsname, const DataSpace &sspace) const +DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string &src_fname, + const H5std_string &src_dsname, const DataSpace &sspace) const { setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace); } diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 74c4be0..820c0d1 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5DSCreatPropList_H -#define __H5DSCreatPropList_H +#ifndef H5DSCreatPropList_H +#define H5DSCreatPropList_H namespace H5 { @@ -123,7 +123,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { // Maps elements of a virtual dataset to elements of the source dataset. void setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname, const DataSpace &sspace) const; - void setVirtual(const DataSpace &vspace, const H5std_string src_fname, const H5std_string src_dsname, + void setVirtual(const DataSpace &vspace, const H5std_string &src_fname, const H5std_string &src_dsname, const DataSpace &sspace) const; ///\brief Returns this class name. @@ -159,4 +159,4 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { }; // end of DSetCreatPropList } // namespace H5 -#endif // __H5DSCreatPropList_H +#endif // H5DSCreatPropList_H diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 7f123a7..43ea6f4 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -72,8 +72,7 @@ DSetMemXferPropList::getConstant() void DSetMemXferPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- @@ -312,7 +311,7 @@ DSetMemXferPropList::getDataTransform() const { // Initialize string to "", so that if there is no expression, the returned // string will be empty - H5std_string expression(""); + H5std_string expression; // Preliminary call to get the expression's length ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0); diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index daeb83e..1e4d668 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5DSetMemXferPropList_H -#define __H5DSetMemXferPropList_H +#ifndef H5DSetMemXferPropList_H +#define H5DSetMemXferPropList_H namespace H5 { @@ -131,4 +131,4 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { }; // end of DSetMemXferPropList } // namespace H5 -#endif // __H5DSetMemXferPropList_H +#endif // H5DSetMemXferPropList_H diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index b228d31..484405a 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5EnumType_H -#define __H5EnumType_H +#ifndef H5EnumType_H +#define H5EnumType_H namespace H5 { @@ -87,4 +87,4 @@ class H5_DLLCPP EnumType : public DataType { }; // end of EnumType } // namespace H5 -#endif // __H5EnumType_H +#endif // H5EnumType_H diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index f6f33e0..6769439 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -25,7 +25,7 @@ const char Exception::DEFAULT_MSG[] = "No detailed information provided"; ///\brief Default constructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::Exception() : detail_message(""), func_name("") +Exception::Exception() { } diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index c7b117b..9970d22 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -12,17 +12,13 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Exception_H -#define __H5Exception_H +#ifndef H5Exception_H +#define H5Exception_H #include namespace H5 { -#ifdef H5_NO_STD -#define H5std_string ::string -#else #define H5std_string std::string -#endif /*! \class Exception \brief Exception provides wrappers of HDF5 error handling functions. @@ -94,86 +90,86 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); FileIException(); - virtual ~FileIException() throw(); + virtual ~FileIException() throw() H5_OVERRIDE; }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException() throw(); + virtual ~GroupIException() throw() H5_OVERRIDE; }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException() throw(); + virtual ~DataSpaceIException() throw() H5_OVERRIDE; }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException() throw(); + virtual ~DataTypeIException() throw() H5_OVERRIDE; }; class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ObjHeaderIException(); - virtual ~ObjHeaderIException() throw(); + virtual ~ObjHeaderIException() throw() H5_OVERRIDE; }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException() throw(); + virtual ~PropListIException() throw() H5_OVERRIDE; }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException() throw(); + virtual ~DataSetIException() throw() H5_OVERRIDE; }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException() throw(); + virtual ~AttributeIException() throw() H5_OVERRIDE; }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException() throw(); + virtual ~ReferenceException() throw() H5_OVERRIDE; }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException() throw(); + virtual ~LibraryIException() throw() H5_OVERRIDE; }; class H5_DLLCPP LocationException : public Exception { public: LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LocationException(); - virtual ~LocationException() throw(); + virtual ~LocationException() throw() H5_OVERRIDE; }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException() throw(); + virtual ~IdComponentException() throw() H5_OVERRIDE; }; // end of IdComponentException } // namespace H5 -#endif // __H5Exception_H +#endif // H5Exception_H diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index f81c1f9..a79ada3 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include using std::cerr; @@ -80,8 +76,7 @@ FileAccPropList::getConstant() void FileAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- @@ -697,6 +692,52 @@ FileAccPropList::getGcReferences() const } //-------------------------------------------------------------------------- +// Function: FileAccPropList::setFileLocking +///\brief Sets file locking flags. +///\param use_file_locking - IN: Flag that determines if file locks should +// be used or not. +///\param ignore_when_disabled - IN: Flag that determines if file locks +// should be be used when disabled on the file system or not. +///\exception H5::PropListIException +///\par Description +/// For information, please refer to the H5Pset_file_locking API in +/// the HDF5 C Reference Manual. +// Programmer Dana Robinson - 2020 +//-------------------------------------------------------------------------- +void +FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const +{ + herr_t ret_value = H5Pset_file_locking(id, use_file_locking, ignore_when_disabled); + + if (ret_value < 0) { + throw PropListIException("FileAccPropList::setFileLocking", "H5Pset_file_locking failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: FileAccPropList::getFileLocking +///\brief Gets file locking flags. +///\param use_file_locking - OUT: Flag that determines if file locks +// should be used or not. +///\param ignore_when_disabled - OUT: Flag that determines if file locks +// should be be used when disabled on the file system or not. +///\exception H5::PropListIException +///\par Description +/// For information, please refer to the H5Pget_file_locking API in +/// the HDF5 C Reference Manual. +// Programmer Dana Robinson - 2020 +//-------------------------------------------------------------------------- +void +FileAccPropList::getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const +{ + herr_t ret_value = H5Pget_file_locking(id, &use_file_locking, &ignore_when_disabled); + + if (ret_value < 0) { + throw PropListIException("FileAccPropList::getFileLocking", "H5Pget_file_locking failed"); + } +} + +//-------------------------------------------------------------------------- // Function: FileAccPropList::setLibverBounds ///\brief Sets bounds on versions of library format to be used when creating /// or writing objects. diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 69e2727..998f870 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5FileAccPropList_H -#define __H5FileAccPropList_H +#ifndef H5FileAccPropList_H +#define H5FileAccPropList_H namespace H5 { @@ -122,6 +122,12 @@ class H5_DLLCPP FileAccPropList : public PropList { // Returns garbage collecting references setting. unsigned getGcReferences() const; + // Sets file locking parameters. + void setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const; + + // Gets file locking parameters. + void getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const; + // Sets bounds on versions of library format to be used when creating // or writing objects. void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const; @@ -162,4 +168,4 @@ class H5_DLLCPP FileAccPropList : public PropList { }; // end of FileAccPropList } // namespace H5 -#endif // __H5FileAccPropList_H +#endif // H5FileAccPropList_H 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 2b3f46f..00ae0b1 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5FileCreatPropList_H -#define __H5FileCreatPropList_H +#ifndef H5FileCreatPropList_H +#define H5FileCreatPropList_H namespace H5 { @@ -109,4 +109,4 @@ class H5_DLLCPP FileCreatPropList : public PropList { }; // end of FileCreatPropList } // namespace H5 -#endif // __H5FileCreatPropList_H +#endif // H5FileCreatPropList_H diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 4c866de..9a6f191 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" @@ -184,7 +180,7 @@ H5File::H5File(hid_t existing_id) : Group() ///\param original - IN: H5File instance to copy // December 2000 //-------------------------------------------------------------------------- -H5File::H5File(const H5File &original) : Group() +H5File::H5File(const H5File &original) : Group(original) { id = original.getId(); incRefCount(); // increment number of references to this id diff --git a/c++/src/H5File.h b/c++/src/H5File.h index b3f4f2c..6126eec 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5File_H -#define __H5File_H +#ifndef H5File_H +#define H5File_H namespace H5 { @@ -39,7 +39,7 @@ class H5_DLLCPP H5File : public Group { const FileAccPropList &access_plist = FileAccPropList::DEFAULT); // Close this file. - virtual void close(); + virtual void close() H5_OVERRIDE; // Gets a copy of the access property list of this file. FileAccPropList getAccessPlist() const; @@ -96,16 +96,16 @@ class H5_DLLCPP H5File : public Group { ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("H5File"); } // Throw file exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; // For CommonFG to get the file id. - virtual hid_t getLocId() const; + virtual hid_t getLocId() const H5_OVERRIDE; // Default constructor H5File(); @@ -114,7 +114,7 @@ class H5_DLLCPP H5File : public Group { H5File(const H5File &original); // Gets the HDF5 file id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // H5File destructor. virtual ~H5File(); @@ -122,7 +122,7 @@ class H5_DLLCPP H5File : public Group { protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the HDF5 file 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: @@ -136,4 +136,4 @@ class H5_DLLCPP H5File : public Group { }; // end of H5File } // namespace H5 -#endif // __H5File_H +#endif // H5File_H diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index e254646..c76be95 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5FloatType_H -#define __H5FloatType_H +#ifndef H5FloatType_H +#define H5FloatType_H namespace H5 { @@ -84,4 +84,4 @@ class H5_DLLCPP FloatType : public AtomType { }; // end of FloatType } // namespace H5 -#endif // __H5FloatType_H +#endif // H5FloatType_H diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 8086fc3..fe791da 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index ae5bb4a..b5f7e51 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __Group_H -#define __Group_H +#ifndef H5Group_H +#define H5Group_H namespace H5 { @@ -24,20 +24,20 @@ namespace H5 { class H5_DLLCPP Group : public H5Object, public CommonFG { public: // Close this group. - virtual void close(); + virtual void close() H5_OVERRIDE; ///\brief Returns this class name. virtual H5std_string - fromClass() const + fromClass() const H5_OVERRIDE { return ("Group"); } // Throw group exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; // for CommonFG to get the file id. - virtual hid_t getLocId() const; + virtual hid_t getLocId() const H5_OVERRIDE; // Creates a group by way of dereference. Group(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, @@ -63,10 +63,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { Group(const Group &original); // Gets the group id. - virtual hid_t getId() const; + virtual hid_t getId() const H5_OVERRIDE; // Destructor - virtual ~Group(); + virtual ~Group() H5_OVERRIDE; // Creates a copy of an existing group using its id. Group(const hid_t group_id); @@ -74,7 +74,7 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the group 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: @@ -83,4 +83,4 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { }; // end of Group } // namespace H5 -#endif // __Group_H +#endif // H5Group_H diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index b756a3d..383d42d 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __IdComponent_H -#define __IdComponent_H +#ifndef H5IdComponent_H +#define H5IdComponent_H namespace H5 { @@ -113,4 +113,4 @@ class H5_DLLCPP IdComponent { }; // end class IdComponent } // namespace H5 -#endif // __IdComponent_H +#endif // H5IdComponent_H diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 1f03150..0dc930d 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -14,19 +14,6 @@ #include -// Define bool type for platforms that don't support bool yet -#ifdef BOOL_NOTDEFINED -#ifdef false -#undef false -#endif -#ifdef true -#undef true -#endif -typedef int bool; -const bool false = 0; -const bool true = 1; -#endif - // These are defined in H5Opkg.h, which should not be included in the C++ API, // so re-define them here for now. @@ -37,3 +24,10 @@ const bool true = 1; * magic number as prefix and checksum as suffix for all chunks. */ #define H5O_VERSION_2 2 + +// Define H5_OVERRIDE to override for C++11. +#if defined(__cplusplus) && (201103L <= __cplusplus) +#define H5_OVERRIDE override +#else +#define H5_OVERRIDE +#endif diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 7841518..185c8f0 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5IntType_H -#define __H5IntType_H +#ifndef H5IntType_H +#define H5IntType_H namespace H5 { @@ -66,4 +66,4 @@ class H5_DLLCPP IntType : public AtomType { }; // end of IntType } // namespace H5 -#endif // __H5IntType_H +#endif // H5IntType_H 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 e6cf888..4fa516c 100644 --- a/c++/src/H5LaccProp.h +++ b/c++/src/H5LaccProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5LinkAccPropList_H -#define __H5LinkAccPropList_H +#ifndef H5LinkAccPropList_H +#define H5LinkAccPropList_H namespace H5 { @@ -70,4 +70,4 @@ class H5_DLLCPP LinkAccPropList : public PropList { }; // end of LinkAccPropList } // namespace H5 -#endif // __H5LinkAccPropList_H +#endif // H5LinkAccPropList_H diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 29721c1..63fe861 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_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index e5a9d7a..aea38e7 100644 --- a/c++/src/H5LcreatProp.h +++ b/c++/src/H5LcreatProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5LinkCreatPropList_H -#define __H5LinkCreatPropList_H +#ifndef H5LinkCreatPropList_H +#define H5LinkCreatPropList_H namespace H5 { @@ -77,4 +77,4 @@ class H5_DLLCPP LinkCreatPropList : public PropList { }; // end of LinkCreatPropList } // namespace H5 -#endif // __H5LinkCreatPropList_H +#endif // H5LinkCreatPropList_H diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index 9a73eee..3df8d56 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Library_H -#define __H5Library_H +#ifndef H5Library_H +#define H5Library_H namespace H5 { @@ -69,4 +69,4 @@ class H5_DLLCPP H5Library { }; // end of H5Library } // namespace H5 -#endif // __H5Library_H +#endif // H5Library_H diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 4ded68e..46f47bb 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -348,7 +348,7 @@ H5Location::getComment(const char *name, size_t buf_size) const { // Initialize string to "", so that if there is no comment, the returned // string will be empty - H5std_string comment(""); + 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); @@ -400,6 +400,7 @@ H5Location::getComment(const H5std_string &name, size_t buf_size) const { return (getComment(name.c_str(), buf_size)); } + #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -648,6 +649,7 @@ H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const return (obj_type); } #endif // DOXYGEN_SHOULD_SKIP_THIS + #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- @@ -706,6 +708,7 @@ H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const } return (obj_type); } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::getRegion @@ -1818,7 +1821,7 @@ H5Location::getLinkval(const char *name, size_t size) const H5L_info2_t linkinfo; char * value_C; // value in C string size_t val_size = size; - H5std_string value = ""; + H5std_string value; herr_t ret_value; // if user doesn't provide buffer size, determine it @@ -2294,7 +2297,6 @@ H5Location::childObjVersion(const H5std_string &objname) const } #ifndef H5_NO_DEPRECATED_SYMBOLS -#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::getObjTypeByIdx ///\brief Returns the type of an object in this group, given the @@ -2372,7 +2374,6 @@ H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const return (obj_type); } -#endif // DOXYGEN_SHOULD_SKIP_THIS #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- @@ -2435,6 +2436,4 @@ H5Location::~H5Location() { } -#endif // DOXYGEN_SHOULD_SKIP_THIS - } // namespace H5 diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 9f61f20..740d0ce 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Location_H -#define __H5Location_H +#ifndef H5Location_H +#define H5Location_H #include "H5Classes.h" // constains forward class declarations @@ -339,4 +339,4 @@ class H5_DLLCPP H5Location : public IdComponent { }; // end of H5Location } // namespace H5 -#endif // __H5Location_H +#endif // H5Location_H diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 8532089..71109d3 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -42,8 +42,11 @@ namespace H5 { #ifndef DOXYGEN_SHOULD_SKIP_THIS // userAttrOpWrpr interfaces between the user's function and the // C library function H5Aiterate2 -extern "C" herr_t -userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data) +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) { H5std_string s_attr_name = H5std_string(attr_name); UserData4Aiterate *myData = reinterpret_cast(op_data); @@ -53,8 +56,9 @@ userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, voi // userVisitOpWrpr interfaces between the user's function and the // C library function H5Ovisit3 -extern "C" herr_t -userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, void *op_data) +static herr_t +userVisitOpWrpr(H5_ATTR_UNUSED hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, + void *op_data) { H5std_string s_attr_name = H5std_string(attr_name); UserData4Visit *myData = reinterpret_cast(op_data); @@ -62,6 +66,8 @@ userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info return status; } +} // extern "C" + //-------------------------------------------------------------------------- // Function: H5Object default constructor (protected) // Programmer Binh-Minh Ribler - 2000 @@ -473,7 +479,7 @@ H5Object::getObjName(char *obj_name, size_t buf_size) const H5std_string H5Object::getObjName() const { - H5std_string obj_name(""); // object name to return + 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(0)); diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 7ba57ed..bc2f14a 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5Object_H -#define __H5Object_H +#ifndef H5Object_H +#define H5Object_H namespace H5 { @@ -106,7 +106,7 @@ class H5_DLLCPP H5Object : public H5Location { void removeAttr(const H5std_string &name) const; // Returns an identifier. - virtual hid_t getId() const = 0; + virtual hid_t getId() const H5_OVERRIDE = 0; // Gets the name of this HDF5 object, i.e., Group, DataSet, or // DataType. @@ -122,14 +122,14 @@ class H5_DLLCPP H5Object : public H5Location { // Sets the identifier of this object to a new value. - this one // doesn't increment reference count - virtual void p_setId(const hid_t new_id) = 0; + virtual void p_setId(const hid_t new_id) H5_OVERRIDE = 0; // Noop destructor. - virtual ~H5Object(); + virtual ~H5Object() H5_OVERRIDE; #endif // DOXYGEN_SHOULD_SKIP_THIS }; // end of H5Object } // namespace H5 -#endif // __H5Object_H +#endif // H5Object_H 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 ec6e9c8..7f6d411 100644 --- a/c++/src/H5OcreatProp.h +++ b/c++/src/H5OcreatProp.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5ObjCreatPropList_H -#define __H5ObjCreatPropList_H +#ifndef H5ObjCreatPropList_H +#define H5ObjCreatPropList_H namespace H5 { @@ -75,4 +75,4 @@ class H5_DLLCPP ObjCreatPropList : public PropList { }; // end of ObjCreatPropList } // namespace H5 -#endif // __H5ObjCreatPropList_H +#endif // H5ObjCreatPropList_H diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index b97a2b8..9e67968 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -27,6 +27,7 @@ #include "H5DataType.h" #include "H5AtomType.h" #include "H5PredType.h" +#include "H5private.h" namespace H5 { @@ -89,7 +90,7 @@ PredType::operator=(const PredType &rhs) // These dummy functions do not inherit from DataType - they'll // throw an DataTypeIException if invoked. void -PredType::commit(H5Location &loc, const char *name) +PredType::commit(H5_ATTR_UNUSED H5Location &loc, H5_ATTR_UNUSED const char *name) { throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!"); diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 19d8798..b40d2b3 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5PredType_H -#define __H5PredType_H +#ifndef H5PredType_H +#define H5PredType_H namespace H5 { @@ -435,11 +435,11 @@ class H5_DLLCPP PredType : public AtomType { #if H5_SIZEOF_UINT_FAST64_T != 0 static PredType *NATIVE_UINT_FAST64_; #endif /* H5_SIZEOF_UINT_FAST64_T */ - // End of Declaration of pointers + // End of Declaration of pointers #endif // DOXYGEN_SHOULD_SKIP_THIS }; // end of PredType } // namespace H5 -#endif // __H5PredType_H +#endif // H5PredType_H diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index c32f852..2c80255 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include @@ -75,8 +71,7 @@ PropList::getConstant() void PropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index cdd9619..12c8b4b 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5PropList_H -#define __H5PropList_H +#ifndef H5PropList_H +#define H5PropList_H namespace H5 { @@ -144,4 +144,4 @@ class H5_DLLCPP PropList : public IdComponent { }; // end of PropList } // namespace H5 -#endif // __H5PropList_H +#endif // H5PropList_H diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 32f336f..5df48f3 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -32,6 +32,7 @@ #include "H5StrType.h" #include "H5DataSet.h" #include "H5PredType.h" +#include "H5private.h" namespace H5 { @@ -104,7 +105,7 @@ 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(const int dummy, const size_t &size) : AtomType() +StrType::StrType(H5_ATTR_UNUSED const int dummy, const size_t &size) : AtomType() { // use DataType::copy to make a copy of the string predefined type // then set its length diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index b24cbef..d272c53 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5StrType_H -#define __H5StrType_H +#ifndef H5StrType_H +#define H5StrType_H namespace H5 { @@ -78,4 +78,4 @@ class H5_DLLCPP StrType : public AtomType { }; // end of StrType } // namespace H5 -#endif // __H5StrType_H +#endif // H5StrType_H diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 674b49d..f767e0e 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __H5VarLenType_H -#define __H5VarLenType_H +#ifndef H5VarLenType_H +#define H5VarLenType_H namespace H5 { @@ -61,4 +61,4 @@ class H5_DLLCPP VarLenType : public DataType { }; // end of VarLenType } // namespace H5 -#endif // __H5VarLenType_H +#endif // H5VarLenType_H diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 65949b6..356112e 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -23,11 +23,7 @@ ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -163,8 +159,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 @@ -172,8 +167,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 @@ -253,8 +247,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 @@ -398,13 +391,13 @@ test_tconv(H5File &file) /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encode and decode enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encode and decode enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- @@ -696,10 +689,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 @@ -889,8 +880,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 @@ -968,8 +958,7 @@ test_types(H5File &file) cerr << " <<< " << "bitfield_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; + delete dset; return -1; } @@ -1000,8 +989,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 } @@ -1035,10 +1023,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 } @@ -1071,10 +1057,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 } @@ -1161,7 +1145,7 @@ const int RANK1 = 1; const H5std_string FILE_ACCPLIST("test_accplist.h5"); static herr_t -test_chunk_cache(FileAccPropList fapl) +test_chunk_cache(const FileAccPropList &fapl) { SUBTEST("DSetAccPropList::set/getChunkCache"); diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index e212aa3..78169b2 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -19,11 +19,7 @@ ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -218,7 +214,7 @@ InvalidActionException::InvalidActionException() : Exception() // func - IN: Name of the function where failure should occur // message - IN: Message //-------------------------------------------------------------------------- -InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message) +InvalidActionException::InvalidActionException(const H5std_string &func, const H5std_string &message) : Exception(func, message) { } @@ -247,7 +243,7 @@ TestFailedException::TestFailedException() : Exception() // func - IN: Name of the function where failure should occur // message - IN: Message //-------------------------------------------------------------------------- -TestFailedException::TestFailedException(const H5std_string func, const H5std_string message) +TestFailedException::TestFailedException(const H5std_string &func, const H5std_string &message) : Exception(func, message) { } diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 6a9187a..444bc68 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -19,8 +19,8 @@ ***************************************************************************/ -#ifndef _h5cpputil_h -#define _h5cpputil_h +#ifndef H5cpputil_H +#define H5cpputil_H #include "h5test.h" @@ -48,14 +48,14 @@ void issue_fail_msg(const char *where, int line, const char *file_name, const ch class InvalidActionException : public Exception { public: - InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + InvalidActionException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); InvalidActionException(); virtual ~InvalidActionException() throw(); }; class TestFailedException : public Exception { public: - TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + TestFailedException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); TestFailedException(); virtual ~TestFailedException() throw(); }; diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index ba71da8..7525c5f 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -16,11 +16,7 @@ tarray.cpp - HDF5 C++ testing the array datatype functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -85,7 +81,7 @@ test_array_compound_array() // Initialize array data to write for (idxi = 0; idxi < SPACE1_DIM1; idxi++) for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { - wdata[idxi][idxj].i = idxi * 10 + idxj; + wdata[idxi][idxj].i = static_cast(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; @@ -182,8 +178,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]=%zd, tdims1[%d]=z%d\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -200,8 +197,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]=%zd, tdims1[%d]=%zd\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -250,8 +248,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]=%zd, tdims1[%d]=%zd\n", - ii, rdims1[ii], ii, tdims1[ii]); + TestErrPrintf( + "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii, + rdims1[ii], ii, tdims1[ii]); continue; } // end if @@ -266,9 +265,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[%d][%d].i=%d, rdata[%d][%d].i=%d\n", - idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); + TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, " + "rdata[%lld][%lld].i=%d\n", + idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i); continue; } // end if } // end for @@ -387,7 +386,7 @@ test_array_info() // Initialize array data to write for (idxi = 0; idxi < SPACE1_DIM1; idxi++) for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { - wdata[idxi][idxj].i = idxi * 10 + idxj; + wdata[idxi][idxj].i = static_cast(idxi * 10 + idxj); for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; @@ -459,7 +458,7 @@ test_array_info() for (ii = 0; ii < ndims; ii++) if (rdims1[ii] != tdims1[ii]) { TestErrPrintf( - "Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, + "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii, rdims1[ii], ii, tdims1[ii]); continue; } // end if diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index e308a3a..adaa237 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -17,11 +17,7 @@ C attribute interface (H5A) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -173,8 +169,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[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Create two more attributes for this dataset, but only write to one. Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att_space); @@ -189,7 +185,7 @@ 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[%d]=%d,read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close both attributes @@ -452,8 +448,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[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Close attribute attr1.close(); @@ -476,7 +472,7 @@ 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[%d]=%d,read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); // Close attribute @@ -541,7 +537,7 @@ 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[%d]=%d, read_data1[%d]=%d\n", + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); /* @@ -572,9 +568,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[%d][%d]=%d, read_data2[%d][%d]=%d\n", - __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " + "read_data2[%llu][%llu]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); } PASSED(); } // end try block @@ -775,16 +771,16 @@ test_attr_compound_read() hsize_t ii, jj; 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))) { - TestErrPrintf( - "%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].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[%d][%d].d=%f, read_data4[%d][%d].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[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", - __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c); + 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", + __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", + __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", + __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c); } /* end if */ // Verify name @@ -1048,7 +1044,7 @@ test_attr_mult_read() 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 %d\n", __LINE__, + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__, (int)dims[0], ATTR1_DIM1); /* Verify Datatype */ @@ -1076,8 +1072,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[%d]=%d,read_data1[%d]=%d\n", __LINE__, - i, attr_data1[i], i, read_data1[i]); + TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n", + __LINE__, i, attr_data1[i], i, read_data1[i]); // Verify Name H5std_string attr_name = attr.getName(); @@ -1131,9 +1127,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[%d][%d]=%d, read_data2[%d][%d]=%d\n", - __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, " + "read_data2[%llu][%llu]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); // Verify Name attr_name = attr.getName(); @@ -1186,8 +1182,8 @@ test_attr_mult_read() 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[%d][%d][%d]=%f, " - "read_data3[%d][%d][%d]=%f\n", + TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, " + "read_data3[%llu][%llu][%llu]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); // Verify Name diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 641002e..2170a9d 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -16,11 +16,7 @@ tcompound.cpp - HDF5 C++ testing the compound data type functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -180,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() /*------------------------------------------------------------------------- @@ -291,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() /*------------------------------------------------------------------------- @@ -411,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() /*------------------------------------------------------------------------- @@ -491,7 +484,7 @@ test_compound_5() int_array.close(); /* Check results */ - if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim || + if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) != 0 || src[1].tdim != dst[1].tdim || src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] || src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) { H5_FAILED(); @@ -508,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() /*------------------------------------------------------------------------- diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index fc73a6a..257233e 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -17,11 +17,7 @@ list functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index da5e2a4..71428ce 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -38,11 +38,7 @@ GetTestNumErrs() -- Retrieve the number of testing errors ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index b082f0a..255fc30 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -20,11 +20,7 @@ h5_fileaccess() -- in h5test.c, returns a file access template ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -179,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 @@ -264,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() diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 1ded033..e89838c 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -16,11 +16,7 @@ tfilter.cpp - HDF5 C++ testing various filters and their combination. ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -49,20 +45,18 @@ static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, /* Temporary filter IDs used for testing */ const int H5Z_FILTER_BOGUS = 305; -#if 0 // H5_ATTR_UNUSED variables caused warning, so duplicated below with NULL instead -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); -#endif -static size_t filter_bogus(size_t nbytes); +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); + /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- @@ -79,13 +73,15 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ *------------------------------------------------------------------------- */ static size_t -#if 0 // H5_ATTR_UNUSED variables caused warning, so duplicated below with NULL instead -filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, - size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) -#endif -filter_bogus(size_t nbytes) +filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) { + (void)flags; + (void)cd_nelmts; + (void)cd_values; + (void)buf_size; + (void)buf; + return nbytes; } diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index e57ac04..9952e68 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -19,11 +19,7 @@ EXTERNAL ROUTINES/VARIABLES: ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -516,7 +512,7 @@ test_h5s_compound_scalar_read() dataset.read(&rdata, type); // Verify read data - if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) { + if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) { cerr << "scalar data different: space4_data.c1=" << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl; cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 1fb2f57..17620ca 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -16,11 +16,7 @@ titerate.cpp - HDF5 C++ testing iterate related functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 231bff2..e8dad5b 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -16,11 +16,7 @@ C link interface (H5L) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -593,7 +589,7 @@ visit_obj_cb(H5Object &obj, const H5std_string name, const H5O_info2_t *oinfo, v ovisit_ud_t *op_data = static_cast(_op_data); // Check for correct object information - if (strcmp(op_data->info[op_data->idx].path, name.c_str())) + if (strcmp(op_data->info[op_data->idx].path, name.c_str()) != 0) return (H5_ITER_ERROR); if (op_data->info[op_data->idx].type != oinfo->type) return (H5_ITER_ERROR); diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 87abd43..5892f39 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -16,11 +16,7 @@ tobject.cpp - HDF5 C++ testing object related functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Cpp.h" // C++ API header file diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 5ec04cd..604ccc0 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -17,11 +17,7 @@ Reference interface (H5R) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -183,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() */ /*------------------------------------------------------------------------- @@ -378,8 +373,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() /*------------------------------------------------------------------------- @@ -522,8 +516,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() */ /*------------------------------------------------------------------------- diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index cf32b2b..b633740 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -16,11 +16,7 @@ ttypes.cpp - HDF5 C++ testing the general datatype functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -806,8 +802,7 @@ test_named() issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg()); } - if (ds_type) - delete ds_type; + delete ds_type; } // test_named /*------------------------------------------------------------------------- diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index cf43371..9c0f78a 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -18,11 +18,7 @@ EXTERNAL ROUTINES/VARIABLES: ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; @@ -187,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(1, sizeof(char)); + dynstring_ds_write = (char *)HDcalloc(2, sizeof(char)); HDmemset(dynstring_ds_write, 'A', 1); // Write data to the dataset, then read it back. @@ -317,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() /*------------------------------------------------------------------------- @@ -531,8 +526,7 @@ test_vlstring_type() issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // end test_vlstring_type() /*------------------------------------------------------------------------- @@ -865,7 +859,7 @@ read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, cha dset.read(&data_read, type, space, space); dset.close(); - if (HDstrcmp(data, data_read)) + if (HDstrcmp(data, data_read) != 0) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); HDfree(data_read); -- cgit v0.12