diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-07-05 15:44:30 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-07-05 15:44:30 (GMT) |
commit | 5c420a91801fb4eaf6b639717ca3f1f2e8f6d4d9 (patch) | |
tree | 218e20418d26437ce5814a2e9ee320dbb8a8dec0 /src/H5S.c | |
parent | 18d75c9985a750e547d80f4b19c881ede4ed5625 (diff) | |
download | hdf5-5c420a91801fb4eaf6b639717ca3f1f2e8f6d4d9.zip hdf5-5c420a91801fb4eaf6b639717ca3f1f2e8f6d4d9.tar.gz hdf5-5c420a91801fb4eaf6b639717ca3f1f2e8f6d4d9.tar.bz2 |
[svn-r13943] Description:
Allow H5Dset_extent() to reduce the size of dimensions that aren't unlimited
Tested on:
Mac OS X/32 10.4.10 (amazon)
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -2086,28 +2086,30 @@ done: *------------------------------------------------------------------------- */ int -H5S_set_extent( H5S_t *space, const hsize_t *size ) +H5S_set_extent(H5S_t *space, const hsize_t *size) { - unsigned u; - herr_t ret_value=0; + unsigned u; /* Local index variable */ + herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI( H5S_set_extent, FAIL ); + FUNC_ENTER_NOAPI(H5S_set_extent, FAIL); /* Check args */ - assert( space && H5S_SIMPLE==H5S_GET_EXTENT_TYPE(space) ); - assert( size); + HDassert(space && H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)); + HDassert(size); /* Verify that the dimensions being changed are allowed to change */ - for ( u = 0; u < space->extent.rank; u++ ) { - if ( space->extent.max && H5S_UNLIMITED != space->extent.max[u] && - space->extent.max[u]!=size[u] ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"dimension cannot be modified") - ret_value++; + for(u = 0; u < space->extent.rank; u++) { + if(space->extent.size[u] != size[u]) { + if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] && + space->extent.max[u] < size[u]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimension cannot be modified") + ret_value++; + } /* end if */ } /* end for */ /* Update */ - if (ret_value) - H5S_set_extent_real(space,size); + if(ret_value) + H5S_set_extent_real(space, size); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2186,6 +2188,10 @@ H5S_set_extent_real( H5S_t *space, const hsize_t *size ) if(H5S_select_all(space, FALSE)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Mark the dataspace as no longer shared if it was before */ + if(H5O_msg_reset_share(H5O_SDSPACE_ID, space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRESET, FAIL, "can't stop sharing dataspace") + done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5S_set_extent_real() */ |