diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 10 | ||||
-rw-r--r-- | test/cache_logging.c | 12 | ||||
-rw-r--r-- | test/genall5.c | 3208 | ||||
-rw-r--r-- | test/ohdr.c | 4 | ||||
-rw-r--r-- | test/tmisc.c | 2 | ||||
-rw-r--r-- | test/tunicode.c | 6 | ||||
-rw-r--r-- | test/tvltypes.c | 22 | ||||
-rw-r--r-- | test/vfd.c | 22 |
8 files changed, 1387 insertions, 1899 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index b9aa3fb..d4db6d0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -56,11 +56,11 @@ TEST_PROG= testhdf5 \ evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith page_buffer \ dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \ - objcopy links unlink twriteorder big mtime fillval mount \ - flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ - enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ - reserved cross_read freespace mf vds file_image unregister \ - cache_logging cork swmr + objcopy links unlink twriteorder big mtime fillval mount \ + flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ + enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ + reserved cross_read freespace mf vds file_image unregister \ + cache_logging cork swmr # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. diff --git a/test/cache_logging.c b/test/cache_logging.c index b4ed53b..1eb9d41 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -65,16 +65,16 @@ test_logging_api(void) start_on_access_out = TRUE; location = NULL; size = 999; - if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, + if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; - if(size != strlen(LOG_LOCATION) + 1) + if(size != HDstrlen(LOG_LOCATION) + 1) TEST_ERROR; /* Check to make sure that the property list getter works */ if(NULL == (location = (char *)HDcalloc(size, sizeof(char)))) TEST_ERROR; - if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, + if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; if((is_enabled != is_enabled_out) @@ -159,17 +159,17 @@ main(void) /* Reset library */ h5_reset(); - printf("Testing basic metadata cache logging functionality.\n"); + HDprintf("Testing basic metadata cache logging functionality.\n"); nerrors += test_logging_api(); if(nerrors) { - printf("***** %d Metadata cache logging TEST%s FAILED! *****\n", + HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; } - printf("All Metadata Cache Logging tests passed.\n"); + HDprintf("All Metadata Cache Logging tests passed.\n"); return 0; } diff --git a/test/genall5.c b/test/genall5.c index 37bab7a..4cc0a2d 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -12,11 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: John Mainzer - * 9/23/15 + * 9/23/15 * - * This file contains a heavily edited and functionaly reduce - * version of the test code first written by Quincey in a file - * of the same name. + * This file contains a heavily edited and functionaly reduce + * version of the test code first written by Quincey in a file + * of the same name. */ #include "cache_common.h" @@ -32,7 +32,7 @@ * Function: ns_grp_0 * * Purpose: Create an empty "new style" group at the specified location - * in the specified file. + * in the specified file. * * If pass is false on entry, do nothing. * @@ -48,70 +48,59 @@ */ void -ns_grp_0(hid_t fid, const char *group_name) -{ +ns_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pcreate() failed"; - } - assert(gcpl > 0); + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pcreate() failed"; + } + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; - } - assert(ret >= 0); + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; + } + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Gcreate2() failed"; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gcreate2() failed"; } - assert(gid > 0); + HDassert(gid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; } - assert(ret >= 0); + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; } - assert(ret >= 0); + HDassert(ret >= 0); } return; @@ -138,97 +127,81 @@ ns_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void vrfy_ns_grp_0(hid_t fid, const char *group_name) -{ +void vrfy_ns_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; unsigned crt_order_flags = 0; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) { + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: H5Gget_info() failed"; } - else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { - + else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + failure_mssg = + "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; } - else if ( 0 != grp_info.nlinks ) { - + else if (0 != grp_info.nlinks) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.nlinks"; } - else if ( 0 != grp_info.max_corder ) { - + else if (0 != grp_info.max_corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.max_corder"; } - else if ( FALSE != grp_info.mounted ) { - + else if ( FALSE != grp_info.mounted) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: FALSE != grp_info.mounted"; } @@ -240,12 +213,10 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) HDassert(false == grp_info.mounted); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: H5Gclose() failed"; } @@ -253,15 +224,14 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) } return; - } /* vrfy_ns_grp_0() */ /*------------------------------------------------------------------------- * Function: ns_grp_c * - * Purpose: Create a compact "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Create a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -276,68 +246,57 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void -ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) -{ +void +ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; unsigned max_compact; unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - + if (gcpl <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pcreate(H5P_GROUP_CREATE) failed"; } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pset_link_creation_order() failed"; } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - + if (gid <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Gcreate2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { max_compact = 0; ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pget_link_phase_change() failed"; } - else if ( nlinks <= 0 ) { - + else if (nlinks <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: nlinks <= 0"; } - else if ( nlinks >= max_compact ) { - + else if (nlinks >= max_compact) { pass = FALSE; failure_mssg = "ns_grp_c: nlinks >= max_compact"; } @@ -348,72 +307,59 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { char linkname[16]; - sprintf(linkname, "%u", u); - - if(0 == (u % 3)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + HDsprintf(linkname, "%u", u); - if ( ret < 0 ) { + if (0 == (u % 3)) { + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_soft() failed"; } HDassert(ret >= 0); } /* end if */ - else if(1 == (u % 3)) { - - ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); - - if ( ret < 0 ) { + else if (1 == (u % 3)) { + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_hard() failed"; } HDassert(ret >= 0); } /* end else-if */ else { - HDassert(2 == (u % 3)); - ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); - - if ( ret < 0 ) { + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_external() failed"; } HDassert(ret >= 0); } /* end else */ - u++; - + u++; } /* end while() */ - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pclose(gcpl) failed"; } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Gclose(gid) failed"; } @@ -428,8 +374,8 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) /*------------------------------------------------------------------------- * Function: vrfy_ns_grp_c * - * Purpose: Verify a compact "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Verify a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -445,8 +391,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) */ void -vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) -{ +vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -454,89 +399,73 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - + if (gid <= 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gopen2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - + if (gcpl <= 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gget_create_plist(gid) failed"; } - assert(gcpl > 0); + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Pget_link_creation_order() failed"; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + failure_mssg = "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Pclose() failed"; } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gget_info() failed"; } - else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { - + else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + failure_mssg = + "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; } - else if ( nlinks != grp_info.nlinks ) { - + else if (nlinks != grp_info.nlinks) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.nlinks"; } - else if ( nlinks != grp_info.max_corder ) { - + else if (nlinks != grp_info.max_corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.max_corder"; } - else if ( FALSE != grp_info.mounted ) { - + else if ( FALSE != grp_info.mounted) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: FALSE != grp_info.mounted"; } @@ -549,42 +478,36 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[16]; htri_t link_exists; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - + if (link_exists < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lexists() failed"; } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_info() failed"; } - else if ( TRUE != lnk_info.corder_valid ) { - + else if ( TRUE != lnk_info.corder_valid) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: TRUE != lnk_info.corder_valid"; } - else if ( u != lnk_info.corder ) { - + else if (u != lnk_info.corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: u != lnk_info.corder"; } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - + else if (H5T_CSET_ASCII != lnk_info.cset) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5T_CSET_ASCII != lnk_info.cset"; } @@ -593,75 +516,62 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(u == lnk_info.corder); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if ( 0 == (u % 3) ) { - + if (0 == (u % 3)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - + if (H5L_TYPE_SOFT != lnk_info.type) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_SOFT != lnk_info.type"; } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: (strlen(group_name) + 1) != lnk_info.u.val_size"; + failure_mssg = "vrfy_ns_grp_c: (HDstrlen(group_name) + 1) != lnk_info.u.val_size"; } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - slinkval = (char *)malloc(lnk_info.u.val_size); - - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); + if (!slinkval) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: malloc of slinkval failed"; + failure_mssg = "vrfy_ns_grp_c: HDmalloc of slinkval failed"; } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed"; } - else if ( 0 != strcmp(slinkval, group_name) ) { - + else if (0 != HDstrcmp(slinkval, group_name)) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: 0 != strcmp(slinkval, group_name)"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(slinkval, group_name)"; } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ - else if(1 == (u % 3)) { - + else if (1 == (u % 3)) { H5O_info_t root_oinfo; - if ( H5L_TYPE_HARD != lnk_info.type ) { - + if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_HARD != lnk_info.type"; } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; } - else if ( root_oinfo.addr != lnk_info.u.address ) { - + else if (root_oinfo.addr != lnk_info.u.address) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); @@ -673,83 +583,70 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(2 == (u % 3)); - if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { - + if (H5L_TYPE_EXTERNAL != lnk_info.type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; + failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; } HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); - elinkval = malloc(lnk_info.u.val_size); - - if ( ! elinkval ) { + elinkval = HDmalloc(lnk_info.u.val_size); + if (!elinkval) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: malloc of elinkval failed."; + failure_mssg = "vrfy_ns_grp_c: HDmalloc of elinkval failed."; } HDassert(elinkval); - ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed."; } HDassert(ret >= 0); - ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, - NULL, &file, &path); - if ( ret < 0 ) { - + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lunpack_elink_val() failed."; } - else if ( 0 != strcmp(file, "external.h5") ) { - + else if (0 != HDstrcmp(file, "external.h5")) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: 0 != strcmp(file, \"external.h5\")"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(file, \"external.h5\")"; } - else if ( 0 != strcmp(path, "/ext") ) { - + else if (0 != HDstrcmp(path, "/ext")) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: 0 != strcmp(path, \"/ext\")"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(path, \"/ext\")"; } HDassert(ret >= 0); - HDassert(0 == strcmp(file, "external.h5")); - HDassert(0 == strcmp(path, "/ext")); + HDassert(0 == HDstrcmp(file, "external.h5")); + HDassert(0 == HDstrcmp(path, "/ext")); - free(elinkval); + HDfree(elinkval); } /* end else */ - u++; - + u++; } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gclose() failed."; } - assert(ret >= 0); + HDassert(ret >= 0); } return; - } /* vrfy_ns_grp_c() */ /*------------------------------------------------------------------------- * Function: ns_grp_d * - * Purpose: Create a dense "new style" group, with 'nlinks' - * (soft/hard/external) links in it in the specified file. + * Purpose: Create a dense "new style" group, with 'nlinks' + * (soft/hard/external) links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -765,153 +662,130 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) */ void -ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) -{ +ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; unsigned max_compact; unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pcreate() failed."; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pcreate() failed."; + } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Gcreate2() failed."; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gcreate2() failed."; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { max_compact = 0; ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; - } - else if ( nlinks <= max_compact ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: nlinks <= max_compact"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; + } + else if (nlinks <= max_compact) { + pass = FALSE; + failure_mssg = "ns_grp_d: nlinks <= max_compact"; + } HDassert(ret >= 0); HDassert(nlinks > max_compact); } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { char linkname[16]; - sprintf(linkname, "%u", u); - - if(0 == (u % 3)) { + HDsprintf(linkname, "%u", u); - ret = H5Lcreate_soft(group_name, gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + if (0 == (u % 3)) { + ret = H5Lcreate_soft(group_name, gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; + } HDassert(ret >= 0); } /* end if */ - else if(1 == (u % 3)) { - - ret = H5Lcreate_hard(fid, "/", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + else if (1 == (u % 3)) { + ret = H5Lcreate_hard(fid, "/", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; + } HDassert(ret >= 0); } /* end else-if */ else { - HDassert(2 == (u % 3)); - ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; + } HDassert(ret >= 0); } /* end else */ u++; - } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gclose() failed."; + } HDassert(ret >= 0); } return; - } /* ns_grp_d() */ /*------------------------------------------------------------------------- * Function: vrfy_ns_grp_d * - * Purpose: Verify a dense "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Verify a dense "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -928,8 +802,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) void -vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) -{ +vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -937,93 +810,75 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; } - assert(gcpl > 0); + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + else if (H5P_CRT_ORDER_TRACKED != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; - } - else if ( H5G_STORAGE_TYPE_DENSE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; - } - else if ( nlinks != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; - } - else if ( nlinks != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; + } + else if (H5G_STORAGE_TYPE_DENSE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; + } + else if (nlinks != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; + } + else if (nlinks != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_DENSE == grp_info.storage_type); HDassert(nlinks == grp_info.nlinks); @@ -1032,116 +887,100 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[16]; htri_t link_exists; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; - } + if (link_exists < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; + } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; - } - else if ( TRUE != lnk_info.corder_valid ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; - } - else if ( u != lnk_info.corder ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; - } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; + } + else if (TRUE != lnk_info.corder_valid) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; + } + else if (u != lnk_info.corder) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; + } + else if (H5T_CSET_ASCII != lnk_info.cset) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; + } HDassert(ret >= 0); HDassert(true == lnk_info.corder_valid); HDassert(u == lnk_info.corder); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if(0 == (u % 3)) { + if (0 == (u % 3)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; - } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; - } + if (H5L_TYPE_SOFT != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); - - slinkval = (char *)malloc(lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: malloc of slinkval failed"; - } + if (!slinkval) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: HDmalloc of slinkval failed"; + } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; - } - else if ( 0 != strcmp(slinkval, group_name) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(slinkval, group_name)"; - } + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; + } + else if (0 != HDstrcmp(slinkval, group_name)) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(slinkval, group_name)"; + } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ - else if(1 == (u % 3)) { + else if (1 == (u % 3)) { H5O_info_t root_oinfo; - if ( H5L_TYPE_HARD != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; - } + if (H5L_TYPE_HARD != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; + } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; - } - else if ( root_oinfo.addr != lnk_info.u.address ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; + } + else if (root_oinfo.addr != lnk_info.u.address) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; + } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); } /* end else-if */ @@ -1152,72 +991,58 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(2 == (u % 3)); - if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; - } + if (H5L_TYPE_EXTERNAL != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; + } HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); - elinkval = malloc(lnk_info.u.val_size); + elinkval = HDmalloc(lnk_info.u.val_size); - if ( ! elinkval ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: malloc of elinkval failed."; - } + if (!elinkval) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: HDmalloc of elinkval failed."; + } HDassert(elinkval); - ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { + pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Lget_val failed."; } HDassert(ret >= 0); - ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, - &file, &path); - if ( ret < 0 ) { - - pass = FALSE; + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path); + if (ret < 0) { + pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Lunpack_elink_val failed."; } - else if ( 0 != strcmp(file, "external.h5") ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(file, \"external.h5\")."; + else if (0 != HDstrcmp(file, "external.h5")) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(file, \"external.h5\")."; + } + else if (0 != HDstrcmp(path, "/ext")) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(path, \"/ext\")"; } - else if ( 0 != strcmp(path, "/ext") ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(path, \"/ext\")"; - } HDassert(ret >= 0); - HDassert(0 == strcmp(file, "external.h5")); - HDassert(0 == strcmp(path, "/ext")); - - free(elinkval); + HDassert(0 == HDstrcmp(file, "external.h5")); + HDassert(0 == HDstrcmp(path, "/ext")); + HDfree(elinkval); } /* end else */ - u++; - + u++; } /* end while() */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; + } HDassert(ret >= 0); } @@ -1254,21 +1079,17 @@ os_grp_0(hid_t fid, const char *group_name) herr_t ret; if ( pass ) { /* get the file's file access property list */ - fapl = H5Fget_access_plist(fid); if ( fapl <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fget_access_plist() failed."; } HDassert(fapl > 0); } - - if ( pass ) { /* get low and high bounds from fapl */ + if ( pass ) { /* get low and high bounds from fapl */ ret = H5Pget_libver_bounds(fapl, &low, &high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1)."; } @@ -1276,11 +1097,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { /* turn file format latest off */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1289,11 +1108,8 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { - - gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( gid <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Gcreate2() failed."; } @@ -1301,11 +1117,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { - ret = H5Gclose(gid); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Gclose() failed."; } @@ -1313,11 +1127,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { /* restore low and high bounds */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, low, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1326,7 +1138,6 @@ os_grp_0(hid_t fid, const char *group_name) } return; - } /* os_grp_0() */ @@ -1349,98 +1160,83 @@ os_grp_0(hid_t fid, const char *group_name) */ void -vrfy_os_grp_0(hid_t fid, const char *group_name) -{ +vrfy_os_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; unsigned crt_order_flags = 0; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; + } HDassert(gcpl > 0); } - if ( pass ) { + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; - } - else if ( 0 != crt_order_flags ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; + } + else if (0 != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; + } HDassert(ret >= 0); HDassert(0 == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; - } - else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; - } - else if ( 0 != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; - } - else if ( 0 != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; + } + else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if (0 != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; + } + else if (0 != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); HDassert(0 == grp_info.nlinks); @@ -1448,28 +1244,25 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) HDassert(false == grp_info.mounted); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_os_grp_0() */ /*------------------------------------------------------------------------- * Function: os_grp_n * - * Purpose: Create an "old style" group, with 'nlinks' soft/hard - * links in it. + * Purpose: Create an "old style" group, with 'nlinks' soft/hard + * links in it. * * If pass is false on entry, do nothing. * @@ -1484,7 +1277,7 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void +void os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) { hid_t gid = -1; @@ -1494,10 +1287,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) herr_t ret; if ( pass ) { /* get the file's file access property list */ - fapl = H5Fget_access_plist(fid); if ( fapl <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Fget_access_plist() failed."; } @@ -1505,10 +1296,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { /* get low and high bounds from fapl */ - ret = H5Pget_libver_bounds(fapl, &low, &high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1)."; } @@ -1516,11 +1305,9 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { /* turn file format latest off */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1529,11 +1316,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { - - gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( gid <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Gcreate2() failed."; } @@ -1544,58 +1328,46 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) u = 0; while ( ( pass ) && ( u < nlinks ) ) { - char linkname[32]; - sprintf(linkname, "ln%d_%u", proc_num, u); + HDsprintf(linkname, "ln%d_%u", proc_num, u); if(0 == (u % 2)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; } HDassert(ret >= 0); } /* end if */ else { - HDassert(1 == (u % 2)); - ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, H5P_DEFAULT); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; } HDassert(ret >= 0); } /* end else */ - u++; - + u++; } /* end while */ if ( pass ) { - ret = H5Gclose(gid); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Gclose() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Gclose() failed."; } - assert(ret >= 0); + HDassert(ret >= 0); } if ( pass ) { /* restore low and high bounds */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, low, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Fset_libver_bounds() failed(2)."; } @@ -1626,8 +1398,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) *------------------------------------------------------------------------- */ void -vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) -{ +vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, + unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -1635,92 +1407,76 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; + } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; - } - else if ( 0 != crt_order_flags ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; + } + else if (0 != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; + } HDassert(ret >= 0); HDassert(0 == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; - } - else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; - } - else if ( nlinks != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; - } - else if ( 0 != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; + } + else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if (nlinks != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; + } + else if (0 != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); HDassert(nlinks == grp_info.nlinks); @@ -1729,137 +1485,117 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[32]; htri_t link_exists; - sprintf(linkname, "ln%d_%u", proc_num, u); + HDsprintf(linkname, "ln%d_%u", proc_num, u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; + if (link_exists < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; } - else if ( FALSE != lnk_info.corder_valid ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; + else if ( FALSE != lnk_info.corder_valid) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; + else if (H5T_CSET_ASCII != lnk_info.cset) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; } HDassert(ret >= 0); HDassert(false == lnk_info.corder_valid); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if(0 == (u % 2)) { + if (0 == (u % 2)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; + if (H5L_TYPE_SOFT != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: (strlen(group_name) + 1) != lnk_info.u.val_size"; + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: (HDstrlen(group_name) + 1) != lnk_info.u.val_size"; } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); - - slinkval = (char *)malloc(lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: malloc of slinkval failed"; + if (!slinkval) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: HDmalloc of slinkval failed"; } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - - if ( ret < 0 ) { + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; } - else if ( 0 != strcmp(slinkval, group_name) ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: 0 != strcmp(slinkval, group_name)"; + else if (0 != HDstrcmp(slinkval, group_name)) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != HDstrcmp(slinkval, group_name)"; } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ else { H5O_info_t root_oinfo; HDassert(1 == (u % 2)); - if ( H5L_TYPE_HARD != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; + if (H5L_TYPE_HARD != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; } - else if ( root_oinfo.addr != lnk_info.u.address ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; + else if (root_oinfo.addr != lnk_info.u.address) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); } /* end else */ - u++; - + u++; } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; } HDassert(ret >= 0); } return; - } /* vrfy_os_grp_n() */ @@ -1867,8 +1603,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) * Function: ds_ctg_i * * Purpose: Create a contiguous dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -1882,106 +1618,91 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) * *------------------------------------------------------------------------- */ -void -ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_DIMS}; + hsize_t dims[1] = { DSET_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; } HDassert(sid > 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Sclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Sclose() failed"; } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_DIMS); - - if ( ! wdata ) { + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - pass = FALSE; - failure_mssg = "ds_ctg_i: malloc of wdata failed."; + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_ctg_i: HDmalloc of wdata failed."; } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) - - wdata[u] = (int)u; - - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) + wdata[u] = (int) u; - if ( ret < 0 ) { + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dwrite() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dwrite() failed."; } HDassert(ret >= 0); - free(wdata); - } - - if ( pass ) { + HDfree(wdata); + } + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dclose() failed"; } HDassert(ret >= 0); } return; - } /* ds_ctg_i */ /*------------------------------------------------------------------------- * Function: vrfy_ds_ctg_i * - * Purpose: Validate a contiguous datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a contiguous datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -1995,9 +1716,8 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2011,225 +1731,187 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; - } - else if ( DSET_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_DIMS == dims[0]); HDassert(DSET_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; - } - assert(ret >= 0); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; + } + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; - } - else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data + && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CONTIGUOUS != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; - } + if (H5D_CONTIGUOUS != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; + } HDassert(H5D_CONTIGUOUS == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; - break; - } - HDassert((int)u == rdata[u]); - } + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; + break; + } + HDassert((int )u == rdata[u]); + } - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; + } HDassert(ret >= 0); } @@ -2242,8 +1924,8 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * Function: ds_chk_i * * Purpose: Create a chunked dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -2257,142 +1939,121 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t dcpl = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_DIMS}; - hsize_t chunk_dims[1] = {DSET_CHUNK_DIMS}; + hsize_t dims[1] = { DSET_DIMS }; + hsize_t chunk_dims[1] = { DSET_CHUNK_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Screate_simple() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Screate_simple() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { dcpl = H5Pcreate(H5P_DATASET_CREATE); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pcreate() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pcreate() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_chunk(dcpl, 1, chunk_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, - H5P_DEFAULT, dcpl, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dcreate2() failed"; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dcreate2() failed"; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_chk_i: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) - wdata[u] = (int)u; + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) + wdata[u] = (int) u; - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dwrite() failed."; - } + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dwrite() failed."; + } HDassert(ret >= 0); - - free(wdata); + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* ds_chk_i */ /*------------------------------------------------------------------------- * Function: vrfy_ds_chk_i * - * Purpose: Validate a chunked datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a chunked datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -2406,9 +2067,8 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2422,249 +2082,204 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; - } - else if ( DSET_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_DIMS == dims[0]); HDassert(DSET_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; - } - else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CHUNKED != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; - } + if (H5D_CHUNKED != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; + } HDassert(H5D_CHUNKED == layout); } - if ( pass ) { - + if (pass) { ret = H5Pget_chunk(dcpl, 1, chunk_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; - } - else if ( DSET_CHUNK_DIMS != chunk_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: "; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; + } + else if ( DSET_CHUNK_DIMS != chunk_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: "; + } HDassert(ret >= 0); HDassert(DSET_CHUNK_DIMS == chunk_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; - break; - } - HDassert((int)u == rdata[u]); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; + break; + } + HDassert((int )u == rdata[u]); } - free(rdata); + HDfree(rdata); } /* end if */ - - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_chk_i() */ @@ -2672,8 +2287,8 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * Function: ds_cpt_i * * Purpose: Create a compact dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -2687,129 +2302,110 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t dcpl = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_COMPACT_DIMS}; + hsize_t dims[1] = { DSET_COMPACT_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { dcpl = H5Pcreate(H5P_DATASET_CREATE); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pcreate() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pcreate() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_layout(dcpl, H5D_COMPACT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, - H5P_DEFAULT, dcpl, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_cpt_i: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_COMPACT_DIMS; u++) - wdata[u] = (int)u; + if ((pass) && (write_data)) { + for (u = 0; u < DSET_COMPACT_DIMS; u++) + wdata[u] = (int) u; - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dwrite() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dwrite() failed."; + } HDassert(ret >= 0); - free(wdata); + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dclose() failed."; + } HDassert(ret >= 0); } @@ -2821,8 +2417,8 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) /*------------------------------------------------------------------------- * Function: vrfy_ds_cpt_i * - * Purpose: Validate a compact datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a compact datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -2836,9 +2432,8 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2852,232 +2447,195 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_COMPACT_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; - } - else if ( DSET_COMPACT_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_COMPACT_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; + } + else if ( DSET_COMPACT_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_COMPACT_DIMS == dims[0]); HDassert(DSET_COMPACT_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; - } - else if ( H5D_SPACE_STATUS_ALLOCATED != allocation ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; + } + else if (H5D_SPACE_STATUS_ALLOCATED != allocation) { + pass = FALSE; + failure_mssg = + "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; + } HDassert(ret >= 0); HDassert(H5D_SPACE_STATUS_ALLOCATED == allocation); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_COMPACT != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; - } + if (H5D_COMPACT != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; + } HDassert(H5D_COMPACT == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; + } HDassert(ret >= 0); - } - - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + } - if ( ! rdata ) { + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS); - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_COMPACT_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; - break; - } - HDassert((int)u == rdata[u]); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_COMPACT_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; + break; + } + HDassert((int )u == rdata[u]); } - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_cpt_i() */ /*------------------------------------------------------------------------- * Function: ds_ctg_v * - * Purpose: Create a contiguous dataset w/variable-length datatype. - * Write data to the data set or not as indicated by the - * write_data parameter. + * Purpose: Create a contiguous dataset w/variable-length datatype. + * Write data to the data set or not as indicated by the + * write_data parameter. * * If pass is false on entry, do nothing. * @@ -3091,166 +2649,142 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) { hid_t dsid = -1; hid_t sid = -1; hid_t tid = -1; - hsize_t dims[1] = {DSET_SMALL_DIMS}; + hsize_t dims[1] = { DSET_SMALL_DIMS }; herr_t ret; hvl_t *wdata = NULL; unsigned u; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Screate_simple"; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Screate_simple"; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { tid = H5Tvlen_create(H5T_NATIVE_INT); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; + } HDassert(tid > 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + if (pass) { + dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; + } HDassert(dsid > 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); + if ((pass) && (write_data)) { + wdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_ctg_v: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_SMALL_DIMS; u++) { - + if ((pass) && (write_data)) { + for (u = 0; u < DSET_SMALL_DIMS; u++) { int *tdata; unsigned len; unsigned v; len = (u % 10) + 1; - tdata = (int *)malloc(sizeof(int) * len); - - if ( !tdata ) { + tdata = (int *) HDmalloc(sizeof(int) * len); - pass = FALSE; - failure_mssg = "ds_ctg_v: malloc of tdata failed."; - break; - } + if (!tdata) { + pass = FALSE; + failure_mssg = "ds_ctg_v: HDmalloc of tdata failed."; + break; + } HDassert(tdata); - for(v = 0; v < len; v++) - tdata[v] = (int)(u + v); + for (v = 0; v < len; v++) + tdata[v] = (int) (u + v); - wdata[u].len = len; - wdata[u].p = tdata; + wdata[u].len = len; + wdata[u].p = tdata; } /* end for */ } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dwrite() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dwrite() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; + } HDassert(ret >= 0); - free(wdata); - + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( sid < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Sclose() failed."; - } + if (sid < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( tid < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Tclose() failed."; - } + if (tid < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* ds_ctg_v() */ /*------------------------------------------------------------------------- * Function: vrfy_ds_ctg_v * - * Purpose: Validate a contiguous datasets w/variable-length datatypes. - * Validate data if indicated via the write_data parameter. + * Purpose: Validate a contiguous datasets w/variable-length datatypes. + * Validate data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -3264,9 +2798,8 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) { hid_t dsid = -1; hid_t sid = -1; hid_t tid = -1; @@ -3281,283 +2814,240 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; - } - else if ( DSET_SMALL_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; - } - else if ( DSET_SMALL_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; + } + else if ( DSET_SMALL_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; + } + else if ( DSET_SMALL_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_SMALL_DIMS == dims[0]); HDassert(DSET_SMALL_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { tmp_tid = H5Tvlen_create(H5T_NATIVE_INT); - if ( tmp_tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; - } + if (tmp_tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; + } HDassert(tmp_tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, tmp_tid); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tmp_tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; - } - else if ( write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data + && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CONTIGUOUS != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; - } + if (H5D_CONTIGUOUS != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; + } HDassert(H5D_CONTIGUOUS == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { + if ((pass) && (write_data)) { + rdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - rdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - - if ( !rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dread(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_SMALL_DIMS; u++) { + if ((pass) && (write_data)) { + for (u = 0; u < DSET_SMALL_DIMS; u++) { unsigned len; unsigned v; - len = (unsigned)rdata[u].len; - for(v = 0; v < len; v++) { - int *tdata = (int *)rdata[u].p; - - if ( !tdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: !tdata"; - break; - } - else if ( (int)(u + v) != tdata[v] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; - break; - } + len = (unsigned) rdata[u].len; + for (v = 0; v < len; v++) { + int *tdata = (int *) rdata[u].p; + + if (!tdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: !tdata"; + break; + } + else if ((int) (u + v) != tdata[v]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; + break; + } HDassert(tdata); - HDassert((int)(u + v) == tdata[v]); + HDassert((int )(u + v) == tdata[v]); } /* end for */ } /* end for */ } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; + } HDassert(ret >= 0); - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_ctg_v() */ - + /*------------------------------------------------------------------------- * Function: create_zoo * @@ -3596,203 +3086,202 @@ create_zoo(hid_t fid, const char *base_path, int proc_num) /* Add & verify an empty "new style" group */ if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_0(fid, full_path); } if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_0(fid, full_path); } /* Add & verify a compact "new style" group (3 link messages) */ if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_c(fid, full_path, 3); } if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_c(fid, full_path, 3); } - /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & + /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & * fractal heap) */ if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_d(fid, full_path, 300); } if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_d(fid, full_path, 300); } /* Add & verify an empty "old style" group to file */ if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); os_grp_0(fid, full_path); } if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_0(fid, full_path); } - /* Add & verify an "old style" group (w/300 links, in v1 B-tree & - * local heap) to file + /* Add & verify an "old style" group (w/300 links, in v1 B-tree & + * local heap) to file */ if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); os_grp_n(fid, full_path, proc_num, 300); } if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_n(fid, full_path, proc_num, 300); } - /* Add & verify a contiguous dataset w/integer datatype (but no data) - * to file + /* Add & verify a contiguous dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, FALSE); } - /* Add & verify a contiguous dataset w/integer datatype (with data) - * to file + /* Add & verify a contiguous dataset w/integer datatype (with data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, TRUE); } - /* Add & verify a chunked dataset w/integer datatype (but no data) - * to file + /* Add & verify a chunked dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_chk_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, FALSE); } - /* Add & verify a chunked dataset w/integer datatype (and data) - * to file + /* Add & verify a chunked dataset w/integer datatype (and data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_chk_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, TRUE); } - /* Add & verify a compact dataset w/integer datatype (but no data) - * to file + /* Add & verify a compact dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_cpt_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, FALSE); } - /* Add & verify a compact dataset w/integer datatype (and data) - * to file + /* Add & verify a compact dataset w/integer datatype (and data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_cpt_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, TRUE); } - /* Add & verify a contiguous dataset w/variable-length datatype - * (but no data) to file + /* Add & verify a contiguous dataset w/variable-length datatype + * (but no data) to file */ if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_v(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, FALSE); } - /* Add & verify a contiguous dataset w/variable-length datatype - * (and data) to file + /* Add & verify a contiguous dataset w/variable-length datatype + * (and data) to file */ if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_v(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, TRUE); } return; - } /* create_zoo() */ - + /*------------------------------------------------------------------------- * Function: validate_zoo * - * Purpose: Given the path to a group in which a "zoo" has been - * constructed, validate the objects in the "zoo". + * Purpose: Given the path to a group in which a "zoo" has been + * constructed, validate the objects in the "zoo". * * If pass is false on entry, do nothing. * @@ -3824,116 +3313,115 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num) /* validate an empty "new style" group */ if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_0(fid, full_path); } /* validate a compact "new style" group (3 link messages) */ if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_c(fid, full_path, 3); } - /* validate a dense "new style" group (w/300 links, in v2 B-tree & + /* validate a dense "new style" group (w/300 links, in v2 B-tree & * fractal heap) */ if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_d(fid, full_path, 300); } /* validate an empty "old style" group in file */ if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_0(fid, full_path); } - /* validate an "old style" group (w/300 links, in v1 B-tree & + /* validate an "old style" group (w/300 links, in v1 B-tree & * local heap) */ if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_n(fid, full_path, proc_num, 300); } - /* validate a contiguous dataset w/integer datatype (but no data) - * in file. + /* validate a contiguous dataset w/integer datatype (but no data) + * in file. */ if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, FALSE); } - /* validate a contiguous dataset w/integer datatype (with data) - * in file. + /* validate a contiguous dataset w/integer datatype (with data) + * in file. */ if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, TRUE); } - /* validate a chunked dataset w/integer datatype (but no data) - * in file + /* validate a chunked dataset w/integer datatype (but no data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, FALSE); } - /* validate a chunked dataset w/integer datatype (and data) - * in file + /* validate a chunked dataset w/integer datatype (and data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, TRUE); } - /* Validate a compact dataset w/integer datatype (but no data) - * in file + /* Validate a compact dataset w/integer datatype (but no data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, FALSE); } - /* validate a compact dataset w/integer datatype (and data) - * in file + /* validate a compact dataset w/integer datatype (and data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, TRUE); } - /* validate a contiguous dataset w/variable-length datatype - * (but no data) to file + /* validate a contiguous dataset w/variable-length datatype + * (but no data) to file */ if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, FALSE); } - /* validate a contiguous dataset w/variable-length datatype - * (and data) to file + /* validate a contiguous dataset w/variable-length datatype + * (and data) to file */ if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, TRUE); } return; - } /* validate_zoo() */ diff --git a/test/ohdr.c b/test/ohdr.c index 146245f..669b1e0 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -470,8 +470,8 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* create a different name for a local copy of the data file to be opened with rd/wr file permissions in case build and test are done in the source directory. */ - HDstrncpy(testfile, FILE_BOGUS, strlen(FILE_BOGUS)); - testfile[strlen(FILE_BOGUS)]='\0'; + HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS)); + testfile[HDstrlen(FILE_BOGUS)]='\0'; HDstrncat(testfile, ".copy", 5); /* Make a copy of the data file from svn. */ diff --git a/test/tmisc.c b/test/tmisc.c index 1e62302..22e1aad 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2272,7 +2272,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char CHECK_PTR(user_block, "HDcalloc"); /* Copy in the user block data */ - HDmemcpy(user_block, str, strlen(str)); + HDmemcpy(user_block, str, HDstrlen(str)); /* Open the new file */ new_fp = HDfopen(new_name,"wb"); diff --git a/test/tunicode.c b/test/tunicode.c index 85f5af0..e0e1f24 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -164,7 +164,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); @@ -226,8 +226,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string. * It will look like "abcdefghabcdefgh". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(buf, new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); diff --git a/test/tvltypes.c b/test/tvltypes.c index e5a3d34..91ef0c2 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -467,7 +467,7 @@ test_vltypes_vlen_atomic(void) /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { - ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -499,7 +499,7 @@ test_vltypes_vlen_atomic(void) /* Try to reclaim read data using "bad" dataspace with no extent * Should fail */ H5E_BEGIN_TRY { - ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); + ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_reclaim"); @@ -1205,9 +1205,9 @@ test_vltypes_compound_vlstr(void) wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2)); wdata[i].v.len=i+L3_INCM; for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) { - strcat(str, "m"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); + HDstrcat(str, "m"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); /*t1->color = red;*/ t1->color = blue; } @@ -1348,7 +1348,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) { - if( strcmp(t1->string, t2->string) ) { + if( HDstrcmp(t1->string, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1368,14 +1368,14 @@ test_vltypes_compound_vlstr(void) CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Use this part for new data */ - strcpy(str, "bbbbbbbb\0"); + HDstrcpy(str, "bbbbbbbb\0"); for(i=0; i<SPACE1_DIM1; i++) { wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2)); wdata2[i].v.len=i+1; for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) { - strcat(str, "pp"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); + HDstrcat(str, "pp"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); t1->color = green; } } /* end for */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) { - if( strcmp(t1->string, t2->string) ) { + if( HDstrcmp(t1->string, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -149,7 +149,7 @@ test_sec2(void) /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * Currently it should be around 2 KB. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -258,7 +258,7 @@ test_core(void) | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA - | H5FD_FEAT_ALLOW_FILE_IMAGE + | H5FD_FEAT_ALLOW_FILE_IMAGE | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) TEST_ERROR @@ -341,7 +341,7 @@ test_core(void) /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * TODO: Needs justification of why is this is a reasonable size. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -379,7 +379,7 @@ test_core(void) for(i = 0; i < CORE_DSET_DIM1; i++) for(j = 0; j < CORE_DSET_DIM2; j++) *pw++ = val++; - HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); /* Create the dataspace */ dims[0] = CORE_DSET_DIM1; @@ -469,7 +469,7 @@ test_core(void) TEST_ERROR; /* Read the data back from the dataset */ - HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0) TEST_ERROR; @@ -488,7 +488,7 @@ test_core(void) /* Check file size API. * There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * TODO: Needs justification of why is this is a reasonable size. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -1330,7 +1330,7 @@ test_multi(void) if((atype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR; - if(H5Tset_size(atype, strlen(meta) + 1) < 0) + if(H5Tset_size(atype, HDstrlen(meta) + 1) < 0) TEST_ERROR; if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0) @@ -1385,7 +1385,7 @@ error: * Purpose: Tests the backward compatibility for MULTI driver. * See if we can open files created with v1.6 library. * The source file was created by the test/file_handle.c - * of the v1.6 library. This test verifies the fix for + * of the v1.6 library. This test verifies the fix for * Issue 2598. In v1.6 library, there was EOA for the whole * MULTI file saved in the super block. We took it out in * v1.8 library because it's meaningless for the MULTI file. @@ -1446,7 +1446,7 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); - /* Make copy for the data file in the build directory, to protect the + /* Make copy for the data file in the build directory, to protect the * original file in the source directory */ sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); @@ -1483,7 +1483,7 @@ test_multi_compat(void) if(H5Fclose(file) < 0) TEST_ERROR; - /* Reopen the file for adding another dataset. The new EOA for metadata file + /* Reopen the file for adding another dataset. The new EOA for metadata file * should be written to the file */ if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; @@ -1510,7 +1510,7 @@ test_multi_compat(void) if(H5Fclose(file) < 0) TEST_ERROR; - /* Reopen the file for read only again. Verify the library can handle + /* Reopen the file for read only again. Verify the library can handle * the EOA correctly */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; |