summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-03-04 21:31:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-03-04 21:31:25 (GMT)
commit83cbb092ed97644bd042ef82d3645e2cdd5c125d (patch)
tree1efa12299df762099d054afffe2fc41cd7e4fdbb
parentfc78e01d1534d26d1badc77286e185059e85fba9 (diff)
downloadhdf5-83cbb092ed97644bd042ef82d3645e2cdd5c125d.zip
hdf5-83cbb092ed97644bd042ef82d3645e2cdd5c125d.tar.gz
hdf5-83cbb092ed97644bd042ef82d3645e2cdd5c125d.tar.bz2
[svn-r10147] Purpose:
Bug fix Description: Filter callback routines were being called with memory "version" of disk datatype (don't ask... :-), which could result in incorrect calculations in the filter callbacks. Solution: Rearrange code to call the filter callbacks after the final disk "version" of the disk datatype has been created. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest
-rw-r--r--src/H5D.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 966347f..1d5a17a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -2115,10 +2115,6 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id));
assert (H5I_GENPROP_LST==H5I_get_type(dxpl_id));
- /* Check if the filters in the DCPL can be applied to this dataset */
- if(H5Z_can_apply(dcpl_id,type_id)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset")
-
/* Get the dataset's datatype */
if (NULL == (type = H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
@@ -2145,16 +2141,6 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
if(NULL == (new_dset->shared = H5D_new(dcpl_id,TRUE,has_vl_type)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /*
- * Set the dataset's checked_filters flag to enable writing.
- * Make sure that H5Z_can_apply is called at the beginning of this function!
- */
- new_dset->shared->checked_filters = TRUE;
-
- /* Make the "set local" filter callbacks for this dataset */
- if(H5Z_set_local(new_dset->shared->dcpl_id,type_id)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters")
-
/* What file is the dataset being added to? */
if(NULL==(file=H5G_insertion_file(loc, name, dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to locate insertion point")
@@ -2163,6 +2149,13 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
if(H5D_init_type(file, new_dset, type_id, type)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy datatype")
+ /* Check if the filters in the DCPL can be applied to this dataset */
+ if(H5Z_can_apply(new_dset->shared->dcpl_id,new_dset->shared->type_id)<0)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset")
+
+ /* Set the dataset's checked_filters flag to enable writing */
+ new_dset->shared->checked_filters = TRUE;
+
/* Copy dataspace for dataset */
if((new_dset->shared->space = H5S_copy(space, FALSE))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy dataspace")
@@ -2171,6 +2164,10 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
if(H5S_select_all(new_dset->shared->space,1)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
+ /* Make the "set local" filter callbacks for this dataset */
+ if(H5Z_set_local(new_dset->shared->dcpl_id,new_dset->shared->type_id)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters")
+
/* Check if the dataset has a non-default DCPL & get important values, if so */
if(new_dset->shared->dcpl_id!=H5P_DATASET_CREATE_DEFAULT) {
H5D_layout_t dcpl_layout; /* Dataset's layout information */
@@ -2408,10 +2405,10 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
} /* end if */
H5FL_FREE(H5D_shared_t,new_dset->shared);
- }
+ } /* end if */
new_dset->ent.file = NULL;
H5FL_FREE(H5D_t, new_dset);
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_create() */