diff options
author | Quincey Koziol <quincey@koziol.cc> | 2016-09-27 17:29:16 (GMT) |
---|---|---|
committer | Quincey Koziol <quincey@koziol.cc> | 2016-09-27 17:29:16 (GMT) |
commit | fa66428a6dd3e9250497618afa6402008c7ed409 (patch) | |
tree | 33d2e0c499f90fbd137607a01ae35d9058d058a3 /test/tattr.c | |
parent | 6d5ee49ff3a33b30b9a7baf0af4f1929ad8d3b72 (diff) | |
download | hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.zip hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.tar.gz hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.tar.bz2 |
Description:
Further warning cleanups: from 667 warnings to 503.
Diffstat (limited to 'test/tattr.c')
-rw-r--r-- | test/tattr.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/test/tattr.c b/test/tattr.c index e7b3ece..6f55081 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -8029,7 +8029,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + 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 */ @@ -8040,8 +8040,10 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -8328,6 +8330,9 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_write() */ /**************************************************************** @@ -8355,7 +8360,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + 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 */ @@ -8366,8 +8371,10 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Shared & Unshared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -8770,6 +8777,9 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_rename() */ /**************************************************************** @@ -8796,7 +8806,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + 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 */ @@ -8807,8 +8817,10 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Shared & Unshared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -9134,6 +9146,9 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_delete() */ /**************************************************************** @@ -9160,7 +9175,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) htri_t is_shared; /* Is attributes shared? */ hsize_t shared_refcount; /* Reference count of shared attribute */ unsigned attr_value; /* Attribute value */ - unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* Data for "big" attribute */ + 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 */ @@ -9171,8 +9186,10 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Shared Attributes in Compact & Dense Storage\n")); - /* Initialize "big" attribute data */ - HDmemset(big_value, 1, sizeof(big_value)); + /* Allocate & initialize "big" attribute data */ + big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); + CHECK(big_value, NULL, "HDmalloc"); + HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); @@ -9484,6 +9501,9 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(big_sid); CHECK(ret, FAIL, "H5Sclose"); + + /* Release memory */ + HDfree(big_value); } /* test_attr_shared_unlink() */ /**************************************************************** |