summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/src/H5DataSet.cpp62
-rw-r--r--c++/src/H5DataSet.h3
-rw-r--r--c++/test/dsets.cpp89
-rw-r--r--c++/test/ttypes.cpp1
-rw-r--r--hl/test/test_image.c11
-rw-r--r--release_docs/RELEASE.txt7
-rw-r--r--src/H5Dmpio.c2
-rw-r--r--src/H5Eprivate.h13
-rw-r--r--test/dt_arith.c93
-rw-r--r--testpar/t_dset.c67
-rw-r--r--testpar/testphdf5.c3
-rw-r--r--testpar/testphdf5.h12
12 files changed, 140 insertions, 223 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 10188ae..b376e57 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -42,7 +42,6 @@ using std::endl;
//--------------------------------------------------------------------------
// Function: DataSet default constructor
///\brief Default constructor: creates a stub DataSet.
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
@@ -52,7 +51,6 @@ DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
// Function: DataSet overloaded constructor
///\brief Creates an DataSet object using the id of an existing dataset.
///\param existing_id - IN: Id of an existing dataset
-// Programmer Binh-Minh Ribler - 2000
// Description
// incRefCount() is needed here to prevent the id from being closed
// prematurely. That is, when application uses the id of an
@@ -69,7 +67,6 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existin
// Function: DataSet copy constructor
///\brief Copy constructor: same HDF5 object as \a original
///\param original - IN: DataSet instance to copy
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(original.id)
{
@@ -77,6 +74,20 @@ DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(origina
}
//--------------------------------------------------------------------------
+// Function: DataSet assignment operator
+///\brief Assignment operator: same HDF5 object as \a original
+///\param original - IN: DataSet instance to copy
+//--------------------------------------------------------------------------
+DataSet &
+DataSet::operator=(const DataSet &original)
+{
+ if (this != &original) {
+ setId(original.id);
+ }
+ return (*this);
+}
+
+//--------------------------------------------------------------------------
// Function: DataSet overload constructor - dereference
///\brief Given a reference, ref, to an hdf5 location, creates a
/// DataSet object
@@ -89,7 +100,6 @@ DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(origina
///\par Description
/// \c loc can be DataSet, Group, H5File, or named DataType, that
/// is a datatype that has been named by DataType::commit.
-// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
: H5Object(), AbstractDs(), id(H5I_INVALID_HID)
@@ -106,7 +116,6 @@ DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, co
///\param ref_type - IN: Reference type - default to H5R_OBJECT
///\param plist - IN: Property list - default to PropList::DEFAULT
///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, const PropList &plist)
: H5Object(), AbstractDs(), id(H5I_INVALID_HID)
@@ -119,7 +128,6 @@ DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, co
///\brief Gets a copy of the dataspace of this dataset.
///\return DataSpace instance
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace
DataSet::getSpace() const
@@ -156,7 +164,6 @@ DataSet::p_get_type() const
///\brief Gets the dataset creation property list.
///\return DSetCreatPropList instance
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList
DataSet::getCreatePlist() const
@@ -200,7 +207,6 @@ DataSet::getAccessPlist() const
///\exception H5::DataSetIException
// Note: H5Dget_storage_size returns 0 when there is no data. This
// function should have no failure. (from SLU)
-// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
hsize_t
DataSet::getStorageSize() const
@@ -214,7 +220,6 @@ DataSet::getStorageSize() const
///\brief Gets the size in memory of the dataset's data.
///\return Size of data (in memory)
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
size_t
DataSet::getInMemDataSize() const
@@ -272,7 +277,6 @@ DataSet::getInMemDataSize() const
///\brief Returns the address of this dataset in the file.
///\return Address of dataset
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
haddr_t
DataSet::getOffset() const
@@ -291,7 +295,6 @@ DataSet::getOffset() const
///\brief Determines whether space has been allocated for a dataset.
///\param status - OUT: Space allocation status
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::getSpaceStatus(H5D_space_status_t &status) const
@@ -309,7 +312,6 @@ DataSet::getSpaceStatus(H5D_space_status_t &status) const
///\param space - IN: Selection for the memory buffer
///\return Amount of storage
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hsize_t
DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const
@@ -334,7 +336,6 @@ DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const
// misses const's. This wrapper will be removed in future release.
// Return Amount of storage
// Exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
@@ -354,7 +355,6 @@ DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const
///\param xfer_plist - IN: Property list used to create the buffer
///\param buf - IN: Pointer to the buffer to be reclaimed
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMemXferPropList &xfer_plist,
@@ -380,7 +380,6 @@ DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMem
///\param xfer_plist - IN: Property list used to create the buffer
///\param buf - IN: Pointer to the buffer to be reclaimed
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//\parDescription
// This function has better prototype for the users than the
// other, which might be removed at some point. BMR - 2006/12/20
@@ -413,7 +412,6 @@ DataSet::vlenReclaim(void *buf, const DataType &type, const DataSpace &space,
/// This function reads raw data from this dataset into the
/// buffer \a buf, converting from file datatype and dataspace
/// to memory datatype \a mem_type and dataspace \a mem_space.
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, const DataSpace &file_space,
@@ -441,7 +439,6 @@ DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, c
///\param file_space - IN: Dataset's dataspace in the file
///\param xfer_plist - IN: Transfer property list for this I/O operation
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
// Modification
// Jul 2009
// Follow the change to Attribute::read and use the following
@@ -490,7 +487,6 @@ DataSet::read(H5std_string &strg, const DataType &mem_type, const DataSpace &mem
/// \a buf to a dataset, converting from memory datatype
/// \a mem_type and dataspace \a mem_space to file datatype
/// and dataspace.
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_space,
@@ -512,7 +508,6 @@ DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_s
// Function: DataSet::write
///\brief This is an overloaded member function, provided for convenience.
/// It takes a reference to a \c H5std_string for the buffer.
-// Programmer Binh-Minh Ribler - 2000
// Modification
// Jul 2009
// Modified to pass the buffer into H5Dwrite properly depending
@@ -568,7 +563,6 @@ DataSet::write(const H5std_string &strg, const DataType &mem_type, const DataSpa
///\exception H5::DataSetIException
///\note This function may not work correctly yet - it's still
/// under development.
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int
DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op,
@@ -594,7 +588,6 @@ DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H
///\par Description
/// For information, please refer to the H5Dset_extent API in
/// the HDF5 C Reference Manual.
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::extend(const hsize_t *size) const
@@ -613,7 +606,6 @@ DataSet::extend(const hsize_t *size) const
///\param buf_type - IN: Datatype of the elements in buffer
///\param space - IN: Dataspace describing memory buffer & containing selection to use
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
void
DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type,
@@ -639,7 +631,6 @@ DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, cons
// Param buf_type - IN: Datatype of the elements in buffer
// Param space - IN: Dataspace describing memory buffer & containing selection to use
// Exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
@@ -658,7 +649,6 @@ DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, cons
///\param buf_type - IN: Datatype of the elements in buffer
///\param space - IN: Dataspace describing memory buffer & containing selection to use
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const
@@ -680,7 +670,6 @@ DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space)
// Param buf_type - IN: Datatype of the elements in buffer
// Param space - IN: Dataspace describing memory buffer & containing selection to use
// Exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
@@ -700,7 +689,6 @@ DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space)
// AbstractDs and Attribute are moved out of H5Object. In
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
-// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
hid_t
DataSet::getId() const
@@ -710,11 +698,10 @@ DataSet::getId() const
//--------------------------------------------------------------------------
// Function: DataSet::p_read_fixed_len (private)
-// brief Reads a fixed length \a H5std_string from a dataset.
-// param mem_type - IN: DataSet datatype (in memory)
-// param strg - IN: Buffer for read string
-// exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Jul, 2009
+// brief Reads a fixed length \a H5std_string from a dataset.
+// param mem_type - IN: DataSet datatype (in memory)
+// param strg - IN: Buffer for read string
+// exceptio n H5::DataSetIException
// Modification
// Jul 2009
// Added in follow to the change in Attribute::read
@@ -748,11 +735,10 @@ DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, con
//--------------------------------------------------------------------------
// Function: DataSet::p_read_variable_len (private)
-// brief Reads a variable length \a H5std_string from an dataset.
-// param mem_type - IN: DataSet datatype (in memory)
-// param strg - IN: Buffer for read string
-// exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Jul, 2009
+// brief Reads a variable length \a H5std_string from an dataset.
+// param mem_type - IN: DataSet datatype (in memory)
+// param strg - IN: Buffer for read string
+// exception H5::DataSetIException
// Modification
// Jul 2009
// Added in follow to the change in Attribute::read
@@ -787,7 +773,6 @@ DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id,
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void
DataSet::p_setId(const hid_t new_id)
@@ -811,7 +796,6 @@ DataSet::p_setId(const hid_t new_id)
// Applications shouldn't need to use it.
// param dset - IN/OUT: DataSet object to be changed
// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
void
f_PropList_setId(PropList *plist, hid_t new_id)
@@ -826,7 +810,6 @@ f_PropList_setId(PropList *plist, hid_t new_id)
///\brief Closes this dataset.
///
///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void
DataSet::close()
@@ -844,7 +827,6 @@ DataSet::close()
//--------------------------------------------------------------------------
// Function: DataSet destructor
///\brief Properly terminates access to this dataset.
-// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index c745470..333ed7a 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -117,6 +117,9 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// Copy constructor - same as the original DataSet.
DataSet(const DataSet &original);
+ // Assignment operator
+ DataSet &operator=(const DataSet &original);
+
// Creates a copy of an existing DataSet using its id.
DataSet(const hid_t existing_id);
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 8a18a35..8a97f58 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -42,6 +42,8 @@ const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
const H5std_string DSET_TCONV_NAME("tconv");
const H5std_string DSET_COMPRESS_NAME("compressed");
const H5std_string DSET_BOGUS_NAME("bogus");
+const H5std_string DSET_OPERATOR("testing operator=");
+const H5std_string DSET_OPERATOR_PATH("/testing operator=");
/* Temporary filter IDs used for testing */
const int H5Z_FILTER_BOGUS = 305;
@@ -58,9 +60,6 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -184,9 +183,6 @@ test_create(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -263,9 +259,6 @@ test_simple_io(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler
- * Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
static herr_t
@@ -325,9 +318,6 @@ test_datasize(FileAccPropList &fapl)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -435,9 +425,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -708,10 +695,6 @@ test_compression(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler
- * Friday, April 22, 2016
- *
*-------------------------------------------------------------------------
*/
const H5std_string DSET_NBIT_NAME("nbit_dataset");
@@ -823,9 +806,6 @@ test_nbit_compression(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Saturday, February 17, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -899,9 +879,6 @@ test_multiopen(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * February 17, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1258,10 +1235,6 @@ test_chunk_cache(const FileAccPropList &fapl)
*
* Return Success: 0
* Failure: number of errors
- *
- * Programmer Binh-Minh Ribler
- * Friday, March 10, 2017
- *
*-------------------------------------------------------------------------
*/
const int RANK = 2;
@@ -1328,6 +1301,60 @@ test_virtual()
} // test_virtual
/*-------------------------------------------------------------------------
+ * Function: test_operator
+ *
+ * Purpose Tests DataSet::operator=
+ *
+ * Return Success: 0
+ *
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_operator(H5File &file)
+{
+ SUBTEST("DataSet::operator=");
+
+ try {
+ // Create a data space
+ hsize_t dims[2];
+ dims[0] = 256;
+ dims[1] = 512;
+ DataSpace space(2, dims, NULL);
+
+ // Create a dataset using the default dataset creation properties.
+ // We're not sure what they are, so we won't check.
+ DataSet dataset = file.createDataSet(DSET_OPERATOR, PredType::NATIVE_DOUBLE, space);
+
+ // Add a comment to the dataset
+ file.setComment(DSET_OPERATOR, "Dataset using operator=");
+
+ // Close the dataset
+ dataset.close();
+
+ // Re-open the dataset
+ DataSet another_dataset(file.openDataSet(DSET_OPERATOR));
+
+ // Try operator= to make another dataset
+ DataSet copied_dataset = another_dataset;
+
+ H5std_string copied_dataset_name = copied_dataset.getObjName();
+ H5std_string another_dataset_name = another_dataset.getObjName();
+
+ PASSED();
+ return 0;
+ } // try block
+
+ // catch all other exceptions
+ catch (Exception &E) {
+ issue_fail_msg("test_operator", __LINE__, __FILE__);
+
+ // clean up and return with failure
+ return -1;
+ }
+} // test_operator
+
+/*-------------------------------------------------------------------------
* Function: test_dset
*
* Purpose Tests the dataset interface (H5D)
@@ -1336,9 +1363,6 @@ test_virtual()
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
- *
* Modifications:
* Nov 12, 01:
* - moved h5_cleanup to outside of try block because
@@ -1376,6 +1400,7 @@ test_dset()
nerrors += test_multiopen(file) < 0 ? 1 : 0;
nerrors += test_types(file) < 0 ? 1 : 0;
nerrors += test_virtual() < 0 ? 1 : 0;
+ nerrors += test_operator(file) < 0 ? 1 : 0;
nerrors += test_chunk_cache(fapl) < 0 ? 1 : 0;
// Close group "emit diagnostics".
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index a244965..50f9282 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -656,7 +656,6 @@ static void
test_named()
{
static hsize_t ds_size[2] = {10, 20};
- hsize_t i;
unsigned attr_data[10][20];
DataType * ds_type = NULL;
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 0c7d511..dc1be96 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -650,10 +650,10 @@ test_generate(void)
HL_TESTING2("make indexed image from land data");
for (i = 0; i < n_elements; i++) {
- if (data[i] < 0)
+ if (data[i] < 0.0f)
image_data[i] = 0;
else
- image_data[i] = (unsigned char)((255 * (data[i])) / xmax);
+ image_data[i] = (unsigned char)((255 * data[i]) / xmax);
}
/* make the image */
@@ -671,10 +671,11 @@ test_generate(void)
HL_TESTING2("make indexed image from sea data");
for (i = 0; i < n_elements; i++) {
- if (data[i] > 0)
+ if (data[i] > 0.0f)
image_data[i] = 0;
- else
- image_data[i] = (unsigned char)((255 * (data[i] - xmin)) / xmin);
+ else {
+ image_data[i] = (unsigned char)((255.0f * (data[i] - xmin)) / (xmax - xmin));
+ }
}
/* make the image */
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 26f0170..21c837b 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -588,7 +588,12 @@ Bug Fixes since HDF5-1.10.7 release
C++ APIs
--------
- -
+ - Added DataSet::operator=
+
+ Some compilers complain if the copy constructor is given explicitly
+ but the assignment operator is implicitly set to default.
+
+ (2021/05/19)
Testing
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 573d1d3..41d9bc0 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -410,7 +410,7 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, co
* collective I/O
*/
if (MPI_SUCCESS !=
- (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
+ (mpi_code = MPI_Allreduce(local_cause, global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index ae86f92..cd567aa 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -168,20 +168,15 @@ typedef struct H5E_t H5E_t;
extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
extern int H5E_mpi_error_str_len;
-#define HMPI_ERROR(mpierr) \
- { \
- MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
- HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \
- }
#define HMPI_DONE_ERROR(retcode, str, mpierr) \
{ \
- HMPI_ERROR(mpierr); \
- HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \
}
#define HMPI_GOTO_ERROR(retcode, str, mpierr) \
{ \
- HMPI_ERROR(mpierr); \
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \
}
#endif /* H5_HAVE_PARALLEL */
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 0ce1475..7b79102 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -74,9 +74,6 @@ typedef enum dtype_t {
OTHER
} dtype_t;
-/* Skip overflow tests if non-zero */
-static int skip_overflow_tests_g = 0;
-
/*
* Although we check whether a floating point overflow generates a SIGFPE and
* turn off overflow tests in that case, it might still be possible for an
@@ -394,7 +391,6 @@ static int without_hardware_g = 0;
HDfree(value); \
}
-void some_dummy_func(float x);
static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits);
static int my_isnan(dtype_t type, void *val);
static int my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos,
@@ -515,92 +511,6 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
}
/*-------------------------------------------------------------------------
- * Function: some_dummy_func
- *
- * Purpose: A dummy function to help check for overflow.
- *
- * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT
- * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW
- * CHECKING.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Tuesday, July 21, 1998
- *
- *-------------------------------------------------------------------------
- */
-void
-some_dummy_func(float x)
-{
- char s[128];
-
- HDsnprintf(s, sizeof(s), "%g", (double)x);
-}
-
-/*-------------------------------------------------------------------------
- * Function: generates_sigfpe
- *
- * Purpose: Determines if SIGFPE is generated from overflows. We must be
- * able to fork() and waitpid() in order for this test to work
- * properly. Sets skip_overflow_tests_g to non-zero if they
- * would generate SIGBUS, zero otherwise.
- *
- * Programmer: Robb Matzke
- * Tuesday, July 21, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void
-generates_sigfpe(void)
-{
-#ifdef H5_HAVE_UNISTD_H
- pid_t pid;
- int status;
- size_t i, j;
- double d;
- unsigned char *dp = (unsigned char *)&d;
- float f;
-
- HDfflush(stdout);
- HDfflush(stderr);
- if ((pid = HDfork()) < 0) {
- HDperror("fork");
- HDexit(EXIT_FAILURE);
- }
- else if (0 == pid) {
- for (i = 0; i < 2000; i++) {
- for (j = 0; j < sizeof(double); j++)
- dp[j] = (unsigned char)HDrand();
- f = (float)d;
- some_dummy_func((float)f);
- }
- HDexit(EXIT_SUCCESS);
- }
-
- while (pid != HDwaitpid(pid, &status, 0))
- /*void*/;
- if (WIFEXITED(status) && 0 == WEXITSTATUS(status)) {
- HDputs("Floating-point overflow cases will be tested.");
- skip_overflow_tests_g = FALSE;
- }
- else if (WIFSIGNALED(status) && SIGFPE == WTERMSIG(status)) {
- HDputs("Floating-point overflow cases cannot be safely tested.");
- skip_overflow_tests_g = TRUE;
- /* delete the core dump file that SIGFPE may have created */
- HDunlink("core");
- }
-#else /* H5_HAVE_UNISTD_H */
- HDputs("Cannot determine if floating-point overflows generate a SIGFPE");
- HDputs("due to a lack of fork(2) - assuming yes.");
- HDputs("Overflow cases will not be tested.");
- skip_overflow_tests_g = TRUE;
-#endif /* H5_HAVE_UNISTD_H */
-}
-
-/*-------------------------------------------------------------------------
* Function: test_hard_query
*
* Purpose: Tests H5Tcompiler_conv() for querying whether a conversion is
@@ -5406,9 +5316,6 @@ main(void)
* for user-defined integer types */
nerrors += (unsigned long)test_derived_integer();
- /* Does floating point overflow generate a SIGFPE? */
- generates_sigfpe();
-
/* Test degenerate cases */
nerrors += (unsigned long)run_fp_tests("noop");
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 400dc36..4a5f140 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -1627,9 +1627,6 @@ extend_writeInd(void)
VRFY((mem_dataspace >= 0), "");
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
- /* Temporary turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* create a file dataspace independently */
file_dataspace = H5Dget_space(dataset2);
@@ -1638,11 +1635,13 @@ extend_writeInd(void)
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dwrite failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Extend dataset2 and try again. Should succeed. */
@@ -1910,20 +1909,19 @@ extend_readInd(void)
VRFY((dataset2 >= 0), "");
/* Try extend dataset1 which is open RDONLY. Should fail. */
- /* first turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
dims[0]++;
- ret = H5Dset_extent(dataset1, dims);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dset_extent(dataset1, dims);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dset_extent failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Read dataset1 using BYROW pattern */
@@ -2208,9 +2206,6 @@ extend_writeAll(void)
}
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
- /* Temporary turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* create a file dataspace independently */
file_dataspace = H5Dget_space(dataset2);
@@ -2219,11 +2214,13 @@ extend_writeAll(void)
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dwrite failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Extend dataset2 and try again. Should succeed. */
@@ -2330,20 +2327,19 @@ extend_readAll(void)
VRFY((dataset2 >= 0), "");
/* Try extend dataset1 which is open RDONLY. Should fail. */
- /* first turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
dims[0]++;
- ret = H5Dset_extent(dataset1, dims);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dset_extent(dataset1, dims);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dset_extent failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Read dataset1 using BYROW pattern */
@@ -3320,14 +3316,23 @@ test_actual_io_mode(int selection_mode)
/* Release some resources */
ret = H5Sclose(sid);
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret = H5Pclose(fapl);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Pclose(dcpl);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Pclose(dxpl_write);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Pclose(dxpl_read);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Dclose(dataset);
+ VRFY((ret >= 0), "H5Dclose succeeded");
ret = H5Sclose(mem_space);
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret = H5Sclose(file_space);
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret = H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded");
HDfree(buffer);
return;
}
@@ -3343,9 +3348,7 @@ void
actual_io_mode_tests(void)
{
int mpi_size = -1;
- int mpi_rank = -1;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
- MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank);
test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE);
@@ -4108,13 +4111,15 @@ dataset_atomicity(void)
if (MAINPROCESS) {
fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
VRFY((fid >= 0), "H5Fopen succeeed");
- }
- /* should fail */
- ret = H5Fset_mpi_atomicity(fid, TRUE);
- VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed");
+ /* should fail */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Fset_mpi_atomicity(fid, TRUE);
+ }
+ H5E_END_TRY
+ VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed");
- if (MAINPROCESS) {
ret = H5Fclose(fid);
VRFY((ret >= 0), "H5Fclose succeeded");
}
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index e693bc0..7405554 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -33,9 +33,6 @@ int ngroups = 512; /* number of groups to create in root
int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
-H5E_auto2_t old_func; /* previous error handler */
-void * old_client_data; /* previous error handler arg.*/
-
/* other option flags */
/* FILENAME and filenames must have the same number of names.
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 673e9aa..daaae43 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -225,13 +225,11 @@ typedef enum {
} ShapeSameTestMethods;
/* Shared global variables */
-extern int dim0, dim1; /*Dataset dimensions */
-extern int chunkdim0, chunkdim1; /*Chunk dimensions */
-extern int nerrors; /*errors count */
-extern H5E_auto2_t old_func; /* previous error handler */
-extern void * old_client_data; /*previous error handler arg.*/
-extern int facc_type; /*Test file access type */
-extern int dxfer_coll_type;
+extern int dim0, dim1; /*Dataset dimensions */
+extern int chunkdim0, chunkdim1; /*Chunk dimensions */
+extern int nerrors; /*errors count */
+extern int facc_type; /*Test file access type */
+extern int dxfer_coll_type;
/* Test program prototypes */
void test_plist_ed(void);