summaryrefslogtreecommitdiffstats
path: root/test/tattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/tattr.c')
-rw-r--r--test/tattr.c4196
1 files changed, 2134 insertions, 2062 deletions
diff --git a/test/tattr.c b/test/tattr.c
index 7c2b5ce..2859f4c 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -6,63 +6,64 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tattr
-*
-* Test the attribute functionality
-*
-*************************************************************/
+ *
+ * Test program: tattr
+ *
+ * Test the attribute functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
+#include "H5VLnative_private.h"
/*
* This file needs to access private information from the H5O package.
* This file also needs to access the object header testing code.
*/
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object headers */
+#include "H5Opkg.h" /* Object headers */
/*
* This file needs to access private information from the H5A package.
* This file also needs to access the attribute testing code.
*/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
#define H5A_TESTING
-#include "H5Apkg.h" /* Attributes */
+#include "H5Apkg.h" /* Attributes */
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
-#define FILENAME "tattr.h5"
-#define NAME_BUF_SIZE 1024
-#define ATTR_NAME_LEN 16
-#define ATTR_MAX_DIMS 7
-#define ATTR_TMP_NAME "a really long temp_name"
-#define CORDER_ITER_STOP 3
+#define FILENAME "tattr.h5"
+#define NAME_BUF_SIZE 1024
+#define ATTR_NAME_LEN 16
+#define ATTR_MAX_DIMS 7
+#define ATTR_TMP_NAME "a really long temp_name"
+#define CORDER_ITER_STOP 3
/* 3-D dataset with fixed dimensions */
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* Dataset Information */
#define DSET1_NAME "Dataset1"
#define DSET2_NAME "Dataset2"
#define DSET3_NAME "Dataset3"
-#define NUM_DSETS 3
+#define NUM_DSETS 3
/* Group Information */
#define GROUP1_NAME "/Group1"
@@ -73,81 +74,83 @@
#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.3, -26.1}, {0.123, -10.0}}, {{973.23, -0.91827}, {2.0, 23.0}}}; /* 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.1, 'd'}, {-100000, 0.123, '3'}},
+ {{-23, 981724.2, 'Q'}, {0, 2.0, '\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() */
@@ -155,17 +158,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.
@@ -173,8 +175,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.
@@ -184,21 +184,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"));
@@ -272,9 +272,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);
@@ -296,11 +297,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);
@@ -309,16 +310,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);
@@ -332,11 +334,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);
@@ -345,16 +347,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);
@@ -412,8 +415,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() */
/****************************************************************
**
@@ -423,15 +425,15 @@ test_attr_basic_write(hid_t fapl)
static void
test_attr_basic_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t attr; /* Attribute ID */
- H5O_info_t oinfo; /* Object info */
- int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
+ 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"));
@@ -445,9 +447,9 @@ test_attr_basic_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 2, "H5Oget_info3");
/* Open first attribute for the dataset */
attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
@@ -458,9 +460,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);
@@ -474,9 +477,9 @@ test_attr_basic_read(hid_t fapl)
CHECK(group, FAIL, "H5Gopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(group, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(group, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open the attribute for the group */
attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT);
@@ -487,10 +490,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);
@@ -503,8 +507,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() */
/****************************************************************
**
@@ -515,13 +518,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.14159; /* 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"));
@@ -538,40 +541,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, H5_DOUBLE(0.0)))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
+ if (!H5_DBL_ABS_EQUAL(rdata, 0.0))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0);
- 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, H5_DOUBLE(0.0)))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
+ if (!H5_DBL_ABS_EQUAL(rdata, 0.0))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0);
- 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() */
/****************************************************************
**
@@ -581,17 +583,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"));
@@ -694,8 +696,7 @@ test_attr_plist(hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_plist() */
-
+} /* test_attr_plist() */
/****************************************************************
**
@@ -706,15 +707,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"));
@@ -739,13 +740,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 */
@@ -783,8 +784,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() */
/****************************************************************
**
@@ -794,26 +794,26 @@ test_attr_compound_write(hid_t fapl)
static void
test_attr_compound_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t space; /* Attribute dataspace */
- hid_t type; /* Attribute datatype */
- hid_t attr; /* Attribute ID */
- char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- int rank; /* Attribute rank */
- hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
- H5T_class_t t_class; /* Attribute datatype class */
- H5T_order_t order; /* Attribute datatype order */
- size_t size; /* Attribute datatype size as stored in file */
- int fields; /* # of Attribute datatype fields */
- char *fieldname; /* Name of a field */
- size_t offset; /* Attribute datatype field offset */
- hid_t field; /* Attribute field datatype */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t space; /* Attribute dataspace */
+ hid_t type; /* Attribute datatype */
+ hid_t attr; /* Attribute ID */
+ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
+ int rank; /* Attribute rank */
+ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
+ H5T_class_t t_class; /* Attribute datatype class */
+ H5T_order_t order; /* Attribute datatype order */
+ size_t size; /* Attribute datatype size as stored in file */
+ int fields; /* # of Attribute datatype fields */
+ char * fieldname; /* Name of a field */
+ size_t offset; /* Attribute datatype field offset */
+ hid_t field; /* Attribute field datatype */
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */
- ssize_t name_len; /* Length of attribute name */
- H5O_info_t oinfo; /* Object info */
- int i, j; /* Local index variables */
- herr_t ret; /* Generic return value */
+ ssize_t name_len; /* Length of attribute name */
+ H5O_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"));
@@ -827,12 +827,13 @@ test_attr_compound_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ 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 */
@@ -842,9 +843,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);
@@ -855,11 +856,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) != 0 || HDstrcmp(fieldname, ATTR4_FIELDNAME2) != 0 ||
+ HDstrcmp(fieldname, ATTR4_FIELDNAME3) != 0))
TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname);
H5free_memory(fieldname);
} /* end for */
@@ -904,18 +904,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)) != 0) {
+ 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) != 0)
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR4_NAME);
/* Close attribute datatype */
@@ -933,8 +937,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() */
/****************************************************************
**
@@ -944,13 +947,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"));
@@ -999,8 +1002,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() */
/****************************************************************
**
@@ -1010,14 +1012,14 @@ test_attr_scalar_write(hid_t fapl)
static void
test_attr_scalar_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- H5S_class_t stype; /* Dataspace class */
- float rdata = 0.0F; /* Buffer for reading 1st attribute */
- H5O_info_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ H5S_class_t stype; /* Dataspace class */
+ float rdata = 0.0F; /* Buffer for reading 1st attribute */
+ H5O_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"));
@@ -1031,9 +1033,9 @@ test_attr_scalar_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open an attribute for the dataset */
attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT);
@@ -1044,9 +1046,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);
@@ -1070,8 +1072,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() */
/****************************************************************
**
@@ -1082,16 +1083,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"));
@@ -1191,8 +1192,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() */
/****************************************************************
**
@@ -1202,25 +1202,25 @@ test_attr_mult_write(hid_t fapl)
static void
test_attr_mult_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t space; /* Attribute dataspace */
- hid_t type; /* Attribute datatype */
- hid_t attr; /* Attribute ID */
- char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */
- int rank; /* Attribute rank */
- hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
- H5T_class_t t_class; /* Attribute datatype class */
- H5T_order_t order; /* Attribute datatype order */
- size_t size; /* Attribute datatype size as stored in file */
- int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
- int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t space; /* Attribute dataspace */
+ hid_t type; /* Attribute datatype */
+ hid_t attr; /* Attribute ID */
+ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
+ char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */
+ int rank; /* Attribute rank */
+ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
+ H5T_class_t t_class; /* Attribute datatype class */
+ H5T_order_t order; /* Attribute datatype order */
+ size_t size; /* Attribute datatype size as stored in file */
+ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */
- ssize_t name_len; /* Length of attribute name */
- H5O_info_t oinfo; /* Object info */
- int i, j, k; /* Local index values */
- herr_t ret; /* Generic return value */
+ ssize_t name_len; /* Length of attribute name */
+ H5O_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"));
@@ -1234,12 +1234,13 @@ test_attr_mult_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ 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 */
@@ -1249,7 +1250,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);
@@ -1269,22 +1270,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) != 0)
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) != 0)
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name);
/* Close attribute */
@@ -1292,7 +1294,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 */
@@ -1302,9 +1305,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);
@@ -1324,23 +1327,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) != 0)
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) != 0)
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name);
/* Close attribute */
@@ -1348,7 +1352,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 */
@@ -1358,11 +1363,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);
@@ -1382,24 +1387,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) != 0)
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) != 0)
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name);
/* Close attribute */
@@ -1413,8 +1420,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() */
/****************************************************************
**
@@ -1422,40 +1428,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) != 0)
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) != 0)
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) != 0)
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.
@@ -1464,12 +1468,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_info_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"));
@@ -1491,13 +1495,13 @@ test_attr_iterate(hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 0, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 0, "H5Oget_info3");
/* 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 */
@@ -1509,13 +1513,13 @@ test_attr_iterate(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* 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 */
@@ -1525,8 +1529,7 @@ test_attr_iterate(hid_t fapl)
/* Close file */
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_iterate() */
-
+} /* test_attr_iterate() */
/****************************************************************
**
@@ -1536,13 +1539,13 @@ test_attr_iterate(hid_t fapl)
static void
test_attr_delete(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t attr; /* Attribute ID */
- char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- ssize_t name_len; /* Length of attribute name */
- H5O_info_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t attr; /* Attribute ID */
+ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
+ ssize_t name_len; /* Length of attribute name */
+ H5O_info2_t oinfo; /* Object info */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1556,51 +1559,53 @@ test_attr_delete(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Try to delete bogus attribute */
ret = H5Adelete(dataset, "Bogus");
VERIFY(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Delete middle (2nd) attribute */
ret = H5Adelete(dataset, ATTR2_NAME);
CHECK(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ 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) != 0)
+ 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) != 0)
+ TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME);
/* Close attribute */
ret = H5Aclose(attr);
@@ -1611,19 +1616,20 @@ test_attr_delete(hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ 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) != 0)
+ TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME);
/* Close attribute */
ret = H5Aclose(attr);
@@ -1634,9 +1640,9 @@ test_attr_delete(hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 0, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 0, "H5Oget_info3");
/* Close dataset */
ret = H5Dclose(dataset);
@@ -1645,8 +1651,7 @@ test_attr_delete(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_delete() */
-
+} /* test_attr_delete() */
/****************************************************************
**
@@ -1657,17 +1662,17 @@ test_attr_delete(hid_t fapl)
static void
test_attr_dtype_shared(hid_t fapl)
{
- hid_t file_id; /* File ID */
- hid_t dset_id; /* Dataset ID */
- hid_t space_id; /* Dataspace ID for dataset & attribute */
- hid_t type_id; /* Datatype ID for named datatype */
- hid_t attr_id; /* Attribute ID */
- int data = 8; /* Data to write */
- int rdata = 0; /* Read read in */
- H5O_info_t oinfo; /* Object's information */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t file_id; /* File ID */
+ hid_t dset_id; /* Dataset ID */
+ hid_t space_id; /* Dataspace ID for dataset & attribute */
+ hid_t type_id; /* Datatype ID for named datatype */
+ hid_t attr_id; /* Attribute ID */
+ int data = 8; /* Data to write */
+ int rdata = 0; /* Read read in */
+ H5O_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"));
@@ -1682,7 +1687,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 */
@@ -1698,9 +1703,9 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(ret, FAIL, "H5Tcommit2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
/* Create dataspace for dataset */
space_id = H5Screate(H5S_SCALAR);
@@ -1711,18 +1716,18 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
/* Create attribute on dataset */
attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
/* Close attribute */
ret = H5Aclose(attr_id);
@@ -1733,18 +1738,18 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
/* Create attribute on dataset */
attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
/* Write data into the attribute */
ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data);
@@ -1770,7 +1775,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");
@@ -1797,18 +1801,18 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
/* Unlink the dataset */
ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
/* Unlink the named datatype */
ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT);
@@ -1821,8 +1825,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() */
/****************************************************************
**
@@ -1833,17 +1836,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"));
@@ -1860,8 +1863,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 */
@@ -1914,8 +1916,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 */
@@ -1963,9 +1965,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);
@@ -1980,9 +1983,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);
@@ -2012,8 +2016,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 */
@@ -2037,9 +2040,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);
@@ -2066,8 +2070,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() */
/****************************************************************
**
@@ -2078,20 +2081,20 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Aopen(loc_id, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
@@ -2106,20 +2109,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);
+ HDsnprintf(attrname, sizeof(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) != 0)
+ 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);
@@ -2132,12 +2137,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() */
/****************************************************************
**
@@ -2148,19 +2152,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"));
@@ -2175,7 +2179,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 */
@@ -2190,7 +2194,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");
}
@@ -2212,9 +2217,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2233,7 +2238,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Add one more attribute, to push into "dense" storage */
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2269,11 +2274,12 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_create() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_dense_create() */
/****************************************************************
**
@@ -2284,19 +2290,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"));
@@ -2311,7 +2317,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 */
@@ -2326,7 +2332,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");
}
@@ -2352,9 +2359,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2377,7 +2384,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
/* Add one more attribute, to push into "dense" storage */
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2413,11 +2420,12 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_open() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_dense_open() */
/****************************************************************
**
@@ -2428,21 +2436,25 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info_t oinfo; /* Object info */
- int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ H5O_info2_t oinfo; /* Object info */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
+ herr_t ret; /* Generic return value */
+
+ /* Only run this test for sec2/default driver */
+ if (!h5_using_default_driver(NULL))
+ return;
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n"));
@@ -2467,7 +2479,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 */
@@ -2482,7 +2494,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");
}
@@ -2508,9 +2521,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2523,9 +2536,9 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2544,7 +2557,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");
@@ -2554,9 +2566,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -2570,7 +2582,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
/* Delete one more attribute, which should cause reversion to compact storage */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -2583,7 +2595,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "test_attr_dense_verify");
/* Delete another attribute, to verify deletion in compact storage */
- HDsprintf(attrname, "attr %02u", (u - 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (u - 1));
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -2607,11 +2619,12 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_delete() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_dense_delete() */
/****************************************************************
**
@@ -2622,23 +2635,27 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_rename(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info_t oinfo; /* Object info */
- unsigned u; /* Local index variable */
- int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
- unsigned use_corder; /* Track creation order or not */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ H5O_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 */
+
+ /* Only run this test for sec2/default driver */
+ if (!h5_using_default_driver(NULL))
+ return;
/* Output message about test being performed */
MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n"));
@@ -2663,7 +2680,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 */
@@ -2678,7 +2695,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");
}
@@ -2688,9 +2706,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");
}
@@ -2704,9 +2722,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
@@ -2726,9 +2744,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Arename_by_name");
/* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2739,13 +2757,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);
@@ -2759,7 +2777,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");
@@ -2769,11 +2786,11 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "new attr %02u", u);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Aopen");
@@ -2799,11 +2816,12 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_rename() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_dense_rename() */
/****************************************************************
**
@@ -2814,22 +2832,26 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- size_t mesg_count; /* # of shared messages */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info_t oinfo; /* Object info */
- unsigned u; /* Local index variable */
- int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ size_t mesg_count; /* # of shared messages */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ H5O_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 */
+
+ /* Only run this test for sec2/default driver */
+ if (!h5_using_default_driver(NULL))
+ return;
/* Output message about test being performed */
MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n"));
@@ -2852,7 +2874,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 */
@@ -2867,7 +2889,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");
}
@@ -2889,9 +2912,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2904,9 +2927,9 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2925,7 +2948,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");
@@ -2943,11 +2965,12 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_unlink() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_dense_unlink() */
/****************************************************************
**
@@ -2958,19 +2981,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"));
@@ -2985,7 +3008,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 */
@@ -3000,15 +3023,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 */
@@ -3025,17 +3049,15 @@ 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 */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3051,12 +3073,11 @@ 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 */
u = 1;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3072,7 +3093,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 */
@@ -3083,12 +3103,11 @@ 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 */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3096,7 +3115,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");
@@ -3113,11 +3131,12 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_limits() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_dense_limits() */
/****************************************************************
**
@@ -3128,23 +3147,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"));
@@ -3172,7 +3191,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");
}
@@ -3194,9 +3214,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3219,7 +3239,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3271,10 +3291,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);
@@ -3324,9 +3343,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);
@@ -3341,9 +3361,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);
@@ -3377,13 +3398,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 */
@@ -3395,9 +3414,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);
@@ -3433,14 +3452,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");
}
@@ -3449,8 +3466,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 */
@@ -3462,9 +3478,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);
@@ -3500,14 +3516,13 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
add_attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(add_attr, FAIL, "H5Acreate2");
@@ -3525,8 +3540,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 */
@@ -3538,9 +3552,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);
@@ -3570,14 +3584,13 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(gid1, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3615,9 +3628,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);
@@ -3644,8 +3658,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() */
/****************************************************************
**
@@ -3656,24 +3669,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"));
@@ -3688,7 +3701,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 */
@@ -3707,7 +3720,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");
}
@@ -3732,19 +3746,17 @@ 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 */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3758,12 +3770,11 @@ 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 */
u = 1;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3777,14 +3788,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);
+ HDsnprintf(attrname, sizeof(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 */
@@ -3801,12 +3811,11 @@ 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 */
u = 3;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3824,12 +3833,11 @@ 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 */
u = 1;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3839,12 +3847,11 @@ 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 */
u = 3;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3854,12 +3861,11 @@ 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 */
u = 2;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3869,12 +3875,11 @@ 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 */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3897,7 +3902,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");
@@ -3916,11 +3920,12 @@ test_attr_big(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_big() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_big() */
/****************************************************************
**
@@ -3931,20 +3936,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"));
@@ -3959,7 +3964,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 */
@@ -3978,7 +3983,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 */
@@ -3989,7 +3993,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");
@@ -4019,7 +4023,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 */
@@ -4030,7 +4033,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");
@@ -4046,7 +4049,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 */
@@ -4057,7 +4059,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);
@@ -4066,7 +4067,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");
@@ -4096,7 +4097,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);
@@ -4105,7 +4105,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");
@@ -4113,7 +4113,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");
@@ -4126,19 +4125,18 @@ 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() */
-
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
+} /* test_attr_null_space() */
/****************************************************************
**
@@ -4150,11 +4148,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"));
@@ -4171,7 +4169,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 */
@@ -4193,7 +4190,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 */
@@ -4204,7 +4200,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");
@@ -4229,7 +4224,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");
@@ -4239,14 +4233,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;
+ (void)fcpl;
+ (void)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() */
/****************************************************************
**
@@ -4257,15 +4251,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"));
@@ -4283,8 +4277,8 @@ 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++) {
- HDsprintf(attrname, "a-%06u", u);
+ for (u = 0; u < nattr; u++) {
+ HDsnprintf(attrname, sizeof(attrname), "a-%06u", u);
exists = H5Aexists(gid, attrname);
VERIFY(exists, FALSE, "H5Aexists");
@@ -4322,7 +4316,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 */
@@ -4334,10 +4327,10 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "a-%06u", u);
exists = H5Aexists(gid, attrname);
VERIFY(exists, TRUE, "H5Aexists");
@@ -4370,12 +4363,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() */
/****************************************************************
**
@@ -4386,14 +4377,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"));
@@ -4406,7 +4397,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");
}
@@ -4428,7 +4420,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);
@@ -4460,7 +4452,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");
@@ -4482,7 +4473,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);
@@ -4495,8 +4486,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() */
/****************************************************************
**
@@ -4507,21 +4497,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"));
@@ -4534,7 +4524,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");
}
@@ -4560,8 +4551,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;
@@ -4585,9 +4576,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -4608,7 +4599,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);
@@ -4630,7 +4621,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");
@@ -4644,8 +4634,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;
@@ -4673,11 +4663,11 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
@@ -4685,7 +4675,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);
@@ -4698,8 +4688,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() */
/****************************************************************
**
@@ -4710,23 +4699,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"));
@@ -4739,7 +4728,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");
}
@@ -4765,8 +4755,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;
@@ -4790,9 +4780,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -4815,7 +4805,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
} /* end for */
/* Create another attribute, to push into dense storage */
- HDsprintf(attrname, "attr %02u", max_compact);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", max_compact);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -4862,7 +4852,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");
@@ -4876,8 +4865,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;
@@ -4905,11 +4894,11 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
@@ -4917,7 +4906,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);
@@ -4930,8 +4919,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() */
/****************************************************************
**
@@ -4943,13 +4931,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"));
@@ -4997,7 +4985,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");
@@ -5038,8 +5025,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() */
/****************************************************************
**
@@ -5050,23 +5036,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"));
@@ -5079,7 +5065,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");
}
@@ -5096,10 +5083,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");
@@ -5109,8 +5096,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;
@@ -5150,7 +5137,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");
@@ -5164,8 +5150,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;
@@ -5183,9 +5169,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5208,7 +5194,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end for */
/* Create another attribute, to push into dense storage */
- HDsprintf(attrname, "attr %02u", max_compact);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", max_compact);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5235,8 +5221,8 @@ 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--) {
- HDsprintf(attrname, "attr %02u", u);
+ for (u = max_compact; u >= min_dense; u--) {
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5256,7 +5242,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end for */
/* Delete another attribute, to push attribute storage into compact form */
- HDsprintf(attrname, "attr %02u", (min_dense - 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (min_dense - 1));
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5270,9 +5256,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5312,7 +5298,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");
@@ -5326,8 +5311,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;
@@ -5359,8 +5344,8 @@ 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--) {
- HDsprintf(attrname, "attr %02u", u);
+ for (u = max_compact; u >= min_dense; u--) {
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5380,7 +5365,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end for */
/* Delete another attribute, to push attribute storage into compact form */
- HDsprintf(attrname, "attr %02u", (min_dense - 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (min_dense - 1));
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5394,9 +5379,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5424,12 +5409,12 @@ 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--) {
- HDsprintf(attrname, "attr %02u", u);
+ for (u = max_compact; u > 0; u--) {
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
} /* end for */
- HDsprintf(attrname, "attr %02u", 0);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", 0);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
} /* end for */
@@ -5449,8 +5434,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() */
/****************************************************************
**
@@ -5461,28 +5445,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"));
@@ -5495,7 +5479,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");
}
@@ -5508,7 +5493,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
@@ -5527,10 +5511,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");
@@ -5544,8 +5527,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;
@@ -5569,9 +5552,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5608,7 +5591,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);
@@ -5622,7 +5605,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");
@@ -5646,7 +5629,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);
@@ -5655,8 +5638,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
@@ -5676,13 +5658,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();
@@ -5701,20 +5682,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) != 0)
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");
@@ -5726,13 +5708,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) != 0)
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);
@@ -5747,12 +5729,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) != 0)
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);
@@ -5767,17 +5749,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) != 0)
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);
@@ -5792,19 +5773,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) != 0)
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.
@@ -5814,26 +5795,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);
@@ -5843,7 +5824,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");
}
@@ -5853,9 +5835,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"))
@@ -5865,8 +5847,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 */
@@ -5879,8 +5862,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;
@@ -5903,16 +5886,18 @@ 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, 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);
+ /* Check for query on non-existent attribute */
+ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5939,17 +5924,20 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5979,21 +5967,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 */
@@ -6017,8 +6008,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() */
/***************************************************************
**
@@ -6047,21 +6037,27 @@ 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 {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Aget_info(attr, NULL);
- } H5E_END_TRY;
+ }
+ 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");
@@ -6078,7 +6074,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
@@ -6106,51 +6101,67 @@ 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 {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, "");
- } H5E_END_TRY;
+ }
+ 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 {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, 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_ATTR_NAME, "", H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename_by_name");
@@ -6167,7 +6178,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
@@ -6193,18 +6203,23 @@ 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 {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Aget_name(attr, 1, NULL);
- } H5E_END_TRY;
+ }
+ 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");
@@ -6221,7 +6236,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.
@@ -6231,28 +6245,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);
@@ -6262,7 +6276,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");
}
@@ -6272,48 +6287,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; H5_INC_ENUM(H5_index_t, 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; H5_INC_ENUM(H5_iter_order_t, 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 */
@@ -6326,8 +6350,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;
@@ -6350,15 +6374,16 @@ 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, FALSE, "H5O__is_attr_dense_test");
- /* Check for deleting non-existant attribute */
+ /* Check for deleting non-existent attribute */
ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -6389,8 +6414,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;
@@ -6408,30 +6433,32 @@ 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)
- HDsprintf(attrname, "attr %02u", (u + 1));
+ 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)
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (u + 1));
else
- HDsprintf(attrname, "attr %02u", (max_compact - (u + 2)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (max_compact - (u + 2)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6446,8 +6473,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;
@@ -6465,10 +6492,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -6480,7 +6508,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 */
@@ -6499,11 +6527,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 */
@@ -6514,8 +6542,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;
@@ -6533,30 +6561,33 @@ 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)
- HDsprintf(attrname, "attr %02u", (u + 1));
+ 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)
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (u + 1));
else
- HDsprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u",
+ ((max_compact * 2) - (u + 2)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6574,13 +6605,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;
@@ -6598,10 +6627,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -6613,7 +6643,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 */
@@ -6622,11 +6652,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;
@@ -6644,38 +6674,42 @@ 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)
- HDsprintf(attrname, "attr %02u", ((u * 2) + 1));
+ 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)
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", ((u * 2) + 1));
else
- HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2)));
+ HDsnprintf(attrname, sizeof(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;
@@ -6693,30 +6727,34 @@ 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)
- HDsprintf(attrname, "attr %02u", ((u * 2) + 3));
+ 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)
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", ((u * 2) + 3));
else
- HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u",
+ ((max_compact * 2) - ((u * 2) + 4)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6746,8 +6784,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);
@@ -6756,8 +6794,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() */
/****************************************************************
**
@@ -6765,70 +6802,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 */
-
-#ifdef QAK
-HDfprintf(stderr, "attr_name = '%s'\n", attr_name);
-if(info)
- HDfprintf(stderr, "info->corder = %u\n", (unsigned)info->corder);
-HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
-#endif /* QAK */
+ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (unsigned)my_info.corder);
+ if (HDstrcmp(attr_name, attrname) != 0)
+ 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
@@ -6841,11 +6870,10 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
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
*
@@ -6862,12 +6890,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
*
@@ -6882,263 +6909,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");
@@ -7146,10 +7161,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;
@@ -7157,17 +7171,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.
@@ -7177,30 +7190,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);
@@ -7210,7 +7223,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");
}
@@ -7221,53 +7235,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; H5_INC_ENUM(H5_index_t, 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; H5_INC_ENUM(H5_iter_order_t, 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 */
@@ -7280,21 +7303,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:
@@ -7311,17 +7334,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7352,11 +7378,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 */
@@ -7364,23 +7392,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:
@@ -7388,10 +7415,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7403,7 +7431,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 */
@@ -7422,11 +7450,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 */
@@ -7437,11 +7465,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 */
@@ -7461,8 +7491,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);
@@ -7474,8 +7504,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
@@ -7491,20 +7520,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");
@@ -7514,10 +7542,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 {
@@ -7530,13 +7558,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.
@@ -7546,27 +7573,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);
@@ -7576,7 +7603,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");
}
@@ -7586,48 +7614,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; H5_INC_ENUM(H5_index_t, 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; H5_INC_ENUM(H5_iter_order_t, 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 */
@@ -7640,8 +7677,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;
@@ -7665,14 +7702,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7698,7 +7737,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 */
@@ -7706,10 +7746,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;
@@ -7727,10 +7766,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7742,7 +7782,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 */
@@ -7761,17 +7801,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 */
@@ -7791,8 +7832,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);
@@ -7801,8 +7842,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
@@ -7818,23 +7858,22 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen");
@@ -7849,7 +7888,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");
@@ -7865,7 +7903,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");
@@ -7883,13 +7920,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.
@@ -7899,26 +7935,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);
@@ -7928,7 +7964,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");
}
@@ -7938,9 +7975,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"))
@@ -7950,8 +7987,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 */
@@ -7964,21 +8002,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:
@@ -7991,7 +8029,7 @@ 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, FALSE, "H5O__is_attr_dense_test");
- /* Check for opening a non-existant attribute on an object with no attributes */
+ /* Check for opening a non-existent attribute on an object with no attributes */
ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret_id, FAIL, "H5Aopen");
@@ -8002,9 +8040,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8030,7 +8068,7 @@ 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, FALSE, "H5O__is_attr_dense_test");
- /* Check for opening a non-existant attribute on an object with compact attribute storage */
+ /* Check for opening a non-existent attribute on an object with compact attribute storage */
ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret_id, FAIL, "H5Aopen");
@@ -8045,23 +8083,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:
@@ -8069,9 +8106,9 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8084,7 +8121,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 */
@@ -8103,16 +8140,16 @@ 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 */
- /* Check for opening a non-existant attribute on an object with dense attribute storage */
+ /* Check for opening a non-existent attribute on an object with dense attribute storage */
ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret_id, FAIL, "H5Aopen");
@@ -8147,8 +8184,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() */
/****************************************************************
**
@@ -8159,25 +8195,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);
@@ -8187,7 +8223,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");
}
@@ -8197,9 +8234,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"))
@@ -8209,8 +8246,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 */
@@ -8223,21 +8261,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:
@@ -8251,10 +8289,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ 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 */
@@ -8284,23 +8323,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:
@@ -8308,10 +8346,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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
+ 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 */
@@ -8323,7 +8362,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 */
@@ -8342,11 +8381,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 */
@@ -8376,7 +8415,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() */
/****************************************************************
**
@@ -8387,28 +8426,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"));
@@ -8427,7 +8466,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");
@@ -8437,7 +8476,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");
@@ -8475,16 +8514,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 */
@@ -8493,7 +8531,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");
}
@@ -8505,7 +8544,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");
@@ -8532,12 +8571,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);
+ HDsnprintf(attrname, sizeof(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");
@@ -8548,7 +8587,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 {
@@ -8567,7 +8606,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 */
@@ -8582,14 +8621,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");
@@ -8600,7 +8638,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 {
@@ -8619,7 +8657,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 */
@@ -8634,7 +8672,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");
@@ -8651,8 +8689,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");
@@ -8672,7 +8710,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 */
@@ -8682,7 +8720,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");
@@ -8698,9 +8736,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
} /* end for */
/* Close dataspaces */
@@ -8711,7 +8751,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_write() */
+} /* test_attr_shared_write() */
/****************************************************************
**
@@ -8722,29 +8762,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"));
@@ -8763,7 +8803,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");
@@ -8773,7 +8813,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");
@@ -8811,16 +8851,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 */
@@ -8829,7 +8868,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");
}
@@ -8841,7 +8881,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");
@@ -8868,12 +8908,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);
+ HDsnprintf(attrname, sizeof(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");
@@ -8884,7 +8924,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 {
@@ -8903,7 +8943,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 */
@@ -8918,14 +8958,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");
@@ -8936,7 +8975,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 {
@@ -8955,7 +8994,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 */
@@ -8970,12 +9009,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);
@@ -8983,14 +9021,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");
@@ -9014,7 +9051,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");
@@ -9034,19 +9071,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");
@@ -9070,7 +9105,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");
@@ -9091,7 +9126,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");
@@ -9103,8 +9137,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");
@@ -9124,7 +9158,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 */
@@ -9134,7 +9168,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");
@@ -9150,9 +9184,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
} /* end for */
/* Close dataspaces */
@@ -9163,7 +9199,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_rename() */
+} /* test_attr_shared_rename() */
/****************************************************************
**
@@ -9174,28 +9210,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"));
@@ -9214,7 +9250,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");
@@ -9224,7 +9260,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");
@@ -9262,16 +9298,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 */
@@ -9280,7 +9315,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");
}
@@ -9292,7 +9328,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");
@@ -9319,12 +9355,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);
+ HDsnprintf(attrname, sizeof(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");
@@ -9335,7 +9371,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 {
@@ -9354,7 +9390,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 */
@@ -9369,14 +9405,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");
@@ -9387,7 +9422,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 {
@@ -9406,7 +9441,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 */
@@ -9421,30 +9456,28 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Delete second dataset's attribute */
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");
@@ -9465,7 +9498,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");
@@ -9477,8 +9509,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");
@@ -9498,7 +9530,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 */
@@ -9508,7 +9540,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");
@@ -9524,9 +9556,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
} /* end for */
/* Close dataspaces */
@@ -9537,7 +9571,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_delete() */
+} /* test_attr_shared_delete() */
/****************************************************************
**
@@ -9548,28 +9582,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"));
@@ -9588,7 +9622,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");
@@ -9598,7 +9632,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");
@@ -9636,16 +9670,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 */
@@ -9654,7 +9687,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");
}
@@ -9666,7 +9700,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");
@@ -9693,12 +9727,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);
+ HDsnprintf(attrname, sizeof(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");
@@ -9709,7 +9743,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 {
@@ -9728,7 +9762,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 */
@@ -9743,14 +9777,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");
@@ -9761,7 +9794,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 {
@@ -9780,7 +9813,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 */
@@ -9795,13 +9828,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");
@@ -9814,21 +9846,20 @@ 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);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Open attribute on first dataset */
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");
@@ -9858,7 +9889,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 */
@@ -9868,7 +9899,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");
@@ -9884,9 +9915,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Check size of file */
- filesize = h5_get_file_size(FILENAME, fapl);
- VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ if (h5_using_default_driver(NULL)) {
+ /* Check size of file */
+ filesize = h5_get_file_size(FILENAME, fapl);
+ VERIFY(filesize, empty_filesize, "h5_get_file_size");
+ }
} /* end for */
/* Close dataspaces */
@@ -9897,7 +9930,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_unlink() */
+} /* test_attr_shared_unlink() */
/****************************************************************
**
@@ -9913,11 +9946,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"));
@@ -9939,7 +9972,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");
@@ -9968,7 +10000,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");
@@ -10001,7 +10032,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");
@@ -10038,11 +10068,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() */
/****************************************************************
**
@@ -10058,17 +10087,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"));
@@ -10081,7 +10110,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 */
@@ -10096,7 +10125,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");
@@ -10106,7 +10135,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");
@@ -10173,7 +10202,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");
@@ -10183,7 +10212,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");
@@ -10201,7 +10230,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
ret = H5Pclose(gcpl);
CHECK(ret, FAIL, "H5Pclose");
-} /* test_attr_bug2() */
+} /* test_attr_bug2() */
/****************************************************************
**
@@ -10214,17 +10243,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"));
@@ -10272,11 +10300,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 */
@@ -10338,7 +10366,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() */
/****************************************************************
**
@@ -10352,14 +10380,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"));
@@ -10420,7 +10448,7 @@ test_attr_bug4(hid_t fcpl, hid_t fapl)
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_bug4() */
+} /* test_attr_bug4() */
/****************************************************************
**
@@ -10432,16 +10460,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"));
@@ -10577,7 +10603,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() */
/****************************************************************
**
@@ -10588,13 +10614,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"));
@@ -10637,7 +10663,7 @@ test_attr_bug6(hid_t fcpl, hid_t fapl)
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_bug6() */
+} /* test_attr_bug6() */
/****************************************************************
**
@@ -10652,19 +10678,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. */
@@ -10700,8 +10725,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
@@ -10727,12 +10753,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
@@ -10760,16 +10788,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
@@ -10797,8 +10828,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
@@ -10824,12 +10856,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);
@@ -10838,7 +10872,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() */
/****************************************************************
**
@@ -10857,21 +10891,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 */
- H5O_info_t oinfo; /* Object info */
- H5A_info_t ainfo; /* Attribute info */
- haddr_t root_addr; /* Root group address */
- herr_t ret; /* Generic return status */
+ hid_t fid; /* File ID */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t gid; /* Group ID */
+ hid_t oid; /* Object ID */
+ hsize_t dims = 256; /* Attribute dimensions */
+ H5O_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 */
/* 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. */
@@ -10881,9 +10915,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gcreate2");
/* Get root group address */
- ret = H5Oget_info2(fid, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(fid, &oinfo, H5O_INFO_BASIC);
CHECK(ret, FAIL, "H5Oget_info");
- root_addr = oinfo.addr;
+ ret = H5VLnative_token_to_addr(fid, oinfo.token, &root_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
/*
* Create link to root group
@@ -10906,10 +10941,13 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT);
CHECK(oid, FAIL, "H5Oopen");
- ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC);
CHECK(ret, FAIL, "H5Oget_info");
- if(oinfo.addr != root_addr)
- TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr);
+ 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);
/* Close file */
ret = H5Fclose(fid);
@@ -10951,14 +10989,18 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT);
CHECK(oid, FAIL, "H5Oopen");
- ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC);
CHECK(ret, FAIL, "H5Oget_info");
- if(oinfo.addr != root_addr)
- TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr);
+ 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);
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 +11011,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() */
/****************************************************************
**
@@ -10983,24 +11025,24 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
** chunk. Do this twice: once with only attributes in the
** object header chunk and once with a (small) soft link in
** the chunk as well. In both cases, the shrunk chunk will
-** initally be too small and a new NULL message must be
+** initially be too small and a new NULL message must be
** created.
**
****************************************************************/
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 +11056,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 +11074,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 +11086,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 +11094,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 +11107,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 +11120,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 +11153,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 +11190,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 +11203,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 +11234,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 +11248,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 +11416,7 @@ test_attr(void)
CHECK(ret, FAIL, "H5Pclose");
ret = H5Pclose(fapl2);
CHECK(ret, FAIL, "H5Pclose");
-} /* test_attr() */
-
+} /* test_attr() */
/*-------------------------------------------------------------------------
* Function: cleanup_attr
@@ -11364,4 +11437,3 @@ cleanup_attr(void)
{
HDremove(FILENAME);
}
-