mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
[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
This commit is contained in:
parent
fc78e01d15
commit
83cbb092ed
29
src/H5D.c
29
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() */
|
||||
|
Loading…
x
Reference in New Issue
Block a user