diff options
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/dsets.cpp | 91 | ||||
-rw-r--r-- | c++/test/h5cpputil.cpp | 21 | ||||
-rw-r--r-- | c++/test/h5cpputil.h | 8 | ||||
-rw-r--r-- | c++/test/tarray.cpp | 14 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 16 | ||||
-rw-r--r-- | c++/test/tcompound.cpp | 85 | ||||
-rw-r--r-- | c++/test/tdspl.cpp | 18 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 38 | ||||
-rw-r--r-- | c++/test/tfilter.cpp | 11 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 39 | ||||
-rw-r--r-- | c++/test/titerate.cpp | 13 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 24 | ||||
-rw-r--r-- | c++/test/tobject.cpp | 27 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 52 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 70 | ||||
-rw-r--r-- | c++/test/tvlstr.cpp | 86 |
16 files changed, 239 insertions, 374 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 1a23f5e..9de6db1 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -404,9 +404,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * Return Success: Data chunk size * * Failure: 0 - * - * Programmer Robb Matzke - * Tuesday, April 21, 1998 *------------------------------------------------------------------------- */ static size_t @@ -729,8 +726,8 @@ test_nbit_compression(H5File &file) SUBTEST("N-bit compression (setup)"); - HDmemset(orig_data, 0, DIM1 * DIM2 * sizeof(s1_t)); - HDmemset(new_data, 0, DIM1 * DIM2 * sizeof(s1_t)); + memset(orig_data, 0, DIM1 * DIM2 * sizeof(s1_t)); + memset(new_data, 0, DIM1 * DIM2 * sizeof(s1_t)); try { // Define datatypes of members of compound datatype @@ -1096,7 +1093,7 @@ test_getnativeinfo(H5File &file) // Get dataset header info H5O_native_info_t ninfo; - HDmemset(&ninfo, 0, sizeof(ninfo)); + memset(&ninfo, 0, sizeof(ninfo)); dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); verify_val(static_cast<long>(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); @@ -1104,7 +1101,7 @@ test_getnativeinfo(H5File &file) // Open the dataset we created above and then close it. This is one // way to open an existing dataset for accessing. dataset = file.openDataSet(DSET_DEFAULT_NAME); - HDmemset(&ninfo, 0, sizeof(ninfo)); + memset(&ninfo, 0, sizeof(ninfo)); dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_ALL); verify_val(static_cast<long>(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); @@ -1367,6 +1364,83 @@ test_operator(H5File &file) } // test_operator /*------------------------------------------------------------------------- + * Function: test_read_string + * + * Purpose Tests DataSet::read(H5std_string ...) + * + * Return Success: 0 + * + * Failure: -1 + *------------------------------------------------------------------------- + */ +static herr_t +test_read_string(H5File &file) +{ + SUBTEST("DataSet::read(H5std_string)"); + try { + const H5std_string DATASET_NAME("test_read_string"); + const unsigned long NX = 8; + const char DATA[NX] = {'a', 0, 0, 0, 0, 0, 0, 'Z'}; + const H5std_string EXPECTED_STR = H5std_string(DATA, NX); + H5std_string str; + + /* + * Write characters with internal null bytes + */ + + PredType datatype(PredType::NATIVE_INT8); + hsize_t dimsf[RANK1] = {NX}; + DataSpace dataspace(RANK1, dimsf); + DataSet dataset = file.createDataSet(DATASET_NAME, datatype, dataspace); + dataset.write(DATA, datatype); + dataset.close(); + + /* + * Read characters with internal null bytes as a string. + * The read std::string should NOT be truncated at the first null byte. + */ + + dataset = file.openDataSet(DATASET_NAME); + dataset.read(str, datatype); + dataset.close(); + verify_val(str.length(), NX, "test_read_string", __LINE__, __FILE__); + verify_val(str, EXPECTED_STR, "test_read_string", __LINE__, __FILE__); + + /* + * Write the H5std_string back to the dataset. + */ + dataset = file.openDataSet(DATASET_NAME); + dataset.write(str, datatype); + dataset.close(); + + /* + * Read characters with internal null bytes as a string, after rewrite. + * The read std::string should NOT be truncated at the first null byte. + */ + + dataset = file.openDataSet(DATASET_NAME); + dataset.read(str, datatype); + dataset.close(); + verify_val(str.length(), NX, "test_read_string", __LINE__, __FILE__); + verify_val(str, EXPECTED_STR, "test_read_string", __LINE__, __FILE__); + + /* + * Success + */ + PASSED(); + return 0; + } + catch (Exception &E) { + // H5_FAILED should probably be invoked before verify_val + H5_FAILED(); + issue_fail_msg("test_read_string", __LINE__, __FILE__); + + // clean up and return with failure + return -1; + } +} // test_read_string + +/*------------------------------------------------------------------------- * Function: test_dset * * Purpose Tests the dataset interface (H5D) @@ -1406,6 +1480,7 @@ test_dset() nerrors += test_virtual() < 0 ? 1 : 0; nerrors += test_operator(file) < 0 ? 1 : 0; nerrors += test_chunk_cache(fapl) < 0 ? 1 : 0; + nerrors += test_read_string(file) < 0 ? 1 : 0; // Close group "emit diagnostics". grp.close(); @@ -1429,8 +1504,6 @@ test_dset() * Purpose Cleanup temporary test files * * Return None - * - * Programmer (use C version) *------------------------------------------------------------------------- */ extern "C" void diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 02805db..c3feefa 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -39,9 +39,6 @@ using namespace H5; * Return if any failure has occurred: 1 * * if no failure occurs: 0 - * - * Programmer Binh-Minh Ribler (using C code segment for reporting tests) - * Friday, February 6, 2001 *------------------------------------------------------------------------- */ int @@ -67,10 +64,6 @@ test_report(int nerrors, const H5std_string &testname) * Purpose Displays that a function has failed with its location. * * Return None - * - * Programmer Binh-Minh Ribler (copied and modified macro CHECK from C) - * Monday, December 20, 2004 - * *------------------------------------------------------------------------- */ void @@ -90,10 +83,6 @@ issue_fail_msg(const char *where, int line, const char *file_name, const char *m * Purpose Displays that a function has failed with its location. * * Return None - * - * Programmer Binh-Minh Ribler (copied and modified macro CHECK from C) - * Monday, December 20, 2004 - * *------------------------------------------------------------------------- */ void @@ -121,9 +110,6 @@ issue_fail_msg(const char *where, int line, const char *file_name, const char *f * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C code segment for checking values) - * Friday, February 6, 2001 *------------------------------------------------------------------------- */ int @@ -147,10 +133,6 @@ check_values(hsize_t i, hsize_t j, int apoint, int acheck) * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler (using C code segment for checking values) - * Friday, September 16, 2016 - * *------------------------------------------------------------------------- */ void @@ -174,9 +156,6 @@ check_values(const char *value, const char *msg, int line, const char *file_name * Return Success: 0 * * Failure: -1 - * - * Programmer Binh-Minh Ribler - * May 2, 2010 *------------------------------------------------------------------------- */ void diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index a5477b6..392382d 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -28,15 +28,15 @@ using std::cerr; using std::endl; #define MESSAGE(V, A) \ - { \ + do { \ if (HDGetTestVerbosity() > (V)) \ print_func A; \ - } + } while (0) #define SUBTEST(TEST) \ - { \ + do { \ printf(" Subtest: %-52s", TEST); \ fflush(stdout); \ - } + } while (0) int check_values(hsize_t i, hsize_t j, int apoint, int acheck); void check_values(const char *value, const char *msg, int line, const char *file_name); diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index 63324ba..f616dcd 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -55,9 +55,6 @@ typedef enum int_t { * Purpose Tests 1-D array of compound datatypes (with array fields) * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * January, 2016 *------------------------------------------------------------------------- */ static void @@ -242,7 +239,7 @@ test_array_compound_array() verify_val(ndims, ARRAY1_RANK, "f2_atype_check.getArrayNDims", __LINE__, __FILE__); // Get the array dimensions - HDmemset(rdims1, 0, sizeof(rdims1)); + memset(rdims1, 0, sizeof(rdims1)); f2_atype_check.getArrayDims(rdims1); // Check the array dimensions @@ -307,9 +304,6 @@ getArr() * * Return None * - * Programmer Binh-Minh Ribler (using C version) - * March, 2016 - * * Description: * Used user's sample code in HDFFV-9562 *------------------------------------------------------------------------- @@ -364,9 +358,6 @@ test_array_assignment() * Purpose Tests getting array information using the const methods. * * Return None - * - * Programmer Binh-Minh Ribler - * April, 2016 *------------------------------------------------------------------------- */ static void @@ -508,9 +499,6 @@ test_array() * Purpose Cleanup temporary test files * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * January, 2016 *------------------------------------------------------------------------- */ extern "C" void diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 4a35763..e018ab1 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -297,7 +297,7 @@ test_attr_getname(FileAccPropList &fapl) // 1. With arbitrary buf_size that is larger than the name size size_t buf_size = FATTR1_NAME.length() + 10; char *fattr1_name = new char[buf_size + 1]; - HDmemset(fattr1_name, 0, buf_size + 1); + memset(fattr1_name, 0, buf_size + 1); ssize_t name_size = 0; // actual length of attribute name name_size = fattr1.getName(fattr1_name, buf_size + 1); CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__); @@ -312,7 +312,7 @@ test_attr_getname(FileAccPropList &fapl) buf_size = 4; char short_name[5] = "File"; // to verify the read name fattr1_name = new char[buf_size + 1]; - HDmemset(fattr1_name, 0, buf_size + 1); + memset(fattr1_name, 0, buf_size + 1); name_size = fattr1.getName(fattr1_name, buf_size + 1); CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__); verify_val(static_cast<size_t>(name_size), FATTR1_NAME.size(), "Attribute::getName", __LINE__, @@ -324,7 +324,7 @@ test_attr_getname(FileAccPropList &fapl) // 3. With a buf_size that equals the name's length. buf_size = FATTR1_NAME.length(); fattr1_name = new char[buf_size + 1]; - HDmemset(fattr1_name, 0, buf_size + 1); + memset(fattr1_name, 0, buf_size + 1); name_size = fattr1.getName(fattr1_name, buf_size + 1); CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__); verify_val(fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); @@ -531,7 +531,7 @@ test_attr_basic_read(FileAccPropList &fapl) // Verify the correct number of attributes another way H5O_info2_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); + memset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(static_cast<long>(oinfo.num_attrs), 3, "DataSet::getObjinfo", __LINE__, __FILE__); @@ -560,7 +560,7 @@ test_attr_basic_read(FileAccPropList &fapl) verify_val(num_attrs, 1, "Group::getNumAttrs", __LINE__, __FILE__); // Verify the correct number of attributes another way - HDmemset(&oinfo, 0, sizeof(oinfo)); + memset(&oinfo, 0, sizeof(oinfo)); group.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(static_cast<long>(oinfo.num_attrs), 1, "Group::getObjinfo", __LINE__, __FILE__); @@ -686,7 +686,7 @@ test_attr_compound_read(FileAccPropList &fapl) // Verify the correct number of attributes another way H5O_info2_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); + memset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(static_cast<long>(oinfo.num_attrs), 1, "DataSet::getObjinfo", __LINE__, __FILE__); @@ -789,7 +789,7 @@ test_attr_compound_read(FileAccPropList &fapl) hsize_t ii, jj; for (ii = 0; ii < ATTR4_DIM1; ii++) for (jj = 0; jj < ATTR4_DIM2; jj++) - if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) { + if (memcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) { TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d, " "read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n", @@ -1663,7 +1663,7 @@ test_string_attr(FileAccPropList &fapl) if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0) TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n", __LINE__, ATTRSTR_DATA.c_str(), string_att_check); - HDfree(string_att_check); + free(string_att_check); /* Test Attribute::read(...,H5std_string& strg) with VL string */ // Read and verify the attribute string as an std::string. diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 96073d6..53939dd 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -40,9 +40,6 @@ typedef struct complex_t { * Purpose Tests various things about compound data types. * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -73,9 +70,6 @@ test_compound_1() * elements. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -100,9 +94,9 @@ test_compound_2() SUBTEST("Compound Element Reordering"); try { // Sizes should be the same, but be careful just in case - buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); - bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t))); - orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t))); + buf = static_cast<unsigned char *>(malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast<unsigned char *>(malloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast<unsigned char *>(malloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i; s_ptr->a = i * 8 + 0; @@ -114,7 +108,7 @@ test_compound_2() s_ptr->d = i * 8 + 6; s_ptr->e = i * 8 + 7; } - HDmemcpy(buf, orig, nelmts * sizeof(src_typ_t)); + memcpy(buf, orig, nelmts * sizeof(src_typ_t)); // Build hdf5 datatypes array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -161,9 +155,9 @@ test_compound_2() } } // Release resources - HDfree(buf); - HDfree(bkg); - HDfree(orig); + free(buf); + free(bkg); + free(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -186,9 +180,6 @@ test_compound_2() * members which appear in the source. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -213,9 +204,9 @@ test_compound_3() SUBTEST("Compound Datatype Subset Conversions"); try { /* Initialize */ - buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); - bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t))); - orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t))); + buf = static_cast<unsigned char *>(malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast<unsigned char *>(malloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast<unsigned char *>(malloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i; s_ptr->a = i * 8 + 0; @@ -271,9 +262,9 @@ test_compound_3() } /* Release resources */ - HDfree(buf); - HDfree(bkg); - HDfree(orig); + free(buf); + free(bkg); + free(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -296,9 +287,6 @@ test_compound_3() * smaller. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -328,9 +316,9 @@ test_compound_4() SUBTEST("Compound Element Shrinking & Reordering"); try { /* Sizes should be the same, but be careful just in case */ - buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); - bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t))); - orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t))); + buf = static_cast<unsigned char *>(malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast<unsigned char *>(malloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast<unsigned char *>(malloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i; s_ptr->a = i * 8 + 0; @@ -390,9 +378,9 @@ test_compound_4() } // for /* Release resources */ - HDfree(buf); - HDfree(bkg); - HDfree(orig); + free(buf); + free(bkg); + free(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -416,9 +404,6 @@ test_compound_4() * which must undergo a conversion. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -439,8 +424,8 @@ test_compound_5() hsize_t dims[1] = {4}; src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}}; dst_typ_t *dst; - void *buf = HDcalloc(2, sizeof(dst_typ_t)); - void *bkg = HDcalloc(2, sizeof(dst_typ_t)); + void *buf = calloc(2, sizeof(dst_typ_t)); + void *bkg = calloc(2, sizeof(dst_typ_t)); ArrayType *array_dt = NULL; // Output message about test being performed @@ -490,8 +475,8 @@ test_compound_5() } /* Free memory buffers */ - HDfree(buf); - HDfree(bkg); + free(buf); + free(bkg); dst = NULL; PASSED(); } // end of try block @@ -511,9 +496,6 @@ test_compound_5() * larger. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -539,9 +521,9 @@ test_compound_6() SUBTEST("Compound Element Growing"); try { /* Sizes should be the same, but be careful just in case */ - buf = static_cast<unsigned char *>(HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); - bkg = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(dst_typ_t))); - orig = static_cast<unsigned char *>(HDmalloc(nelmts * sizeof(src_typ_t))); + buf = static_cast<unsigned char *>(malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)))); + bkg = static_cast<unsigned char *>(malloc(nelmts * sizeof(dst_typ_t))); + orig = static_cast<unsigned char *>(malloc(nelmts * sizeof(src_typ_t))); for (i = 0; i < nelmts; i++) { s_ptr = (reinterpret_cast<src_typ_t *>(orig)) + i; s_ptr->b = (i * 8 + 1) & 0x7fff; @@ -574,9 +556,9 @@ test_compound_6() } /* Release resources */ - HDfree(buf); - HDfree(bkg); - HDfree(orig); + free(buf); + free(bkg); + free(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -596,9 +578,6 @@ test_compound_6() * overlaps the end of the compound datatype. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -662,9 +641,6 @@ test_compound_7() * Purpose Tests member function setSize() on compound datatype * * Return None - * - * Programmer Binh-Minh Ribler (use partial C version test_ooo_order) - * March, 2014 *------------------------------------------------------------------------- */ const H5std_string COMPFILE("tcompound_types.h5"); @@ -750,9 +726,6 @@ test_compound_set_size() * Purpose Main compound datatype testing routine * * Return None - * - * Programmer Binh-Minh Ribler - * January 2007 *------------------------------------------------------------------------- */ extern "C" void diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index 308285f..bccc41a 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -60,12 +60,12 @@ test_transfplist() // Find out the length of the transform expression, allocate the buffer // for it, then read and verify the expression from the copied plist size_t tran_len = static_cast<size_t>(dxpl_c_to_f_copy.getDataTransform(NULL)); - char *c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1)); - HDmemset(c_to_f_read, 0, tran_len + 1); + char *c_to_f_read = static_cast<char *>(malloc(tran_len + 1)); + memset(c_to_f_read, 0, tran_len + 1); dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1); verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f), "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - HDfree(c_to_f_read); + free(c_to_f_read); // // Read the expression of each of the prop lists and verify the read @@ -75,12 +75,12 @@ test_transfplist() // Get and verify the expression with: // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0]) tran_len = static_cast<size_t>(dxpl_c_to_f.getDataTransform(NULL)); - c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1)); - HDmemset(c_to_f_read, 0, tran_len + 1); + c_to_f_read = static_cast<char *>(malloc(tran_len + 1)); + memset(c_to_f_read, 0, tran_len + 1); dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1); verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f), "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - HDfree(c_to_f_read); + free(c_to_f_read); // Get and verify the expression with: // H5std_string DSetMemXferPropList::getDataTransform() @@ -91,12 +91,12 @@ test_transfplist() // Get and verify the expression with: // ssize_t getDataTransform(char* exp, const size_t buf_size) tran_len = static_cast<size_t>(dxpl_utrans_inv.getDataTransform(NULL, 0)); - char *utrans_inv_read = static_cast<char *>(HDmalloc(tran_len + 1)); - HDmemset(utrans_inv_read, 0, tran_len + 1); + char *utrans_inv_read = static_cast<char *>(malloc(tran_len + 1)); + memset(utrans_inv_read, 0, tran_len + 1); dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1); verify_val(const_cast<const char *>(utrans_inv_read), const_cast<const char *>(utrans_inv), "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - HDfree(utrans_inv_read); + free(utrans_inv_read); PASSED(); } diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index d683797..212a241 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -61,10 +61,6 @@ const H5std_string FILE4("tfile4.h5"); * Purpose Test file and template creations * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2001 - * *------------------------------------------------------------------------- */ static void @@ -263,10 +259,6 @@ test_file_create() * Purpose Test file accesses * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2001 - * *------------------------------------------------------------------------- */ static void @@ -339,9 +331,6 @@ test_file_open() * Purpose Test file size. * * Return None - * - * Programmer Raymond Lu - * June, 2004 *------------------------------------------------------------------------- */ static void @@ -402,9 +391,6 @@ test_file_size() * Purpose Test file number. * * Return None - * - * Programmer Quincey Koziol - * April, 2019 *------------------------------------------------------------------------- */ static void @@ -459,9 +445,6 @@ test_file_num() * Purpose Test getting file's name. * * Return None - * - * Programmer Binh-Minh Ribler - * July, 2004 *------------------------------------------------------------------------- */ const int RANK = 2; @@ -643,7 +626,7 @@ test_file_attribute() verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__); // Read back attribute's data - HDmemset(rdata, 0, sizeof(rdata)); + memset(rdata, 0, sizeof(rdata)); dattr.read(PredType::NATIVE_INT, rdata); /* Check results */ for (i = 0; i < ATTR1_DIM1; i++) { @@ -670,9 +653,6 @@ test_file_attribute() * versions for the right objects. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * March, 2015 *------------------------------------------------------------------------- */ const H5std_string FILE6("tfile5.h5"); @@ -702,7 +682,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F // Verify object header version another way H5O_native_info_t ninfo; - HDmemset(&ninfo, 0, sizeof(ninfo)); + memset(&ninfo, 0, sizeof(ninfo)); file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__); @@ -729,7 +709,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__); // Verify object header version another way - HDmemset(&ninfo, 0, sizeof(ninfo)); + memset(&ninfo, 0, sizeof(ninfo)); group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__); @@ -769,9 +749,6 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F * libver bounds is handled correctly. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * March 2015 *------------------------------------------------------------------------- */ static void @@ -792,9 +769,6 @@ test_libver_bounds() * Purpose Verify that H5File works as a root group. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * March, 2015 *------------------------------------------------------------------------- */ static void @@ -855,9 +829,6 @@ test_commonfg() * when the file is re-opened. * * Return None - * - * Programmer Binh-Minh Ribler - * February, 2017 *------------------------------------------------------------------------- */ const H5std_string FILE7("tfile7.h5"); @@ -994,9 +965,6 @@ test_file_info() * Purpose Main file testing routine * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January 2001 *------------------------------------------------------------------------- */ extern "C" void diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 34078a7..5bfd34c 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -68,9 +68,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * Return Success: Data chunk size * * Failure: 0 - * - * Programmer Robb Matzke - * Tuesday, April 21, 1998 *------------------------------------------------------------------------- */ static size_t @@ -92,10 +89,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values * Purpose Test null I/O filter by itself. * * Return None - * - * Programmer Binh-Minh Ribler (use C version, from dsets.c/test_filters) - * January, 2007 - * *------------------------------------------------------------------------- */ const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; @@ -139,10 +132,6 @@ test_null_filter() * Purpose Test SZIP filter by itself. * * Return None - * - * Programmer Binh-Minh Ribler (partly from dsets.c/test_filters) - * January, 2007 - * *------------------------------------------------------------------------- */ const H5std_string DSET_SZIP_NAME("szipped dataset"); diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index b9a84e1..04bc3c0 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -83,10 +83,6 @@ int space5_data = 7; * Purpose Test basic H5S (dataspace) code * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * Mar 2001 - * *------------------------------------------------------------------------- */ static void @@ -120,8 +116,8 @@ test_h5s_basic() hsize_t tdims[4]; // Dimension array to test with ndims = sid1.getSimpleExtentDims(tdims); verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0, - "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(memcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims", + __LINE__, __FILE__); // Create simple dataspace sid2 hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4}; @@ -139,9 +135,9 @@ test_h5s_basic() // Retrieves dimension size and max size of dataspace sid2 and // verify them ndims = sid2.getSimpleExtentDims(tdims, tmax); - verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, - "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims", + verify_val(memcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims", + __LINE__, __FILE__); + verify_val(memcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); // Check to be sure we can't create a simple data space that has too @@ -209,10 +205,6 @@ test_h5s_basic() * Purpose Test scalar H5S (dataspace) writing code * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * Mar 2001 - * *------------------------------------------------------------------------- */ static void @@ -266,10 +258,6 @@ test_h5s_scalar_write() * Purpose Test scalar H5S (dataspace) reading code * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * Mar 2001 - * *------------------------------------------------------------------------- */ static void @@ -320,10 +308,6 @@ test_h5s_scalar_read() * Purpose Test null H5S (dataspace) code * * Return None - * - * Programmer Raymond Lu (using C version) - * May 18, 2004 - * *------------------------------------------------------------------------- */ static void @@ -367,10 +351,6 @@ test_h5s_null() * datatypes * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * Mar 2001 - * *------------------------------------------------------------------------- */ static void @@ -428,10 +408,6 @@ test_h5s_compound_scalar_write() * datatypes * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * Mar 2001 - * *------------------------------------------------------------------------- */ static void @@ -468,7 +444,7 @@ test_h5s_compound_scalar_read() dataset.read(&rdata, type); // Verify read data - if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) { + if (memcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) { cerr << "scalar data different: space4_data.c1=" << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl; cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u @@ -492,9 +468,6 @@ test_h5s_compound_scalar_read() * Purpose Main dataspace testing routine * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * Mar 2001 *------------------------------------------------------------------------- */ extern "C" void diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 5d20f80..4c84d80 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -125,9 +125,6 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR * * Return Success: 0 * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Friday, September 9, 2016 *------------------------------------------------------------------------- */ static void @@ -179,7 +176,7 @@ test_iter_group(FileAccPropList &fapl) check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__); /* Sort the dataset names */ - HDqsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp); + qsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ @@ -267,7 +264,7 @@ test_iter_group(FileAccPropList &fapl) /* Free the dataset names */ for (int i = 0; i < NDATASETS + 2; i++) - HDfree(lnames[i]); + free(lnames[i]); // Everything will be closed as they go out of scope @@ -384,9 +381,6 @@ printelems(const Group &group, const H5std_string &dsname, const H5std_string &a * Function: test_HDFFV_9920 * * Purpose Tests the fix for HDFFV-9920 - * - * Programmer Binh-Minh Ribler - * Friday, September 9, 2016 *------------------------------------------------------------------------- */ static void @@ -443,9 +437,6 @@ test_HDFFV_9920() * * Return Success: 0 * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Tuesday, September 6, 2016 *------------------------------------------------------------------------- */ extern "C" void diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index ebb457a..7017217 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -67,9 +67,9 @@ test_basic_links(hid_t fapl_id, hbool_t new_format) try { if (new_format) - SUBTEST("Link creation (w/new group format)") + SUBTEST("Link creation (w/new group format)"); else - SUBTEST("Link creation") + SUBTEST("Link creation"); h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); @@ -174,9 +174,9 @@ test_lcpl(hid_t fapl_id, hbool_t new_format) hsize_t dims[2]; if (new_format) - SUBTEST("Link creation property lists (w/new group format)") + SUBTEST("Link creation property lists (w/new group format)"); else - SUBTEST("Link creation property lists") + SUBTEST("Link creation property lists"); try { FileAccPropList fapl(fapl_id); @@ -254,9 +254,9 @@ test_move(hid_t fapl_id, hbool_t new_format) char filename[1024]; if (new_format) - SUBTEST("Group::moveLink (w/new group format)") + SUBTEST("Group::moveLink (w/new group format)"); else - SUBTEST("Group::moveLink") + SUBTEST("Group::moveLink"); try { FileAccPropList fapl(fapl_id); @@ -399,9 +399,9 @@ test_copy(hid_t fapl_id, hbool_t new_format) char filename[1024]; if (new_format) - SUBTEST("Group::copyLink (w/new group format)") + SUBTEST("Group::copyLink (w/new group format)"); else - SUBTEST("Group::copyLink") + SUBTEST("Group::copyLink"); try { // Create two new files @@ -537,9 +537,9 @@ test_num_links(hid_t fapl_id, hbool_t new_format) char filename[NAME_BUF_SIZE]; if (new_format) - SUBTEST("Setting number of links (w/new group format)") + SUBTEST("Setting number of links (w/new group format)"); else - SUBTEST("Setting number of links") + SUBTEST("Setting number of links"); try { // Use the file access template id to create a file access prop. list. @@ -622,9 +622,9 @@ test_visit(hid_t fapl_id, hbool_t new_format) char filename[NAME_BUF_SIZE]; if (new_format) - SUBTEST("H5Object::visit (w/new group format)") + SUBTEST("H5Object::visit (w/new group format)"); else - SUBTEST("H5Object::visit") + SUBTEST("H5Object::visit"); try { // Use the file access template id to create a file access prop. list diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 696783d..741c628 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -57,9 +57,6 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Grou * * Return Success: 0 * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Friday, March 4, 2014 *------------------------------------------------------------------------- */ static void @@ -159,9 +156,6 @@ test_get_objname() * * Return Success: 0 * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Friday, March 4, 2014 *------------------------------------------------------------------------- */ static void @@ -242,9 +236,6 @@ test_existance() * * Return Success: 0 * Failure: -1 - * - * Programmer Binh-Minh Ribler - * March 4, 2014 *------------------------------------------------------------------------- */ static void @@ -341,9 +332,6 @@ test_get_objname_ontypes() * * Return Success: 0 * Failure: -1 - * - * Programmer Binh-Minh Ribler - * Friday, March 4, 2014 *------------------------------------------------------------------------- */ static void @@ -406,9 +394,6 @@ test_get_objtype() * Purpose Test Group::getObjId function. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * March, 2017 *------------------------------------------------------------------------- */ const H5std_string GROUPNAME("group"); @@ -551,8 +536,8 @@ test_getobjectinfo_same_file() Group grp2(file1.createGroup(GROUP2NAME)); // Reset object info - HDmemset(&oinfo1, 0, sizeof(oinfo1)); - HDmemset(&oinfo2, 0, sizeof(oinfo2)); + memset(&oinfo1, 0, sizeof(oinfo1)); + memset(&oinfo2, 0, sizeof(oinfo2)); // Query the info of two groups and verify that they have the same // file number @@ -574,8 +559,8 @@ test_getobjectinfo_same_file() grp2 = file2.openGroup(GROUP2NAME); // Reset object info - HDmemset(&oinfo1, 0, sizeof(oinfo1)); - HDmemset(&oinfo2, 0, sizeof(oinfo2)); + memset(&oinfo1, 0, sizeof(oinfo1)); + memset(&oinfo2, 0, sizeof(oinfo2)); // Query the info of two groups and verify that they have the same // file number @@ -584,8 +569,8 @@ test_getobjectinfo_same_file() verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjinfo", __LINE__, __FILE__); // Reset object info - HDmemset(&oinfo1, 0, sizeof(oinfo1)); - HDmemset(&oinfo2, 0, sizeof(oinfo2)); + memset(&oinfo1, 0, sizeof(oinfo1)); + memset(&oinfo2, 0, sizeof(oinfo2)); file1.getObjinfo(GROUP1NAME, oinfo1); file1.getObjinfo(GROUP2NAME, oinfo2); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index fc7931f..31c5022 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -80,9 +80,9 @@ test_reference_params() // Allocate write & read buffers size_t temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t)); - wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1)); - rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1)); - tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1)); + wbuf = static_cast<hobj_ref_t *>(malloc(temp_size * SPACE1_DIM1)); + rbuf = static_cast<hobj_ref_t *>(malloc(temp_size * SPACE1_DIM1)); + tbuf = static_cast<hobj_ref_t *>(malloc(temp_size * SPACE1_DIM1)); // Create file FILE1 file1 = new H5File(FILE1, H5F_ACC_TRUNC); @@ -168,9 +168,9 @@ test_reference_params() // Let sid1 go out of scope // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); + free(wbuf); + free(rbuf); + free(tbuf); PASSED(); } // end try @@ -206,9 +206,9 @@ test_reference_obj() // Allocate write & read buffers size_t temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t)); - wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1)); - rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1)); - tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1)); + wbuf = static_cast<hobj_ref_t *>(malloc(temp_size * SPACE1_DIM1)); + rbuf = static_cast<hobj_ref_t *>(malloc(temp_size * SPACE1_DIM1)); + tbuf = static_cast<hobj_ref_t *>(malloc(temp_size * SPACE1_DIM1)); // Create file FILE1 file1 = new H5File(FILE1, H5F_ACC_TRUNC); @@ -368,9 +368,9 @@ test_reference_obj() file1->close(); // Free allocated buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); + free(wbuf); + free(rbuf); + free(tbuf); PASSED(); } // end try @@ -488,14 +488,14 @@ test_reference_group() // Check object type using Group::getObjinfo() H5O_info2_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); + memset(&oinfo, 0, sizeof(oinfo)); group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 0, oinfo); verify_val(static_cast<long>(oinfo.type), static_cast<long>(H5O_TYPE_DATASET), "Group::getObjinfo", __LINE__, __FILE__); // Check for out of bound query by index try { - HDmemset(&oinfo, 0, sizeof(oinfo)); + memset(&oinfo, 0, sizeof(oinfo)); group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 9, oinfo); // Should FAIL but didn't, so throw an invalid action exception @@ -555,10 +555,10 @@ test_reference_region_1D() *drbuf; // Buffer for reading numeric data from disk // Allocate write & read buffers - wbuf = static_cast<hdset_reg_ref_t *>(HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1)); - rbuf = static_cast<hdset_reg_ref_t *>(HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1)); - dwbuf = static_cast<uint8_t *>(HDmalloc(sizeof(uint8_t) * SPACE3_DIM1)); - drbuf = static_cast<uint8_t *>(HDcalloc(sizeof(uint8_t), SPACE3_DIM1)); + wbuf = static_cast<hdset_reg_ref_t *>(calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1)); + rbuf = static_cast<hdset_reg_ref_t *>(malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1)); + dwbuf = static_cast<uint8_t *>(malloc(sizeof(uint8_t) * SPACE3_DIM1)); + drbuf = static_cast<uint8_t *>(calloc(sizeof(uint8_t), SPACE3_DIM1)); // Create file FILE1 H5File file1(FILE2, H5F_ACC_TRUNC); @@ -714,7 +714,7 @@ test_reference_region_1D() /* Allocate space for the hyperslab blocks */ coords = - static_cast<hsize_t *>(HDmalloc(static_cast<size_t>(nelms) * SPACE3_RANK * sizeof(hsize_t) * 2)); + static_cast<hsize_t *>(malloc(static_cast<size_t>(nelms) * SPACE3_RANK * sizeof(hsize_t) * 2)); // Get the list of hyperslab blocks currently selected reg_sp.getSelectHyperBlocklist(0, static_cast<hsize_t>(nelms), coords); @@ -751,7 +751,7 @@ test_reference_region_1D() verify_val(static_cast<long>(coords[28]), 72, "Hyperslab Coordinates", __LINE__, __FILE__); verify_val(static_cast<long>(coords[29]), 73, "Hyperslab Coordinates", __LINE__, __FILE__); - HDfree(coords); + free(coords); // Check boundaries reg_sp.getSelectBounds(low, high); @@ -774,7 +774,7 @@ test_reference_region_1D() /* Allocate space for the hyperslab blocks */ coords = - static_cast<hsize_t *>(HDmalloc(static_cast<size_t>(nelmspts) * SPACE3_RANK * sizeof(hsize_t))); + static_cast<hsize_t *>(malloc(static_cast<size_t>(nelmspts) * SPACE3_RANK * sizeof(hsize_t))); // Get the list of element points currently selected elm_sp.getSelectElemPointlist(0, static_cast<hsize_t>(nelmspts), coords); @@ -791,7 +791,7 @@ test_reference_region_1D() verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__); verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__); - HDfree(coords); + free(coords); // Check boundaries elm_sp.getSelectBounds(low, high); @@ -808,10 +808,10 @@ test_reference_region_1D() file1.close(); // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); + free(wbuf); + free(rbuf); + free(dwbuf); + free(drbuf); PASSED(); } // end try diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index ff86213..322b72f 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -44,8 +44,8 @@ using namespace H5; /* #include "H5Tpkg.h" */ -const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", - "encode_decode.h5", "h5_type_operators.h5", NULL}; +static const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", + "encode_decode.h5", "h5_type_operators.h5", NULL}; typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t; @@ -76,9 +76,6 @@ typedef struct { * Purpose Test type classes * * Return None. - * - * Programmer Binh-Minh Ribler (using C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -113,9 +110,6 @@ test_classes() * Purpose Test datatype copy functionality * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * January, 2007 *------------------------------------------------------------------------- */ static void @@ -165,9 +159,6 @@ test_copy() * Purpose Test DataType::detectClass() * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * August, 2017 *------------------------------------------------------------------------- */ typedef struct { /* Struct with atomic fields */ @@ -359,9 +350,6 @@ test_detect_type_class() * Purpose Tests VarLenType class * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * August, 2017 *------------------------------------------------------------------------- */ static void @@ -432,9 +420,6 @@ test_vltype() * Purpose Tests query functions of compound and enumeration types. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ const H5std_string CompT_NAME("Compound_type"); @@ -462,11 +447,16 @@ test_query() // Create a enumerate datatype EnumType tid2(sizeof(short)); - tid2.insert("RED", (enum_val = 0, &enum_val)); - tid2.insert("GREEN", (enum_val = 1, &enum_val)); - tid2.insert("BLUE", (enum_val = 2, &enum_val)); - tid2.insert("ORANGE", (enum_val = 3, &enum_val)); - tid2.insert("YELLOW", (enum_val = 4, &enum_val)); + enum_val = 0; + tid2.insert("RED", &enum_val); + enum_val = 1; + tid2.insert("GREEN", &enum_val); + enum_val = 2; + tid2.insert("BLUE", &enum_val); + enum_val = 3; + tid2.insert("ORANGE", &enum_val); + enum_val = 4; + tid2.insert("YELLOW", &enum_val); // Query member number and member index by name, for compound type int nmembs = tid1.getNmembers(); @@ -552,9 +542,6 @@ test_query() * Purpose Tests transient datatypes. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ @@ -631,9 +618,6 @@ test_transient() * Purpose Tests named datatypes. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 *------------------------------------------------------------------------- */ @@ -798,9 +782,6 @@ test_named() * Purpose Test datatype encode/decode functionality. * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * August, 2017 *------------------------------------------------------------------------- */ const int ARRAY1_RANK = 1; @@ -859,11 +840,16 @@ test_encode_decode() // Create a enumerate datatype EnumType enumtyp(sizeof(short)); - enumtyp.insert("RED", (enum_val = 0, &enum_val)); - enumtyp.insert("GREEN", (enum_val = 1, &enum_val)); - enumtyp.insert("BLUE", (enum_val = 2, &enum_val)); - enumtyp.insert("ORANGE", (enum_val = 3, &enum_val)); - enumtyp.insert("YELLOW", (enum_val = 4, &enum_val)); + enum_val = 0; + enumtyp.insert("RED", &enum_val); + enum_val = 1; + enumtyp.insert("GREEN", &enum_val); + enum_val = 2; + enumtyp.insert("BLUE", &enum_val); + enum_val = 3; + enumtyp.insert("ORANGE", &enum_val); + enum_val = 4; + enumtyp.insert("YELLOW", &enum_val); // Encode compound type in a buffer enumtyp.encode(); @@ -1018,9 +1004,6 @@ test_encode_decode() * Purpose Test datatype encode/decode functionality. * * Return None - * - * Programmer Binh-Minh Ribler (using C version) - * August, 2017 *------------------------------------------------------------------------- */ @@ -1060,9 +1043,12 @@ test_operators() // Create an enumerate datatype EnumType enumtyp(sizeof(short)); - enumtyp.insert("RED", (enum_val = 0, &enum_val)); - enumtyp.insert("GREEN", (enum_val = 1, &enum_val)); - enumtyp.insert("BLUE", (enum_val = 2, &enum_val)); + enum_val = 0; + enumtyp.insert("RED", &enum_val); + enum_val = 1; + enumtyp.insert("GREEN", &enum_val); + enum_val = 2; + enumtyp.insert("BLUE", &enum_val); // Verify that operator== and operator!= work properly verify_val(cmptyp == enumtyp, false, "DataType::operator==", __LINE__, __FILE__); diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 1cde7f1..748333f 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -65,7 +65,7 @@ static void *test_vlstr_alloc_custom(size_t size, void *info) extra=MAX(sizeof(void *),sizeof(size_t)); - if((ret_value=HDmalloc(extra+size))!=NULL) { + if((ret_value=malloc(extra+size))!=NULL) { *(size_t *)ret_value=size; *mem_used+=size; } // end if @@ -108,7 +108,7 @@ static void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; *mem_used-=*(size_t *)mem; - HDfree(mem); + free(mem); } // end if } #endif @@ -119,10 +119,6 @@ static void test_vlstr_free_custom(void *_mem, void *info) * Purpose Test writing/reading VL strings on datasets. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ // String for testing datasets @@ -166,7 +162,7 @@ test_vlstring_dataset() TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n", __LINE__, DSET1_DATA.c_str(), string_ds_check); - HDfree(string_ds_check); // note: no need for std::string test + free(string_ds_check); // note: no need for std::string test string_ds_check = NULL; // Read and verify the dataset string as an std::string. @@ -182,8 +178,8 @@ test_vlstring_dataset() // Test scalar type dataset with 1 value. dset1 = root.createDataSet("test_scalar_small", vlst, ds_space); - dynstring_ds_write = static_cast<char *>(HDcalloc(2, sizeof(char))); - HDmemset(dynstring_ds_write, 'A', 1); + dynstring_ds_write = static_cast<char *>(calloc(2, sizeof(char))); + memset(dynstring_ds_write, 'A', 1); // Write data to the dataset, then read it back. dset1.write(&dynstring_ds_write, vlst); @@ -193,7 +189,7 @@ test_vlstring_dataset() if (HDstrcmp(string_ds_check, dynstring_ds_write) != 0) TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n", dynstring_ds_write, string_ds_check); - HDfree(string_ds_check); + free(string_ds_check); string_ds_check = NULL; dset1.close(); @@ -213,9 +209,9 @@ test_vlstring_dataset() } if (dynstring_ds_write) - HDfree(dynstring_ds_write); + free(dynstring_ds_write); if (string_ds_check) - HDfree(string_ds_check); + free(string_ds_check); } // test_vlstring_dataset() /*------------------------------------------------------------------------- @@ -224,10 +220,6 @@ test_vlstring_dataset() * Purpose Test writing/reading VL string array to/from datasets. * * Return None - * - * Programmer Binh-Minh Ribler - * July, 2009 - * *------------------------------------------------------------------------- */ const H5std_string DSSTRARR_NAME("StringArray_dset"); @@ -268,7 +260,7 @@ test_vlstring_array_dataset() TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__, string_ds_array[ii], string_ds_check[ii]); - HDfree(string_ds_check[ii]); + free(string_ds_check[ii]); } // Close objects that are no longer needed. @@ -284,8 +276,8 @@ test_vlstring_array_dataset() // Create and write another dataset. DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space)); - char *wdata2 = static_cast<char *>(HDcalloc(65534, sizeof(char))); - HDmemset(wdata2, 'A', 65533); + char *wdata2 = static_cast<char *>(calloc(65534, sizeof(char))); + memset(wdata2, 'A', 65533); dataset2.write(&wdata2, vlst); char *rdata2; @@ -296,8 +288,8 @@ test_vlstring_array_dataset() // Release resources from second dataset operation. scalar_space.close(); dataset2.close(); - HDfree(wdata2); - HDfree(rdata2); + free(wdata2); + free(rdata2); // Close objects and file. dataset2.close(); @@ -322,10 +314,6 @@ test_vlstring_array_dataset() * zero-sized. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ static void @@ -442,10 +430,6 @@ test_vlstrings_special() * Purpose Test if VL string is treated as string. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ const H5std_string VLSTR_TYPE("vl_string_type"); @@ -541,10 +525,6 @@ test_vlstring_type() * Purpose Test storing VL strings in compact datasets. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ static void @@ -620,10 +600,6 @@ test_compact_vlstring() * Purpose Test writing/reading VL strings on attributes. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ static char *string_att_write = NULL; @@ -662,7 +638,7 @@ test_vlstring_attribute() TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n", __LINE__, ATTRSTR_DATA.c_str(), string_att_check); - HDfree(string_att_check); // note: no need for std::string test + free(string_att_check); // note: no need for std::string test // Read and verify the attribute string as an std::string. H5std_string read_str; @@ -677,8 +653,8 @@ test_vlstring_attribute() // Test creating a "large" sized string attribute gr_attr = root.createAttribute("test_scalar_large", vlst, att_space); - string_att_write = static_cast<char *>(HDcalloc(8192, sizeof(char))); - HDmemset(string_att_write, 'A', 8191); + string_att_write = static_cast<char *>(calloc(8192, sizeof(char))); + memset(string_att_write, 'A', 8191); // Write data to the attribute, then read it back. gr_attr.write(vlst, &string_att_write); @@ -690,8 +666,8 @@ test_vlstring_attribute() string_att_write, string_att_check); // Release resources. - HDfree(string_att_check); - HDfree(string_att_write); + free(string_att_check); + free(string_att_write); gr_attr.close(); file1.close(); @@ -711,10 +687,6 @@ test_vlstring_attribute() * Purpose Test reading VL strings from attributes. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ static void test_read_vl_string_attribute() @@ -739,7 +711,7 @@ static void test_read_vl_string_attribute() att.read(vlst, &string_att_check); if(HDstrcmp(string_att_check,ATTRSTR_DATA.c_str())!=0) TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",ATTRSTR_DATA.c_str(),string_att_check); - HDfree(string_att_check); + free(string_att_check); att.close(); // Test reading "large" sized string attribute @@ -747,8 +719,8 @@ static void test_read_vl_string_attribute() att.read(vlst, &string_att_check); if(HDstrcmp(string_att_check,string_att_write)!=0) TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); - HDfree(string_att_check); - HDfree(string_att_write); // Free string allocated in test_write_vl_string_attribute + free(string_att_check); + free(string_att_write); // Free string allocated in test_write_vl_string_attribute // Close objects and file. att.close(); @@ -773,10 +745,6 @@ static void test_read_vl_string_attribute() * Purpose Test writing/reading VL string array to/from attributes. * * Return None - * - * Programmer Binh-Minh Ribler - * July, 2009 - * *------------------------------------------------------------------------- */ const H5std_string ATTRSTRARR_NAME("StringArray_attr"); @@ -821,7 +789,7 @@ test_vlstring_array_attribute() TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n", __LINE__, string_att_check[ii], string_att_check[ii]); - HDfree(string_att_check[ii]); // note: no need for std::string test + free(string_att_check[ii]); // note: no need for std::string test } // Close group's attribute. @@ -869,7 +837,7 @@ read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, cha if (HDstrcmp(data, data_read) != 0) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); - HDfree(data_read); + free(data_read); } // end try catch (FileIException &ferr) { throw; @@ -886,10 +854,6 @@ read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, cha * have been linked/unlinked. * * Return None - * - * Programmer Binh-Minh Ribler (use C version) - * January, 2007 - * *------------------------------------------------------------------------- */ const H5std_string FILENAME2("tvlstr2.h5"); @@ -967,10 +931,6 @@ test_vl_rewrite() * Purpose VL string testing main routine. * * Return None - * - * Programmer Binh-Minh Ribler - * January, 2007 - * *------------------------------------------------------------------------- */ extern "C" void |