diff options
Diffstat (limited to 'c++/src')
39 files changed, 176 insertions, 379 deletions
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index b93ae4a..29313c4 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 H5_OVERRIDE; + virtual DataType *decode() const 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 H5_OVERRIDE + fromClass() const override { return ("ArrayType"); } @@ -61,7 +61,7 @@ class H5_DLLCPP ArrayType : public DataType { ArrayType(const hid_t existing_id); // Noop destructor - virtual ~ArrayType() H5_OVERRIDE; + virtual ~ArrayType() override; // Default constructor ArrayType(); diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index e00a308..1b5153e 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 H5_OVERRIDE + fromClass() const override { return ("AtomType"); } @@ -68,7 +68,7 @@ class H5_DLLCPP AtomType : public DataType { AtomType(const AtomType &original); // Noop destructor - virtual ~AtomType() H5_OVERRIDE; + virtual ~AtomType() override; #endif // DOXYGEN_SHOULD_SKIP_THIS protected: diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 0e37c2b..954222c 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -14,7 +14,6 @@ #include <iostream> #include <string> -#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -313,7 +312,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 +323,8 @@ 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](); // Use overloaded function name_size = getName(name_C, name_size + 1); @@ -336,6 +335,7 @@ Attribute::getName() const // Clean up resource delete[] name_C; } + // Return attribute's name return (attr_name); } @@ -393,8 +393,8 @@ 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](); // Use overloaded function name_size = getName(name_C, len + 1); @@ -551,7 +551,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 71bfa14..47375a5 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() H5_OVERRIDE; + virtual void close() 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 H5_OVERRIDE; + virtual DataSpace getSpace() const override; // Returns the amount of storage size required for this attribute. - virtual hsize_t getStorageSize() const H5_OVERRIDE; + virtual hsize_t getStorageSize() const override; // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const H5_OVERRIDE; + virtual size_t getInMemDataSize() const 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 H5_OVERRIDE + fromClass() const override { return ("Attribute"); } // Gets the attribute id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this attribute. - virtual ~Attribute() H5_OVERRIDE; + virtual ~Attribute() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: // Sets the attribute id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) 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 H5_OVERRIDE; + virtual hid_t p_get_type() const 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 4424d89..59fd9cf 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 H5_OVERRIDE; + virtual DataType *decode() const 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 H5_OVERRIDE + fromClass() const override { return ("CompType"); } // Noop destructor. - virtual ~CompType() H5_OVERRIDE; + virtual ~CompType() override; private: // Contains common code that is used by the member functions diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h index 398918d..1accbd6 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 H5_OVERRIDE + fromClass() const override { return ("DSetAccPropList"); } @@ -51,7 +51,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { DSetAccPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetAccPropList() H5_OVERRIDE; + virtual ~DSetAccPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 47031db..ce56e30 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -14,7 +14,6 @@ #include <iostream> #include <string> -#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -717,8 +716,8 @@ 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) { - char *strg_C = new char[data_size + 1]; - HDmemset(strg_C, 0, data_size + 1); // clear buffer + // Create buffer for C string + char *strg_C = new char[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 +758,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 d50b2c5..8430f7a 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() H5_OVERRIDE; + virtual void close() 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 H5_OVERRIDE; + virtual DataSpace getSpace() const 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 H5_OVERRIDE; + virtual hsize_t getStorageSize() const override; // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const H5_OVERRIDE; + virtual size_t getInMemDataSize() const 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 H5_OVERRIDE + fromClass() const 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 H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this dataset. - virtual ~DataSet() H5_OVERRIDE; + virtual ~DataSet() override; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataset id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) 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 H5_OVERRIDE; + virtual hid_t p_get_type() const 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.h b/c++/src/H5DataSpace.h index 5583baa..87852a2 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -43,7 +43,7 @@ class H5_DLLCPP DataSpace : public IdComponent { DataSpace &operator=(const DataSpace &rhs); // Closes this dataspace. - virtual void close() H5_OVERRIDE; + virtual void close() override; // Makes copy of an existing dataspace. void copy(const DataSpace &like_space); @@ -115,25 +115,25 @@ class H5_DLLCPP DataSpace : public IdComponent { ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("DataSpace"); } // Gets the dataspace id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // Deletes the global constant static void deleteConstants(); // Destructor: properly terminates access to this dataspace. - virtual ~DataSpace() H5_OVERRIDE; + virtual ~DataSpace() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: // Sets the dataspace id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index cdf28cf..b00a526 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -32,7 +32,6 @@ #include "H5DataType.h" #include "H5AtomType.h" #include "H5PredType.h" -#include "H5private.h" #include "H5AbstractDs.h" #include "H5DataSet.h" #include "H5Attribute.h" @@ -316,8 +315,9 @@ DataType::encode() // Allocate buffer and call C function again to encode if (buf_size > 0) { - encoded_buf = static_cast<unsigned char *>(HDcalloc(1, buf_size)); - ret_value = H5Tencode(id, encoded_buf, &buf_size); + encoded_buf = new unsigned char[buf_size](); + + ret_value = H5Tencode(id, encoded_buf, &buf_size); if (ret_value < 0) { throw DataTypeIException("DataType::encode", "H5Tencode failed"); } @@ -970,7 +970,7 @@ DataType::close() // Free and reset buffer of encoded object description if it's been used if (encoded_buf != NULL) { - HDfree(encoded_buf); + delete[] encoded_buf; buf_size = 0; } } diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 7dd371b..109dcbb 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() H5_OVERRIDE; + virtual void close() 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 H5_OVERRIDE + fromClass() const 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 H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this datatype. - virtual ~DataType() H5_OVERRIDE; + virtual ~DataType() 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) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) 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.h b/c++/src/H5DcreatProp.h index b822c25..a2d5ff2 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 H5_OVERRIDE + fromClass() const override { return ("DSetCreatPropList"); } @@ -141,7 +141,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { DSetCreatPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetCreatPropList() H5_OVERRIDE; + virtual ~DSetCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 40faac2..1fd6878 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -13,7 +13,6 @@ #include <string> -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -324,8 +323,7 @@ DSetMemXferPropList::getDataTransform() const // If expression exists, calls C routine again to get it 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 + char *exp_C = new char[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 3925a57..24f8d70 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 H5_OVERRIDE + fromClass() const override { return ("DSetMemXferPropList"); } @@ -113,7 +113,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { DSetMemXferPropList(const hid_t plist_id); // Noop destructor - virtual ~DSetMemXferPropList() H5_OVERRIDE; + virtual ~DSetMemXferPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 6c7b533..2073365 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -13,7 +13,6 @@ #include <string> -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -219,8 +218,7 @@ EnumType::insert(const H5std_string &name, void *value) const 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 + char *name_C = new char[size + 1](); // temporary C-string for C API // 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 2501e4b..f9091ca 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 H5_OVERRIDE; + virtual DataType *decode() const 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 H5_OVERRIDE + fromClass() const 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() H5_OVERRIDE; + virtual ~EnumType() override; }; // end of EnumType } // namespace H5 diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 9970d22..e22f74b 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -90,84 +90,84 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); FileIException(); - virtual ~FileIException() throw() H5_OVERRIDE; + virtual ~FileIException() throw() override; }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException() throw() H5_OVERRIDE; + virtual ~GroupIException() throw() override; }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException() throw() H5_OVERRIDE; + virtual ~DataSpaceIException() throw() override; }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException() throw() H5_OVERRIDE; + virtual ~DataTypeIException() throw() override; }; class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ObjHeaderIException(); - virtual ~ObjHeaderIException() throw() H5_OVERRIDE; + virtual ~ObjHeaderIException() throw() override; }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException() throw() H5_OVERRIDE; + virtual ~PropListIException() throw() override; }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException() throw() H5_OVERRIDE; + virtual ~DataSetIException() throw() override; }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException() throw() H5_OVERRIDE; + virtual ~AttributeIException() throw() override; }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException() throw() H5_OVERRIDE; + virtual ~ReferenceException() throw() override; }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException() throw() H5_OVERRIDE; + virtual ~LibraryIException() throw() override; }; class H5_DLLCPP LocationException : public Exception { public: LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LocationException(); - virtual ~LocationException() throw() H5_OVERRIDE; + virtual ~LocationException() throw() override; }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException() throw() H5_OVERRIDE; + virtual ~IdComponentException() throw() override; }; // end of IdComponentException } // namespace H5 diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 53c7799..7d998e2 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 H5_OVERRIDE + fromClass() const override { return ("FileAccPropList"); } @@ -150,7 +150,7 @@ class H5_DLLCPP FileAccPropList : public PropList { FileAccPropList(const hid_t plist_id); // Noop destructor - virtual ~FileAccPropList() H5_OVERRIDE; + virtual ~FileAccPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 65daf8f..ba0c2e6 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 H5_OVERRIDE + fromClass() const override { return ("FileCreatPropList"); } @@ -91,7 +91,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { FileCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~FileCreatPropList() H5_OVERRIDE; + virtual ~FileCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5File.h b/c++/src/H5File.h index bdd7b84..daed073 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -39,7 +39,7 @@ class H5_DLLCPP H5File : public Group { const FileAccPropList &access_plist = FileAccPropList::DEFAULT); // Close this file. - virtual void close() H5_OVERRIDE; + virtual void close() 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 H5_OVERRIDE + fromClass() const override { return ("H5File"); } // Throw file exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override; // For CommonFG to get the file id. - virtual hid_t getLocId() const H5_OVERRIDE; + virtual hid_t getLocId() const override; // Default constructor H5File(); @@ -114,15 +114,15 @@ class H5_DLLCPP H5File : public Group { H5File(const H5File &original); // Gets the HDF5 file id. - virtual hid_t getId() const H5_OVERRIDE; + virtual hid_t getId() const override; // H5File destructor. - virtual ~H5File() H5_OVERRIDE; + virtual ~H5File() override; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the HDF5 file id. - virtual void p_setId(const hid_t new_id) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index e8df757..387520f 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 H5_OVERRIDE; + virtual DataType *decode() const 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 H5_OVERRIDE + fromClass() const override { return ("FloatType"); } @@ -79,7 +79,7 @@ class H5_DLLCPP FloatType : public AtomType { FloatType(const FloatType &original); // Noop destructor. - virtual ~FloatType() H5_OVERRIDE; + virtual ~FloatType() override; }; // end of FloatType } // namespace H5 diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index b5f7e51..e72d65c 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -24,20 +24,20 @@ namespace H5 { class H5_DLLCPP Group : public H5Object, public CommonFG { public: // Close this group. - virtual void close() H5_OVERRIDE; + virtual void close() override; ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const override { return ("Group"); } // Throw group exception. - virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const H5_OVERRIDE; + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override; // for CommonFG to get the file id. - virtual hid_t getLocId() const H5_OVERRIDE; + virtual hid_t getLocId() const 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 H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor - virtual ~Group() H5_OVERRIDE; + virtual ~Group() 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) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) override; #endif // DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 18bcbd3..d546d32 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -13,7 +13,6 @@ #include <string> -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5Library.h" @@ -399,8 +398,7 @@ 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](); name_size = H5Fget_name(temp_id, name_C, name_size + 1); diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 0dc930d..e662d90 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -24,10 +24,3 @@ * 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 f0f30ac..ec3dd19 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 H5_OVERRIDE; + virtual DataType *decode() const 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 H5_OVERRIDE + fromClass() const override { return ("IntType"); } @@ -61,7 +61,7 @@ class H5_DLLCPP IntType : public AtomType { IntType(const IntType &original); // Noop destructor. - virtual ~IntType() H5_OVERRIDE; + virtual ~IntType() override; }; // end of IntType } // namespace H5 diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h index 65a9673..accc7cd 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 H5_OVERRIDE + fromClass() const override { return ("LinkAccPropList"); } @@ -52,7 +52,7 @@ class H5_DLLCPP LinkAccPropList : public PropList { size_t getNumLinks() const; // Noop destructor - virtual ~LinkAccPropList() H5_OVERRIDE; + virtual ~LinkAccPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index c0c66a4..5570dbc 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 H5_OVERRIDE + fromClass() const override { return ("LinkCreatPropList"); } @@ -59,7 +59,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList { H5T_cset_t getCharEncoding() const; // Noop destructor - virtual ~LinkCreatPropList() H5_OVERRIDE; + virtual ~LinkCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index bb754a2..eb8dd4c 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -15,7 +15,6 @@ #include <iostream> using namespace std; -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -367,8 +366,7 @@ H5Location::getComment(const char *name, size_t buf_size) const tmp_len = comment_len; // Temporary buffer for char* comment - char *comment_C = new char[tmp_len + 1]; - HDmemset(comment_C, 0, tmp_len + 1); // clear buffer + char *comment_C = new char[tmp_len + 1](); // Used overloaded function ssize_t temp_len = getComment(name, tmp_len + 1, comment_C); @@ -1835,8 +1833,8 @@ 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](); ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT); if (ret_value < 0) { @@ -2046,9 +2044,8 @@ 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 - char *name_C = new char[name_len + 1]; - HDmemset(name_C, 0, name_len + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[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 +2099,8 @@ 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](); // call overloaded function to get the name ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 71109d3..cb803af 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -13,7 +13,6 @@ #include <string> -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -45,9 +44,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 +59,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 +486,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 +497,8 @@ 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](); // Use overloaded function name_size = getObjName(name_C, name_size + 1); @@ -534,8 +538,8 @@ 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](); // Use overloaded function name_size = getObjName(name_C, len + 1); diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index bc2f14a..9e5a541 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -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 H5_OVERRIDE = 0; + virtual hid_t getId() const override = 0; // Gets the name of this HDF5 object, i.e., Group, DataSet, or // DataType. @@ -122,10 +122,10 @@ 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) H5_OVERRIDE = 0; + virtual void p_setId(const hid_t new_id) override = 0; // Noop destructor. - virtual ~H5Object() H5_OVERRIDE; + virtual ~H5Object() override; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h index 0aa825b..5e2bf49 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 H5_OVERRIDE + fromClass() const override { return ("ObjCreatPropList"); } @@ -57,7 +57,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList { ObjCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~ObjCreatPropList() H5_OVERRIDE; + virtual ~ObjCreatPropList() override; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 9e67968..72d560d 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 @@ -469,63 +441,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 @@ -655,63 +595,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; @@ -845,62 +753,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 c4ac6b2..45f20ab 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 H5_OVERRIDE + fromClass() const override { return ("PredType"); } @@ -42,7 +42,7 @@ class H5_DLLCPP PredType : public AtomType { PredType(const PredType &original); // Noop destructor - virtual ~PredType() H5_OVERRIDE; + virtual ~PredType() 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 46e4931..7dca716 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -15,7 +15,6 @@ #include <string> -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -458,8 +457,7 @@ 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](); herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 2df326b..5320699 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() H5_OVERRIDE; + virtual void close() 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 H5_OVERRIDE + fromClass() const 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 H5_OVERRIDE; + virtual hid_t getId() const override; // Destructor: properly terminates access to this property list. - virtual ~PropList() H5_OVERRIDE; + virtual ~PropList() 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) H5_OVERRIDE; + virtual void p_setId(const hid_t new_id) 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 3e4013a..2dc3bdc 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 H5_OVERRIDE; + virtual DataType *decode() const 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 H5_OVERRIDE + fromClass() const override { return ("StrType"); } @@ -73,7 +73,7 @@ class H5_DLLCPP StrType : public AtomType { StrType(const StrType &original); // Noop destructor. - virtual ~StrType() H5_OVERRIDE; + virtual ~StrType() override; }; // end of StrType } // namespace H5 diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 583b9cd..a8d0504 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 H5_OVERRIDE; + virtual DataType *decode() const override; ///\brief Returns this class name. virtual H5std_string - fromClass() const H5_OVERRIDE + fromClass() const 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() H5_OVERRIDE; + virtual ~VarLenType() override; // Default constructor VarLenType(); |