diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
commit | ec8ad09125032c9c232878d02e90aa86df162841 (patch) | |
tree | 5d63105d3a0db7d5bbee41c5b74b097649a2115e /test/tattr.c | |
parent | 453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff) | |
download | hdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2 |
Source formatted
Diffstat (limited to 'test/tattr.c')
-rw-r--r-- | test/tattr.c | 3671 |
1 files changed, 1838 insertions, 1833 deletions
diff --git a/test/tattr.c b/test/tattr.c index 2a5e613..510ff81 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*********************************************************** -* -* Test program: tattr -* -* Test the attribute functionality -* -*************************************************************/ + * + * Test program: tattr + * + * Test the attribute functionality + * + *************************************************************/ #include "testhdf5.h" @@ -25,44 +25,44 @@ * This file needs to access private information from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ #define H5O_TESTING -#include "H5Opkg.h" /* Object headers */ +#include "H5Opkg.h" /* Object headers */ /* * This file needs to access private information from the H5A package. * This file also needs to access the attribute testing code. */ -#define H5A_FRIEND /*suppress error about including H5Apkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ #define H5A_TESTING -#include "H5Apkg.h" /* Attributes */ +#include "H5Apkg.h" /* Attributes */ /* * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING -#include "H5Fpkg.h" /* File access */ +#include "H5Fpkg.h" /* File access */ -#define FILENAME "tattr.h5" -#define NAME_BUF_SIZE 1024 -#define ATTR_NAME_LEN 16 -#define ATTR_MAX_DIMS 7 -#define ATTR_TMP_NAME "a really long temp_name" -#define CORDER_ITER_STOP 3 +#define FILENAME "tattr.h5" +#define NAME_BUF_SIZE 1024 +#define ATTR_NAME_LEN 16 +#define ATTR_MAX_DIMS 7 +#define ATTR_TMP_NAME "a really long temp_name" +#define CORDER_ITER_STOP 3 /* 3-D dataset with fixed dimensions */ -#define SPACE1_RANK 3 -#define SPACE1_DIM1 3 -#define SPACE1_DIM2 15 -#define SPACE1_DIM3 13 +#define SPACE1_RANK 3 +#define SPACE1_DIM1 3 +#define SPACE1_DIM2 15 +#define SPACE1_DIM3 13 /* Dataset Information */ #define DSET1_NAME "Dataset1" #define DSET2_NAME "Dataset2" #define DSET3_NAME "Dataset3" -#define NUM_DSETS 3 +#define NUM_DSETS 3 /* Group Information */ #define GROUP1_NAME "/Group1" @@ -73,89 +73,91 @@ #define TYPE1_NAME "/Type" /* Attribute Rank & Dimensions */ -#define ATTR1_NAME "Attr1" -#define ATTR1_RANK 1 -#define ATTR1_DIM1 3 -int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */ +#define ATTR1_NAME "Attr1" +#define ATTR1_RANK 1 +#define ATTR1_DIM1 3 +int attr_data1[ATTR1_DIM1] = {512, -234, 98123}; /* Test data for 1st attribute */ /* rank & dimensions for another attribute */ -#define ATTR1A_NAME "Attr1_a" -int attr_data1a[ATTR1_DIM1]={256,11945,-22107}; - -#define ATTR2_NAME "Attr2" -#define ATTR2_RANK 2 -#define ATTR2_DIM1 2 -#define ATTR2_DIM2 2 -int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */ - -#define ATTR3_NAME "Attr3" -#define ATTR3_RANK 3 -#define ATTR3_DIM1 2 -#define ATTR3_DIM2 2 -#define ATTR3_DIM3 2 -double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3F,-26.1F}, {0.123F,-10.0F}},{{973.23F,-0.91827F},{2.0F,23.0F}}}; /* Test data for 3rd attribute */ - -#define ATTR4_NAME "Attr4" -#define ATTR4_RANK 2 -#define ATTR4_DIM1 2 -#define ATTR4_DIM2 2 -#define ATTR4_FIELDNAME1 "i" -#define ATTR4_FIELDNAME2 "d" -#define ATTR4_FIELDNAME3 "c" -size_t attr4_field1_off=0; -size_t attr4_field2_off=0; -size_t attr4_field3_off=0; +#define ATTR1A_NAME "Attr1_a" +int attr_data1a[ATTR1_DIM1] = {256, 11945, -22107}; + +#define ATTR2_NAME "Attr2" +#define ATTR2_RANK 2 +#define ATTR2_DIM1 2 +#define ATTR2_DIM2 2 +int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test data for 2nd attribute */ + +#define ATTR3_NAME "Attr3" +#define ATTR3_RANK 3 +#define ATTR3_DIM1 2 +#define ATTR3_DIM2 2 +#define ATTR3_DIM3 2 +double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = { + {{2.3F, -26.1F}, {0.123F, -10.0F}}, + {{973.23F, -0.91827F}, {2.0F, 23.0F}}}; /* Test data for 3rd attribute */ + +#define ATTR4_NAME "Attr4" +#define ATTR4_RANK 2 +#define ATTR4_DIM1 2 +#define ATTR4_DIM2 2 +#define ATTR4_FIELDNAME1 "i" +#define ATTR4_FIELDNAME2 "d" +#define ATTR4_FIELDNAME3 "c" +size_t attr4_field1_off = 0; +size_t attr4_field2_off = 0; +size_t attr4_field3_off = 0; struct attr4_struct { - int i; + int i; double d; - char c; - } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1F,'d'},{-100000, 0.123F,'3'}}, - {{-23,981724.2F,'Q'},{0,2.0F,'\n'}}}; /* Test data for 4th attribute */ + char c; +} attr_data4[ATTR4_DIM1][ATTR4_DIM2] = { + {{3, -26.1F, 'd'}, {-100000, 0.123F, '3'}}, + {{-23, 981724.2F, 'Q'}, {0, 2.0F, '\n'}}}; /* Test data for 4th attribute */ -#define ATTR5_NAME "Attr5" -#define ATTR5_RANK 0 -float attr_data5=-5.123F; /* Test data for 5th attribute */ +#define ATTR5_NAME "Attr5" +#define ATTR5_RANK 0 +float attr_data5 = -5.123F; /* Test data for 5th attribute */ -#define ATTR6_RANK 3 -#define ATTR6_DIM1 100 -#define ATTR6_DIM2 100 -#define ATTR6_DIM3 100 +#define ATTR6_RANK 3 +#define ATTR6_DIM1 100 +#define ATTR6_DIM2 100 +#define ATTR6_DIM3 100 -#define ATTR7_NAME "attr 1 - 000000" -#define ATTR8_NAME "attr 2" +#define ATTR7_NAME "attr 1 - 000000" +#define ATTR8_NAME "attr 2" -#define LINK1_NAME "Link1" +#define LINK1_NAME "Link1" -#define NATTR_MANY_OLD 350 -#define NATTR_MANY_NEW 35000 +#define NATTR_MANY_OLD 350 +#define NATTR_MANY_NEW 35000 #define BUG2_NATTR 100 #define BUG2_NATTR2 16 -#define BUG3_DSET_NAME "dset" -#define BUG3_DT_NAME "dt" -#define BUG3_ATTR_NAME "attr" +#define BUG3_DSET_NAME "dset" +#define BUG3_DT_NAME "dt" +#define BUG3_ATTR_NAME "attr" /* Used by test_attr_delete_last_dense() */ -#define GRPNAME "grp" +#define GRPNAME "grp" #define ATTRNAME "attr" -#define DIM0 100 -#define DIM1 100 -#define RANK 2 +#define DIM0 100 +#define DIM1 100 +#define RANK 2 /* Attribute iteration struct */ typedef struct { - H5_iter_order_t order; /* Direction of iteration */ - unsigned ncalled; /* # of times callback is entered */ - unsigned nskipped; /* # of attributes skipped */ - int stop; /* # of iterations to stop after */ - hsize_t curr; /* Current creation order value */ - size_t max_visit; /* Size of "visited attribute" flag array */ - hbool_t *visited; /* Pointer to array of "visited attribute" flags */ + H5_iter_order_t order; /* Direction of iteration */ + unsigned ncalled; /* # of times callback is entered */ + unsigned nskipped; /* # of attributes skipped */ + int stop; /* # of iterations to stop after */ + hsize_t curr; /* Current creation order value */ + size_t max_visit; /* Size of "visited attribute" flag array */ + hbool_t * visited; /* Pointer to array of "visited attribute" flags */ } attr_iter_info_t; -static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, - void *op_data); +static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *op_data); /* Global dcpl ID, can be re-set as a generated dcpl for various operations * across multiple tests. @@ -163,8 +165,6 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, */ static hid_t dcpl_g = H5P_DEFAULT; - - /**************************************************************** ** ** test_attr_basic_write(): Test basic H5A (attribute) code. @@ -174,21 +174,21 @@ static hid_t dcpl_g = H5P_DEFAULT; static void test_attr_basic_write(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t group; /* Group ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr, attr2; /* Attribute ID */ - hsize_t attr_size; /* storage size for attribute */ - ssize_t attr_name_size; /* size of attribute name */ - char *attr_name=NULL; /* name of attribute */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; - int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ - int i; - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t attr, attr2; /* Attribute ID */ + hsize_t attr_size; /* storage size for attribute */ + ssize_t attr_name_size; /* size of attribute name */ + char * attr_name = NULL; /* name of attribute */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2}; + int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ + int i; + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n")); @@ -262,9 +262,10 @@ test_attr_basic_write(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -286,11 +287,11 @@ test_attr_basic_write(hid_t fapl) attr_name_size = H5Aget_name(attr, (size_t)0, NULL); CHECK(attr_name_size, FAIL, "H5Aget_name"); - if(attr_name_size > 0) { - attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char)); + if (attr_name_size > 0) { + attr_name = (char *)HDcalloc((size_t)(attr_name_size + 1), sizeof(char)); CHECK_PTR(attr_name, "HDcalloc"); - if(attr_name) { + if (attr_name) { ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name); CHECK(ret, FAIL, "H5Aget_name"); ret = HDstrcmp(attr_name, ATTR_TMP_NAME); @@ -299,16 +300,17 @@ test_attr_basic_write(hid_t fapl) HDfree(attr_name); attr_name = NULL; } /* end if */ - } /* end if */ + } /* end if */ /* Read attribute information immediately, without closing attribute */ ret = H5Aread(attr, H5T_NATIVE_INT, read_data1); CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -322,11 +324,11 @@ test_attr_basic_write(hid_t fapl) attr_name_size = H5Aget_name(attr2, (size_t)0, NULL); CHECK(attr_name_size, FAIL, "H5Aget_name"); - if(attr_name_size > 0) { - attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char)); + if (attr_name_size > 0) { + attr_name = (char *)HDcalloc((size_t)(attr_name_size + 1), sizeof(char)); CHECK_PTR(attr_name, "HDcalloc"); - if(attr_name) { + if (attr_name) { ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name); CHECK(ret, FAIL, "H5Aget_name"); ret = HDstrcmp(attr_name, ATTR1A_NAME); @@ -335,16 +337,17 @@ test_attr_basic_write(hid_t fapl) HDfree(attr_name); attr_name = NULL; } /* end if */ - } /* end if */ + } /* end if */ /* Read attribute information immediately, without closing attribute */ ret = H5Aread(attr2, H5T_NATIVE_INT, read_data1); CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1a[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1a[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d, read_data1[%d]=%d\n", __LINE__, + i, attr_data1a[i], i, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr2); @@ -402,8 +405,7 @@ test_attr_basic_write(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_basic_write() */ - +} /* test_attr_basic_write() */ /**************************************************************** ** @@ -413,15 +415,15 @@ test_attr_basic_write(hid_t fapl) static void test_attr_basic_read(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t group; /* Group ID */ - hid_t attr; /* Attribute ID */ - H5O_info_t oinfo; /* Object info */ - int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ - int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ - int i, j; /* Local index variables */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t attr; /* Attribute ID */ + H5O_info_t oinfo; /* Object info */ + int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ + int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ + int i, j; /* Local index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -448,9 +450,10 @@ test_attr_basic_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -477,10 +480,11 @@ test_attr_basic_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR2_DIM1; i++) - for(j = 0; j < ATTR2_DIM2; j++) - if(attr_data2[i][j] != read_data2[i][j]) - TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", __LINE__, i, j, attr_data2[i][j], i, j, read_data1[i]); + for (i = 0; i < ATTR2_DIM1; i++) + for (j = 0; j < ATTR2_DIM2; j++) + if (attr_data2[i][j] != read_data2[i][j]) + TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -493,8 +497,7 @@ test_attr_basic_read(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_basic_read() */ - +} /* test_attr_basic_read() */ /**************************************************************** ** @@ -505,13 +508,13 @@ test_attr_basic_read(hid_t fapl) static void test_attr_flush(hid_t fapl) { - hid_t fil, /* File ID */ - att, /* Attribute ID */ - spc, /* Dataspace ID */ - set; /* Dataset ID */ - double wdata=3.14159F; /* Data to write */ - double rdata; /* Data read in */ - herr_t ret; /* Generic return value */ + hid_t fil, /* File ID */ + att, /* Attribute ID */ + spc, /* Dataspace ID */ + set; /* Dataset ID */ + double wdata = 3.14159F; /* Data to write */ + double rdata; /* Data read in */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Flushing\n")); @@ -528,40 +531,39 @@ test_attr_flush(hid_t fapl) att = H5Acreate2(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT); CHECK(att, FAIL, "H5Acreate2"); - ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); + ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F); + if (!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, (double)0.0F); - ret=H5Fflush(fil, H5F_SCOPE_GLOBAL); + ret = H5Fflush(fil, H5F_SCOPE_GLOBAL); CHECK(ret, FAIL, "H5Fflush"); - ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); + ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F); + if (!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, (double)0.0F); - ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); + ret = H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); CHECK(ret, FAIL, "H5Awrite"); - ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); + ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!H5_DBL_ABS_EQUAL(rdata,wdata)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,wdata); + if (!H5_DBL_ABS_EQUAL(rdata, wdata)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, wdata); - ret=H5Sclose(spc); + ret = H5Sclose(spc); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Aclose(att); + ret = H5Aclose(att); CHECK(ret, FAIL, "H5Aclose"); - ret=H5Dclose(set); + ret = H5Dclose(set); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Fclose(fil); + ret = H5Fclose(fil); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_flush() */ - +} /* test_attr_flush() */ /**************************************************************** ** @@ -571,17 +573,17 @@ test_attr_flush(hid_t fapl) static void test_attr_plist(hid_t fapl) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t did = H5I_INVALID_HID; /* Dataset ID */ - hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */ - hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */ - hid_t aid = H5I_INVALID_HID; /* Attribute ID */ - hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */ - hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - H5T_cset_t cset; /* Character set for attributes */ - herr_t ret; /* Generic return value */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */ + hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */ + hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + H5T_cset_t cset; /* Character set for attributes */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Property Lists\n")); @@ -684,8 +686,7 @@ test_attr_plist(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_plist() */ - +} /* test_attr_plist() */ /**************************************************************** ** @@ -696,15 +697,15 @@ test_attr_plist(hid_t fapl) static void test_attr_compound_write(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t tid1; /* Attribute datatype ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2}; - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t tid1; /* Attribute datatype ID */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR4_DIM1, ATTR4_DIM2}; + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Multiple Attribute Functions\n")); @@ -729,13 +730,13 @@ test_attr_compound_write(hid_t fapl) tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct attr4_struct)); CHECK(tid1, FAIL, "H5Tcreate"); attr4_field1_off = HOFFSET(struct attr4_struct, i); - ret = H5Tinsert(tid1, ATTR4_FIELDNAME1, attr4_field1_off, H5T_NATIVE_INT); + ret = H5Tinsert(tid1, ATTR4_FIELDNAME1, attr4_field1_off, H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); attr4_field2_off = HOFFSET(struct attr4_struct, d); - ret = H5Tinsert(tid1, ATTR4_FIELDNAME2, attr4_field2_off, H5T_NATIVE_DOUBLE); + ret = H5Tinsert(tid1, ATTR4_FIELDNAME2, attr4_field2_off, H5T_NATIVE_DOUBLE); CHECK(ret, FAIL, "H5Tinsert"); attr4_field3_off = HOFFSET(struct attr4_struct, c); - ret = H5Tinsert(tid1, ATTR4_FIELDNAME3, attr4_field3_off, H5T_NATIVE_SCHAR); + ret = H5Tinsert(tid1, ATTR4_FIELDNAME3, attr4_field3_off, H5T_NATIVE_SCHAR); CHECK(ret, FAIL, "H5Tinsert"); /* Create dataspace for 1st attribute */ @@ -773,8 +774,7 @@ test_attr_compound_write(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_compound_write() */ - +} /* test_attr_compound_write() */ /**************************************************************** ** @@ -784,26 +784,26 @@ test_attr_compound_write(hid_t fapl) static void test_attr_compound_read(hid_t fapl) { - hid_t fid1; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t space; /* Attribute dataspace */ - hid_t type; /* Attribute datatype */ - hid_t attr; /* Attribute ID */ - char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ - int rank; /* Attribute rank */ - hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ - H5T_class_t t_class; /* Attribute datatype class */ - H5T_order_t order; /* Attribute datatype order */ - size_t size; /* Attribute datatype size as stored in file */ - int fields; /* # of Attribute datatype fields */ - char *fieldname; /* Name of a field */ - size_t offset; /* Attribute datatype field offset */ - hid_t field; /* Attribute field datatype */ + hid_t fid1; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t space; /* Attribute dataspace */ + hid_t type; /* Attribute datatype */ + hid_t attr; /* Attribute ID */ + char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ + int rank; /* Attribute rank */ + hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ + H5T_class_t t_class; /* Attribute datatype class */ + H5T_order_t order; /* Attribute datatype order */ + size_t size; /* Attribute datatype size as stored in file */ + int fields; /* # of Attribute datatype fields */ + char * fieldname; /* Name of a field */ + size_t offset; /* Attribute datatype field offset */ + hid_t field; /* Attribute field datatype */ struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */ - ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ - int i, j; /* Local index variables */ - herr_t ret; /* Generic return value */ + ssize_t name_len; /* Length of attribute name */ + H5O_info_t oinfo; /* Object info */ + int i, j; /* Local index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -822,7 +822,8 @@ test_attr_compound_read(hid_t fapl) VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); /* Open 1st attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Dataspace */ @@ -832,9 +833,9 @@ test_attr_compound_read(hid_t fapl) VERIFY(rank, ATTR4_RANK, "H5Sget_simple_extent_ndims"); ret = H5Sget_simple_extent_dims(space, dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); - if(dims[0] != ATTR4_DIM1) + if (dims[0] != ATTR4_DIM1) TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR4_DIM1); - if(dims[1] != ATTR4_DIM2) + if (dims[1] != ATTR4_DIM2) TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n", (int)dims[1], ATTR4_DIM2); H5Sclose(space); @@ -845,11 +846,10 @@ test_attr_compound_read(hid_t fapl) VERIFY(t_class, H5T_COMPOUND, "H5Tget_class"); fields = H5Tget_nmembers(type); VERIFY(fields, 3, "H5Tget_nmembers"); - for(i = 0; i < fields; i++) { + for (i = 0; i < fields; i++) { fieldname = H5Tget_member_name(type, (unsigned)i); - if(!(HDstrcmp(fieldname, ATTR4_FIELDNAME1) || - HDstrcmp(fieldname, ATTR4_FIELDNAME2) || - HDstrcmp(fieldname, ATTR4_FIELDNAME3))) + if (!(HDstrcmp(fieldname, ATTR4_FIELDNAME1) || HDstrcmp(fieldname, ATTR4_FIELDNAME2) || + HDstrcmp(fieldname, ATTR4_FIELDNAME3))) TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname); H5free_memory(fieldname); } /* end for */ @@ -894,18 +894,22 @@ test_attr_compound_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR4_DIM1; i++) - for(j = 0; j < ATTR4_DIM2; j++) - if(HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) { - HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); - HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); - TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c); + for (i = 0; i < ATTR4_DIM1; i++) + for (j = 0; j < ATTR4_DIM2; j++) + if (HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) { + HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", + __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); + HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", + __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); + TestErrPrintf( + "%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", + __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c); } /* end if */ /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR4_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR4_NAME)) + if (HDstrcmp(attr_name, ATTR4_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR4_NAME); /* Close attribute datatype */ @@ -923,8 +927,7 @@ test_attr_compound_read(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_compound_read() */ - +} /* test_attr_compound_read() */ /**************************************************************** ** @@ -934,13 +937,13 @@ test_attr_compound_read(hid_t fapl) static void test_attr_scalar_write(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -989,8 +992,7 @@ test_attr_scalar_write(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_scalar_write() */ - +} /* test_attr_scalar_write() */ /**************************************************************** ** @@ -1000,14 +1002,14 @@ test_attr_scalar_write(hid_t fapl) static void test_attr_scalar_read(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - H5S_class_t stype; /* Dataspace class */ - float rdata = 0.0F; /* Buffer for reading 1st attribute */ - H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + H5S_class_t stype; /* Dataspace class */ + float rdata = 0.0F; /* Buffer for reading 1st attribute */ + H5O_info_t oinfo; /* Object info */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n")); @@ -1034,9 +1036,9 @@ test_attr_scalar_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(rdata, attr_data5)) - HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", - "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__); + if (!H5_FLT_ABS_EQUAL(rdata, attr_data5)) + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Aread", + (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__); /* Get the attribute's dataspace */ sid = H5Aget_space(attr); @@ -1060,8 +1062,7 @@ test_attr_scalar_read(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_scalar_read() */ - +} /* test_attr_scalar_read() */ /**************************************************************** ** @@ -1072,16 +1073,16 @@ test_attr_scalar_read(hid_t fapl) static void test_attr_mult_write(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; - hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2}; + hsize_t dims4[] = {ATTR3_DIM1, ATTR3_DIM2, ATTR3_DIM3}; + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Multiple Attribute Functions\n")); @@ -1181,8 +1182,7 @@ test_attr_mult_write(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_mult_write() */ - +} /* test_attr_mult_write() */ /**************************************************************** ** @@ -1192,25 +1192,25 @@ test_attr_mult_write(hid_t fapl) static void test_attr_mult_read(hid_t fapl) { - hid_t fid1; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t space; /* Attribute dataspace */ - hid_t type; /* Attribute datatype */ - hid_t attr; /* Attribute ID */ - char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ - char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */ - int rank; /* Attribute rank */ - hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ - H5T_class_t t_class; /* Attribute datatype class */ - H5T_order_t order; /* Attribute datatype order */ - size_t size; /* Attribute datatype size as stored in file */ - int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ - int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ + hid_t fid1; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t space; /* Attribute dataspace */ + hid_t type; /* Attribute datatype */ + hid_t attr; /* Attribute ID */ + char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ + char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */ + int rank; /* Attribute rank */ + hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ + H5T_class_t t_class; /* Attribute datatype class */ + H5T_order_t order; /* Attribute datatype order */ + size_t size; /* Attribute datatype size as stored in file */ + int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ + int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */ - ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ - int i, j, k; /* Local index values */ - herr_t ret; /* Generic return value */ + ssize_t name_len; /* Length of attribute name */ + H5O_info_t oinfo; /* Object info */ + int i, j, k; /* Local index values */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1229,7 +1229,8 @@ test_attr_mult_read(hid_t fapl) VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); /* Open 1st attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Dataspace */ @@ -1239,7 +1240,7 @@ test_attr_mult_read(hid_t fapl) VERIFY(rank, ATTR1_RANK, "H5Sget_simple_extent_ndims"); ret = H5Sget_simple_extent_dims(space, dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); - if(dims[0] != ATTR1_DIM1) + if (dims[0] != ATTR1_DIM1) TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR1_DIM1); H5Sclose(space); @@ -1259,22 +1260,23 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR1_NAME)) + if (HDstrcmp(attr_name, ATTR1_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR1_NAME); /* Verify Name with too small of a buffer */ - name_len = H5Aget_name(attr,HDstrlen(ATTR1_NAME), attr_name); + name_len = H5Aget_name(attr, HDstrlen(ATTR1_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); - HDstrcpy(temp_name, ATTR1_NAME); /* make a copy of the name */ - temp_name[HDstrlen(ATTR1_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ - if(HDstrcmp(attr_name, temp_name)) + HDstrcpy(temp_name, ATTR1_NAME); /* make a copy of the name */ + temp_name[HDstrlen(ATTR1_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ + if (HDstrcmp(attr_name, temp_name)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name); /* Close attribute */ @@ -1282,7 +1284,8 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Open 2nd attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Dataspace */ @@ -1292,9 +1295,9 @@ test_attr_mult_read(hid_t fapl) VERIFY(rank, ATTR2_RANK, "H5Sget_simple_extent_ndims"); ret = H5Sget_simple_extent_dims(space, dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); - if(dims[0] != ATTR2_DIM1) + if (dims[0] != ATTR2_DIM1) TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR2_DIM1); - if(dims[1] != ATTR2_DIM2) + if (dims[1] != ATTR2_DIM2) TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n", (int)dims[1], ATTR2_DIM2); H5Sclose(space); @@ -1314,23 +1317,24 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR2_DIM1; i++) - for(j = 0; j < ATTR2_DIM2; j++) - if(attr_data2[i][j] != read_data2[i][j]) - TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); + for (i = 0; i < ATTR2_DIM1; i++) + for (j = 0; j < ATTR2_DIM2; j++) + if (attr_data2[i][j] != read_data2[i][j]) + TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", + __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]); /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR2_NAME)) + if (HDstrcmp(attr_name, ATTR2_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR2_NAME); /* Verify Name with too small of a buffer */ name_len = H5Aget_name(attr, HDstrlen(ATTR2_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); - HDstrcpy(temp_name, ATTR2_NAME); /* make a copy of the name */ - temp_name[HDstrlen(ATTR2_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ - if(HDstrcmp(attr_name, temp_name)) + HDstrcpy(temp_name, ATTR2_NAME); /* make a copy of the name */ + temp_name[HDstrlen(ATTR2_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ + if (HDstrcmp(attr_name, temp_name)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name); /* Close attribute */ @@ -1338,7 +1342,8 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Open 2nd attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Dataspace */ @@ -1348,11 +1353,11 @@ test_attr_mult_read(hid_t fapl) VERIFY(rank, ATTR3_RANK, "H5Sget_simple_extent_ndims"); ret = H5Sget_simple_extent_dims(space, dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); - if(dims[0] != ATTR3_DIM1) + if (dims[0] != ATTR3_DIM1) TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR3_DIM1); - if(dims[1] != ATTR3_DIM2) + if (dims[1] != ATTR3_DIM2) TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n", (int)dims[1], ATTR3_DIM2); - if(dims[2] != ATTR3_DIM3) + if (dims[2] != ATTR3_DIM3) TestErrPrintf("attribute dimensions different: dims[2]=%d, should be %d\n", (int)dims[2], ATTR3_DIM3); H5Sclose(space); @@ -1372,24 +1377,26 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR3_DIM1; i++) - for(j = 0; j < ATTR3_DIM2; j++) - for(k = 0; k < ATTR3_DIM3; k++) - if(!H5_DBL_ABS_EQUAL(attr_data3[i][j][k], read_data3[i][j][k])) - TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); + for (i = 0; i < ATTR3_DIM1; i++) + for (j = 0; j < ATTR3_DIM2; j++) + for (k = 0; k < ATTR3_DIM3; k++) + if (!H5_DBL_ABS_EQUAL(attr_data3[i][j][k], read_data3[i][j][k])) + TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, " + "read_data3[%d][%d][%d]=%f\n", + __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]); /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR3_NAME)) + if (HDstrcmp(attr_name, ATTR3_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME); /* Verify Name with too small of a buffer */ name_len = H5Aget_name(attr, HDstrlen(ATTR3_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - HDstrcpy(temp_name, ATTR3_NAME); /* make a copy of the name */ - temp_name[HDstrlen(ATTR3_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ - if(HDstrcmp(attr_name, temp_name)) + HDstrcpy(temp_name, ATTR3_NAME); /* make a copy of the name */ + temp_name[HDstrlen(ATTR3_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */ + if (HDstrcmp(attr_name, temp_name)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name); /* Close attribute */ @@ -1403,8 +1410,7 @@ test_attr_mult_read(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_mult_read() */ - +} /* test_attr_mult_read() */ /**************************************************************** ** @@ -1412,40 +1418,38 @@ test_attr_mult_read(hid_t fapl) ** ****************************************************************/ static herr_t -attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo, - void *op_data) +attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *op_data) { - int *count = (int *)op_data; - herr_t ret = 0; + int * count = (int *)op_data; + herr_t ret = 0; - switch(*count) { + switch (*count) { case 0: - if(HDstrcmp(name, ATTR1_NAME)) + if (HDstrcmp(name, ATTR1_NAME)) TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR1_NAME); - (*count)++; - break; + (*count)++; + break; case 1: - if(HDstrcmp(name, ATTR2_NAME)) + if (HDstrcmp(name, ATTR2_NAME)) TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR2_NAME); - (*count)++; - break; + (*count)++; + break; case 2: - if(HDstrcmp(name, ATTR3_NAME)) + if (HDstrcmp(name, ATTR3_NAME)) TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR3_NAME); - (*count)++; - break; + (*count)++; + break; default: ret = -1; break; - } /* end switch() */ + } /* end switch() */ - return(ret); + return (ret); } /* end attr_op1() */ - /**************************************************************** ** ** test_attr_iterate(): Test H5A (attribute) iterator code. @@ -1454,12 +1458,12 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR static void test_attr_iterate(hid_t fapl) { - hid_t file; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - int count; /* operator data for the iterator */ + hid_t file; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + int count; /* operator data for the iterator */ H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1487,7 +1491,7 @@ test_attr_iterate(hid_t fapl) /* Iterate over attributes on dataset */ count = 0; - ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count); + ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count); VERIFY(ret, 0, "H5Aiterate2"); /* Close dataset */ @@ -1505,7 +1509,7 @@ test_attr_iterate(hid_t fapl) /* Iterate over attributes on dataset */ count = 0; - ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count); + ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count); VERIFY(ret, 0, "H5Aiterate2"); /* Close dataset */ @@ -1515,8 +1519,7 @@ test_attr_iterate(hid_t fapl) /* Close file */ ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_iterate() */ - +} /* test_attr_iterate() */ /**************************************************************** ** @@ -1526,13 +1529,13 @@ test_attr_iterate(hid_t fapl) static void test_attr_delete(hid_t fapl) { - hid_t fid1; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t attr; /* Attribute ID */ - char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ - ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t attr; /* Attribute ID */ + char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ + ssize_t name_len; /* Length of attribute name */ + H5O_info_t oinfo; /* Object info */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1569,28 +1572,30 @@ test_attr_delete(hid_t fapl) VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); /* Open 1st attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR1_NAME)) - TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); + if (HDstrcmp(attr_name, ATTR1_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR1_NAME); /* Close attribute */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open last (formally 3rd) attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR3_NAME)) - TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); + if (HDstrcmp(attr_name, ATTR3_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME); /* Close attribute */ ret = H5Aclose(attr); @@ -1606,14 +1611,15 @@ test_attr_delete(hid_t fapl) VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); /* Open last (formally 3rd) attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name, ATTR3_NAME)) - TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); + if (HDstrcmp(attr_name, ATTR3_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME); /* Close attribute */ ret = H5Aclose(attr); @@ -1635,8 +1641,7 @@ test_attr_delete(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_delete() */ - +} /* test_attr_delete() */ /**************************************************************** ** @@ -1647,17 +1652,17 @@ test_attr_delete(hid_t fapl) static void test_attr_dtype_shared(hid_t fapl) { - hid_t file_id; /* File ID */ - hid_t dset_id; /* Dataset ID */ - hid_t space_id; /* Dataspace ID for dataset & attribute */ - hid_t type_id; /* Datatype ID for named datatype */ - hid_t attr_id; /* Attribute ID */ - int data = 8; /* Data to write */ - int rdata = 0; /* Read read in */ - H5O_info_t oinfo; /* Object's information */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t file_id; /* File ID */ + hid_t dset_id; /* Dataset ID */ + hid_t space_id; /* Dataspace ID for dataset & attribute */ + hid_t type_id; /* Datatype ID for named datatype */ + hid_t attr_id; /* Attribute ID */ + int data = 8; /* Data to write */ + int rdata = 0; /* Read read in */ + H5O_info_t oinfo; /* Object's information */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Shared Datatypes with Attributes\n")); @@ -1672,7 +1677,7 @@ test_attr_dtype_shared(hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -1760,7 +1765,6 @@ test_attr_dtype_shared(hid_t fapl) ret = H5Fclose(file_id); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(file_id, FAIL, "H5Fopen"); @@ -1811,8 +1815,7 @@ test_attr_dtype_shared(hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dtype_shared() */ - +} /* test_attr_dtype_shared() */ /**************************************************************** ** @@ -1823,17 +1826,17 @@ test_attr_dtype_shared(hid_t fapl) static void test_attr_duplicate_ids(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t gid1, gid2; /* Group ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr, attr2; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ - int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */ - int i; - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t gid1, gid2; /* Group ID */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t attr, attr2; /* Attribute ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ + int rewrite_data[ATTR1_DIM1] = {1234, -423, 9907256}; /* Test data for rewrite */ + int i; + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing operations with two ID handles\n")); @@ -1850,8 +1853,7 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, - dcpl_g, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Create dataspace for attribute */ @@ -1904,8 +1906,8 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(0 != read_data1[i]) + for (i = 0; i < ATTR1_DIM1; i++) + if (0 != read_data1[i]) TestErrPrintf("%d: attribute data different: read_data1[%d]=%d\n", __LINE__, i, read_data1[i]); /* Open attribute for the second time */ @@ -1953,9 +1955,10 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Open attribute for the second time */ attr2 = H5Aopen(dataset, ATTR1_NAME, H5P_DEFAULT); @@ -1970,9 +1973,10 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(read_data1[i] != rewrite_data[i]) - TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__, i, read_data1[i], i, rewrite_data[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (read_data1[i] != rewrite_data[i]) + TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__, + i, read_data1[i], i, rewrite_data[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -2002,8 +2006,7 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(gid1, FAIL, "H5Gcreate2"); /* Create hard link to the first group */ - ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lcreate_hard"); /* Try to create an attribute on the group */ @@ -2027,9 +2030,10 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -2056,8 +2060,7 @@ test_attr_duplicate_ids(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_duplicate_ids() */ - +} /* test_attr_duplicate_ids() */ /**************************************************************** ** @@ -2068,18 +2071,18 @@ test_attr_duplicate_ids(hid_t fapl) static int test_attr_dense_verify(hid_t loc_id, unsigned max_attr) { - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - hid_t attr; /* Attribute ID */ - unsigned value; /* Attribute value */ - unsigned u; /* Local index variable */ - int old_nerrs; /* Number of errors when entering this check */ - herr_t ret; /* Generic return value */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + hid_t attr; /* Attribute ID */ + unsigned value; /* Attribute value */ + unsigned u; /* Local index variable */ + int old_nerrs; /* Number of errors when entering this check */ + herr_t ret; /* Generic return value */ /* Retrieve the current # of reported errors */ old_nerrs = GetTestNumErrs(); /* Re-open all the attributes by name and verify the data */ - for(u = 0; u < max_attr; u++) { + for (u = 0; u < max_attr; u++) { /* Open attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Aopen(loc_id, attrname, H5P_DEFAULT); @@ -2096,20 +2099,22 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) } /* end for */ /* Re-open all the attributes by index and verify the data */ - for(u = 0; u < max_attr; u++) { - ssize_t name_len; /* Length of attribute name */ - char check_name[ATTR_NAME_LEN]; /* Buffer for checking attribute names */ + for (u = 0; u < max_attr; u++) { + ssize_t name_len; /* Length of attribute name */ + char check_name[ATTR_NAME_LEN]; /* Buffer for checking attribute names */ /* Open attribute */ - attr = H5Aopen_by_idx(loc_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + attr = H5Aopen_by_idx(loc_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, + H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Name */ HDsprintf(attrname, "attr %02u", u); name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, check_name); VERIFY(name_len, HDstrlen(attrname), "H5Aget_name"); - if(HDstrcmp(check_name, attrname)) - TestErrPrintf("attribute name different: attrname = '%s', should be '%s'\n", check_name, attrname); + if (HDstrcmp(check_name, attrname)) + TestErrPrintf("attribute name different: attrname = '%s', should be '%s'\n", check_name, + attrname); /* Read data from the attribute */ ret = H5Aread(attr, H5T_NATIVE_UINT, &value); @@ -2122,12 +2127,11 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) } /* end for */ /* Retrieve current # of errors */ - if(old_nerrs == GetTestNumErrs()) - return(0); + if (old_nerrs == GetTestNumErrs()) + return (0); else - return(-1); -} /* test_attr_dense_verify() */ - + return (-1); +} /* test_attr_dense_verify() */ /**************************************************************** ** @@ -2138,19 +2142,19 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) static void test_attr_dense_create(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dense Attribute Storage Creation\n")); @@ -2165,7 +2169,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -2180,7 +2184,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -2202,7 +2207,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until just before converting to dense storage */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -2262,8 +2267,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dense_create() */ - +} /* test_attr_dense_create() */ /**************************************************************** ** @@ -2274,19 +2278,19 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) static void test_attr_dense_open(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Opening Attributes in Dense Storage\n")); @@ -2301,7 +2305,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -2316,7 +2320,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -2342,7 +2347,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until just before converting to dense storage */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -2406,8 +2411,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dense_open() */ - +} /* test_attr_dense_open() */ /**************************************************************** ** @@ -2418,21 +2422,21 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) static void test_attr_dense_delete(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ - int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + H5O_info_t oinfo; /* Object info */ + int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n")); @@ -2457,7 +2461,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -2472,7 +2476,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) if (use_min_dset_oh) { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); - } else { + } + else { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); } @@ -2498,7 +2503,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until well into dense storage */ - for(u = 0; u < (max_compact * 2); u++) { + for (u = 0; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -2534,7 +2539,6 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -2544,7 +2548,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Delete attributes until the attributes revert to compact storage again */ - for(u--; u >= min_dense; u--) { + for (u--; u >= min_dense; u--) { /* Delete attribute */ HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); @@ -2600,8 +2604,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dense_delete() */ - +} /* test_attr_dense_delete() */ /**************************************************************** ** @@ -2612,23 +2615,23 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) static void test_attr_dense_rename(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ - unsigned u; /* Local index variable */ - int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); - unsigned use_corder; /* Track creation order or not */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + H5O_info_t oinfo; /* Object info */ + unsigned u; /* Local index variable */ + int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); + unsigned use_corder; /* Track creation order or not */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n")); @@ -2653,7 +2656,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -2668,7 +2671,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) if (use_min_dset_oh) { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy"); - } else { + } + else { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); } @@ -2678,9 +2682,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Using creation order or not */ - for(use_corder = FALSE; use_corder <= TRUE; use_corder++) { + for (use_corder = FALSE; use_corder <= TRUE; use_corder++) { - if(use_corder) { + if (use_corder) { ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } @@ -2694,7 +2698,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until well into dense storage */ - for(u = 0; u < (max_compact * 2); u++) { + for (u = 0; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -2729,13 +2733,13 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); - if(!use_corder) { + if (!use_corder) { /* Unlink dataset with attributes */ ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } - } /* end for use_corder */ + } /* end for use_corder */ /* Close dataspace */ ret = H5Sclose(sid); @@ -2749,7 +2753,6 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, H5I_INVALID_HID, "H5Fopen"); @@ -2759,8 +2762,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); /* Verify renamed attributes */ - for(u = 0; u < (max_compact * 2); u++) { - unsigned value; /* Attribute value */ + for (u = 0; u < (max_compact * 2); u++) { + unsigned value; /* Attribute value */ /* Open attribute */ HDsprintf(attrname, "new attr %02u", u); @@ -2792,8 +2795,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dense_rename() */ - +} /* test_attr_dense_rename() */ /**************************************************************** ** @@ -2804,22 +2806,22 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) static void test_attr_dense_unlink(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - size_t mesg_count; /* # of shared messages */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ - unsigned u; /* Local index variable */ - int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + size_t mesg_count; /* # of shared messages */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + H5O_info_t oinfo; /* Object info */ + unsigned u; /* Local index variable */ + int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n")); @@ -2842,7 +2844,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -2857,7 +2859,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) if (use_min_dset_oh) { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); - } else { + } + else { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); } @@ -2879,7 +2882,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until well into dense storage */ - for(u = 0; u < (max_compact * 2); u++) { + for (u = 0; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -2915,7 +2918,6 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -2936,8 +2938,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dense_unlink() */ - +} /* test_attr_dense_unlink() */ /**************************************************************** ** @@ -2948,19 +2949,19 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) static void test_attr_dense_limits(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact, rmax_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense, rmin_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact, rmax_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense, rmin_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Phase Change Limits For Attributes in Dense Storage\n")); @@ -2975,7 +2976,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -2990,15 +2991,16 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } /* Change limits on compact/dense attribute storage */ max_compact = 0; - min_dense = 0; - ret = H5Pset_attr_phase_change(dcpl, max_compact, min_dense); + min_dense = 0; + ret = H5Pset_attr_phase_change(dcpl, max_compact, min_dense); CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Create a dataset */ @@ -3015,12 +3017,10 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Add first attribute, which should be immediately in dense storage */ /* Create attribute */ @@ -3041,7 +3041,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Add second attribute, to allow deletions to be checked easily */ /* Create attribute */ @@ -3062,7 +3061,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Delete second attribute, attributes should still be stored densely */ /* Delete attribute */ @@ -3073,7 +3071,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Delete first attribute, attributes should not be stored densely */ /* Delete attribute */ @@ -3086,7 +3083,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); @@ -3106,8 +3102,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_dense_limits() */ - +} /* test_attr_dense_limits() */ /**************************************************************** ** @@ -3118,23 +3113,23 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) static void test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t gid1, gid2; /* Group ID */ - hid_t sid, sid2; /* Dataspace ID */ - hid_t attr, attr2, add_attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - hsize_t dims[] = {ATTR1_DIM1}; - int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading attribute */ - int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */ - unsigned scalar_data = 1317; /* scalar data for attribute */ - unsigned read_scalar; /* variable for reading attribute*/ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - unsigned u, i; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t gid1, gid2; /* Group ID */ + hid_t sid, sid2; /* Dataspace ID */ + hid_t attr, attr2, add_attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + hsize_t dims[] = {ATTR1_DIM1}; + int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading attribute */ + int rewrite_data[ATTR1_DIM1] = {1234, -423, 9907256}; /* Test data for rewrite */ + unsigned scalar_data = 1317; /* scalar data for attribute */ + unsigned read_scalar; /* variable for reading attribute*/ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + unsigned u, i; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing operations with two IDs for Dense Storage\n")); @@ -3162,7 +3157,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -3184,7 +3180,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes, until just before converting to dense storage */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -3261,10 +3257,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(0 != read_data1[i]) - TestErrPrintf("%d: attribute data different: read_data1[%d]=%d\n", __LINE__, - i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (0 != read_data1[i]) + TestErrPrintf("%d: attribute data different: read_data1[%d]=%d\n", __LINE__, i, read_data1[i]); /* Open attribute for the second time */ attr2 = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -3314,9 +3309,10 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Open attribute for the second time */ attr2 = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -3331,9 +3327,10 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(read_data1[i] != rewrite_data[i]) - TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__, i, read_data1[i], i, rewrite_data[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (read_data1[i] != rewrite_data[i]) + TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__, + i, read_data1[i], i, rewrite_data[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -3367,13 +3364,11 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open first attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, - H5P_DEFAULT, H5P_DEFAULT); + attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Open attribute for the second time */ - attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, - H5P_DEFAULT, H5P_DEFAULT); + attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Write attribute information with the second ID */ @@ -3385,9 +3380,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - if(read_scalar != scalar_data) - TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", - __LINE__, read_scalar, scalar_data); + if (read_scalar != scalar_data) + TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", __LINE__, read_scalar, + scalar_data); /* Close attribute */ ret = H5Aclose(attr); @@ -3423,14 +3418,12 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open attribute of the dataset for the first time */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, - H5P_DEFAULT, H5P_DEFAULT); + attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Delete a few attributes until the storage switches to compact */ - for(u = max_compact; u >= min_dense - 1; u--) { - ret = H5Adelete_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, - H5P_DEFAULT); + for (u = max_compact; u >= min_dense - 1; u--) { + ret = H5Adelete_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_idx"); } @@ -3439,8 +3432,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Open attribute for the second time */ - attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, - H5P_DEFAULT, H5P_DEFAULT); + attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Write attribute information with the second ID */ @@ -3452,9 +3444,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - if(read_scalar != scalar_data) - TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", - __LINE__, read_scalar, scalar_data); + if (read_scalar != scalar_data) + TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", __LINE__, read_scalar, + scalar_data); /* Close attribute */ ret = H5Aclose(attr); @@ -3490,12 +3482,11 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Open attribute of the dataset for the first time */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, - H5P_DEFAULT, H5P_DEFAULT); + attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Delete a few attributes until the storage switches to compact */ - for(u = min_dense-1; u <= max_compact; u++) { + for (u = min_dense - 1; u <= max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); add_attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -3515,8 +3506,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Open attribute for the second time */ - attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, - H5P_DEFAULT, H5P_DEFAULT); + attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Write attribute information with the second ID */ @@ -3528,9 +3518,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - if(read_scalar != scalar_data) - TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", - __LINE__, read_scalar, scalar_data); + if (read_scalar != scalar_data) + TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", __LINE__, read_scalar, + scalar_data); /* Close attribute */ ret = H5Aclose(attr); @@ -3560,12 +3550,11 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(gid1, FAIL, "H5Gcreate2"); /* Create hard link to the first group */ - ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lcreate_hard"); /* Add attributes, until just before converting to dense storage */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(gid1, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -3605,9 +3594,10 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aread"); /* Verify values read in */ - for(i = 0; i < ATTR1_DIM1; i++) - if(attr_data1[i] != read_data1[i]) - TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]); + for (i = 0; i < ATTR1_DIM1; i++) + if (attr_data1[i] != read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, + attr_data1[i], i, read_data1[i]); /* Close attribute */ ret = H5Aclose(attr); @@ -3634,8 +3624,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_dense_dup_ids() */ - +} /* test_attr_dense_dup_ids() */ /**************************************************************** ** @@ -3646,24 +3635,24 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) static void test_attr_big(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t big_sid; /* "Big" dataspace ID */ - hsize_t dims[ATTR6_RANK] = {ATTR6_DIM1, ATTR6_DIM2, ATTR6_DIM3}; /* Attribute dimensions */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - unsigned nshared_indices; /* # of shared message indices */ - H5F_libver_t low, high; /* File format bounds */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t big_sid; /* "Big" dataspace ID */ + hsize_t dims[ATTR6_RANK] = {ATTR6_DIM1, ATTR6_DIM2, ATTR6_DIM3}; /* Attribute dimensions */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + unsigned nshared_indices; /* # of shared message indices */ + H5F_libver_t low, high; /* File format bounds */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Storing 'Big' Attributes in Dense Storage\n")); @@ -3678,7 +3667,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -3697,7 +3686,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -3722,14 +3712,12 @@ test_attr_big(hid_t fcpl, hid_t fapl) ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - /* Check on dataset's attribute storage status */ is_empty = H5O__is_attr_empty_test(dataset); VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Add first "small" attribute, which should be in compact storage */ /* Create attribute */ @@ -3748,7 +3736,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Add second "small" attribute, which should stay in compact storage */ /* Create attribute */ @@ -3767,14 +3754,13 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Add first "big" attribute, which should push storage into dense form */ /* Create attribute */ u = 2; HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); - if(low == H5F_LIBVER_LATEST) { + if (low == H5F_LIBVER_LATEST) { CHECK(attr, FAIL, "H5Acreate2"); /* Close attribute */ @@ -3791,7 +3777,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); - /* Add second "big" attribute, which should leave storage in dense form */ /* Create attribute */ @@ -3814,7 +3799,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); - /* Delete second "small" attribute, attributes should still be stored densely */ /* Delete attribute */ @@ -3829,7 +3813,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); - /* Delete second "big" attribute, attributes should still be stored densely */ /* Delete attribute */ @@ -3844,7 +3827,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test"); - /* Delete first "big" attribute, attributes should _not_ be stored densely */ /* Delete attribute */ @@ -3859,7 +3841,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Delete first "small" attribute, should be no attributes now */ /* Delete attribute */ @@ -3887,7 +3868,6 @@ test_attr_big(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end else */ - /* Close dataspaces */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); @@ -3909,8 +3889,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_big() */ - +} /* test_attr_big() */ /**************************************************************** ** @@ -3921,20 +3900,20 @@ test_attr_big(hid_t fcpl, hid_t fapl) static void test_attr_null_space(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t null_sid; /* "null" dataspace ID */ - hid_t attr_sid; /* Attribute's dataspace ID */ - hid_t attr; /* Attribute ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned value; /* Attribute value */ - htri_t cmp; /* Results of comparison */ - hsize_t storage_size; /* Size of storage for attribute */ - H5A_info_t ainfo; /* Attribute info */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t null_sid; /* "null" dataspace ID */ + hid_t attr_sid; /* Attribute's dataspace ID */ + hid_t attr; /* Attribute ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned value; /* Attribute value */ + htri_t cmp; /* Results of comparison */ + hsize_t storage_size; /* Size of storage for attribute */ + H5A_info_t ainfo; /* Attribute info */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Storing Attributes with 'null' dataspace\n")); @@ -3949,7 +3928,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ @@ -3968,7 +3947,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); - /* Add attribute with 'null' dataspace */ /* Create attribute */ @@ -3979,7 +3957,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Try to read data from the attribute */ /* (shouldn't fail, but should leave buffer alone) */ value = 23; - ret = H5Aread(attr, H5T_NATIVE_UINT, &value); + ret = H5Aread(attr, H5T_NATIVE_UINT, &value); CHECK(ret, FAIL, "H5Aread"); VERIFY(value, 23, "H5Aread"); @@ -4009,7 +3987,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Add another attribute with 'null' dataspace */ /* Create attribute */ @@ -4020,7 +3997,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Try to write data to the attribute */ /* (shouldn't fail, but should leave buffer alone) */ value = 23; - ret = H5Awrite(attr, H5T_NATIVE_UINT, &value); + ret = H5Awrite(attr, H5T_NATIVE_UINT, &value); CHECK(ret, FAIL, "H5Awrite"); VERIFY(value, 23, "H5Awrite"); @@ -4036,7 +4013,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file and check on the attributes */ /* Re-open file */ @@ -4047,7 +4023,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dopen2"); - /* Open first attribute */ HDstrcpy(attrname, "null attr #2"); attr = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -4056,7 +4031,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Try to read data from the attribute */ /* (shouldn't fail, but should leave buffer alone) */ value = 23; - ret = H5Aread(attr, H5T_NATIVE_UINT, &value); + ret = H5Aread(attr, H5T_NATIVE_UINT, &value); CHECK(ret, FAIL, "H5Aread"); VERIFY(value, 23, "H5Aread"); @@ -4086,7 +4061,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Open second attribute */ HDstrcpy(attrname, "null attr"); attr = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -4095,7 +4069,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Try to write data to the attribute */ /* (shouldn't fail, but should leave buffer alone) */ value = 23; - ret = H5Awrite(attr, H5T_NATIVE_UINT, &value); + ret = H5Awrite(attr, H5T_NATIVE_UINT, &value); CHECK(ret, FAIL, "H5Awrite"); VERIFY(value, 23, "H5Awrite"); @@ -4103,7 +4077,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -4116,19 +4089,16 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Close dataspaces */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(null_sid); CHECK(ret, FAIL, "H5Sclose"); - /* Check size of file */ filesize = h5_get_file_size(FILENAME, fapl); VERIFY(filesize, empty_filesize, "h5_get_file_size"); -} /* test_attr_null_space() */ - +} /* test_attr_null_space() */ /**************************************************************** ** @@ -4140,11 +4110,11 @@ static void test_attr_deprec(hid_t fcpl, hid_t fapl) { #ifndef H5_NO_DEPRECATED_SYMBOLS - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deprecated Attribute Routines\n")); @@ -4161,7 +4131,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); - /* Add attribute to dataset */ /* Create attribute */ @@ -4183,7 +4152,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file and operate on the attribute */ /* Re-open file */ @@ -4194,7 +4162,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dopen2"); - /* Get number of attributes with bad ID */ ret = H5Aget_num_attrs((hid_t)-1); VERIFY(ret, FAIL, "H5Aget_num_attrs"); @@ -4219,7 +4186,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -4229,14 +4195,14 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); #else /* H5_NO_DEPRECATED_SYMBOLS */ /* Shut compiler up */ - fcpl = fcpl; fapl = fapl; + fcpl = fcpl; + fapl = fapl; /* Output message about test being skipped */ MESSAGE(5, ("Skipping Test On Deprecated Attribute Routines\n")); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -} /* test_attr_deprec() */ - +} /* test_attr_deprec() */ /**************************************************************** ** @@ -4247,15 +4213,15 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) static void test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t gid; /* Group ID */ - hid_t sid; /* Dataspace ID */ - hid_t aid; /* Attribute ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned nattr = (new_format ? NATTR_MANY_NEW : NATTR_MANY_OLD); /* Number of attributes */ - htri_t exists; /* Whether the attribute exists or not */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t gid; /* Group ID */ + hid_t sid; /* Dataspace ID */ + hid_t aid; /* Attribute ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned nattr = (new_format ? NATTR_MANY_NEW : NATTR_MANY_OLD); /* Number of attributes */ + htri_t exists; /* Whether the attribute exists or not */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Storing Many Attributes\n")); @@ -4273,7 +4239,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Create many attributes */ - for(u = 0; u < nattr; u++) { + for (u = 0; u < nattr; u++) { HDsprintf(attrname, "a-%06u", u); exists = H5Aexists(gid, attrname); @@ -4312,7 +4278,6 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file and check on the attributes */ /* Re-open file */ @@ -4324,8 +4289,8 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); /* Verify attributes */ - for(u = 0; u < nattr; u++) { - unsigned value; /* Attribute value */ + for (u = 0; u < nattr; u++) { + unsigned value; /* Attribute value */ HDsprintf(attrname, "a-%06u", u); @@ -4360,12 +4325,10 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Close dataspaces */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_many() */ - +} /* test_attr_many() */ /**************************************************************** ** @@ -4376,14 +4339,14 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) static void test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ hid_t dcpl; /* Dataset creation property list ID */ - unsigned crt_order_flags;/* Creation order flags */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - herr_t ret; /* Generic return value */ + unsigned crt_order_flags; /* Creation order flags */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Code for Attributes with Creation Order Info\n")); @@ -4396,7 +4359,8 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -4418,7 +4382,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pset_attr_creation_order"); ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags); CHECK(ret, FAIL, "H5Pget_attr_creation_order"); - VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) , "H5Pget_attr_creation_order"); + VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "H5Pget_attr_creation_order"); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -4450,7 +4414,6 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -4472,7 +4435,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) /* Query the attribute creation properties */ ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags); CHECK(ret, FAIL, "H5Pget_attr_creation_order"); - VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) , "H5Pget_attr_creation_order"); + VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "H5Pget_attr_creation_order"); /* Close property list */ ret = H5Pclose(dcpl); @@ -4485,8 +4448,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_corder_create_basic() */ - +} /* test_attr_corder_create_basic() */ /**************************************************************** ** @@ -4497,21 +4459,21 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) static void test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Compact Storage of Attributes with Creation Order Info\n")); @@ -4524,7 +4486,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -4550,8 +4513,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -4575,7 +4538,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create several attributes, but keep storage in compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -4598,7 +4561,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); } /* end for */ - } /* end for */ + } /* end for */ /* Close Datasets */ ret = H5Dclose(dset1); @@ -4620,7 +4583,6 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -4634,8 +4596,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -4663,8 +4625,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) /* Loop through attributes, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ - for(u = 0; u < max_compact; u++) { - H5A_info_t ainfo; /* Attribute information */ + for (u = 0; u < max_compact; u++) { + H5A_info_t ainfo; /* Attribute information */ /* Retrieve information for attribute */ HDsprintf(attrname, "attr %02u", u); @@ -4675,7 +4637,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) VERIFY(ainfo.corder_valid, TRUE, "H5Aget_info_by_name"); VERIFY(ainfo.corder, u, "H5Aget_info_by_name"); } /* end for */ - } /* end for */ + } /* end for */ /* Close Datasets */ ret = H5Dclose(dset1); @@ -4688,8 +4650,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_corder_create_compact() */ - +} /* test_attr_corder_create_compact() */ /**************************************************************** ** @@ -4700,23 +4661,23 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) static void test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dense Storage of Attributes with Creation Order Info\n")); @@ -4729,7 +4690,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -4755,8 +4717,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -4780,7 +4742,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create several attributes, but keep storage in compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -4852,7 +4814,6 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -4866,8 +4827,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -4895,8 +4856,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) /* Loop through attributes, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ - for(u = 0; u < (max_compact + 1); u++) { - H5A_info_t ainfo; /* Attribute information */ + for (u = 0; u < (max_compact + 1); u++) { + H5A_info_t ainfo; /* Attribute information */ /* Retrieve information for attribute */ HDsprintf(attrname, "attr %02u", u); @@ -4907,7 +4868,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) VERIFY(ainfo.corder_valid, TRUE, "H5Aget_info_by_name"); VERIFY(ainfo.corder, u, "H5Aget_info_by_name"); } /* end for */ - } /* end for */ + } /* end for */ /* Close Datasets */ ret = H5Dclose(dset1); @@ -4920,8 +4881,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_corder_create_dense() */ - +} /* test_attr_corder_create_dense() */ /**************************************************************** ** @@ -4933,13 +4893,13 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) static void test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t gcpl_id = -1; /* Group creation property list ID */ - hid_t gid = -1; /* Group ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - int buf; /* Attribute data */ - herr_t ret; /* Generic return value */ + hid_t fid = -1; /* File ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t gid = -1; /* Group ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + int buf; /* Attribute data */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Creating Attributes w/New & Old Format\n")); @@ -4987,7 +4947,6 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file, without "use the latest format" flag */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -5028,8 +4987,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) /* Close attribute dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_corder_create_reopen() */ - +} /* test_attr_corder_create_reopen() */ /**************************************************************** ** @@ -5040,23 +4998,23 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) static void test_attr_corder_transition(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Storage Transitions of Attributes with Creation Order Info\n")); @@ -5069,7 +5027,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -5086,10 +5045,10 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); -/* XXX: Try to find a way to resize dataset's object header so that the object - * header can have one chunk, then retrieve "empty" file size and check - * that size after everything is deleted -QAK - */ + /* XXX: Try to find a way to resize dataset's object header so that the object + * header can have one chunk, then retrieve "empty" file size and check + * that size after everything is deleted -QAK + */ /* Create datasets */ dset1 = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset1, FAIL, "H5Dcreate2"); @@ -5099,8 +5058,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -5140,7 +5099,6 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -5154,8 +5112,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -5173,7 +5131,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end switch */ /* Create several attributes, but keep storage in compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -5225,7 +5183,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete several attributes from object, until attribute storage resumes compact form */ - for(u = max_compact; u >= min_dense; u--) { + for (u = max_compact; u >= min_dense; u--) { HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5260,7 +5218,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ - for(u = (min_dense - 1); u < (max_compact + 1); u++) { + for (u = (min_dense - 1); u < (max_compact + 1); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -5302,7 +5260,6 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -5316,8 +5273,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -5349,7 +5306,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete several attributes from object, until attribute storage resumes compact form */ - for(u = max_compact; u >= min_dense; u--) { + for (u = max_compact; u >= min_dense; u--) { HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5384,7 +5341,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ - for(u = (min_dense - 1); u < (max_compact + 1); u++) { + for (u = (min_dense - 1); u < (max_compact + 1); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -5414,7 +5371,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete all attributes */ - for(u = max_compact; u > 0; u--) { + for (u = max_compact; u > 0; u--) { HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5439,8 +5396,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_corder_transition() */ - +} /* test_attr_corder_transition() */ /**************************************************************** ** @@ -5451,28 +5407,28 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) static void test_attr_corder_delete(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned reopen_file; /* Whether to re-open the file before deleting group */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned reopen_file; /* Whether to re-open the file before deleting group */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ #ifdef LATER - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ -#endif /* LATER */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ +#endif /* LATER */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Object w/Dense Attribute Storage and Creation Order Info\n")); @@ -5485,7 +5441,8 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -5498,7 +5455,6 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); CHECK(ret, FAIL, "H5Pget_attr_phase_change"); - /* XXX: Try to find a way to resize dataset's object header so that the object * header can have one chunk, then retrieve "empty" file size and check * that size after everything is deleted -QAK @@ -5517,10 +5473,9 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(empty_size, FAIL, "h5_get_file_size"); #endif /* LATER */ - /* Loop to leave file open when deleting dataset, or to close & re-open file * before deleting dataset */ - for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) { + for (reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) { /* Create test file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -5534,8 +5489,8 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -5559,7 +5514,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, until attribute storage is in dense form */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -5598,7 +5553,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check for deleting datasets without re-opening file */ - if(!reopen_file) { + if (!reopen_file) { ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); @@ -5612,7 +5567,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); /* Check for deleting dataset after re-opening file */ - if(reopen_file) { + if (reopen_file) { /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -5636,7 +5591,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(file_size, FAIL, "h5_get_file_size"); VERIFY(file_size, empty_size, "h5_get_file_size"); #endif /* LATER */ - } /* end for */ + } /* end for */ /* Close property list */ ret = H5Pclose(dcpl); @@ -5645,8 +5600,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_corder_delete() */ - +} /* test_attr_corder_delete() */ /*------------------------------------------------------------------------- * Function: attr_info_by_idx_check @@ -5666,13 +5620,12 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) *------------------------------------------------------------------------- */ static int -attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, - hbool_t use_index) +attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t use_index) { - char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ - H5A_info_t ainfo; /* Attribute info struct */ - int old_nerrs; /* Number of errors when entering this check */ - herr_t ret; /* Generic return value */ + char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ + H5A_info_t ainfo; /* Attribute info struct */ + int old_nerrs; /* Number of errors when entering this check */ + herr_t ret; /* Generic return value */ /* Retrieve the current # of reported errors */ old_nerrs = GetTestNumErrs(); @@ -5691,20 +5644,21 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, /* Verify the name for new link, in increasing creation order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, + (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if(HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname)) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); - /* Don't test "native" order if there is no creation order index, since * there's not a good way to easily predict the attribute's order in the name * index. */ - if(use_index) { + if (use_index) { /* Verify the information for first attribute, in native creation order */ HDmemset(&ainfo, 0, sizeof(ainfo)); - ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &ainfo, H5P_DEFAULT); + ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &ainfo, + H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_idx"); VERIFY(ainfo.corder, 0, "H5Aget_info_by_idx"); @@ -5716,13 +5670,13 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, /* Verify the name for new link, in increasing native order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, + (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if(HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname)) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); } /* end if */ - /* Verify the information for first attribute, in decreasing creation order */ HDmemset(&ainfo, 0, sizeof(ainfo)); ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &ainfo, H5P_DEFAULT); @@ -5737,12 +5691,12 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, /* Verify the name for new link, in increasing creation order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, + (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if(HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname)) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); - /* Verify the information for first attribute, in increasing name order */ HDmemset(&ainfo, 0, sizeof(ainfo)); ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT); @@ -5757,17 +5711,16 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, /* Verify the name for new link, in increasing name order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, + (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if(HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname)) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); - /* Don't test "native" order queries on link name order, since there's not * a good way to easily predict the order of the links in the name index. */ - /* Verify the information for first attribute, in decreasing name order */ HDmemset(&ainfo, 0, sizeof(ainfo)); ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &ainfo, H5P_DEFAULT); @@ -5782,19 +5735,19 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, /* Verify the name for new link, in increasing name order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, + (size_t)NAME_BUF_SIZE, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_name_by_idx"); - if(HDstrcmp(attrname, tmpname)) + if (HDstrcmp(attrname, tmpname)) TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__); /* Retrieve current # of errors */ - if(old_nerrs == GetTestNumErrs()) - return(0); + if (old_nerrs == GetTestNumErrs()) + return (0); else - return(-1); + return (-1); } /* end attr_info_by_idx_check() */ - /**************************************************************** ** ** test_attr_info_by_idx(): Test basic H5A (attribute) code. @@ -5804,26 +5757,26 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, static void test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - H5A_info_t ainfo; /* Attribute information */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned use_index; /* Use index on creation order values */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + H5A_info_t ainfo; /* Attribute information */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned use_index; /* Use index on creation order values */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -5833,7 +5786,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -5843,9 +5797,9 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { + for (use_index = FALSE; use_index <= TRUE; use_index++) { /* Output message about test being performed */ - if(use_index) + if (use_index) MESSAGE(5, ("Testing Querying Attribute Info By Index w/Creation Order Index\n")) else MESSAGE(5, ("Testing Querying Attribute Info By Index w/o Creation Order Index\n")) @@ -5855,8 +5809,9 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Set attribute creation order tracking & indexing for object */ - if(new_format == TRUE) { - ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); + if (new_format == TRUE) { + ret = H5Pset_attr_creation_order( + dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } /* end if */ @@ -5869,8 +5824,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -5894,13 +5849,15 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for query on non-existant attribute */ - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT); + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_name_by_idx"); /* Create attributes, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -5929,15 +5886,18 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound offset queries */ - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT); + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT); + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_name_by_idx"); /* Create more attributes, to push into dense form */ - for(; u < (max_compact * 2); u++) { + for (; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -5969,21 +5929,24 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); - if(new_format) { + if (new_format) { /* Retrieve & verify # of records in the name & creation order indices */ ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O__attr_dense_info_test"); - if(use_index) + if (use_index) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound offset queries */ - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT); + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT); + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aget_name_by_idx"); } /* end for */ @@ -6007,8 +5970,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_info_by_idx() */ - +} /* test_attr_info_by_idx() */ /**************************************************************** ** @@ -6019,28 +5981,28 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) static void test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - H5A_info_t ainfo; /* Attribute information */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - unsigned use_index; /* Use index on creation order values */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + H5A_info_t ainfo; /* Attribute information */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -6050,7 +6012,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -6060,48 +6023,57 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { + for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { + for (use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing Order w/Creation Order Index\n")) + if (idx_type == H5_INDEX_CRT_ORDER) { + if (order == H5_ITER_INC) { + if (use_index) + MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing " + "Order w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing " + "Order w/o Creation Order Index\n")) } /* end if */ else { - if(use_index) - MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing Order w/Creation Order Index\n")) + if (use_index) + MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing " + "Order w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing " + "Order w/o Creation Order Index\n")) } /* end else */ - } /* end if */ + } /* end if */ else { - if(order == H5_ITER_INC) { - if(use_index) - MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order w/Creation Order Index\n")) + if (order == H5_ITER_INC) { + if (use_index) + MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order " + "w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order w/o " + "Creation Order Index\n")) } /* end if */ else { - if(use_index) - MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/Creation Order Index\n")) + if (use_index) + MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order " + "w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/o " + "Creation Order Index\n")) } /* end else */ - } /* end else */ + } /* end else */ /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Set attribute creation order tracking & indexing for object */ - if(new_format == TRUE) { - ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); + if (new_format == TRUE) { + ret = H5Pset_attr_creation_order( + dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } /* end if */ @@ -6114,8 +6086,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6143,10 +6115,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(ret, FAIL, "H5Adelete_by_idx"); /* Create attributes, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -6177,8 +6150,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6196,27 +6169,29 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Delete attributes from compact storage */ - for(u = 0; u < (max_compact - 1); u++) { + for (u = 0; u < (max_compact - 1); u++) { /* Delete first attribute in appropriate order */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify the attribute information for first attribute in appropriate order */ HDmemset(&ainfo, 0, sizeof(ainfo)); - ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, H5P_DEFAULT); - if(new_format) { - if(order == H5_ITER_INC) { + ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, + H5P_DEFAULT); + if (new_format) { + if (order == H5_ITER_INC) { VERIFY(ainfo.corder, (u + 1), "H5Aget_info_by_idx"); } /* end if */ else { VERIFY(ainfo.corder, (max_compact - (u + 2)), "H5Aget_info_by_idx"); } /* end else */ - } /* end if */ + } /* end if */ /* Verify the name for first attribute in appropriate order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - if(order == H5_ITER_INC) + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + if (order == H5_ITER_INC) HDsprintf(attrname, "attr %02u", (u + 1)); else HDsprintf(attrname, "attr %02u", (max_compact - (u + 2))); @@ -6234,8 +6209,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6253,10 +6228,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Create more attributes, to push into dense form */ - for(u = 0; u < (max_compact * 2); u++) { + for (u = 0; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -6268,7 +6244,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - if(u >= max_compact) { + if (u >= max_compact) { is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ @@ -6287,11 +6263,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); - if(new_format) { + if (new_format) { /* Retrieve & verify # of records in the name & creation order indices */ ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O__attr_dense_info_test"); - if(use_index) + if (use_index) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ @@ -6302,8 +6278,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6321,27 +6297,29 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Delete attributes from dense storage */ - for(u = 0; u < ((max_compact * 2) - 1); u++) { + for (u = 0; u < ((max_compact * 2) - 1); u++) { /* Delete first attribute in appropriate order */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify the attribute information for first attribute in appropriate order */ HDmemset(&ainfo, 0, sizeof(ainfo)); - ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, H5P_DEFAULT); - if(new_format) { - if(order == H5_ITER_INC) { + ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, + H5P_DEFAULT); + if (new_format) { + if (order == H5_ITER_INC) { VERIFY(ainfo.corder, (u + 1), "H5Aget_info_by_idx"); } /* end if */ else { VERIFY(ainfo.corder, ((max_compact * 2) - (u + 2)), "H5Aget_info_by_idx"); } /* end else */ - } /* end if */ + } /* end if */ /* Verify the name for first attribute in appropriate order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - if(order == H5_ITER_INC) + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + if (order == H5_ITER_INC) HDsprintf(attrname, "attr %02u", (u + 1)); else HDsprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2))); @@ -6362,13 +6340,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(ret, FAIL, "H5Adelete_by_idx"); } /* end for */ - - /* Delete attributes in middle */ - + /* Delete attributes in middle */ /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6386,10 +6362,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Create attributes, to push into dense form */ - for(u = 0; u < (max_compact * 2); u++) { + for (u = 0; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -6401,7 +6378,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - if(u >= max_compact) { + if (u >= max_compact) { is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ @@ -6410,11 +6387,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = attr_info_by_idx_check(my_dataset, attrname, (hsize_t)u, use_index); CHECK(ret, FAIL, "attr_info_by_idx_check"); } /* end for */ - } /* end for */ + } /* end for */ /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6432,38 +6409,41 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Delete every other attribute from dense storage, in appropriate order */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Delete attribute */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify the attribute information for first attribute in appropriate order */ HDmemset(&ainfo, 0, sizeof(ainfo)); - ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, &ainfo, H5P_DEFAULT); - if(new_format) { - if(order == H5_ITER_INC) { + ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, &ainfo, + H5P_DEFAULT); + if (new_format) { + if (order == H5_ITER_INC) { VERIFY(ainfo.corder, ((u * 2) + 1), "H5Aget_info_by_idx"); } /* end if */ else { - VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 2)), "H5Aget_info_by_idx"); + VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 2)), + "H5Aget_info_by_idx"); } /* end else */ - } /* end if */ + } /* end if */ /* Verify the name for first attribute in appropriate order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - if(order == H5_ITER_INC) + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + if (order == H5_ITER_INC) HDsprintf(attrname, "attr %02u", ((u * 2) + 1)); else HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ - } /* end for */ + } /* end for */ /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -6481,27 +6461,30 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Delete remaining attributes from dense storage, in appropriate order */ - for(u = 0; u < (max_compact - 1); u++) { + for (u = 0; u < (max_compact - 1); u++) { /* Delete attribute */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify the attribute information for first attribute in appropriate order */ HDmemset(&ainfo, 0, sizeof(ainfo)); - ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, H5P_DEFAULT); - if(new_format) { - if(order == H5_ITER_INC) { + ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, + H5P_DEFAULT); + if (new_format) { + if (order == H5_ITER_INC) { VERIFY(ainfo.corder, ((u * 2) + 3), "H5Aget_info_by_idx"); } /* end if */ else { - VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 4)), "H5Aget_info_by_idx"); + VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 4)), + "H5Aget_info_by_idx"); } /* end else */ - } /* end if */ + } /* end if */ /* Verify the name for first attribute in appropriate order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - if(order == H5_ITER_INC) + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + if (order == H5_ITER_INC) HDsprintf(attrname, "attr %02u", ((u * 2) + 3)); else HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4))); @@ -6534,8 +6517,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } /* end for */ - } /* end for */ - } /* end for */ + } /* end for */ + } /* end for */ /* Close property list */ ret = H5Pclose(dcpl); @@ -6544,8 +6527,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_delete_by_idx() */ - +} /* test_attr_delete_by_idx() */ /**************************************************************** ** @@ -6553,63 +6535,62 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) ** ****************************************************************/ static herr_t -attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, - void *_op_data) +attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data) { - attr_iter_info_t *op_data = (attr_iter_info_t *)_op_data; /* User data */ - char attrname[NAME_BUF_SIZE]; /* Object name */ - H5A_info_t my_info; /* Local attribute info */ + attr_iter_info_t *op_data = (attr_iter_info_t *)_op_data; /* User data */ + char attrname[NAME_BUF_SIZE]; /* Object name */ + H5A_info_t my_info; /* Local attribute info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the attribute information directly to compare */ - if(H5Aget_info_by_name(loc_id, ".", attr_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + if (H5Aget_info_by_name(loc_id, ".", attr_name, &my_info, H5P_DEFAULT) < 0) + return (H5_ITER_ERROR); /* Check more things for revised attribute iteration (vs. older attribute iteration) */ - if(info) { + if (info) { /* Check for correct order of iteration */ /* (if we are operating in increasing or decreasing order) */ - if(op_data->order != H5_ITER_NATIVE) - if(info->corder != op_data->curr) - return(H5_ITER_ERROR); + if (op_data->order != H5_ITER_NATIVE) + if (info->corder != op_data->curr) + return (H5_ITER_ERROR); /* Compare attribute info structs */ - if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); - if(info->corder != my_info.corder) - return(H5_ITER_ERROR); - if(info->cset != my_info.cset) - return(H5_ITER_ERROR); - if(info->data_size != my_info.data_size) - return(H5_ITER_ERROR); + if (info->corder_valid != my_info.corder_valid) + return (H5_ITER_ERROR); + if (info->corder != my_info.corder) + return (H5_ITER_ERROR); + if (info->cset != my_info.cset) + return (H5_ITER_ERROR); + if (info->data_size != my_info.data_size) + return (H5_ITER_ERROR); } /* end if */ /* Verify name of link */ HDsprintf(attrname, "attr %02u", (unsigned)my_info.corder); - if(HDstrcmp(attr_name, attrname)) - return(H5_ITER_ERROR); + if (HDstrcmp(attr_name, attrname)) + return (H5_ITER_ERROR); /* Check if we've visited this link before */ - if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); - if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + if ((size_t)op_data->curr >= op_data->max_visit) + return (H5_ITER_ERROR); + if (op_data->visited[op_data->curr]) + return (H5_ITER_ERROR); op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ - if(op_data->order != H5_ITER_DEC) + if (op_data->order != H5_ITER_DEC) op_data->curr++; else op_data->curr--; /* Check for stopping in the middle of iterating */ - if(op_data->stop > 0) - if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + if (op_data->stop > 0) + if (--op_data->stop == 0) + return (CORDER_ITER_STOP); - return(H5_ITER_CONT); + return (H5_ITER_CONT); } /* end attr_iterate2_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -6622,11 +6603,10 @@ attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, static herr_t attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data) { - return(attr_iterate2_cb(loc_id, attr_name, NULL, _op_data)); + return (attr_iterate2_cb(loc_id, attr_name, NULL, _op_data)); } /* end attr_iterate1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- * Function: attr_iterate2_fail_cb * @@ -6643,12 +6623,11 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data) */ static int attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *attr_name, - const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) + const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { - return(H5_ITER_ERROR); + return (H5_ITER_ERROR); } /* end attr_iterate2_fail_cb() */ - /*------------------------------------------------------------------------- * Function: attr_iterate_check * @@ -6663,263 +6642,251 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED * *------------------------------------------------------------------------- */ static int -attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_attrs, - attr_iter_info_t *iter_info) +attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + unsigned max_attrs, attr_iter_info_t *iter_info) { - unsigned v; /* Local index variable */ - hsize_t skip; /* # of attributes to skip on object */ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of attributes to skip on object */ #ifndef H5_NO_DEPRECATED_SYMBOLS - unsigned oskip; /* # of attributes to skip on object, with H5Aiterate1 */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - int old_nerrs; /* Number of errors when entering this check */ - herr_t ret; /* Generic return value */ + unsigned oskip; /* # of attributes to skip on object, with H5Aiterate1 */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + int old_nerrs; /* Number of errors when entering this check */ + herr_t ret; /* Generic return value */ /* Retrieve the current # of reported errors */ old_nerrs = GetTestNumErrs(); /* Iterate over attributes on object */ iter_info->nskipped = (unsigned)(skip = 0); - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info); CHECK(ret, FAIL, "H5Aiterate2"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate2"); - for(v = 0; v < max_attrs; v++) + for (v = 0; v < max_attrs; v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate2"); - /* Iterate over attributes on object */ iter_info->nskipped = (unsigned)(skip = 0); - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate_by_name"); - for(v = 0; v < max_attrs; v++) + for (v = 0; v < max_attrs; v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name"); - /* Iterate over attributes on object */ iter_info->nskipped = (unsigned)(skip = 0); - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate_by_name"); - for(v = 0; v < max_attrs; v++) + for (v = 0; v < max_attrs; v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name"); - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over attributes on object, with H5Aiterate1 */ iter_info->nskipped = oskip = 0; - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate1(obj_id, &oskip, attr_iterate1_cb, iter_info); CHECK(ret, FAIL, "H5Aiterate1"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate1"); - for(v = 0; v < max_attrs; v++) + for (v = 0; v < max_attrs; v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate1"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some attributes on object */ iter_info->nskipped = (unsigned)(skip = max_attrs / 2); - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info); CHECK(ret, FAIL, "H5Aiterate2"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate2"); - if(order == H5_ITER_INC) { - for(v = 0; v < (max_attrs / 2); v++) + if (order == H5_ITER_INC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate2"); } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_attrs / 2); v++) + else if (order == H5_ITER_DEC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate2"); } /* end if */ else { - unsigned nvisit = 0; /* # of links visited */ + unsigned nvisit = 0; /* # of links visited */ HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_attrs; v++) - if(iter_info->visited[v] == TRUE) + for (v = 0; v < max_attrs; v++) + if (iter_info->visited[v] == TRUE) nvisit++; VERIFY(skip, (max_attrs / 2), "H5Aiterate2"); } /* end else */ - /* Skip over some attributes on object */ iter_info->nskipped = (unsigned)(skip = max_attrs / 2); - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate_by_name"); - if(order == H5_ITER_INC) { - for(v = 0; v < (max_attrs / 2); v++) + if (order == H5_ITER_INC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate_by_name"); } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_attrs / 2); v++) + else if (order == H5_ITER_DEC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name"); } /* end if */ else { - unsigned nvisit = 0; /* # of links visited */ + unsigned nvisit = 0; /* # of links visited */ HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_attrs; v++) - if(iter_info->visited[v] == TRUE) + for (v = 0; v < max_attrs; v++) + if (iter_info->visited[v] == TRUE) nvisit++; VERIFY(skip, (max_attrs / 2), "H5Aiterate_by_name"); } /* end else */ - /* Skip over some attributes on object */ iter_info->nskipped = (unsigned)(skip = max_attrs / 2); - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); /* Verify that we visited all the attributes */ VERIFY(skip, max_attrs, "H5Aiterate_by_name"); - if(order == H5_ITER_INC) { - for(v = 0; v < (max_attrs / 2); v++) + if (order == H5_ITER_INC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate_by_name"); } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_attrs / 2); v++) + else if (order == H5_ITER_DEC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name"); } /* end if */ else { - unsigned nvisit = 0; /* # of links visited */ + unsigned nvisit = 0; /* # of links visited */ HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_attrs; v++) - if(iter_info->visited[v] == TRUE) + for (v = 0; v < max_attrs; v++) + if (iter_info->visited[v] == TRUE) nvisit++; VERIFY(skip, (max_attrs / 2), "H5Aiterate_by_name"); } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some attributes on object, with H5Aiterate1 */ iter_info->nskipped = oskip = max_attrs / 2; - iter_info->order = order; - iter_info->stop = -1; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? (unsigned)oskip : ((max_attrs - 1) - oskip); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? (unsigned)oskip : ((max_attrs - 1) - oskip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate1(obj_id, &oskip, attr_iterate1_cb, iter_info); CHECK(ret, FAIL, "H5Aiterate1"); /* Verify that we visited all the links */ VERIFY(oskip, max_attrs, "H5Aiterate1"); - if(order == H5_ITER_INC) { - for(v = 0; v < (max_attrs / 2); v++) + if (order == H5_ITER_INC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate1"); } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_attrs / 2); v++) + else if (order == H5_ITER_DEC) { + for (v = 0; v < (max_attrs / 2); v++) VERIFY(iter_info->visited[v], TRUE, "H5Aiterate1"); } /* end if */ else { - unsigned nvisit = 0; /* # of links visited */ + unsigned nvisit = 0; /* # of links visited */ HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_attrs; v++) - if(iter_info->visited[v] == TRUE) + for (v = 0; v < max_attrs; v++) + if (iter_info->visited[v] == TRUE) nvisit++; VERIFY(skip, (max_attrs / 2), "H5Aiterate1"); - } /* end else */ + } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over attributes on object, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); - iter_info->order = order; - iter_info->stop = 3; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info); CHECK(ret, FAIL, "H5Aiterate2"); VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate2"); VERIFY(iter_info->ncalled, 3, "H5Aiterate2"); - /* Iterate over attributes on object, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); - iter_info->order = order; - iter_info->stop = 3; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate_by_name"); VERIFY(iter_info->ncalled, 3, "H5Aiterate_by_name"); - /* Iterate over attributes on object, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); - iter_info->order = order; - iter_info->stop = 3; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate_by_name"); VERIFY(iter_info->ncalled, 3, "H5Aiterate_by_name"); - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over attributes on object, stopping in the middle, with H5Aiterate1() */ iter_info->nskipped = oskip = 0; - iter_info->order = order; - iter_info->stop = 3; - iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); ret = H5Aiterate1(obj_id, &oskip, attr_iterate1_cb, iter_info); CHECK(ret, FAIL, "H5Aiterate1"); @@ -6927,10 +6894,9 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, VERIFY(iter_info->ncalled, 3, "H5Aiterate1"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; - ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL); + ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL); VERIFY(ret, FAIL, "H5Aiterate2"); skip = 0; @@ -6938,17 +6904,16 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, VERIFY(ret, FAIL, "H5Aiterate_by_name"); skip = 0; - ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aiterate_by_name"); /* Retrieve current # of errors */ - if(old_nerrs == GetTestNumErrs()) - return(0); + if (old_nerrs == GetTestNumErrs()) + return (0); else - return(-1); + return (-1); } /* end attr_iterate_check() */ - /**************************************************************** ** ** test_attr_iterate2(): Test basic H5A (attribute) code. @@ -6958,30 +6923,30 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, static void test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - attr_iter_info_t iter_info; /* Iterator info */ - hbool_t *visited = NULL; /* Array of flags for visiting links */ - hsize_t idx; /* Start index for iteration */ - unsigned use_index; /* Use index on creation order values */ - const char *dsetname; /* Name of dataset for attributes */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + attr_iter_info_t iter_info; /* Iterator info */ + hbool_t * visited = NULL; /* Array of flags for visiting links */ + hsize_t idx; /* Start index for iteration */ + unsigned use_index; /* Use index on creation order values */ + const char * dsetname; /* Name of dataset for attributes */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -6991,7 +6956,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -7002,53 +6968,62 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = max_compact * 2; - visited = (hbool_t*)HDmalloc(sizeof(hbool_t) * iter_info.max_visit); + visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit); CHECK_PTR(visited, "HDmalloc"); iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { + for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { + for (use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Increasing Order w/Creation Order Index\n")) + if (idx_type == H5_INDEX_CRT_ORDER) { + if (order == H5_ITER_INC) { + if (use_index) + MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in " + "Increasing Order w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Increasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in " + "Increasing Order w/o Creation Order Index\n")) } /* end if */ else { - if(use_index) - MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Decreasing Order w/Creation Order Index\n")) + if (use_index) + MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in " + "Decreasing Order w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Decreasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in " + "Decreasing Order w/o Creation Order Index\n")) } /* end else */ - } /* end if */ + } /* end if */ else { - if(order == H5_ITER_INC) { - if(use_index) - MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order w/Creation Order Index\n")) + if (order == H5_ITER_INC) { + if (use_index) + MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order " + "w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order " + "w/o Creation Order Index\n")) } /* end if */ else { - if(use_index) - MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order w/Creation Order Index\n")) + if (use_index) + MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order " + "w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order " + "w/o Creation Order Index\n")) } /* end else */ - } /* end else */ + } /* end else */ /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Set attribute creation order tracking & indexing for object */ - if(new_format == TRUE) { - ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); + if (new_format == TRUE) { + ret = H5Pset_attr_creation_order( + dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } /* end if */ @@ -7061,21 +7036,21 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; - dsetname = DSET1_NAME; + dsetname = DSET1_NAME; break; case 1: my_dataset = dset2; - dsetname = DSET2_NAME; + dsetname = DSET2_NAME; break; case 2: my_dataset = dset3; - dsetname = DSET3_NAME; + dsetname = DSET3_NAME; break; default: @@ -7092,17 +7067,20 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = H5Aiterate2(my_dataset, idx_type, order, NULL, attr_iterate2_cb, NULL); CHECK(ret, FAIL, "H5Aiterate2"); - ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, NULL, attr_iterate2_cb, NULL, + H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); - ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, NULL, attr_iterate2_cb, NULL, + H5P_DEFAULT); CHECK(ret, FAIL, "H5Aiterate_by_name"); /* Create attributes, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -7133,11 +7111,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(ret, FAIL, "H5Aiterate2"); idx = u; - ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aiterate_by_name"); idx = u; - ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aiterate_by_name"); /* Test iteration over attributes stored compactly */ @@ -7145,23 +7125,22 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "attr_iterate_check"); } /* end for */ - /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; - dsetname = DSET1_NAME; + dsetname = DSET1_NAME; break; case 1: my_dataset = dset2; - dsetname = DSET2_NAME; + dsetname = DSET2_NAME; break; case 2: my_dataset = dset3; - dsetname = DSET3_NAME; + dsetname = DSET3_NAME; break; default: @@ -7169,10 +7148,11 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Create more attributes, to push into dense form */ - for(u = max_compact; u < (max_compact * 2); u++) { + for (u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -7184,7 +7164,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - if(u >= max_compact) { + if (u >= max_compact) { is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ @@ -7203,11 +7183,11 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); - if(new_format) { + if (new_format) { /* Retrieve & verify # of records in the name & creation order indices */ ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O__attr_dense_info_test"); - if(use_index) + if (use_index) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ @@ -7218,11 +7198,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(ret, FAIL, "H5Aiterate2"); idx = u; - ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aiterate_by_name"); idx = u; - ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT); + ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, + H5P_DEFAULT); VERIFY(ret, FAIL, "H5Aiterate_by_name"); /* Test iteration over attributes stored densely */ @@ -7242,8 +7224,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } /* end for */ - } /* end for */ - } /* end for */ + } /* end for */ + } /* end for */ /* Close property list */ ret = H5Pclose(dcpl); @@ -7255,8 +7237,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Free the "visited link" array */ HDfree(visited); -} /* test_attr_iterate2() */ - +} /* test_attr_iterate2() */ /*------------------------------------------------------------------------- * Function: attr_open_by_idx_check @@ -7272,20 +7253,19 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) *------------------------------------------------------------------------- */ static int -attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - unsigned max_attrs) +attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_attrs) { - hid_t attr_id; /* ID of attribute to test */ - H5A_info_t ainfo; /* Attribute info */ - int old_nerrs; /* Number of errors when entering this check */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t attr_id; /* ID of attribute to test */ + H5A_info_t ainfo; /* Attribute info */ + int old_nerrs; /* Number of errors when entering this check */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Retrieve the current # of reported errors */ old_nerrs = GetTestNumErrs(); /* Open each attribute on object by index and check that it's the correct one */ - for(u = 0; u < max_attrs; u++) { + for (u = 0; u < max_attrs; u++) { /* Open the attribute */ attr_id = H5Aopen_by_idx(obj_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Aopen_by_idx"); @@ -7295,10 +7275,10 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, CHECK(ret, FAIL, "H5Aget_info"); /* Check that the object is the correct one */ - if(order == H5_ITER_INC) { + if (order == H5_ITER_INC) { VERIFY(ainfo.corder, u, "H5Aget_info"); } /* end if */ - else if(order == H5_ITER_DEC) { + else if (order == H5_ITER_DEC) { VERIFY(ainfo.corder, (max_attrs - (u + 1)), "H5Aget_info"); } /* end if */ else { @@ -7311,13 +7291,12 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, } /* end for */ /* Retrieve current # of errors */ - if(old_nerrs == GetTestNumErrs()) - return(0); + if (old_nerrs == GetTestNumErrs()) + return (0); else - return(-1); + return (-1); } /* end attr_open_by_idx_check() */ - /**************************************************************** ** ** test_attr_open_by_idx(): Test basic H5A (attribute) code. @@ -7327,27 +7306,27 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, static void test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - unsigned use_index; /* Use index on creation order values */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -7357,7 +7336,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -7367,48 +7347,57 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { + for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { + for (use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing Order w/Creation Order Index\n")) + if (idx_type == H5_INDEX_CRT_ORDER) { + if (order == H5_ITER_INC) { + if (use_index) + MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing " + "Order w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing " + "Order w/o Creation Order Index\n")) } /* end if */ else { - if(use_index) - MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing Order w/Creation Order Index\n")) + if (use_index) + MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing " + "Order w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing " + "Order w/o Creation Order Index\n")) } /* end else */ - } /* end if */ + } /* end if */ else { - if(order == H5_ITER_INC) { - if(use_index) - MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order w/Creation Order Index\n")) + if (order == H5_ITER_INC) { + if (use_index) + MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order " + "w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order w/o " + "Creation Order Index\n")) } /* end if */ else { - if(use_index) - MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/Creation Order Index\n")) + if (use_index) + MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order " + "w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/o Creation Order Index\n")) + MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/o " + "Creation Order Index\n")) } /* end else */ - } /* end else */ + } /* end else */ /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Set attribute creation order tracking & indexing for object */ - if(new_format == TRUE) { - ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); + if (new_format == TRUE) { + ret = H5Pset_attr_creation_order( + dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } /* end if */ @@ -7421,8 +7410,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -7446,14 +7435,16 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ - ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, + H5P_DEFAULT); VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Create attributes, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -7479,7 +7470,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ - ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, + H5P_DEFAULT); VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ @@ -7487,10 +7479,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "attr_open_by_idx_check"); } /* end for */ - /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; break; @@ -7508,10 +7499,11 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Create more attributes, to push into dense form */ - for(u = max_compact; u < (max_compact * 2); u++) { + for (u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); /* Write data into the attribute */ @@ -7523,7 +7515,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - if(u >= max_compact) { + if (u >= max_compact) { is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ @@ -7542,17 +7534,18 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); - if(new_format) { + if (new_format) { /* Retrieve & verify # of records in the name & creation order indices */ ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O__attr_dense_info_test"); - if(use_index) + if (use_index) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound opening an attribute on an object */ - ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, + H5P_DEFAULT); VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ @@ -7572,8 +7565,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } /* end for */ - } /* end for */ - } /* end for */ + } /* end for */ + } /* end for */ /* Close property list */ ret = H5Pclose(dcpl); @@ -7582,8 +7575,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_open_by_idx() */ - +} /* test_attr_open_by_idx() */ /*------------------------------------------------------------------------- * Function: attr_open_check @@ -7599,21 +7591,20 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) *------------------------------------------------------------------------- */ static int -attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, - unsigned max_attrs) +attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attrs) { - hid_t attr_id; /* ID of attribute to test */ - H5A_info_t ainfo; /* Attribute info */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - int old_nerrs; /* Number of errors when entering this check */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t attr_id; /* ID of attribute to test */ + H5A_info_t ainfo; /* Attribute info */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + int old_nerrs; /* Number of errors when entering this check */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Retrieve the current # of reported errors */ old_nerrs = GetTestNumErrs(); /* Open each attribute on object by index and check that it's the correct one */ - for(u = 0; u < max_attrs; u++) { + for (u = 0; u < max_attrs; u++) { /* Open the attribute */ HDsprintf(attrname, "attr %02u", u); attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT); @@ -7630,7 +7621,6 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, ret = H5Aclose(attr_id); CHECK(ret, FAIL, "H5Aclose"); - /* Open the attribute */ attr_id = H5Aopen_by_name(obj_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Aopen_by_name"); @@ -7646,7 +7636,6 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, ret = H5Aclose(attr_id); CHECK(ret, FAIL, "H5Aclose"); - /* Open the attribute */ attr_id = H5Aopen_by_name(fid, dsetname, attrname, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Aopen_by_name"); @@ -7664,13 +7653,12 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, } /* end for */ /* Retrieve current # of errors */ - if(old_nerrs == GetTestNumErrs()) - return(0); + if (old_nerrs == GetTestNumErrs()) + return (0); else - return(-1); + return (-1); } /* end attr_open_check() */ - /**************************************************************** ** ** test_attr_open_by_name(): Test basic H5A (attribute) code. @@ -7680,26 +7668,26 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, static void test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned use_index; /* Use index on creation order values */ - const char *dsetname; /* Name of dataset for attributes */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned use_index; /* Use index on creation order values */ + const char *dsetname; /* Name of dataset for attributes */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -7709,7 +7697,8 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -7719,9 +7708,9 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { + for (use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ - if(use_index) + if (use_index) MESSAGE(5, ("Testing Opening Attributes By Name w/Creation Order Index\n")) else MESSAGE(5, ("Testing Opening Attributes By Name w/o Creation Order Index\n")) @@ -7731,8 +7720,9 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Set attribute creation order tracking & indexing for object */ - if(new_format == TRUE) { - ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); + if (new_format == TRUE) { + ret = H5Pset_attr_creation_order( + dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } /* end if */ @@ -7745,21 +7735,21 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; - dsetname = DSET1_NAME; + dsetname = DSET1_NAME; break; case 1: my_dataset = dset2; - dsetname = DSET2_NAME; + dsetname = DSET2_NAME; break; case 2: my_dataset = dset3; - dsetname = DSET3_NAME; + dsetname = DSET3_NAME; break; default: @@ -7783,7 +7773,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Create attributes, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -7826,23 +7816,22 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "attr_open_check"); } /* end for */ - /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; - dsetname = DSET1_NAME; + dsetname = DSET1_NAME; break; case 1: my_dataset = dset2; - dsetname = DSET2_NAME; + dsetname = DSET2_NAME; break; case 2: my_dataset = dset3; - dsetname = DSET3_NAME; + dsetname = DSET3_NAME; break; default: @@ -7850,7 +7839,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Create more attributes, to push into dense form */ - for(u = max_compact; u < (max_compact * 2); u++) { + for (u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -7865,7 +7854,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - if(u >= max_compact) { + if (u >= max_compact) { is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ @@ -7884,11 +7873,11 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); - if(new_format) { + if (new_format) { /* Retrieve & verify # of records in the name & creation order indices */ ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O__attr_dense_info_test"); - if(use_index) + if (use_index) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ @@ -7928,8 +7917,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_open_by_name() */ - +} /* test_attr_open_by_name() */ /**************************************************************** ** @@ -7940,25 +7928,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) static void test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned use_index; /* Use index on creation order values */ - const char *dsetname; /* Name of dataset for attributes */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned use_index; /* Use index on creation order values */ + const char *dsetname; /* Name of dataset for attributes */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -7968,7 +7956,8 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -7978,9 +7967,9 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { + for (use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ - if(use_index) + if (use_index) MESSAGE(5, ("Testing Creating Attributes By Name w/Creation Order Index\n")) else MESSAGE(5, ("Testing Creating Attributes By Name w/o Creation Order Index\n")) @@ -7990,8 +7979,9 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Set attribute creation order tracking & indexing for object */ - if(new_format == TRUE) { - ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); + if (new_format == TRUE) { + ret = H5Pset_attr_creation_order( + dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); } /* end if */ @@ -8004,21 +7994,21 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(dset3, FAIL, "H5Dcreate2"); /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; - dsetname = DSET1_NAME; + dsetname = DSET1_NAME; break; case 1: my_dataset = dset2; - dsetname = DSET2_NAME; + dsetname = DSET2_NAME; break; case 2: my_dataset = dset3; - dsetname = DSET3_NAME; + dsetname = DSET3_NAME; break; default: @@ -8032,10 +8022,11 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { + for (u = 0; u < max_compact; u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate_by_name"); /* Write data into the attribute */ @@ -8065,23 +8056,22 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "attr_open_check"); } /* end for */ - /* Work on all the datasets */ - for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { - switch(curr_dset) { + for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch (curr_dset) { case 0: my_dataset = dset1; - dsetname = DSET1_NAME; + dsetname = DSET1_NAME; break; case 1: my_dataset = dset2; - dsetname = DSET2_NAME; + dsetname = DSET2_NAME; break; case 2: my_dataset = dset3; - dsetname = DSET3_NAME; + dsetname = DSET3_NAME; break; default: @@ -8089,10 +8079,11 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Create more attributes, to push into dense form */ - for(u = max_compact; u < (max_compact * 2); u++) { + for (u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ HDsprintf(attrname, "attr %02u", u); - attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate_by_name"); /* Write data into the attribute */ @@ -8104,7 +8095,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - if(u >= max_compact) { + if (u >= max_compact) { is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ @@ -8123,11 +8114,11 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) is_dense = H5O__is_attr_dense_test(my_dataset); VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); - if(new_format) { + if (new_format) { /* Retrieve & verify # of records in the name & creation order indices */ ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O__attr_dense_info_test"); - if(use_index) + if (use_index) VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ @@ -8157,7 +8148,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_create_by_name() */ +} /* test_attr_create_by_name() */ /**************************************************************** ** @@ -8168,28 +8159,28 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) static void test_attr_shared_write(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t my_fcpl; /* File creation property list ID */ - hid_t dataset, dataset2; /* Dataset IDs */ - hid_t attr_tid; /* Attribute's datatype ID */ - hid_t sid, big_sid; /* Dataspace IDs */ - hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - htri_t is_shared; /* Is attributes shared? */ - hsize_t shared_refcount; /* Reference count of shared attribute */ - unsigned attr_value; /* Attribute value */ - unsigned *big_value; /* Data for "big" attribute */ - size_t mesg_count; /* # of shared messages */ - unsigned test_shared; /* Index over shared component type */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* File ID */ + hid_t my_fcpl; /* File creation property list ID */ + hid_t dataset, dataset2; /* Dataset IDs */ + hid_t attr_tid; /* Attribute's datatype ID */ + hid_t sid, big_sid; /* Dataspace IDs */ + hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_shared; /* Is attributes shared? */ + hsize_t shared_refcount; /* Reference count of shared attribute */ + unsigned attr_value; /* Attribute value */ + unsigned * big_value; /* Data for "big" attribute */ + size_t mesg_count; /* # of shared messages */ + unsigned test_shared; /* Index over shared component type */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n")); @@ -8208,7 +8199,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(big_sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ - for(test_shared = 0; test_shared < 3; test_shared++) { + for (test_shared = 0; test_shared < 3; test_shared++) { /* Make copy of file creation property list */ my_fcpl = H5Pcopy(fcpl); CHECK(my_fcpl, FAIL, "H5Pcopy"); @@ -8218,7 +8209,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Tcopy"); /* Special setup for each type of shared components */ - if(test_shared == 0) { + if (test_shared == 0) { /* Make attributes > 500 bytes shared */ ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); @@ -8256,16 +8247,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); /* Commit datatype to file */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); } /* end if */ @@ -8274,7 +8264,8 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -8286,7 +8277,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(dataset2, FAIL, "H5Dcreate2"); /* Check on dataset's message storage status */ - if(test_shared != 0) { + if (test_shared != 0) { /* Datasets' datatypes can be shared */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -8313,12 +8304,12 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute name */ HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on first dataset */ attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -8329,7 +8320,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -8348,7 +8339,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -8363,14 +8354,13 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on second dataset */ attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -8381,7 +8371,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -8400,7 +8390,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -8415,7 +8405,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset2); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); @@ -8432,8 +8422,8 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check on shared message status now */ - if(test_shared != 0) { - if(test_shared == 1) { + if (test_shared != 0) { + if (test_shared == 1) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -8453,7 +8443,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ @@ -8463,7 +8453,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); - if(test_shared != 0) { + if (test_shared != 0) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -8492,7 +8482,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_write() */ +} /* test_attr_shared_write() */ /**************************************************************** ** @@ -8503,29 +8493,29 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) static void test_attr_shared_rename(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t my_fcpl; /* File creation property list ID */ - hid_t dataset, dataset2; /* Dataset ID2 */ - hid_t attr_tid; /* Attribute's datatype ID */ - hid_t sid, big_sid; /* Dataspace IDs */ - hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ - char attrname2[NAME_BUF_SIZE]; /* Name of attribute on second dataset */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - htri_t is_shared; /* Is attributes shared? */ - hsize_t shared_refcount; /* Reference count of shared attribute */ - unsigned attr_value; /* Attribute value */ - unsigned *big_value; /* Data for "big" attribute */ - size_t mesg_count; /* # of shared messages */ - unsigned test_shared; /* Index over shared component type */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t my_fcpl; /* File creation property list ID */ + hid_t dataset, dataset2; /* Dataset ID2 */ + hid_t attr_tid; /* Attribute's datatype ID */ + hid_t sid, big_sid; /* Dataspace IDs */ + hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ + char attrname2[NAME_BUF_SIZE]; /* Name of attribute on second dataset */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_shared; /* Is attributes shared? */ + hsize_t shared_refcount; /* Reference count of shared attribute */ + unsigned attr_value; /* Attribute value */ + unsigned * big_value; /* Data for "big" attribute */ + size_t mesg_count; /* # of shared messages */ + unsigned test_shared; /* Index over shared component type */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Shared & Unshared Attributes in Compact & Dense Storage\n")); @@ -8544,7 +8534,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(big_sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ - for(test_shared = 0; test_shared < 3; test_shared++) { + for (test_shared = 0; test_shared < 3; test_shared++) { /* Make copy of file creation property list */ my_fcpl = H5Pcopy(fcpl); CHECK(my_fcpl, FAIL, "H5Pcopy"); @@ -8554,7 +8544,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Tcopy"); /* Special setup for each type of shared components */ - if(test_shared == 0) { + if (test_shared == 0) { /* Make attributes > 500 bytes shared */ ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); @@ -8592,16 +8582,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); /* Commit datatype to file */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); } /* end if */ @@ -8610,7 +8599,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -8622,7 +8612,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(dataset2, FAIL, "H5Dcreate2"); /* Check on dataset's message storage status */ - if(test_shared != 0) { + if (test_shared != 0) { /* Datasets' datatypes can be shared */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -8649,12 +8639,12 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute name */ HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on first dataset */ attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -8665,7 +8655,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -8684,7 +8674,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -8699,14 +8689,13 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on second dataset */ attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -8717,7 +8706,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -8736,7 +8725,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -8751,12 +8740,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset2); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Create new attribute name */ HDsprintf(attrname2, "new attr %02u", u); @@ -8764,14 +8752,13 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) ret = H5Arename_by_name(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT); CHECK(ret, FAIL, "H5Arename_by_name"); - /* Check refcount on attributes now */ /* Check refcount on renamed attribute */ attr = H5Aopen(dataset2, attrname2, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); - if(u % 2) { + if (u % 2) { /* Check that attribute is not shared */ is_shared = H5A__is_shared_test(attr); VERIFY(is_shared, FALSE, "H5A__is_shared_test"); @@ -8795,7 +8782,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) attr = H5Aopen(dataset, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); - if(u % 2) { + if (u % 2) { /* Check that attribute is not shared */ is_shared = H5A__is_shared_test(attr); VERIFY(is_shared, FALSE, "H5A__is_shared_test"); @@ -8815,19 +8802,17 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Change second dataset's attribute's name back to original */ ret = H5Arename_by_name(fid, DSET2_NAME, attrname2, attrname, H5P_DEFAULT); CHECK(ret, FAIL, "H5Arename_by_name"); - /* Check refcount on attributes now */ /* Check refcount on renamed attribute */ attr = H5Aopen(dataset2, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); - if(u % 2) { + if (u % 2) { /* Check that attribute is not shared */ is_shared = H5A__is_shared_test(attr); VERIFY(is_shared, FALSE, "H5A__is_shared_test"); @@ -8851,7 +8836,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) attr = H5Aopen(dataset, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); - if(u % 2) { + if (u % 2) { /* Check that attribute is not shared */ is_shared = H5A__is_shared_test(attr); VERIFY(is_shared, FALSE, "H5A__is_shared_test"); @@ -8872,7 +8857,6 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); } /* end for */ - /* Close attribute's datatype */ ret = H5Tclose(attr_tid); CHECK(ret, FAIL, "H5Tclose"); @@ -8884,8 +8868,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check on shared message status now */ - if(test_shared != 0) { - if(test_shared == 1) { + if (test_shared != 0) { + if (test_shared == 1) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -8905,7 +8889,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ @@ -8915,7 +8899,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); - if(test_shared != 0) { + if (test_shared != 0) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -8944,7 +8928,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_rename() */ +} /* test_attr_shared_rename() */ /**************************************************************** ** @@ -8955,28 +8939,28 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) static void test_attr_shared_delete(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t my_fcpl; /* File creation property list ID */ - hid_t dataset, dataset2; /* Dataset IDs */ - hid_t attr_tid; /* Attribute's datatype ID */ - hid_t sid, big_sid; /* Dataspace IDs */ - hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - htri_t is_shared; /* Is attributes shared? */ - hsize_t shared_refcount; /* Reference count of shared attribute */ - unsigned attr_value; /* Attribute value */ - unsigned *big_value; /* Data for "big" attribute */ - size_t mesg_count; /* # of shared messages */ - unsigned test_shared; /* Index over shared component type */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* File ID */ + hid_t my_fcpl; /* File creation property list ID */ + hid_t dataset, dataset2; /* Dataset IDs */ + hid_t attr_tid; /* Attribute's datatype ID */ + hid_t sid, big_sid; /* Dataspace IDs */ + hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_shared; /* Is attributes shared? */ + hsize_t shared_refcount; /* Reference count of shared attribute */ + unsigned attr_value; /* Attribute value */ + unsigned * big_value; /* Data for "big" attribute */ + size_t mesg_count; /* # of shared messages */ + unsigned test_shared; /* Index over shared component type */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Shared & Unshared Attributes in Compact & Dense Storage\n")); @@ -8995,7 +8979,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(big_sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ - for(test_shared = 0; test_shared < 3; test_shared++) { + for (test_shared = 0; test_shared < 3; test_shared++) { /* Make copy of file creation property list */ my_fcpl = H5Pcopy(fcpl); CHECK(my_fcpl, FAIL, "H5Pcopy"); @@ -9005,7 +8989,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Tcopy"); /* Special setup for each type of shared components */ - if(test_shared == 0) { + if (test_shared == 0) { /* Make attributes > 500 bytes shared */ ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); @@ -9043,16 +9027,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); /* Commit datatype to file */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); } /* end if */ @@ -9061,7 +9044,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -9073,7 +9057,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(dataset2, FAIL, "H5Dcreate2"); /* Check on dataset's message storage status */ - if(test_shared != 0) { + if (test_shared != 0) { /* Datasets' datatypes can be shared */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -9100,12 +9084,12 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute name */ HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on first dataset */ attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -9116,7 +9100,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -9135,7 +9119,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -9150,14 +9134,13 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on second dataset */ attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -9168,7 +9151,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -9187,7 +9170,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -9202,15 +9185,14 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset2); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ - /* Delete attributes from second dataset */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute name */ HDsprintf(attrname, "attr %02u", u); @@ -9218,14 +9200,13 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) ret = H5Adelete_by_name(fid, DSET2_NAME, attrname, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_name"); - /* Check refcount on attributes now */ /* Check refcount on first dataset's attribute */ attr = H5Aopen(dataset, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); - if(u % 2) { + if (u % 2) { /* Check that attribute is not shared */ is_shared = H5A__is_shared_test(attr); VERIFY(is_shared, FALSE, "H5A__is_shared_test"); @@ -9246,7 +9227,6 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); } /* end for */ - /* Close attribute's datatype */ ret = H5Tclose(attr_tid); CHECK(ret, FAIL, "H5Tclose"); @@ -9258,8 +9238,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check on shared message status now */ - if(test_shared != 0) { - if(test_shared == 1) { + if (test_shared != 0) { + if (test_shared == 1) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -9279,7 +9259,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ @@ -9289,7 +9269,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); - if(test_shared != 0) { + if (test_shared != 0) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -9318,7 +9298,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_delete() */ +} /* test_attr_shared_delete() */ /**************************************************************** ** @@ -9329,28 +9309,28 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) static void test_attr_shared_unlink(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t my_fcpl; /* File creation property list ID */ - hid_t dataset, dataset2; /* Dataset IDs */ - hid_t attr_tid; /* Attribute's datatype ID */ - hid_t sid, big_sid; /* Dataspace IDs */ - hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ - unsigned max_compact; /* Maximum # of attributes to store compactly */ - unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ - htri_t is_shared; /* Is attributes shared? */ - hsize_t shared_refcount; /* Reference count of shared attribute */ - unsigned attr_value; /* Attribute value */ - unsigned *big_value; /* Data for "big" attribute */ - size_t mesg_count; /* # of shared messages */ - unsigned test_shared; /* Index over shared component type */ - unsigned u; /* Local index variable */ - h5_stat_size_t empty_filesize; /* Size of empty file */ - h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + hid_t fid; /* File ID */ + hid_t my_fcpl; /* File creation property list ID */ + hid_t dataset, dataset2; /* Dataset IDs */ + hid_t attr_tid; /* Attribute's datatype ID */ + hid_t sid, big_sid; /* Dataspace IDs */ + hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */ + unsigned max_compact; /* Maximum # of attributes to store compactly */ + unsigned min_dense; /* Minimum # of attributes to store "densely" */ + htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_shared; /* Is attributes shared? */ + hsize_t shared_refcount; /* Reference count of shared attribute */ + unsigned attr_value; /* Attribute value */ + unsigned * big_value; /* Data for "big" attribute */ + size_t mesg_count; /* # of shared messages */ + unsigned test_shared; /* Index over shared component type */ + unsigned u; /* Local index variable */ + h5_stat_size_t empty_filesize; /* Size of empty file */ + h5_stat_size_t filesize; /* Size of file after modifications */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Shared Attributes in Compact & Dense Storage\n")); @@ -9369,7 +9349,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(big_sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ - for(test_shared = 0; test_shared < 3; test_shared++) { + for (test_shared = 0; test_shared < 3; test_shared++) { /* Make copy of file creation property list */ my_fcpl = H5Pcopy(fcpl); CHECK(my_fcpl, FAIL, "H5Pcopy"); @@ -9379,7 +9359,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(attr_tid, FAIL, "H5Tcopy"); /* Special setup for each type of shared components */ - if(test_shared == 0) { + if (test_shared == 0) { /* Make attributes > 500 bytes shared */ ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); @@ -9417,16 +9397,15 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); - if(empty_filesize < 0) + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); - /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); /* Commit datatype to file */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); } /* end if */ @@ -9435,7 +9414,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) if (dcpl_g == H5P_DEFAULT) { dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); - } else { + } + else { dcpl = H5Pcopy(dcpl_g); CHECK(dcpl, FAIL, "H5Pcopy"); } @@ -9447,7 +9427,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(dataset2, FAIL, "H5Dcreate2"); /* Check on dataset's message storage status */ - if(test_shared != 0) { + if (test_shared != 0) { /* Datasets' datatypes can be shared */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -9474,12 +9454,12 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute name */ HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on first dataset */ attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -9490,7 +9470,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -9509,7 +9489,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -9524,14 +9504,13 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); - /* Alternate between creating "small" & "big" attributes */ - if(u % 2) { + if (u % 2) { /* Create "small" attribute on second dataset */ attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -9542,7 +9521,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ attr_value = u + 1; - ret = H5Awrite(attr, attr_tid, &attr_value); + ret = H5Awrite(attr, attr_tid, &attr_value); CHECK(ret, FAIL, "H5Awrite"); } /* end if */ else { @@ -9561,7 +9540,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Write data into the attribute */ big_value[0] = u + 1; - ret = H5Awrite(attr, attr_tid, big_value); + ret = H5Awrite(attr, attr_tid, big_value); CHECK(ret, FAIL, "H5Awrite"); /* Check refcount for attribute */ @@ -9576,13 +9555,12 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset2); - if(u < max_compact) + if (u < max_compact) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ - /* Close attribute's datatype */ ret = H5Tclose(attr_tid); CHECK(ret, FAIL, "H5Tclose"); @@ -9595,13 +9573,12 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); - /* Check on first dataset's attribute storage status */ is_dense = H5O__is_attr_dense_test(dataset); VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Check ref count on attributes of first dataset */ - for(u = 0; u < max_compact * 2; u++) { + for (u = 0; u < max_compact * 2; u++) { /* Create attribute name */ HDsprintf(attrname, "attr %02u", u); @@ -9609,7 +9586,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) attr = H5Aopen(dataset, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); - if(u % 2) { + if (u % 2) { /* Check that attribute is not shared */ is_shared = H5A__is_shared_test(attr); VERIFY(is_shared, FALSE, "H5A__is_shared_test"); @@ -9639,7 +9616,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ - if(test_shared == 2) { + if (test_shared == 2) { ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ @@ -9649,7 +9626,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); - if(test_shared != 0) { + if (test_shared != 0) { /* Check on datatype storage status */ ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); @@ -9678,7 +9655,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_unlink() */ +} /* test_attr_shared_unlink() */ /**************************************************************** ** @@ -9694,11 +9671,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) static void test_attr_bug1(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t gid; /* Group ID */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - herr_t ret; /* Generic return status */ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing Allocating and De-allocating Attributes in Unusual Way\n")); @@ -9720,7 +9697,6 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file and create another group, then attribute on first group */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -9749,7 +9725,6 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file and create another group, then another attribute on first group */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -9782,7 +9757,6 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file and re-create attributes on first group */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid, FAIL, "H5Fopen"); @@ -9819,11 +9793,10 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Close dataspace ID */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Gclose"); -} /* test_attr_bug1() */ +} /* test_attr_bug1() */ /**************************************************************** ** @@ -9839,17 +9812,17 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) static void test_attr_bug2(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t gid; /* Group ID */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hid_t gcpl; /* Group creation property list */ - hsize_t dims[2] = {10, 100}; /* Attribute dimensions */ - char aname[16]; /* Attribute name */ - unsigned i; /* index */ - herr_t ret; /* Generic return status */ - htri_t tri_ret; /* htri_t return status */ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hid_t gcpl; /* Group creation property list */ + hsize_t dims[2] = {10, 100}; /* Attribute dimensions */ + char aname[16]; /* Attribute name */ + unsigned i; /* index */ + herr_t ret; /* Generic return status */ + htri_t tri_ret; /* htri_t return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing Allocating and De-allocating Attributes in Unusual Way\n")); @@ -9862,7 +9835,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Not doing this with the latest format actually triggers a different bug. * This will be tested here as soon as it is fixed. -NAF */ - ret = H5Pset_attr_phase_change (gcpl, BUG2_NATTR+10, BUG2_NATTR+5); + ret = H5Pset_attr_phase_change(gcpl, BUG2_NATTR + 10, BUG2_NATTR + 5); CHECK(ret, FAIL, "H5Pset_attr_phase_change"); /* Create dataspace ID for attributes */ @@ -9877,7 +9850,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Create attributes on group */ - for (i=0; i<BUG2_NATTR; i++) { + for (i = 0; i < BUG2_NATTR; i++) { HDsprintf(aname, "%03u", i); aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -9887,7 +9860,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) } /* Delete every other attribute */ - for (i=1; i<BUG2_NATTR; i+=2) { + for (i = 1; i < BUG2_NATTR; i += 2) { HDsprintf(aname, "%03u", i); ret = H5Adelete(gid, aname); CHECK(ret, FAIL, "H5Adelete"); @@ -9954,7 +9927,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Create attributes on group */ - for (i=0; i<BUG2_NATTR2; i++) { + for (i = 0; i < BUG2_NATTR2; i++) { HDsprintf(aname, "%03u", i); aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -9964,7 +9937,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) } /* Delete every other attribute */ - for (i=0; i<BUG2_NATTR2; i++) { + for (i = 0; i < BUG2_NATTR2; i++) { HDsprintf(aname, "%03u", i); ret = H5Adelete(gid, aname); CHECK(ret, FAIL, "H5Adelete"); @@ -9982,7 +9955,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) ret = H5Pclose(gcpl); CHECK(ret, FAIL, "H5Pclose"); -} /* test_attr_bug2() */ +} /* test_attr_bug2() */ /**************************************************************** ** @@ -9995,17 +9968,16 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) static void test_attr_bug3(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t aid1, aid2; /* Attribute IDs */ - hid_t sid1, sid2; /* Dataspace ID */ - hid_t tid1, tid2; /* Datatype IDs */ - hid_t did; /* Dataset ID */ - hsize_t dims1[2] = {2, 2}, - dims2[2] = {3, 3}; /* Dimensions */ - int wdata1[2][2]; - unsigned wdata2[3][3]; /* Write buffers */ - unsigned u, v; /* Local index variables */ - herr_t ret; /* Generic return status */ + hid_t fid; /* File ID */ + hid_t aid1, aid2; /* Attribute IDs */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t tid1, tid2; /* Datatype IDs */ + hid_t did; /* Dataset ID */ + hsize_t dims1[2] = {2, 2}, dims2[2] = {3, 3}; /* Dimensions */ + int wdata1[2][2]; + unsigned wdata2[3][3]; /* Write buffers */ + unsigned u, v; /* Local index variables */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attributes in the Same Header as their Datatypes\n")); @@ -10053,11 +10025,11 @@ test_attr_bug3(hid_t fcpl, hid_t fapl) CHECK(aid2, FAIL, "H5Aopen"); /* Initialize the write buffers */ - for(u = 0; u < dims1[0]; u++) - for(v = 0; v < dims1[1]; v++) + for (u = 0; u < dims1[0]; u++) + for (v = 0; v < dims1[1]; v++) wdata1[u][v] = (int)((u * dims1[1]) + v); - for(u = 0; u < dims2[0]; u++) - for(v = 0; v < dims2[1]; v++) + for (u = 0; u < dims2[0]; u++) + for (v = 0; v < dims2[1]; v++) wdata2[u][v] = (unsigned)((u * dims2[1]) + v); /* Write data to the attributes */ @@ -10119,7 +10091,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_bug3() */ +} /* test_attr_bug3() */ /**************************************************************** ** @@ -10133,14 +10105,14 @@ test_attr_bug3(hid_t fcpl, hid_t fapl) static void test_attr_bug4(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t gid; /* Group ID */ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ hid_t aid1, aid2, aid3; /* Attribute IDs */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hid_t did; /* Dataset ID */ - hsize_t dims[1] = {5}; /* Attribute dimensions */ - herr_t ret; /* Generic return status */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hid_t did; /* Dataset ID */ + hsize_t dims[1] = {5}; /* Attribute dimensions */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n")); @@ -10201,7 +10173,7 @@ test_attr_bug4(hid_t fcpl, hid_t fapl) ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_bug4() */ +} /* test_attr_bug4() */ /**************************************************************** ** @@ -10213,16 +10185,14 @@ test_attr_bug4(hid_t fcpl, hid_t fapl) static void test_attr_bug5(hid_t fcpl, hid_t fapl) { - hid_t fid1, fid2; /* File IDs */ - hid_t gid1, gid2; /* Group IDs */ - hid_t did1, did2; /* Dataset IDs */ - hid_t tid1, tid2; /* Datatype IDs */ - hid_t aidg1, aidg2, - aidd1, aidd2, - aidt1, aidt2; /* Attribute IDs */ - hid_t sid; /* Dataspace ID */ - hsize_t dims[1] = {5}; /* Attribute dimensions */ - herr_t ret; /* Generic return status */ + hid_t fid1, fid2; /* File IDs */ + hid_t gid1, gid2; /* Group IDs */ + hid_t did1, did2; /* Dataset IDs */ + hid_t tid1, tid2; /* Datatype IDs */ + hid_t aidg1, aidg2, aidd1, aidd2, aidt1, aidt2; /* Attribute IDs */ + hid_t sid; /* Dataspace ID */ + hsize_t dims[1] = {5}; /* Attribute dimensions */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing Opening an Attribute Through Multiple Files Concurrently\n")); @@ -10358,7 +10328,7 @@ test_attr_bug5(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_bug5() */ +} /* test_attr_bug5() */ /**************************************************************** ** @@ -10369,13 +10339,13 @@ test_attr_bug5(hid_t fcpl, hid_t fapl) static void test_attr_bug6(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t gid; /* Group ID */ - hid_t aid1, aid2; /* Attribute IDs */ - hid_t sid; /* Dataspace ID */ - hsize_t dims[ATTR1_RANK] = {ATTR1_DIM1}; /* Attribute dimensions */ - int intar[ATTR1_DIM1]; /* Data reading buffer */ - herr_t ret; /* Generic return status */ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid1, aid2; /* Attribute IDs */ + hid_t sid; /* Dataspace ID */ + hsize_t dims[ATTR1_RANK] = {ATTR1_DIM1}; /* Attribute dimensions */ + int intar[ATTR1_DIM1]; /* Data reading buffer */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing that empty attribute can be read\n")); @@ -10418,7 +10388,7 @@ test_attr_bug6(hid_t fcpl, hid_t fapl) ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_bug6() */ +} /* test_attr_bug6() */ /**************************************************************** ** @@ -10433,19 +10403,18 @@ test_attr_bug6(hid_t fcpl, hid_t fapl) static void test_attr_bug7(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t dims_s = 140; /* Small attribute dimensions */ - hsize_t dims_l = 65480; /* Large attribute dimensions */ - H5A_info_t ainfo; /* Attribute info */ - herr_t ret; /* Generic return status */ + hid_t fid; /* File ID */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t dims_s = 140; /* Small attribute dimensions */ + hsize_t dims_l = 65480; /* Large attribute dimensions */ + H5A_info_t ainfo; /* Attribute info */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing adding and deleting large attributes\n")); - /* Create committed datatype to operate on. Use a committed datatype so that * there is nothing after the object header and the first chunk can expand and * contract as necessary. */ @@ -10481,8 +10450,9 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) CHECK(tid, FAIL, "H5Topen2"); ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); /* * Create another small attribute. Should cause chunk size field to expand by @@ -10508,12 +10478,14 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) CHECK(tid, FAIL, "H5Topen2"); ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); ret = H5Aget_info_by_name(tid, ".", ATTR2_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); /* * Create large attribute. Should cause chunk size field to expand by 2 bytes @@ -10541,16 +10513,19 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) CHECK(tid, FAIL, "H5Topen2"); ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); ret = H5Aget_info_by_name(tid, ".", ATTR2_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); ret = H5Aget_info_by_name(tid, ".", ATTR3_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_l) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_l); + if (ainfo.data_size != dims_l) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_l); /* * Delete last two attributes - should merge into a null message that is too @@ -10578,8 +10553,9 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) CHECK(tid, FAIL, "H5Topen2"); ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); /* * Create large attribute. Should cause chunk size field to expand by 3 bytes @@ -10605,12 +10581,14 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) CHECK(tid, FAIL, "H5Topen2"); ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_s) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); + if (ainfo.data_size != dims_s) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_s); ret = H5Aget_info_by_name(tid, ".", ATTR2_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims_l) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_l); + if (ainfo.data_size != dims_l) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims_l); /* Close IDs */ ret = H5Tclose(tid); @@ -10619,7 +10597,7 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_bug7() */ +} /* test_attr_bug7() */ /**************************************************************** ** @@ -10638,21 +10616,20 @@ test_attr_bug7(hid_t fcpl, hid_t fapl) static void test_attr_bug8(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - hid_t gid; /* Group ID */ - hid_t oid; /* Object ID */ - hsize_t dims = 256; /* Attribute dimensions */ - H5O_info_t oinfo; /* Object info */ - H5A_info_t ainfo; /* Attribute info */ - haddr_t root_addr; /* Root group address */ - herr_t ret; /* Generic return status */ + hid_t fid; /* File ID */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hid_t gid; /* Group ID */ + hid_t oid; /* Object ID */ + hsize_t dims = 256; /* Attribute dimensions */ + H5O_info_t oinfo; /* Object info */ + H5A_info_t ainfo; /* Attribute info */ + haddr_t root_addr; /* Root group address */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing attribute expanding object header with undecoded messages\n")); - /* Create committed datatype to operate on. Use a committed datatype so that * there is nothing after the object header and the first chunk can expand and * contract as necessary. */ @@ -10689,8 +10666,9 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(oid, FAIL, "H5Oopen"); ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + if (oinfo.addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", + (long long unsigned)oinfo.addr, (long long unsigned)root_addr); /* Close file */ ret = H5Fclose(fid); @@ -10734,12 +10712,14 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(oid, FAIL, "H5Oopen"); ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + if (oinfo.addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", + (long long unsigned)oinfo.addr, (long long unsigned)root_addr); ret = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); - if(ainfo.data_size != dims) - TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims); + if (ainfo.data_size != dims) + TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", + (long long unsigned)ainfo.data_size, (long long unsigned)dims); /* Close IDs */ ret = H5Oclose(oid); @@ -10750,7 +10730,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_bug8() */ +} /* test_attr_bug8() */ /**************************************************************** ** @@ -10771,17 +10751,17 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) static void test_attr_bug9(hid_t fcpl, hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t sid = -1; /* Dataspace ID */ - hsize_t dims[1] = {32768}; /* Attribute dimensions */ - int create_link; /* Whether to create a soft link */ - unsigned max_compact; /* Setting from fcpl */ - unsigned min_dense; /* Setting from fcpl */ - char aname[11]; /* Attribute name */ - unsigned i; /* Local index variable */ - herr_t ret; /* Generic return status */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dims[1] = {32768}; /* Attribute dimensions */ + int create_link; /* Whether to create a soft link */ + unsigned max_compact; /* Setting from fcpl */ + unsigned min_dense; /* Setting from fcpl */ + char aname[11]; /* Attribute name */ + unsigned i; /* Local index variable */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n")); @@ -10795,7 +10775,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Run with and without the soft link */ - for(create_link = 0; create_link < 2; create_link++) { + for (create_link = 0; create_link < 2; create_link++) { /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); @@ -10813,7 +10793,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); /* Create enough attributes to cause a change to dense storage */ - for(i = 0; i < max_compact + 1; i++) { + for (i = 0; i < max_compact + 1; i++) { /* Create attribute */ HDsnprintf(aname, sizeof(aname), "%u", i); aid = H5Acreate2(gid, aname, H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -10825,7 +10805,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) /* Create enough soft links that exactly one goes into chunk 1 if * requested */ - if(i == 0 && create_link) { + if (i == 0 && create_link) { ret = H5Lcreate_soft("b", gid, "a", H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lcreate_soft"); ret = H5Lcreate_soft("d", gid, "c", H5P_DEFAULT, H5P_DEFAULT); @@ -10833,7 +10813,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) ret = H5Lcreate_soft("f", gid, "e", H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lcreate_soft"); } /* end if */ - } /* end for */ + } /* end for */ /* Close IDs */ ret = H5Gclose(gid); @@ -10846,7 +10826,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_bug9() */ +} /* test_attr_bug9() */ /**************************************************************** ** @@ -10859,14 +10839,14 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) static void test_attr_delete_last_dense(hid_t fcpl, hid_t fapl) { - hid_t fid; /* File ID */ - hid_t gid; /* Group ID */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ hsize_t dim2[2] = {DIM0, DIM1}; /* Dimension sizes */ - int i, j; /* Local index variables */ - double *data = NULL; /* Pointer to the data buffer */ - herr_t ret; /* Generic return status */ + int i, j; /* Local index variables */ + double *data = NULL; /* Pointer to the data buffer */ + herr_t ret; /* Generic return status */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting the last large attribute stored densely\n")); @@ -10892,8 +10872,8 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl) CHECK_PTR(data, "HDmalloc"); /* Initialize the data */ - for(i = 0; i < DIM0; i++) - for(j = 0; j < DIM1; j++) + for (i = 0; i < DIM0; i++) + for (j = 0; j < DIM1; j++) *(data + i * DIM1 + j) = i + j; /* Write to the attribute */ @@ -10929,10 +10909,10 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); /* Free the data buffer */ - if(data) + if (data) HDfree(data); -} /* test_attr_delete_last_dense() */ +} /* test_attr_delete_last_dense() */ /**************************************************************** ** @@ -10942,13 +10922,13 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl) void test_attr(void) { - hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ - hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */ - hid_t dcpl = -1; /* Dataset creation property list */ - unsigned new_format; /* Whether to use the new format or not */ - unsigned use_shared; /* Whether to use shared attributes or not */ - unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ - herr_t ret; /* Generic return value */ + hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ + hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */ + hid_t dcpl = -1; /* Dataset creation property list */ + unsigned new_format; /* Whether to use the new format or not */ + unsigned use_shared; /* Whether to use shared attributes or not */ + unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ + herr_t ret; /* Generic return value */ MESSAGE(5, ("Testing Attributes\n")); @@ -10973,11 +10953,12 @@ test_attr(void) ret = H5Pset_shared_mesg_index(fcpl2, (unsigned)0, H5O_SHMESG_ATTR_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); - for(minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { - if(minimize_dset_oh == 0) { + for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { + if (minimize_dset_oh == 0) { MESSAGE(7, ("testing with default dataset object headers\n")); dcpl_g = H5P_DEFAULT; - } else { + } + else { MESSAGE(7, ("testing with minimzied dataset object headers\n")); dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); @@ -10986,120 +10967,146 @@ test_attr(void) dcpl_g = dcpl; } - for(new_format = FALSE; new_format <= TRUE; new_format++) { + for (new_format = FALSE; new_format <= TRUE; new_format++) { hid_t my_fapl; /* Set the FAPL for the type of format */ - if(new_format) { + if (new_format) { MESSAGE(7, ("testing with new file format\n")); my_fapl = fapl2; - } else { + } + else { MESSAGE(7, ("testing with old file format\n")); my_fapl = fapl; } /* These next two tests use the same file information */ - test_attr_basic_write(my_fapl); /* Test basic H5A writing code */ - test_attr_basic_read(my_fapl); /* Test basic H5A reading code */ + test_attr_basic_write(my_fapl); /* Test basic H5A writing code */ + test_attr_basic_read(my_fapl); /* Test basic H5A reading code */ /* These next two tests use their own file information */ - test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */ - test_attr_plist(my_fapl); /* Test attribute property lists */ + test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */ + test_attr_plist(my_fapl); /* Test attribute property lists */ /* These next two tests use the same file information */ - test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */ - test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */ + test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */ + test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */ /* These next two tests use the same file information */ - test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */ - test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */ + test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */ + test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */ /* These next four tests use the same file information */ - test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */ - test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */ - test_attr_iterate(my_fapl); /* Test H5A iterator code */ - test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */ + test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */ + test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */ + test_attr_iterate(my_fapl); /* Test H5A iterator code */ + test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */ /* This next test uses its own file information */ - test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */ + test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */ /* This next test uses its own file information */ test_attr_duplicate_ids(my_fapl); - for(use_shared = FALSE; use_shared <= TRUE; use_shared++) { + for (use_shared = FALSE; use_shared <= TRUE; use_shared++) { hid_t my_fcpl; - if(new_format == TRUE && use_shared) { + if (new_format == TRUE && use_shared) { MESSAGE(7, ("testing with shared attributes\n")); my_fcpl = fcpl2; - } else { + } + else { MESSAGE(7, ("testing without shared attributes\n")); my_fcpl = fcpl; } - test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */ - test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */ - test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */ - test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */ + test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */ + test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */ + test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */ + test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */ /* New attribute API routine tests */ - test_attr_info_by_idx(new_format, my_fcpl, my_fapl); /* Test querying attribute info by index */ - test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */ - test_attr_iterate2(new_format, my_fcpl, my_fapl); /* Test iterating over attributes by index */ + test_attr_info_by_idx(new_format, my_fcpl, + my_fapl); /* Test querying attribute info by index */ + test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */ + test_attr_iterate2(new_format, my_fcpl, + my_fapl); /* Test iterating over attributes by index */ test_attr_open_by_idx(new_format, my_fcpl, my_fapl); /* Test opening attributes by index */ test_attr_open_by_name(new_format, my_fcpl, my_fapl); /* Test opening attributes by name */ test_attr_create_by_name(new_format, my_fcpl, my_fapl); /* Test creating attributes by name */ /* Tests that address specific bugs */ - test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ - test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ - test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ - test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */ - test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ - test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */ + test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ + test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ + test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ + test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */ + test_attr_bug5(my_fcpl, + my_fapl); /* Test opening/closing attributes through different file handles */ + test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */ /* test_attr_bug7 is specific to the "new" object header format, * and in fact fails if used with the old format due to the * attributes being larger than 64K */ - test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ - test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */ + test_attr_bug8(my_fcpl, + my_fapl); /* Test attribute expanding object header with undecoded messages */ + test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */ /* tests specific to the "new format" */ if (new_format == TRUE) { /* General attribute tests */ - test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */ - test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */ - test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */ - test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */ - test_attr_dense_unlink(my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */ - test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ - test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */ + test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */ + test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */ + test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */ + test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */ + test_attr_dense_unlink( + my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */ + test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ + test_attr_dense_dup_ids(my_fcpl, + my_fapl); /* Test duplicated IDs for dense attribute storage */ /* Attribute creation order tests */ - test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */ - test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */ - test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */ - test_attr_corder_create_reopen(my_fcpl, my_fapl);/* Test creating attributes w/reopening file from using new format to using old format */ - test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */ - test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */ + test_attr_corder_create_basic( + my_fcpl, my_fapl); /* Test creating an object w/attribute creation order info */ + test_attr_corder_create_compact(my_fcpl, + my_fapl); /* Test compact attribute storage on an object + w/attribute creation order info */ + test_attr_corder_create_dense(my_fcpl, + my_fapl); /* Test dense attribute storage on an object + w/attribute creation order info */ + test_attr_corder_create_reopen(my_fcpl, + my_fapl); /* Test creating attributes w/reopening file from + using new format to using old format */ + test_attr_corder_transition(my_fcpl, + my_fapl); /* Test attribute storage transitions on an object + w/attribute creation order info */ + test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage + w/attribute creation order info */ /* More complex tests with exclusively both "new format" and "shared" attributes */ - if(use_shared == TRUE) { - test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */ - test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */ - test_attr_shared_delete(my_fcpl, my_fapl); /* Test deleting shared attributes in compact & dense storage */ - test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared attributes in compact & dense storage */ - } /* if using shared attributes */ + if (use_shared == TRUE) { + test_attr_shared_write( + my_fcpl, + my_fapl); /* Test writing to shared attributes in compact & dense storage */ + test_attr_shared_rename( + my_fcpl, + my_fapl); /* Test renaming shared attributes in compact & dense storage */ + test_attr_shared_delete( + my_fcpl, + my_fapl); /* Test deleting shared attributes in compact & dense storage */ + test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared + attributes in compact & dense storage */ + } /* if using shared attributes */ test_attr_delete_last_dense(my_fcpl, my_fapl); /* test_attr_bug7 is specific to the "new" object header format, * and in fact fails if used with the old format due to the * attributes being larger than 64K */ - test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */ + test_attr_bug7(my_fcpl, + my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */ } /* if using "new format" */ - } /* for unshared/shared attributes */ - } /* for old/new format */ + } /* for unshared/shared attributes */ + } /* for old/new format */ if (minimize_dset_oh != 0) { ret = H5Pclose(dcpl); @@ -11120,8 +11127,7 @@ test_attr(void) CHECK(ret, FAIL, "H5Pclose"); ret = H5Pclose(fapl2); CHECK(ret, FAIL, "H5Pclose"); -} /* test_attr() */ - +} /* test_attr() */ /*------------------------------------------------------------------------- * Function: cleanup_attr @@ -11142,4 +11148,3 @@ cleanup_attr(void) { HDremove(FILENAME); } - |