summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-08 15:26:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-08 15:26:02 (GMT)
commitd3ee3988b68292524b3a893b9db55c074f4b9e87 (patch)
tree64395dd8ffd157ccd761ea54f7ee2c739e7b48ed /src/H5D.c
parenta6f5c793469cba3e0c1168e07bd6c7f833321623 (diff)
downloadhdf5-d3ee3988b68292524b3a893b9db55c074f4b9e87.zip
hdf5-d3ee3988b68292524b3a893b9db55c074f4b9e87.tar.gz
hdf5-d3ee3988b68292524b3a893b9db55c074f4b9e87.tar.bz2
[svn-r14192] Description:
Deprecate H5Dextend in favor of H5Dset_extent (without using API versioning, due to changed behavior) and switch internal usage to H5Dset_extent Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/H5D.c b/src/H5D.c
index a6b9a52..5133651 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3077,8 +3077,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Dset_extent
*
- * Purpose: Modifies the dimensions of a dataset, based on H5Dextend.
- * Can change to a lower dimension.
+ * Purpose: Modifies the dimensions of a dataset.
+ * Can change to a smaller dimension.
*
* Return: Non-negative on success, negative on failure
*
@@ -3130,10 +3130,7 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
H5S_t *space; /* Dataset's dataspace */
int rank; /* Dataspace # of dimensions */
hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
- hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */
- hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */
htri_t changed; /* Whether the dataspace changed size */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_set_extent, FAIL)
@@ -3142,40 +3139,44 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
HDassert(dset);
HDassert(size);
- /*-------------------------------------------------------------------------
- * Get the data space
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Get the data space
+ *-------------------------------------------------------------------------
+ */
space = dset->shared->space;
- /*-------------------------------------------------------------------------
- * Check if we are shrinking or expanding any of the dimensions
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Check if we are shrinking or expanding any of the dimensions
+ *-------------------------------------------------------------------------
+ */
if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- /* Determine if we are shrinking and/or expanding any dimensions */
- for(u = 0; u < (unsigned)rank; u++) {
- if(size[u] < curr_dims[u])
- shrink = TRUE;
- if(size[u] > curr_dims[u])
- expand = TRUE;
- } /* end for */
-
- /*-------------------------------------------------------------------------
- * Modify the size of the data space
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Modify the size of the data space
+ *-------------------------------------------------------------------------
+ */
if((changed = H5S_set_extent(space, size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space")
/* Don't bother updating things, unless they've changed */
if(changed) {
- /*-------------------------------------------------------------------------
- * Modify the dataset storage
- *-------------------------------------------------------------------------
- */
+ hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */
+ hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */
+ unsigned u; /* Local index variable */
+
+ /* Determine if we are shrinking and/or expanding any dimensions */
+ for(u = 0; u < (unsigned)rank; u++) {
+ if(size[u] < curr_dims[u])
+ shrink = TRUE;
+ if(size[u] > curr_dims[u])
+ expand = TRUE;
+ } /* end for */
+
+ /*-------------------------------------------------------------------------
+ * Modify the dataset storage
+ *-------------------------------------------------------------------------
+ */
/* Save the new dataspace in the file if necessary */
if(H5S_write(&(dset->oloc), space, TRUE, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace")
@@ -3191,11 +3192,11 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset storage")
- /*-------------------------------------------------------------------------
- * Remove chunk information in the case of chunked datasets
- * This removal takes place only in case we are shrinking the dateset
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Remove chunk information in the case of chunked datasets
+ * This removal takes place only in case we are shrinking the dateset
+ *-------------------------------------------------------------------------
+ */
if(shrink && H5D_CHUNKED == dset->shared->layout.type) {
H5D_io_info_t io_info; /* Dataset I/O info */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */