diff options
author | James Laird <jlaird@hdfgroup.org> | 2006-12-20 21:33:51 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2006-12-20 21:33:51 (GMT) |
commit | 56dae018e20d1810137e61564c4ca47da3d32937 (patch) | |
tree | 4bcd5a99aa7ffddca9232a3b90e19dd9e5895094 /src/H5Z.c | |
parent | 79c17d54cc2f66f57f51f578681a35140e2b580e (diff) | |
download | hdf5-56dae018e20d1810137e61564c4ca47da3d32937.zip hdf5-56dae018e20d1810137e61564c4ca47da3d32937.tar.gz hdf5-56dae018e20d1810137e61564c4ca47da3d32937.tar.bz2 |
[svn-r13084] Fixed a bug that occurrs when copying DCPLs with filters that have filter
data.
Added a regression test for this bug.
Tested on kagiso.
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -787,6 +787,19 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* Allocate additional space in the pipeline if it's full */ if(pline->nused >= pline->nalloc) { H5O_pline_t x; + size_t n; + + /* Each filter's data may be stored internally or may be + * 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 + * 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; + } x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc); x.filter = H5MM_realloc(pline->filter, x.nalloc*sizeof(x.filter[0])); @@ -794,6 +807,14 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") pline->nalloc = x.nalloc; pline->filter = x.filter; + + /* Fix pointers in filters that need to point to their own internal + * data. + */ + for(n=0; n<pline->nalloc; ++n) { + if(NULL == pline->filter[n].cd_values) + pline->filter[n].cd_values = pline->filter[n]._cd_values; + } } /* end if */ /* Add the new filter to the pipeline */ |