From a7a013782f0af93f511142b5d167c2bc8ca8505d Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 13:41:34 -0500 Subject: Various clang tidy warning fixes (#448) * Fixed clang-tidy bugprone-reserved-identifier warnings * Fixed clang-tidy bugprone-assert-side-effect warnings * Fixed clang-tidy bugprone-copy-constructor-init warning * Fixed clang-tidy readability-redundant-preprocessor warning For error_test.c the removed code was already dead, because it was in the else of an `#if H5_USE_16_API` block. Based on H5Location.h, I think p_get_ref_obj_type was meant to be in `#ifndef DOXYGEN_SHOULD_SKIP_THIS` and an `#endif` was missing. Similarly, in the header, getObjTypeByIdx is only in H5_NO_DEPRECATED_SYMBOLS, not DOXYGEN_SHOULD_SKIP_THIS. * Fixed clang-tidy readability-redundant-string-init warnings * Fixed some clang-tidy performance-type-promotion-in-math-fn warnings * Fixed clang-tidy performance-unnecessary-value-param warnings * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox --- c++/src/H5Attribute.cpp | 2 +- c++/src/H5DcreatProp.cpp | 4 +-- c++/src/H5DcreatProp.h | 2 +- c++/src/H5DxferProp.cpp | 2 +- c++/src/H5Exception.cpp | 2 +- c++/src/H5File.cpp | 2 +- c++/src/H5Location.cpp | 11 ++++---- c++/src/H5Object.cpp | 2 +- c++/test/dsets.cpp | 2 +- c++/test/h5cpputil.cpp | 4 +-- c++/test/h5cpputil.h | 4 +-- src/H5Tconv.c | 4 +-- src/H5Zscaleoffset.c | 4 +-- test/cache_common.c | 4 +-- test/dsets.c | 38 ++++++++++++------------- test/earray.c | 50 ++++++++++++++++----------------- test/error_test.c | 5 ---- test/external.c | 6 ++-- test/ohdr.c | 6 ++-- tools/test/h5diff/h5diffgentest.c | 52 +++++++++++++++++------------------ tools/test/h5repack/h5repackgentest.c | 34 +++++++++++------------ tools/test/perform/sio_engine.c | 2 +- tools/test/perform/sio_perf.c | 2 +- 23 files changed, 119 insertions(+), 125 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index d893fec..b74349c 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -308,7 +308,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/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index d670b74..0ffcbf7 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -769,8 +769,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 3c032ee..820c0d1 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -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. diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index d9d7884..98e6214 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -306,7 +306,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/H5Exception.cpp b/c++/src/H5Exception.cpp index 1aa8ecc..8ea20ff 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() {} //-------------------------------------------------------------------------- // Function: Exception overloaded constructor diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index bbdcd6b..e40cafe 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -178,7 +178,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/H5Location.cpp b/c++/src/H5Location.cpp index 2d14bfc..b136faa 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -346,7 +346,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); @@ -398,6 +398,7 @@ H5Location::getComment(const H5std_string &name, size_t buf_size) const { return (getComment(name.c_str(), buf_size)); } + #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -646,6 +647,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 */ //-------------------------------------------------------------------------- @@ -704,6 +706,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 @@ -1816,7 +1819,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 */ //-------------------------------------------------------------------------- @@ -2433,6 +2434,4 @@ f_DataSpace_setId(DataSpace *dspace, hid_t new_id) //-------------------------------------------------------------------------- H5Location::~H5Location() {} -#endif // DOXYGEN_SHOULD_SKIP_THIS - } // namespace H5 diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 725d1da..c2eba8d 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -477,7 +477,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++/test/dsets.cpp b/c++/test/dsets.cpp index 93c266f..0faf457 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1157,7 +1157,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 d42fc8c..38f9300 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -212,7 +212,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) { } @@ -237,7 +237,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 4439ae3..444bc68 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.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/src/H5Tconv.c b/src/H5Tconv.c index 60ad627..8cc6ede 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8477,7 +8477,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (size_t)(HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1); + buf_size = (size_t)(HDpow(2.0, (double)src.u.f.esize) / 8 + 1); int_buf = (uint8_t *)H5MM_calloc(buf_size); /* Get conversion exception callback property */ @@ -9315,7 +9315,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } /* Check if the exponent is too big */ - expo_max = (hsize_t)(HDpow((double)2.0f, (double)dst.u.f.esize) - 1); + expo_max = (hsize_t)(HDpow(2.0, (double)dst.u.f.esize) - 1); if (expo > expo_max) { /*overflows*/ if (cb_struct.func) { /*user's exception handler. Reverse back source order*/ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 3a08a07..5310f7d 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -364,12 +364,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ { \ i = 0; \ - while (i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ + while (i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ i++; \ if (i < d_nelmts) \ min = max = buf[i]; \ for (; i < d_nelmts; i++) { \ - if (HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ + if (HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ continue; /* ignore fill value */ \ if (buf[i] > max) \ max = buf[i]; \ diff --git a/test/cache_common.c b/test/cache_common.c index 54b1cc5..676b8d1 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1683,7 +1683,7 @@ execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_o HDassert(cache_ptr != NULL); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(entry_ptr != NULL); - HDassert(entry_ptr = entry_ptr->self); + HDassert(entry_ptr == entry_ptr->self); HDassert(entry_ptr->header.addr == entry_ptr->addr); HDassert((entry_ptr->flush_op_self_resize_in_progress) || (entry_ptr->header.size == entry_ptr->size)); HDassert(op_ptr != NULL); @@ -2243,7 +2243,7 @@ resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_ } else { - HDassert(entry_ptr->size = (entry_ptr->header).size); + HDassert(entry_ptr->size == (entry_ptr->header).size); } } } diff --git a/test/dsets.c b/test/dsets.c index 8600d75..0905b4e 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -3181,7 +3181,7 @@ test_nbit_int(hid_t file) /* Initialize data, assuming size of long long >= size of int */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0f, (double)(precision - 1)); + power = HDpow(2.0, (double)(precision - 1)); orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset); /* even-numbered values are negtive */ @@ -3558,7 +3558,7 @@ test_nbit_array(hid_t file) for (j = 0; j < (size_t)size[1]; j++) for (m = 0; m < (size_t)adims[0]; m++) for (n = 0; n < (size_t)adims[1]; n++) { - power = HDpow(2.0F, (double)precision); + power = HDpow(2.0, (double)precision); orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % (long long)power) << offset); } /* end for */ @@ -3754,11 +3754,11 @@ test_nbit_compound(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0F, (double)(precision[0] - 1)); + power = HDpow(2.0, (double)(precision[0] - 1)); orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0F, (double)(precision[1] - 1)); + power = HDpow(2.0, (double)(precision[1] - 1)); orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2] - 1)); + power = HDpow(2.0, (double)(precision[2] - 1)); orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].f = float_val[i][j]; @@ -4036,32 +4036,32 @@ test_nbit_compound_2(hid_t file) /* Initialize data, assuming size of long long >= size of member datatypes */ for (i = 0; i < (size_t)size[0]; i++) for (j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0F, (double)(precision[0] - 1)); + power = HDpow(2.0, (double)(precision[0] - 1)); orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]); - power = HDpow(2.0F, (double)(precision[1] - 1)); + power = HDpow(2.0, (double)(precision[1] - 1)); orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2] - 1)); + power = HDpow(2.0, (double)(precision[2] - 1)); orig_data[i][j].a.s = (short)(-(((long long)HDrandom() % (long long)power) << offset[2])); orig_data[i][j].a.f = float_val[i][j]; - power = HDpow(2.0F, (double)precision[3]); + power = HDpow(2.0, (double)precision[3]); orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]); for (m = 0; m < (size_t)array_dims[0]; m++) for (n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0F, (double)(precision[4] - 1)); + power = HDpow(2.0, (double)(precision[4] - 1)); orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]); } /* end for */ for (m = 0; m < (size_t)array_dims[0]; m++) for (n = 0; n < (size_t)array_dims[1]; n++) { - power = HDpow(2.0F, (double)(precision[0] - 1)); + power = HDpow(2.0, (double)(precision[0] - 1)); orig_data[i][j].d[m][n].i = (int)(-(((long long)HDrandom() % (long long)power) << offset[0])); - power = HDpow(2.0F, (double)(precision[1] - 1)); + power = HDpow(2.0, (double)(precision[1] - 1)); orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); - power = HDpow(2.0F, (double)(precision[2] - 1)); + power = HDpow(2.0, (double)(precision[2] - 1)); orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; @@ -4292,7 +4292,7 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for (i = 0; i < (size_t)size[0]; i++) { - power = HDpow(2.0F, 17.0F - 1.0F); + power = HDpow(2.0, 17.0 - 1.0); HDmemset(&orig_data[i], 0, sizeof(orig_data[i])); orig_data[i].i = (int)(HDrandom() % (long)power); HDstrcpy(orig_data[i].str, "fixed-length C string"); @@ -4481,7 +4481,7 @@ test_nbit_int_size(hid_t file) */ for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { - power = HDpow(2.0F, (double)(precision - 1)); + power = HDpow(2.0, (double)(precision - 1)); orig[i][j] = HDrandom() % (int)power << offset; } @@ -5145,7 +5145,7 @@ test_scaleoffset_float(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0F, -3.0F)) { + if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5291,7 +5291,7 @@ test_scaleoffset_float_2(hid_t file) /* Check that the values read are the same as the values written */ for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0F, -3.0F)) { + if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -5412,7 +5412,7 @@ test_scaleoffset_double(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0F, -7.0F)) { + if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -5558,7 +5558,7 @@ test_scaleoffset_double_2(hid_t file) /* Check that the values read are the same as the values written */ for (j = 0; j < (size_t)size[1]; j++) { - if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0F, -7.0F)) { + if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); diff --git a/test/earray.c b/test/earray.c index 52908a7..bfd3d55 100644 --- a/test/earray.c +++ b/test/earray.c @@ -122,7 +122,7 @@ typedef struct earray_iter_t { hsize_t cnt); /* Initialize/allocate iterator private info */ hssize_t (*next)(void *info); /* Get the next element to test */ hssize_t (*max_elem)(const void *info); /* Get the max. element set */ - int (*state)(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, + int (*state)(void *in_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx); /* Get the state of the extensible array */ herr_t (*term)(void *info); /* Shutdown/free iterator private info */ } earray_iter_t; @@ -1290,9 +1290,9 @@ eiter_fw_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_para *------------------------------------------------------------------------- */ static hssize_t -eiter_fw_next(void *_eiter) +eiter_fw_next(void *in_eiter) { - eiter_fw_t *eiter = (eiter_fw_t *)_eiter; + eiter_fw_t *eiter = (eiter_fw_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1318,9 +1318,9 @@ eiter_fw_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_fw_max(const void *_eiter) +eiter_fw_max(const void *in_eiter) { - const eiter_fw_t *eiter = (const eiter_fw_t *)_eiter; + const eiter_fw_t *eiter = (const eiter_fw_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1343,10 +1343,10 @@ eiter_fw_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_fw_state(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, +eiter_fw_state(void *in_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx) { - eiter_fw_t *eiter = (eiter_fw_t *)_eiter; + eiter_fw_t *eiter = (eiter_fw_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1490,9 +1490,9 @@ eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam, hs *------------------------------------------------------------------------- */ static hssize_t -eiter_rv_next(void *_eiter) +eiter_rv_next(void *in_eiter) { - eiter_rv_t *eiter = (eiter_rv_t *)_eiter; + eiter_rv_t *eiter = (eiter_rv_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1518,9 +1518,9 @@ eiter_rv_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_rv_max(const void *_eiter) +eiter_rv_max(const void *in_eiter) { - const eiter_rv_t *eiter = (const eiter_rv_t *)_eiter; + const eiter_rv_t *eiter = (const eiter_rv_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1543,10 +1543,10 @@ eiter_rv_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_rv_state(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, +eiter_rv_state(void *in_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx) { - eiter_rv_t *eiter = (eiter_rv_t *)_eiter; + eiter_rv_t *eiter = (eiter_rv_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1720,9 +1720,9 @@ eiter_rnd_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par *------------------------------------------------------------------------- */ static hssize_t -eiter_rnd_next(void *_eiter) +eiter_rnd_next(void *in_eiter) { - eiter_rnd_t *eiter = (eiter_rnd_t *)_eiter; + eiter_rnd_t *eiter = (eiter_rnd_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1753,9 +1753,9 @@ eiter_rnd_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_rnd_max(const void *_eiter) +eiter_rnd_max(const void *in_eiter) { - const eiter_rnd_t *eiter = (const eiter_rnd_t *)_eiter; + const eiter_rnd_t *eiter = (const eiter_rnd_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1778,9 +1778,9 @@ eiter_rnd_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_rnd_term(void *_eiter) +eiter_rnd_term(void *in_eiter) { - eiter_rnd_t *eiter = (eiter_rnd_t *)_eiter; + eiter_rnd_t *eiter = (eiter_rnd_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1934,9 +1934,9 @@ eiter_cyc_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par *------------------------------------------------------------------------- */ static hssize_t -eiter_cyc_next(void *_eiter) +eiter_cyc_next(void *in_eiter) { - eiter_cyc_t *eiter = (eiter_cyc_t *)_eiter; + eiter_cyc_t *eiter = (eiter_cyc_t *)in_eiter; hssize_t ret_val; /* Sanity check */ @@ -1969,9 +1969,9 @@ eiter_cyc_next(void *_eiter) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hssize_t -eiter_cyc_max(const void *_eiter) +eiter_cyc_max(const void *in_eiter) { - const eiter_cyc_t *eiter = (const eiter_cyc_t *)_eiter; + const eiter_cyc_t *eiter = (const eiter_cyc_t *)in_eiter; /* Sanity check */ HDassert(eiter); @@ -1994,9 +1994,9 @@ eiter_cyc_max(const void *_eiter) *------------------------------------------------------------------------- */ static int -eiter_cyc_term(void *_eiter) +eiter_cyc_term(void *in_eiter) { - eiter_cyc_t *eiter = (eiter_cyc_t *)_eiter; + eiter_cyc_t *eiter = (eiter_cyc_t *)in_eiter; /* Sanity check */ HDassert(eiter); diff --git a/test/error_test.c b/test/error_test.c index e294a43..9bbebec 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -129,13 +129,8 @@ test_error(hid_t file) TEST_ERROR; if (old_data != NULL) TEST_ERROR; -#ifdef H5_USE_16_API - if (old_func != (H5E_auto_t)H5Eprint) - TEST_ERROR; -#else /* H5_USE_16_API */ if (old_func != (H5E_auto2_t)H5Eprint2) TEST_ERROR; -#endif /* H5_USE_16_API */ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) TEST_ERROR; diff --git a/test/external.c b/test/external.c index 9109e75..0957a03 100644 --- a/test/external.c +++ b/test/external.c @@ -465,7 +465,7 @@ error: *------------------------------------------------------------------------- */ static int -__add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, hsize_t max_ext_size) +add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, hsize_t max_ext_size) { char exname[AEF_EXNAME_MAX_LEN + 1]; unsigned int i = 0; @@ -519,7 +519,7 @@ test_multiple_files(hid_t file) max_ext_size = (hsize_t)(sizeof(int) * max_size[0] / n_external_files); - if (__add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { + if (add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { FAIL_STACK_ERROR; } @@ -543,7 +543,7 @@ test_multiple_files(hid_t file) max_ext_size -= 1; - if (__add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { + if (add_external_files(dcpl, n_external_files, 0, max_ext_size) < 0) { FAIL_STACK_ERROR; } diff --git a/test/ohdr.c b/test/ohdr.c index 54040e1..c586ff3 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -780,7 +780,7 @@ count_attributes(hid_t dset_id) * On success, stores size in `size_out` pointer. */ static herr_t -_oh_getsize(hid_t did, hsize_t *size_out) +oh_getsize(hid_t did, hsize_t *size_out) { H5O_native_info_t ninfo; @@ -803,9 +803,9 @@ oh_compare(hid_t did1, hid_t did2) hsize_t space1 = 0; hsize_t space2 = 0; - if (FAIL == _oh_getsize(did1, &space1)) + if (FAIL == oh_getsize(did1, &space1)) return -1; - if (FAIL == _oh_getsize(did2, &space2)) + if (FAIL == oh_getsize(did2, &space2)) return -2; if (space1 < space2) diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index cf60a6a..f03254e 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -465,15 +465,15 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data15[6]; float data16[6]; - data15[0] = (float)HDsqrt(-1.0F); + data15[0] = (float)HDsqrt(-1.0); data15[1] = 1.0F; - data15[2] = (float)HDsqrt(-1.0F); + data15[2] = (float)HDsqrt(-1.0); data15[3] = 1.0F; data15[4] = 1.0F; data15[5] = 1.0F; - data16[0] = (float)HDsqrt(-1.0F); - data16[1] = (float)HDsqrt(-1.0F); + data16[0] = (float)HDsqrt(-1.0); + data16[1] = (float)HDsqrt(-1.0); data16[2] = 1.0F; data16[3] = 1.0F; data16[4] = 1.0F; @@ -492,19 +492,19 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) double data17[6]; double data18[6]; - data17[0] = HDsqrt(-1.0F); - data17[1] = 1.0F; - data17[2] = HDsqrt(-1.0F); - data17[3] = 1.0F; - data17[4] = 1.0F; - data17[5] = 1.0F; + data17[0] = HDsqrt(-1.0); + data17[1] = 1.0; + data17[2] = HDsqrt(-1.0); + data17[3] = 1.0; + data17[4] = 1.0; + data17[5] = 1.0; - data18[0] = HDsqrt(-1.0F); - data18[1] = HDsqrt(-10000.0F); - data18[2] = 1.0F; - data18[3] = 1.0F; - data18[4] = 1.0F; - data18[5] = 1.0F; + data18[0] = HDsqrt(-1.0); + data18[1] = HDsqrt(-10000.0); + data18[2] = 1.0; + data18[3] = 1.0; + data18[4] = 1.0; + data18[5] = 1.0; write_dset(gid1, 1, dims1, "fp17", H5T_NATIVE_DOUBLE, data17); write_dset(gid1, 1, dims1, "fp18", H5T_NATIVE_DOUBLE, data18); @@ -519,11 +519,11 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F); - data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F); + data19[0] = data19[1] = data19[2] = (float)HDlog(0.0); + data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0); - data20[0] = data20[1] = data20[2] = HDlog(0.0F); - data20[3] = data20[4] = data20[5] = -HDlog(0.0F); + data20[0] = data20[1] = data20[2] = HDlog(0.0); + data20[3] = data20[4] = data20[5] = -HDlog(0.0); write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19); write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19); @@ -547,13 +547,13 @@ test_basic(const char *fname1, const char *fname2, const char *fname3) size_t type_size; hid_t tid; - buf1[0].d = HDsqrt(-1.0F); - buf1[0].f = (float)HDsqrt(-1.0F); - buf2[0].d = HDsqrt(-1.0F); - buf2[0].f = (float)HDsqrt(-1.0F); + buf1[0].d = HDsqrt(-1.0); + buf1[0].f = (float)HDsqrt(-1.0); + buf2[0].d = HDsqrt(-1.0); + buf2[0].f = (float)HDsqrt(-1.0); - buf1[1].d = HDsqrt(-1.0F); - buf1[1].f = (float)HDsqrt(-1.0F); + buf1[1].d = HDsqrt(-1.0); + buf1[1].f = (float)HDsqrt(-1.0); buf2[1].d = 0.0F; buf2[1].f = 0.0F; diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 2b94422..576b1c7 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -72,8 +72,8 @@ struct external_def { * Returns 0 on success, -1 on failure. */ static int -__make_dataset(hid_t file_id, const char *dset_name, hid_t mem_type_id, hid_t space_id, hid_t dcpl_id, - void *wdata) +make_dataset(hid_t file_id, const char *dset_name, hid_t mem_type_id, hid_t space_id, hid_t dcpl_id, + void *wdata) { hid_t dset_id = H5I_INVALID_HID; int ret_value = 0; @@ -90,7 +90,7 @@ done: (void)H5Dclose(dset_id); return ret_value; -} /* end __make_dataset() */ +} /* end make_dataset() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Helper function to populate the DCPL external storage list. @@ -101,8 +101,8 @@ done: * Returns 0 on success, -1 on failure. */ static int -__set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_file, unsigned n_elts_total, - hsize_t elt_size) +set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_file, unsigned n_elts_total, + hsize_t elt_size) { char name[MAX_NAME_SIZE]; unsigned n_external_files = 0; @@ -123,7 +123,7 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_f return -1; } return 0; -} /* end __set_dcpl_external_list() */ +} /* end set_dcpl_external_list() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Generalized utility function to write a file with the specified data and @@ -132,8 +132,8 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_f * Returns 0 on success, -1 on failure. */ static int -__make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize_t rank, hsize_t *dims, - void *wdata) +make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize_t rank, hsize_t *dims, + void *wdata) { char filename[MAX_NAME_SIZE]; hid_t file_id = H5I_INVALID_HID; @@ -149,8 +149,8 @@ __make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize if (dcpl_id == H5I_INVALID_HID) H5REPACKGENTEST_OOPS; - if (__set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total, - ext->type_size) < 0) + if (set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total, + ext->type_size) < 0) H5REPACKGENTEST_OOPS; } @@ -162,13 +162,13 @@ __make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize if (file_id == H5I_INVALID_HID) H5REPACKGENTEST_OOPS; - if (__make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0) + if (make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0) H5REPACKGENTEST_OOPS; done: H5REPACKGENTEST_COMMON_CLEANUP(dcpl_id, file_id, space_id); return ret_value; -} /* end __make_file() */ +} /* end make_file() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Returns 0 on success, -1 on failure. @@ -190,7 +190,7 @@ generate_int32le_1d(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0) + if (make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -216,7 +216,7 @@ generate_int32le_2d(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0) + if (make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -249,7 +249,7 @@ generate_int32le_3d(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0) + if (make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -282,7 +282,7 @@ generate_uint8be(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0) + if (make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0) ret_value = -1; return ret_value; @@ -312,7 +312,7 @@ generate_f32le(hbool_t external) } def_ptr = (TRUE == external) ? (&def) : NULL; - if (__make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0) + if (make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0) ret_value = -1; return ret_value; diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index f8061d4..e5a0ec8 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -80,7 +80,7 @@ static int clean_file_g = -1; /*whether to cleanup temporary test */ /*0 is no cleanup; 1 is do cleanup */ /* the different types of file descriptors we can expect */ -typedef union _file_descr { +typedef union { int posixfd; /* POSIX file handle*/ hid_t h5fd; /* HDF5 file */ } file_descr; diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index 8463ffa..5b3a9e8 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -292,7 +292,7 @@ struct options { size_t page_size; }; -typedef struct _minmax { +typedef struct { double min; double max; double sum; -- cgit v0.12