mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-24 17:51:25 +08:00
[svn-r13085] Yesterday's checkin wasn't a complete fix for copying filters in DCPLs.
Extended the test so it broke again and then fixed it again. Tested on kagiso.
This commit is contained in:
parent
56dae018e2
commit
e3fe4f7790
@ -793,12 +793,12 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
|
||||
* a separate block of memory.
|
||||
* For each filter, if cd_values points to the internal array
|
||||
* _cd_values, the pointer will need to be updated when the
|
||||
* filter struct is reallocated. Set these pointers to NULL
|
||||
* filter struct is reallocated. Set these pointers to ~NULL
|
||||
* so that we can reset them after reallocating the filters array.
|
||||
*/
|
||||
for(n=0; n<pline->nalloc; ++n) {
|
||||
if(pline->filter[n].cd_values == pline->filter[n]._cd_values)
|
||||
pline->filter[n].cd_values = NULL;
|
||||
pline->filter[n].cd_values = (void *) ~((size_t)NULL);
|
||||
}
|
||||
|
||||
x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc);
|
||||
@ -812,7 +812,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
|
||||
* data.
|
||||
*/
|
||||
for(n=0; n<pline->nalloc; ++n) {
|
||||
if(NULL == pline->filter[n].cd_values)
|
||||
if(pline->filter[n].cd_values == (void *) ~((size_t) NULL))
|
||||
pline->filter[n].cd_values = pline->filter[n]._cd_values;
|
||||
}
|
||||
} /* end if */
|
||||
|
60
test/tmisc.c
60
test/tmisc.c
@ -287,6 +287,7 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
|
||||
#define MISC25A_ATTR3_LEN 1
|
||||
#define MISC25B_FILE "mergemsg.h5"
|
||||
#define MISC25B_GROUP "grp1"
|
||||
#define MISC26_FILE "dcpl_file"
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
@ -4650,17 +4651,23 @@ test_misc25b(void)
|
||||
static void
|
||||
test_misc26(void)
|
||||
{
|
||||
hid_t dcpl1, dcpl2; /* Property List IDs */
|
||||
hid_t fid; /* File ID */
|
||||
hid_t sid; /* Dataspace ID */
|
||||
hid_t did; /* Dataset ID */
|
||||
hid_t dcpl1, dcpl2, dcpl3; /* Property List IDs */
|
||||
hsize_t dims[] = {1};
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Copying filter pipelines\n"));
|
||||
|
||||
/* Create the property list */
|
||||
/* Create the property list. It needs chunking so we can add filters */
|
||||
dcpl1 = H5Pcreate(H5P_DATASET_CREATE);
|
||||
CHECK_I(dcpl1, "H5Pcreate");
|
||||
ret = H5Pset_chunk(dcpl1, 1, dims);
|
||||
CHECK_I(ret, "H5Pset_chunk");
|
||||
|
||||
/* Add a filter to the property list */
|
||||
/* Add a filter with a data value to the property list */
|
||||
ret = H5Pset_deflate(dcpl1, 1);
|
||||
CHECK_I(ret, "H5Pset_deflate");
|
||||
|
||||
@ -4668,18 +4675,56 @@ test_misc26(void)
|
||||
dcpl2 = H5Pcopy(dcpl1);
|
||||
CHECK_I(dcpl2, "H5Pcopy");
|
||||
|
||||
/* Add a filter to the copy */
|
||||
/* Add a filter with no data values to the copy */
|
||||
ret = H5Pset_shuffle(dcpl2);
|
||||
CHECK_I(ret, "H5Pset_shuffle");
|
||||
|
||||
/* Close the property lists. If adding the second filter to
|
||||
* dcpl2 caused it to be in an inconsistent state, closing it
|
||||
* will trip an assert.
|
||||
/* Copy the copy */
|
||||
dcpl3 = H5Pcopy(dcpl2);
|
||||
CHECK_I(dcpl3, "H5Pcopy");
|
||||
|
||||
/* Add another filter */
|
||||
ret = H5Pset_deflate(dcpl3, 2);
|
||||
CHECK_I(ret, "H5Pset_deflate");
|
||||
|
||||
|
||||
/* Create a new file and datasets within that file that use these
|
||||
* property lists
|
||||
*/
|
||||
fid = H5Fcreate(MISC26_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(fid, FAIL, "H5Fcreate");
|
||||
|
||||
sid = H5Screate_simple(1, dims, dims);
|
||||
CHECK(sid, FAIL, "H5Screate_simple");
|
||||
|
||||
did = H5Dcreate(fid, "dataset1", H5T_NATIVE_FLOAT, sid, dcpl1);
|
||||
CHECK(did, FAIL, "H5Dcreate");
|
||||
ret = H5Dclose(did);
|
||||
CHECK_I(ret, "H5Dclose");
|
||||
|
||||
did = H5Dcreate(fid, "dataset2", H5T_NATIVE_FLOAT, sid, dcpl2);
|
||||
CHECK(did, FAIL, "H5Dcreate");
|
||||
ret = H5Dclose(did);
|
||||
CHECK_I(ret, "H5Dclose");
|
||||
|
||||
did = H5Dcreate(fid, "dataset3", H5T_NATIVE_FLOAT, sid, dcpl3);
|
||||
CHECK(did, FAIL, "H5Dcreate");
|
||||
ret = H5Dclose(did);
|
||||
CHECK_I(ret, "H5Dclose");
|
||||
|
||||
/* Close the dataspace and file */
|
||||
ret = H5Sclose(sid);
|
||||
CHECK_I(ret, "H5Sclose");
|
||||
ret = H5Fclose(fid);
|
||||
CHECK_I(ret, "H5Fclose");
|
||||
|
||||
/* Close the property lists. */
|
||||
ret = H5Pclose(dcpl1);
|
||||
CHECK_I(ret, "H5Pclose");
|
||||
ret = H5Pclose(dcpl2);
|
||||
CHECK_I(ret, "H5Pclose");
|
||||
ret = H5Pclose(dcpl3);
|
||||
CHECK_I(ret, "H5Pclose");
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
@ -4774,5 +4819,6 @@ cleanup_misc(void)
|
||||
HDremove(MISC23_FILE);
|
||||
HDremove(MISC24_FILE);
|
||||
HDremove(MISC25A_FILE);
|
||||
HDremove(MISC26_FILE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user