diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
commit | f1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch) | |
tree | ebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /test/tattr.c | |
parent | 10343c197906415388f2a4c8d292e21d25cf7381 (diff) | |
download | hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2 |
Source formatted
Diffstat (limited to 'test/tattr.c')
-rw-r--r-- | test/tattr.c | 3760 |
1 files changed, 1885 insertions, 1875 deletions
diff --git a/test/tattr.c b/test/tattr.c index 496dd6c..7bc215d 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" #include "H5VLnative_private.h" @@ -26,44 +26,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" @@ -74,81 +74,84 @@ #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 /* Used by test_attr_info_null_info_pointer() */ #define GET_INFO_NULL_POINTER_ATTR_NAME "NullInfoPointerAttr" /* Used by test_attr_rename_invalid_name() */ -#define INVALID_RENAME_TEST_ATTR_NAME "InvalidRenameTestAttr" +#define INVALID_RENAME_TEST_ATTR_NAME "InvalidRenameTestAttr" #define INVALID_RENAME_TEST_NEW_ATTR_NAME "InvalidRenameTestNewAttr" /* Used by test_attr_get_name_invalid_buf() */ @@ -156,17 +159,16 @@ float attr_data5=-5.123F; /* Test data for 5th attribute */ /* 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. @@ -174,8 +176,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. @@ -185,21 +185,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")); @@ -273,9 +273,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); @@ -297,11 +298,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); @@ -310,16 +311,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); @@ -333,11 +335,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); @@ -346,16 +348,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); @@ -413,8 +416,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() */ /**************************************************************** ** @@ -424,15 +426,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_info2_t oinfo; /* Object info */ - int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t attr; /* Attribute ID */ + H5O_info2_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 */ + 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")); @@ -459,9 +461,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); @@ -488,10 +491,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); @@ -504,8 +508,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() */ /**************************************************************** ** @@ -516,13 +519,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")); @@ -539,40 +542,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() */ /**************************************************************** ** @@ -582,17 +584,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")); @@ -695,8 +697,7 @@ test_attr_plist(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_plist() */ - +} /* test_attr_plist() */ /**************************************************************** ** @@ -707,15 +708,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")); @@ -740,13 +741,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 */ @@ -784,8 +785,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() */ /**************************************************************** ** @@ -795,26 +795,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_info2_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_info2_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")); @@ -833,7 +833,8 @@ test_attr_compound_read(hid_t fapl) VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* 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 */ @@ -843,9 +844,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); @@ -856,11 +857,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 */ @@ -905,18 +905,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 */ @@ -934,8 +938,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() */ /**************************************************************** ** @@ -945,13 +948,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")); @@ -1000,8 +1003,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() */ /**************************************************************** ** @@ -1011,14 +1013,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_info2_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_info2_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")); @@ -1045,9 +1047,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); @@ -1071,8 +1073,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() */ /**************************************************************** ** @@ -1083,16 +1084,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")); @@ -1192,8 +1193,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() */ /**************************************************************** ** @@ -1203,25 +1203,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_info2_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_info2_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")); @@ -1240,7 +1240,8 @@ test_attr_mult_read(hid_t fapl) VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* 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 */ @@ -1250,7 +1251,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); @@ -1270,22 +1271,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 */ @@ -1293,7 +1295,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 */ @@ -1303,9 +1306,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); @@ -1325,23 +1328,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 */ @@ -1349,7 +1353,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 */ @@ -1359,11 +1364,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); @@ -1383,24 +1388,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 */ @@ -1414,8 +1421,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() */ /**************************************************************** ** @@ -1423,40 +1429,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. @@ -1465,12 +1469,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 */ - H5O_info2_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + hid_t file; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + int count; /* operator data for the iterator */ + H5O_info2_t oinfo; /* Object info */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1498,7 +1502,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 */ @@ -1516,7 +1520,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 */ @@ -1526,8 +1530,7 @@ test_attr_iterate(hid_t fapl) /* Close file */ ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_iterate() */ - +} /* test_attr_iterate() */ /**************************************************************** ** @@ -1537,13 +1540,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_info2_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_info2_t oinfo; /* Object info */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1580,28 +1583,30 @@ test_attr_delete(hid_t fapl) VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* 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); @@ -1617,14 +1622,15 @@ test_attr_delete(hid_t fapl) VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* 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); @@ -1646,8 +1652,7 @@ test_attr_delete(hid_t fapl) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_attr_delete() */ - +} /* test_attr_delete() */ /**************************************************************** ** @@ -1658,17 +1663,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_info2_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_info2_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")); @@ -1683,7 +1688,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 */ @@ -1771,7 +1776,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"); @@ -1822,8 +1826,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() */ /**************************************************************** ** @@ -1834,17 +1837,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")); @@ -1861,8 +1864,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 */ @@ -1915,8 +1917,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 */ @@ -1964,9 +1966,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); @@ -1981,9 +1984,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); @@ -2013,8 +2017,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 */ @@ -2038,9 +2041,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); @@ -2067,8 +2071,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() */ /**************************************************************** ** @@ -2079,18 +2082,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); @@ -2107,20 +2110,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); @@ -2133,12 +2138,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() */ /**************************************************************** ** @@ -2149,19 +2153,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")); @@ -2176,7 +2180,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 */ @@ -2191,7 +2195,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"); } @@ -2213,7 +2218,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); @@ -2273,8 +2278,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() */ /**************************************************************** ** @@ -2285,19 +2289,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")); @@ -2312,7 +2316,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 */ @@ -2327,7 +2331,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"); } @@ -2353,7 +2358,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); @@ -2417,8 +2422,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() */ /**************************************************************** ** @@ -2429,21 +2433,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_info2_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_info2_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")); @@ -2468,7 +2472,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 */ @@ -2483,7 +2487,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"); } @@ -2509,7 +2514,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); @@ -2545,7 +2550,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"); @@ -2555,7 +2559,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); @@ -2611,8 +2615,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() */ /**************************************************************** ** @@ -2623,23 +2626,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_info2_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_info2_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")); @@ -2664,7 +2667,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 */ @@ -2679,7 +2682,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"); } @@ -2689,9 +2693,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"); } @@ -2705,7 +2709,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); @@ -2740,13 +2744,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); @@ -2760,7 +2764,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"); @@ -2770,8 +2773,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); @@ -2803,8 +2806,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() */ /**************************************************************** ** @@ -2815,22 +2817,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_info2_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_info2_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")); @@ -2853,7 +2855,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 */ @@ -2868,7 +2870,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"); } @@ -2890,7 +2893,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); @@ -2926,7 +2929,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"); @@ -2947,8 +2949,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() */ /**************************************************************** ** @@ -2959,19 +2960,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")); @@ -2986,7 +2987,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 */ @@ -3001,15 +3002,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 */ @@ -3026,12 +3028,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 */ @@ -3052,7 +3052,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 */ @@ -3073,7 +3072,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 */ @@ -3084,7 +3082,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 */ @@ -3097,7 +3094,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"); @@ -3117,8 +3113,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() */ /**************************************************************** ** @@ -3129,23 +3124,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")); @@ -3173,7 +3168,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"); } @@ -3195,7 +3191,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); @@ -3272,10 +3268,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); @@ -3325,9 +3320,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); @@ -3342,9 +3338,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); @@ -3378,13 +3375,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 */ @@ -3396,9 +3391,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); @@ -3434,14 +3429,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"); } @@ -3450,8 +3443,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 */ @@ -3463,9 +3455,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); @@ -3501,12 +3493,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); @@ -3526,8 +3517,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 */ @@ -3539,9 +3529,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); @@ -3571,12 +3561,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); @@ -3616,9 +3605,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); @@ -3645,8 +3635,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() */ /**************************************************************** ** @@ -3657,24 +3646,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")); @@ -3689,7 +3678,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 */ @@ -3708,7 +3697,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"); } @@ -3733,14 +3723,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 */ @@ -3759,7 +3747,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 */ @@ -3778,14 +3765,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 */ @@ -3802,7 +3788,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 */ @@ -3825,7 +3810,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 */ @@ -3840,7 +3824,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 */ @@ -3855,7 +3838,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 */ @@ -3870,7 +3852,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 */ @@ -3898,7 +3879,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"); @@ -3920,8 +3900,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() */ /**************************************************************** ** @@ -3932,20 +3911,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")); @@ -3960,7 +3939,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 */ @@ -3979,7 +3958,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 */ @@ -3990,7 +3968,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"); @@ -4020,7 +3998,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 */ @@ -4031,7 +4008,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"); @@ -4047,7 +4024,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 */ @@ -4058,7 +4034,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); @@ -4067,7 +4042,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"); @@ -4097,7 +4072,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); @@ -4106,7 +4080,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"); @@ -4114,7 +4088,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"); @@ -4127,19 +4100,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() */ /**************************************************************** ** @@ -4151,11 +4121,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")); @@ -4172,7 +4142,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 */ @@ -4194,7 +4163,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 */ @@ -4205,7 +4173,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"); @@ -4230,7 +4197,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"); @@ -4240,14 +4206,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() */ /**************************************************************** ** @@ -4258,15 +4224,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")); @@ -4284,7 +4250,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); @@ -4323,7 +4289,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 */ @@ -4335,8 +4300,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); @@ -4371,12 +4336,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() */ /**************************************************************** ** @@ -4387,14 +4350,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")); @@ -4407,7 +4370,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"); } @@ -4429,7 +4393,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); @@ -4461,7 +4425,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"); @@ -4483,7 +4446,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); @@ -4496,8 +4459,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() */ /**************************************************************** ** @@ -4508,21 +4470,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")); @@ -4535,7 +4497,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"); } @@ -4561,8 +4524,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; @@ -4586,7 +4549,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); @@ -4609,7 +4572,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); @@ -4631,7 +4594,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"); @@ -4645,8 +4607,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; @@ -4674,8 +4636,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); @@ -4686,7 +4648,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); @@ -4699,8 +4661,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() */ /**************************************************************** ** @@ -4711,23 +4672,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")); @@ -4740,7 +4701,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"); } @@ -4766,8 +4728,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; @@ -4791,7 +4753,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); @@ -4863,7 +4825,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"); @@ -4877,8 +4838,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; @@ -4906,8 +4867,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); @@ -4918,7 +4879,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); @@ -4931,8 +4892,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() */ /**************************************************************** ** @@ -4944,13 +4904,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")); @@ -4998,7 +4958,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"); @@ -5039,8 +4998,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() */ /**************************************************************** ** @@ -5051,23 +5009,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")); @@ -5080,7 +5038,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"); } @@ -5097,10 +5056,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"); @@ -5110,8 +5069,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; @@ -5151,7 +5110,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"); @@ -5165,8 +5123,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; @@ -5184,7 +5142,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); @@ -5236,7 +5194,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"); @@ -5271,7 +5229,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); @@ -5313,7 +5271,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"); @@ -5327,8 +5284,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; @@ -5360,7 +5317,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"); @@ -5395,7 +5352,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); @@ -5425,7 +5382,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"); @@ -5450,8 +5407,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() */ /**************************************************************** ** @@ -5462,28 +5418,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")); @@ -5496,7 +5452,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"); } @@ -5509,7 +5466,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 @@ -5528,10 +5484,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"); @@ -5545,8 +5500,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; @@ -5570,7 +5525,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); @@ -5609,7 +5564,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); @@ -5623,7 +5578,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"); @@ -5647,7 +5602,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); @@ -5656,8 +5611,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 @@ -5677,13 +5631,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(); @@ -5702,20 +5655,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"); @@ -5727,13 +5681,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); @@ -5748,12 +5702,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); @@ -5768,17 +5722,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); @@ -5793,19 +5746,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. @@ -5815,26 +5768,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); @@ -5844,7 +5797,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"); } @@ -5854,9 +5808,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")) @@ -5866,8 +5820,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 */ @@ -5880,8 +5835,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; @@ -5905,13 +5860,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); @@ -5940,15 +5897,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); @@ -5980,21 +5940,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 */ @@ -6018,8 +5981,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() */ /*************************************************************** ** @@ -6048,21 +6010,24 @@ test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl) attr = H5Acreate2(fid, GET_INFO_NULL_POINTER_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - H5E_BEGIN_TRY { - err_ret = H5Aget_info(attr, NULL); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Aget_info(attr, NULL); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Aget_info"); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { err_ret = H5Aget_info_by_name(fid, ".", GET_INFO_NULL_POINTER_ATTR_NAME, NULL, H5P_DEFAULT); - } H5E_END_TRY; + } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Aget_info_by_name"); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { err_ret = H5Aget_info_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, H5P_DEFAULT); - } H5E_END_TRY; + } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Aget_info_by_idx"); @@ -6079,7 +6044,6 @@ test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl) CHECK(err_ret, FAIL, "H5Fclose"); } - /*************************************************************** ** ** test_attr_rename_invalid_name(): A test to ensure that @@ -6107,51 +6071,49 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) attr = H5Acreate2(fid, INVALID_RENAME_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - H5E_BEGIN_TRY { - err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { - err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { - err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { - err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, ""); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, ""); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename"); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { err_ret = H5Arename_by_name(fid, ".", NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME, H5P_DEFAULT); - } H5E_END_TRY; + } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename_by_name"); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { err_ret = H5Arename_by_name(fid, ".", "", INVALID_RENAME_TEST_NEW_ATTR_NAME, H5P_DEFAULT); - } H5E_END_TRY; + } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename_by_name"); - H5E_BEGIN_TRY { - err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename_by_name"); - H5E_BEGIN_TRY { - err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT); } + H5E_END_TRY; CHECK(err_ret, SUCCEED, "H5Arename_by_name"); @@ -6168,7 +6130,6 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) CHECK(err_ret, FAIL, "H5Fclose"); } - /*************************************************************** ** ** test_attr_get_name_invalid_buf(): A test to ensure that @@ -6194,18 +6155,20 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create attribute */ - attr = H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + attr = + H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); - H5E_BEGIN_TRY { - err_ret = H5Aget_name(attr, 1, NULL); - } H5E_END_TRY; + H5E_BEGIN_TRY { err_ret = H5Aget_name(attr, 1, NULL); } + H5E_END_TRY; VERIFY(err_ret, FAIL, "H5Aget_name"); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { err_ret = H5Aget_name_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 1, H5P_DEFAULT); - } H5E_END_TRY; + } + H5E_END_TRY; VERIFY(err_ret, FAIL, "H5Aget_name_by_idx"); @@ -6222,7 +6185,6 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) CHECK(err_ret, FAIL, "H5Fclose"); } - /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -6232,28 +6194,28 @@ test_attr_get_name_invalid_buf(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); @@ -6263,7 +6225,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"); } @@ -6273,48 +6236,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 */ @@ -6327,8 +6299,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; @@ -6356,10 +6328,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 */ @@ -6390,8 +6363,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; @@ -6409,27 +6382,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))); @@ -6447,8 +6422,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; @@ -6466,10 +6441,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 */ @@ -6481,7 +6457,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 */ @@ -6500,11 +6476,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 */ @@ -6515,8 +6491,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; @@ -6534,27 +6510,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))); @@ -6575,13 +6553,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; @@ -6599,10 +6575,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 */ @@ -6614,7 +6591,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 */ @@ -6623,11 +6600,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; @@ -6645,38 +6622,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; @@ -6694,27 +6674,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))); @@ -6747,8 +6730,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); @@ -6757,8 +6740,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() */ /**************************************************************** ** @@ -6766,63 +6748,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 @@ -6835,11 +6816,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 * @@ -6856,12 +6836,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 * @@ -6876,263 +6855,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"); @@ -7140,10 +7107,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; @@ -7151,17 +7117,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. @@ -7171,30 +7136,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); @@ -7204,7 +7169,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"); } @@ -7215,53 +7181,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 */ @@ -7274,21 +7249,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: @@ -7305,17 +7280,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 */ @@ -7346,11 +7324,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 */ @@ -7358,23 +7338,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: @@ -7382,10 +7361,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 */ @@ -7397,7 +7377,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 */ @@ -7416,11 +7396,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 */ @@ -7431,11 +7411,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 */ @@ -7455,8 +7437,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); @@ -7468,8 +7450,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 @@ -7485,20 +7466,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"); @@ -7508,10 +7488,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 { @@ -7524,13 +7504,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. @@ -7540,27 +7519,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); @@ -7570,7 +7549,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"); } @@ -7580,48 +7560,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 */ @@ -7634,8 +7623,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; @@ -7659,14 +7648,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 */ @@ -7692,7 +7683,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 */ @@ -7700,10 +7692,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; @@ -7721,10 +7712,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 */ @@ -7736,7 +7728,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 */ @@ -7755,17 +7747,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 */ @@ -7785,8 +7778,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); @@ -7795,8 +7788,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 @@ -7812,21 +7804,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); @@ -7843,7 +7834,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"); @@ -7859,7 +7849,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"); @@ -7877,13 +7866,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. @@ -7893,26 +7881,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); @@ -7922,7 +7910,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"); } @@ -7932,9 +7921,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")) @@ -7944,8 +7933,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 */ @@ -7958,21 +7948,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: @@ -7996,7 +7986,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); @@ -8039,23 +8029,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: @@ -8063,7 +8052,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); @@ -8078,7 +8067,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 */ @@ -8097,11 +8086,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 */ @@ -8141,8 +8130,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() */ /**************************************************************** ** @@ -8153,25 +8141,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); @@ -8181,7 +8169,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"); } @@ -8191,9 +8180,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")) @@ -8203,8 +8192,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 */ @@ -8217,21 +8207,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: @@ -8245,10 +8235,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 */ @@ -8278,23 +8269,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: @@ -8302,10 +8292,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 */ @@ -8317,7 +8308,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 */ @@ -8336,11 +8327,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 */ @@ -8370,7 +8361,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() */ /**************************************************************** ** @@ -8381,28 +8372,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")); @@ -8421,7 +8412,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"); @@ -8431,7 +8422,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"); @@ -8469,16 +8460,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 */ @@ -8487,7 +8477,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"); } @@ -8499,7 +8490,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"); @@ -8526,12 +8517,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"); @@ -8542,7 +8533,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 { @@ -8561,7 +8552,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 */ @@ -8576,14 +8567,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"); @@ -8594,7 +8584,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 { @@ -8613,7 +8603,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 */ @@ -8628,7 +8618,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"); @@ -8645,8 +8635,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"); @@ -8666,7 +8656,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 */ @@ -8676,7 +8666,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"); @@ -8705,7 +8695,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_write() */ +} /* test_attr_shared_write() */ /**************************************************************** ** @@ -8716,29 +8706,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")); @@ -8757,7 +8747,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"); @@ -8767,7 +8757,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"); @@ -8805,16 +8795,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 */ @@ -8823,7 +8812,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"); } @@ -8835,7 +8825,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"); @@ -8862,12 +8852,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"); @@ -8878,7 +8868,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 { @@ -8897,7 +8887,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 */ @@ -8912,14 +8902,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"); @@ -8930,7 +8919,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 { @@ -8949,7 +8938,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 */ @@ -8964,12 +8953,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); @@ -8977,14 +8965,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"); @@ -9008,7 +8995,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"); @@ -9028,19 +9015,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"); @@ -9064,7 +9049,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"); @@ -9085,7 +9070,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"); @@ -9097,8 +9081,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"); @@ -9118,7 +9102,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 */ @@ -9128,7 +9112,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"); @@ -9157,7 +9141,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_rename() */ +} /* test_attr_shared_rename() */ /**************************************************************** ** @@ -9168,28 +9152,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")); @@ -9208,7 +9192,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"); @@ -9218,7 +9202,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"); @@ -9256,16 +9240,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 */ @@ -9274,7 +9257,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"); } @@ -9286,7 +9270,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"); @@ -9313,12 +9297,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"); @@ -9329,7 +9313,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 { @@ -9348,7 +9332,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 */ @@ -9363,14 +9347,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"); @@ -9381,7 +9364,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 { @@ -9400,7 +9383,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 */ @@ -9415,15 +9398,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); @@ -9431,14 +9413,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"); @@ -9459,7 +9440,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"); @@ -9471,8 +9451,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"); @@ -9492,7 +9472,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 */ @@ -9502,7 +9482,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"); @@ -9531,7 +9511,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_delete() */ +} /* test_attr_shared_delete() */ /**************************************************************** ** @@ -9542,28 +9522,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")); @@ -9582,7 +9562,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"); @@ -9592,7 +9572,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"); @@ -9630,16 +9610,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 */ @@ -9648,7 +9627,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"); } @@ -9660,7 +9640,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"); @@ -9687,12 +9667,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"); @@ -9703,7 +9683,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 { @@ -9722,7 +9702,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 */ @@ -9737,14 +9717,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"); @@ -9755,7 +9734,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 { @@ -9774,7 +9753,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 */ @@ -9789,13 +9768,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"); @@ -9808,13 +9786,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); @@ -9822,7 +9799,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"); @@ -9852,7 +9829,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 */ @@ -9862,7 +9839,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"); @@ -9891,7 +9868,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Release memory */ HDfree(big_value); -} /* test_attr_shared_unlink() */ +} /* test_attr_shared_unlink() */ /**************************************************************** ** @@ -9907,11 +9884,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")); @@ -9933,7 +9910,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"); @@ -9962,7 +9938,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"); @@ -9995,7 +9970,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"); @@ -10032,11 +10006,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() */ /**************************************************************** ** @@ -10052,17 +10025,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")); @@ -10075,7 +10048,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 */ @@ -10090,7 +10063,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"); @@ -10100,7 +10073,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"); @@ -10167,7 +10140,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"); @@ -10177,7 +10150,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"); @@ -10195,7 +10168,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) ret = H5Pclose(gcpl); CHECK(ret, FAIL, "H5Pclose"); -} /* test_attr_bug2() */ +} /* test_attr_bug2() */ /**************************************************************** ** @@ -10208,17 +10181,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")); @@ -10266,11 +10238,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 */ @@ -10332,7 +10304,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() */ /**************************************************************** ** @@ -10346,14 +10318,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")); @@ -10414,7 +10386,7 @@ test_attr_bug4(hid_t fcpl, hid_t fapl) ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_bug4() */ +} /* test_attr_bug4() */ /**************************************************************** ** @@ -10426,16 +10398,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")); @@ -10571,7 +10541,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() */ /**************************************************************** ** @@ -10582,13 +10552,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")); @@ -10631,7 +10601,7 @@ test_attr_bug6(hid_t fcpl, hid_t fapl) ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); -} /* test_attr_bug6() */ +} /* test_attr_bug6() */ /**************************************************************** ** @@ -10646,19 +10616,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. */ @@ -10694,8 +10663,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 @@ -10721,12 +10691,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 @@ -10754,16 +10726,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 @@ -10791,8 +10766,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 @@ -10818,12 +10794,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); @@ -10832,7 +10810,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() */ /**************************************************************** ** @@ -10851,22 +10829,21 @@ 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 */ + 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_info2_t oinfo; /* Object info */ - H5A_info_t ainfo; /* Attribute info */ - haddr_t root_addr; /* Root group address */ - haddr_t link_addr; /* Link (to root group) address */ - herr_t ret; /* Generic return status */ + H5A_info_t ainfo; /* Attribute info */ + haddr_t root_addr; /* Root group address */ + haddr_t link_addr; /* Link (to 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. */ @@ -10906,8 +10883,9 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Oget_info"); ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); CHECK(ret, FAIL, "H5VLnative_token_to_addr"); - if(link_addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr); + if (link_addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", + (long long unsigned)link_addr, (long long unsigned)root_addr); /* Close file */ ret = H5Fclose(fid); @@ -10953,12 +10931,14 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Oget_info"); ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); CHECK(ret, FAIL, "H5VLnative_token_to_addr"); - if(link_addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr); + if (link_addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", + (long long unsigned)link_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); @@ -10969,7 +10949,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() */ /**************************************************************** ** @@ -10990,17 +10970,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")); @@ -11014,7 +10994,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"); @@ -11032,7 +11012,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); @@ -11044,7 +11024,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); @@ -11052,7 +11032,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); @@ -11065,7 +11045,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() */ /**************************************************************** ** @@ -11078,14 +11058,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")); @@ -11111,8 +11091,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 */ @@ -11148,10 +11128,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() */ /**************************************************************** ** @@ -11161,13 +11141,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")); @@ -11192,11 +11172,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"); @@ -11205,123 +11186,154 @@ 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_info_null_info_pointer(my_fcpl, my_fapl); /* Test passing a NULL attribute info pointer to H5Aget_info(_by_name/_by_idx) */ - test_attr_rename_invalid_name(my_fcpl, my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */ - test_attr_get_name_invalid_buf(my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */ + 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_info_null_info_pointer(my_fcpl, + my_fapl); /* Test passing a NULL attribute info pointer to + H5Aget_info(_by_name/_by_idx) */ + test_attr_rename_invalid_name( + my_fcpl, + my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */ + test_attr_get_name_invalid_buf( + my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */ /* 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); @@ -11342,8 +11354,7 @@ test_attr(void) CHECK(ret, FAIL, "H5Pclose"); ret = H5Pclose(fapl2); CHECK(ret, FAIL, "H5Pclose"); -} /* test_attr() */ - +} /* test_attr() */ /*------------------------------------------------------------------------- * Function: cleanup_attr @@ -11364,4 +11375,3 @@ cleanup_attr(void) { HDremove(FILENAME); } - |