diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-04-26 15:44:08 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-04-26 15:44:08 (GMT) |
commit | 124979bfc261386070516a81f26e7a28417c56d3 (patch) | |
tree | 692d2f0342a026dd74045f7be1e1e8c8e4ae05ae /src | |
parent | 80043b04c036548fe4c47a1fc5acb8a544fbcb8d (diff) | |
download | hdf5-124979bfc261386070516a81f26e7a28417c56d3.zip hdf5-124979bfc261386070516a81f26e7a28417c56d3.tar.gz hdf5-124979bfc261386070516a81f26e7a28417c56d3.tar.bz2 |
[svn-r5272] Purpose:
Bug fix
Description:
Move iterator initialization in H5D_read & H5D_write before any errors can
occur.
Platforms tested:
FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -2250,6 +2250,11 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); + /* Initialize these before any errors can occur */ + HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t)); + HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t)); + HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t)); + /* Get the dataset's creation property list */ if (NULL == (dc_plist = H5I_object(dataset->dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); @@ -2258,11 +2263,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (NULL == (dx_plist = H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); - /* Initialize these before any errors can occur */ - HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t)); - HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t)); - HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t)); - if (!file_space) { if (NULL==(free_this_space=H5S_read (&(dataset->ent)))) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data space from dataset header"); @@ -2664,6 +2664,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); + /* Initialize these before any errors can occur */ + HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t)); + HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t)); + HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t)); + /* Get the dataset's creation property list */ if (NULL == (dc_plist = H5I_object(dataset->dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); @@ -2689,11 +2694,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet"); #endif - /* Initialize these before any errors can occur */ - HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t)); - HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t)); - HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t)); - if (0==(H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file"); |