summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-01-22 21:07:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-01-22 21:07:54 (GMT)
commitdc41c7371153fc4cf7bba6cf09868a03f19e445a (patch)
tree252c829a898c1bb379301baf9dc1771bd6901e81
parent681d9231cf2fb1f01ef84c14285195c059d64a16 (diff)
downloadhdf5-dc41c7371153fc4cf7bba6cf09868a03f19e445a.zip
hdf5-dc41c7371153fc4cf7bba6cf09868a03f19e445a.tar.gz
hdf5-dc41c7371153fc4cf7bba6cf09868a03f19e445a.tar.bz2
[svn-r13167] Description:
Get rid of two different types of fill value struct (merge H5O_fill_t and H5O_fill_new_t) and clean up & simplify dataset initialization code. (In preparation for shared object header message method call refactoring). Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.8 (amazon)
-rw-r--r--src/H5D.c1159
-rw-r--r--src/H5Dcontig.c87
-rw-r--r--src/H5Dio.c181
-rw-r--r--src/H5Distore.c442
-rw-r--r--src/H5Dpkg.h6
-rw-r--r--src/H5Dprivate.h6
-rw-r--r--src/H5Dpublic.h26
-rw-r--r--src/H5MM.c6
-rw-r--r--src/H5Oefl.c32
-rw-r--r--src/H5Ofill.c303
-rw-r--r--src/H5Oprivate.h26
-rw-r--r--src/H5Pdcpl.c601
-rw-r--r--src/H5Spublic.h2
-rw-r--r--src/H5private.h24
-rw-r--r--test/tvltypes.c2
15 files changed, 1283 insertions, 1620 deletions
diff --git a/src/H5D.c b/src/H5D.c
index a0304a6..7f1ee27 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -170,25 +170,17 @@ H5D_init_interface(void)
if(NULL == (def_dcpl = H5I_object(H5P_LST_DATASET_CREATE_g)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list")
- /* Set up the default allocation time information */
- if(H5P_get(def_dcpl, H5D_CRT_ALLOC_TIME_NAME, &H5D_def_dset.alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve space allocation time")
-
- /* Get the default external file list information */
- if(H5P_get(def_dcpl, H5D_CRT_EXT_FILE_LIST_NAME, &H5D_def_dset.efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve external file list")
-
/* Get the default data storage method */
if(H5P_get(def_dcpl, H5D_CRT_LAYOUT_NAME, &H5D_def_dset.layout.type) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
- /* Get the default fill value time */
- if(H5P_get(def_dcpl, H5D_CRT_FILL_TIME_NAME, &H5D_def_dset.fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time")
-
- /* Get the default fill value */
- if(H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.fill) < 0)
+ /* Get the default dataset creation properties */
+ if(H5P_get(def_dcpl, H5D_CRT_EXT_FILE_LIST_NAME, &H5D_def_dset.dcpl_cache.efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve external file list")
+ if(H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.dcpl_cache.fill) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value")
+ if(H5P_get(def_dcpl, H5D_CRT_DATA_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
/* Reset the "default DXPL cache" information */
HDmemset(&H5D_def_dxpl_cache, 0, sizeof(H5D_dxpl_cache_t));
@@ -224,8 +216,8 @@ H5D_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_term_interface)
- if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_DATASET))>0) {
+ if(H5_interface_initialize_g) {
+ if((n=H5I_nmembers(H5I_DATASET))>0) {
/* The dataset API uses the "force" flag set to true because it
* is using the "file objects" (H5FO) API functions to track open
* objects in the file. Using the H5FO code means that dataset
@@ -256,58 +248,7 @@ H5D_term_interface(void)
}
}
FUNC_LEAVE_NOAPI(n)
-}
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5D_get_dcpl_cache
- PURPOSE
- Get all the values for the DCPL cache.
- USAGE
- herr_t H5D_get_dcpl_cache(dcpl_id, cache)
- hid_t dcpl_id; IN: DCPL to query
- H5D_dcpl_cache_t *cache;IN/OUT: DCPL cache to fill with values
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Query all the values from a DCPL that are needed by internal routines
- within the library.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5D_get_dcpl_cache(hid_t dcpl_id, H5D_dcpl_cache_t *cache)
-{
- H5P_genplist_t *dc_plist; /* Data transfer property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5D_get_dcpl_cache)
-
- /* Check args */
- HDassert(cache);
-
- /* Get the dataset transfer property list */
- if (NULL == (dc_plist = H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
-
- /* Get I/O pipeline info */
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &cache->pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O pipeline info")
-
- /* Get fill value info */
- if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &cache->fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill value info")
-
- /* Get fill time info */
- if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &cache->fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill time")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D_get_dcpl_cache() */
+} /* end H5D_term_interface() */
/*-------------------------------------------------------------------------
@@ -390,7 +331,7 @@ H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if((dset_id = H5I_register(H5I_DATASET, new_dset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset")
- if(H5G_loc(dset_id, &dset_loc) <0)
+ if(H5G_loc(dset_id, &dset_loc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get location for dataset")
/* Link the new dataset */
@@ -661,20 +602,16 @@ H5Dopen_expand(hid_t loc_id, const char *name, hid_t dapl_id)
done:
if(ret_value < 0) {
- if(dset != NULL) {
- if(H5D_close(dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
- } /* end if */
+ if(dset != NULL && H5D_close(dset) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
else {
- if(loc_found) {
- if(H5G_loc_free(&dset_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
- }
+ if(loc_found && H5G_loc_free(&dset_loc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
} /* end else */
} /* end if */
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Dopen_expand() */
/*-------------------------------------------------------------------------
@@ -743,21 +680,21 @@ H5Dget_space(hid_t dset_id)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Read the data space message and return a data space object */
- if (NULL==(space=H5S_copy (dset->shared->space, FALSE)))
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get data space")
+ if(NULL==(space=H5S_copy (dset->shared->space, FALSE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get data space")
/* Create an atom */
- if ((ret_value=H5I_register (H5I_DATASPACE, space))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space")
+ if((ret_value=H5I_register (H5I_DATASPACE, space)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space")
done:
- if(ret_value<0) {
+ if(ret_value < 0) {
if(space!=NULL) {
- if(H5S_close(space)<0)
+ if(H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
} /* end if */
} /* end if */
@@ -791,11 +728,11 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
/* Check arguments */
if(NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Read data space address and return */
if(FAIL==(ret_value=H5D_get_space_status(dset, allocation, H5AC_ind_dxpl_id)))
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
done:
FUNC_LEAVE_API(ret_value)
@@ -828,18 +765,18 @@ H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id)
FUNC_ENTER_NOAPI_NOINIT(H5D_get_space_status)
- assert(dset);
+ HDassert(dset);
/* Get the dataset's dataspace */
- space=dset->shared->space;
- assert(space);
+ space = dset->shared->space;
+ HDassert(space);
/* Get the total number of elements in dataset's dataspace */
- if((total_elem=H5S_GET_EXTENT_NPOINTS(space))<0)
+ if((total_elem=H5S_GET_EXTENT_NPOINTS(space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get # of dataspace elements")
/* Get the size of the dataset's datatype */
- if((type_size=H5T_get_size(dset->shared->type))==0)
+ if((type_size = H5T_get_size(dset->shared->type)) == 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get size of datatype")
/* Compute the maximum size of the dataset in bytes */
@@ -847,23 +784,23 @@ H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id)
full_size=((hsize_t)total_elem)*type_size;
/* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- space_allocated=H5D_get_storage_size(dset,dxpl_id);
+ space_allocated = H5D_get_storage_size(dset, dxpl_id);
/* Decide on how much of the space is allocated */
- if(space_allocated==0)
+ if(space_allocated == 0)
*allocation = H5D_SPACE_STATUS_NOT_ALLOCATED;
- else if(space_allocated==full_size)
+ else if(space_allocated == full_size)
*allocation = H5D_SPACE_STATUS_ALLOCATED;
else {
/* Should only happen for chunked datasets currently */
- assert(dset->shared->layout.type==H5D_CHUNKED);
+ HDassert(dset->shared->layout.type == H5D_CHUNKED);
*allocation = H5D_SPACE_STATUS_PART_ALLOCATED;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5D_get_space_status() */
/*-------------------------------------------------------------------------
@@ -894,29 +831,29 @@ H5Dget_type(hid_t dset_id)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Copy the datatype and mark it read-only */
- if (NULL==(copied_type=H5T_copy (dset->shared->type, H5T_COPY_REOPEN)))
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy the datatype")
+ if(NULL==(copied_type=H5T_copy (dset->shared->type, H5T_COPY_REOPEN)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy the datatype")
/* Mark any datatypes as being in memory now */
- if (H5T_set_loc(copied_type, NULL, H5T_LOC_MEMORY)<0)
+ if(H5T_set_loc(copied_type, NULL, H5T_LOC_MEMORY) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
/* Unlock copied type */
- if (H5T_lock (copied_type, FALSE)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
+ if(H5T_lock (copied_type, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
/* Create an atom */
- if ((ret_value=H5I_register (H5I_DATATYPE, copied_type))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ if((ret_value=H5I_register (H5I_DATATYPE, copied_type)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
- if(ret_value<0) {
+ if(ret_value < 0) {
if(copied_type!=NULL) {
- if(H5T_close (copied_type)<0)
+ if(H5T_close (copied_type) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
} /* end if */
@@ -944,26 +881,26 @@ done:
hid_t
H5Dget_create_plist(hid_t dset_id)
{
- H5D_t *dset = NULL;
- H5O_fill_t copied_fill={NULL,0,NULL};
- H5P_genplist_t *dcpl_plist;
- H5P_genplist_t *new_plist;
+ H5D_t *dset; /* Dataset structure */
+ H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
+ H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
+ H5O_fill_t copied_fill; /* Fill value to tweak */
hid_t new_dcpl_id = FAIL;
- hid_t ret_value = FAIL;
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(H5Dget_create_plist, FAIL)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if (NULL == (dcpl_plist = H5I_object(dset->shared->dcpl_id)))
+ if(NULL == (dset = H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (dcpl_plist = H5I_object(dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
/* Copy the creation property list */
if((new_dcpl_id = H5P_copy_plist(dcpl_plist)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to copy the creation property list")
- if (NULL == (new_plist = H5I_object(new_dcpl_id)))
+ if(NULL == (new_plist = H5I_object(new_dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
/* Retrieve any object creation properties */
@@ -974,9 +911,9 @@ H5Dget_create_plist(hid_t dset_id)
if(H5P_get(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
- /* Copy the dataset type into the fill value message */
- if(copied_fill.type==NULL)
- if(NULL==(copied_fill.type=H5T_copy(dset->shared->type, H5T_COPY_TRANSIENT)))
+ /* Copy the dataset type into the fill value message, if there's actually a fill value */
+ if(copied_fill.buf != NULL && copied_fill.type == NULL)
+ if(NULL == (copied_fill.type = H5T_copy(dset->shared->type, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value")
/* Set back the fill value property to property list */
@@ -984,16 +921,15 @@ H5Dget_create_plist(hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property list fill value")
/* Set the return value */
- ret_value=new_dcpl_id;
+ ret_value = new_dcpl_id;
done:
- if(ret_value<0) {
- if(new_dcpl_id>0)
+ if(ret_value < 0)
+ if(new_dcpl_id > 0)
(void)H5I_dec_ref(new_dcpl_id);
- } /* end if */
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Dget_create_plist() */
/*-------------------------------------------------------------------------
@@ -1013,25 +949,25 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t *size)
{
- H5D_t *dset = NULL;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5D_t *dset;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Dextend, FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
- if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
+ if(NULL == (dset = H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if (!size)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+ if(!size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Increase size */
- if (H5D_extend (dset, size, H5AC_dxpl_id)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
+ if(H5D_extend(dset, size, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Dextend() */
/*-------------------------------------------------------------------------
@@ -1059,23 +995,20 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
/* Allocate new shared dataset structure */
if(NULL == (new_dset = H5FL_MALLOC(H5D_shared_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Copy the default dataset information */
+ HDmemcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t));
/* If we are using the default dataset creation property list, during creation
* don't bother to copy it, just increment the reference count
*/
if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
- /* Copy the default dataset information */
- HDmemcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t));
-
if(H5I_inc_ref(dcpl_id) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, NULL, "Can't increment default DCPL ID")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "Can't increment default DCPL ID")
new_dset->dcpl_id = dcpl_id;
} /* end if */
else {
- /* Reset the dataset information */
- HDmemset(new_dset, 0, sizeof(H5D_shared_t));
-
/* Get the property list */
if(NULL == (plist = H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
@@ -1122,16 +1055,16 @@ H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
FUNC_ENTER_NOAPI(H5D_init_type, FAIL)
/* Sanity checking */
- assert(file);
- assert(dset);
- assert(type);
+ HDassert(file);
+ HDassert(dset);
+ HDassert(type);
/* Check whether the datatype is relocatable */
- if((relocatable=H5T_is_relocatable(type))<0)
+ if((relocatable = H5T_is_relocatable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
/* Check whether the datatype is immutable */
- if((immutable=H5T_is_immutable(type))<0)
+ if((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
@@ -1141,17 +1074,17 @@ H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy datatype")
/* Mark any datatypes as being on disk now */
- if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK)<0)
+ if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
/* Get a datatype ID for the dataset's datatype */
- if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type))<0)
+ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
/* Not a custom datatype, just use it directly */
else {
- if(H5I_inc_ref(type_id)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment datatype ID")
+ if(H5I_inc_ref(type_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment datatype ID")
/* Use existing datatype */
dset->shared->type_id = type_id;
@@ -1164,13 +1097,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_update_entry_info
- *
- * Purpose: Create and fill an H5G_entry_t object for insertion into
- * the group LOC.
+ * Function: H5D_update_oh_info
*
- * This code was originally found at the end of H5D_create()
- * but was placed here for general use.
+ * Purpose: Create and fill object header for dataset
*
* Return: Success: SUCCEED
* Failure: FAIL
@@ -1181,113 +1110,84 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
+H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
{
+ struct H5O_t *oh = NULL; /* Pointer to dataset's object header */
size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */
+ unsigned oh_flags = H5AC__DIRTIED_FLAG;
H5O_loc_t *oloc = NULL; /* Dataset's object location */
H5O_layout_t *layout; /* Dataset's layout information */
H5T_t *type; /* Dataset's datatype */
- H5D_alloc_time_t alloc_time; /* Dataset's allocation time */
- H5O_efl_t *efl; /* Dataset's external file list */
- H5P_genplist_t *dc_plist = NULL; /* Dataset's creation property list */
hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
-
- /* fill value variables */
- H5D_fill_time_t fill_time;
H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- H5O_fill_new_t fill; /* Default fill value */
- H5D_fill_value_t fill_status;
-
- struct H5O_t *oh = NULL; /* Pointer to dataset's object header */
- unsigned oh_flags = H5AC__DIRTIED_FLAG;
+ H5D_fill_value_t fill_status; /* Fill value status */
+ hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_update_entry_info, FAIL)
+ FUNC_ENTER_NOAPI(H5D_update_oh_info, FAIL)
/* Sanity checking */
HDassert(file);
HDassert(dset);
- /* Portably initialize the fill value */
- HDmemset(&fill, 0, sizeof(H5O_fill_new_t));
- fill.alloc_time = H5D_ALLOC_TIME_LATE;
- fill.fill_time = H5D_FILL_TIME_ALLOC;
- fill.fill_defined = TRUE;
-
- /* Set some location variables, for convenience */
+ /* Set some local variables, for convenience */
oloc = &dset->oloc;
layout = &dset->shared->layout;
type = dset->shared->type;
- alloc_time = dset->shared->alloc_time;
- efl = &dset->shared->efl;
+ fill_prop = &dset->shared->dcpl_cache.fill;
/* Get the file's 'use the latest version of the format' flag */
use_latest_format = H5F_USE_LATEST_FORMAT(file);
- /* Point at dataset's copy, to cache it for later */
- fill_prop = &dset->shared->fill;
- fill_time = dset->shared->fill_time;
-
- /* Check if dataset has non-default creation property list */
- if(dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
- /* Get new dataset's property list object */
- if (NULL == (dc_plist = H5I_object(dset->shared->dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
-
- /*
- * Retrieve properties of fill value and others. Copy them into new fill
- * value struct.
- */
- if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time")
- dset->shared->fill_time=fill_time; /* Cache this for later */
-
- /* Get the fill value information from the property list */
- if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value")
- } /* end if */
-
+ /* Retrieve "defined" status of fill value */
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* Special case handling for variable-length types */
if(H5T_detect_class(type, H5T_VLEN)) {
/* If the default fill value is chosen for variable-length types, always write it */
- if(fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_DEFAULT) {
- dset->shared->fill_time = fill_time = H5D_FILL_TIME_ALLOC;
-
+ if(fill_prop->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_DEFAULT) {
/* Update dataset creation property */
- HDassert(dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT);
- if(H5P_set(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill time")
+ fill_prop->fill_time = H5D_FILL_TIME_ALLOC;
+
+ /* Note that the fill value changed */
+ fill_changed = TRUE;
} /* end if */
/* Don't allow never writing fill values with variable-length types */
- if(fill_time == H5D_FILL_TIME_NEVER)
+ if(fill_prop->fill_time == H5D_FILL_TIME_NEVER)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Dataset doesn't support VL datatype when fill value is not defined")
} /* end if */
+ /* Determine whether fill value is defined or not */
if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
- if(H5O_msg_copy(H5O_FILL_ID, fill_prop, &fill) == NULL)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to copy fill value")
-
- if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(&fill, type, dxpl_id) < 0)
+ /* Convert fill value buffer to dataset's datatype */
+ if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type")
- fill.fill_defined = TRUE;
- } else if (fill_status == H5D_FILL_VALUE_UNDEFINED) {
- fill.size = -1;
- fill.type = fill.buf = NULL;
- fill.fill_defined = FALSE;
+ fill_prop->fill_defined = TRUE;
+ } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) {
+ fill_prop->fill_defined = FALSE;
} else
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined")
- fill.alloc_time = alloc_time;
- fill.fill_time = fill_time;
-
/* Check for invalid fill & allocation time setting */
- if(fill.fill_defined == FALSE && fill_time == H5D_FILL_TIME_ALLOC)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to create dataset")
+ if(fill_prop->fill_defined == FALSE && fill_prop->fill_time == H5D_FILL_TIME_ALLOC)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "fill value writing on allocation set, but no fill value defined")
+
+ /* Check if the fill value info changed */
+ if(fill_changed) {
+ H5P_genplist_t *dc_plist; /* Dataset's creation property list */
+
+ /* Get dataset's property list object */
+ HDassert(dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT);
+ if(NULL == (dc_plist = H5I_object(dset->shared->dcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
+
+ /* Update dataset creation property */
+ if(H5P_set(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info")
+ } /* end if */
/* Add the dataset's raw data size to the size of the header, if the raw data will be stored as compact */
if(layout->type == H5D_COMPACT)
@@ -1302,28 +1202,15 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to protect dataset object header")
/* Write new fill value message */
- if(H5O_msg_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &fill, &oh_flags) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, update it */
/* (only if we aren't trying to write the latest version of the file format) */
- if(fill.buf && !use_latest_format) {
- /* Clear any previous values */
- if(H5O_msg_reset(H5O_FILL_ID, fill_prop)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
-
- /* Copy new fill value information to old fill value struct */
- if(H5O_msg_copy(H5O_FILL_ID, &fill, fill_prop) == NULL)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL,"unable to copy fill value")
-
+ if(fill_prop->buf && !use_latest_format) {
/* Write old fill value */
- if(fill_prop->buf && H5O_msg_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop, &oh_flags) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
-
- /* Update dataset creation property */
- HDassert(dset->shared->dcpl_id!=H5P_DATASET_CREATE_DEFAULT);
- if(H5P_set(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value")
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message")
} /* end if */
/* Update the type and space header messages */
@@ -1333,32 +1220,32 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
/* Update the filters message, if this is a chunked dataset */
if(layout->type == H5D_CHUNKED) {
- H5O_pline_t pline; /* Chunked data I/O pipeline info */
-
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve pipeline filter")
+ H5O_pline_t *pline; /* Dataset's I/O pipeline information */
- if(pline.nused > 0 && H5O_msg_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, &pline, &oh_flags) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
+ pline = &dset->shared->dcpl_cache.pline;
+ if(pline->nused > 0 && H5O_msg_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
/*
* Allocate storage if space allocate time is early; otherwise delay
* allocation until later.
*/
- if (alloc_time == H5D_ALLOC_TIME_EARLY)
- if (H5D_alloc_storage(file, dxpl_id, dset, H5D_ALLOC_CREATE, FALSE, FALSE) < 0)
+ if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY)
+ if(H5D_alloc_storage(file, dxpl_id, dset, H5D_ALLOC_CREATE, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
- /* Update external storage message */
- if(efl->nused > 0) {
+ /* Update external storage message, if it's used */
+ if(dset->shared->dcpl_cache.efl.nused > 0) {
+ H5O_efl_t *efl = &dset->shared->dcpl_cache.efl; /* Dataset's external file list */
size_t heap_size = H5HL_ALIGN(1);
size_t u;
- for (u = 0; u < efl->nused; ++u)
+ /* Determine size of heap needed to stored the file names */
+ for(u = 0; u < efl->nused; ++u)
heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1);
- if (H5HL_create(file, dxpl_id, heap_size, &efl->heap_addr/*out*/) < 0 ||
+ if(H5HL_create(file, dxpl_id, heap_size, &efl->heap_addr/*out*/) < 0 ||
H5HL_insert(file, dxpl_id, efl->heap_addr, (size_t)1, "") == (size_t)(-1))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create external file list name heap")
@@ -1366,9 +1253,9 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
size_t offset = H5HL_insert(file, dxpl_id, efl->heap_addr,
HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name);
- assert(0 == efl->slot[u].name_offset);
+ HDassert(0 == efl->slot[u].name_offset);
- if (offset == (size_t)(-1))
+ if(offset == (size_t)(-1))
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to insert URL into name heap")
efl->slot[u].name_offset = offset;
@@ -1380,8 +1267,8 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
/* Create layout message */
/* (Don't make layout message constant unless allocation time is early, since space may not be allocated) */
- /* Note: this is relying on H5D_alloc_storage not calling H5O_msg_write during dataset creation */
- if(H5O_msg_append(file, dxpl_id, oh, H5O_LAYOUT_ID, ((alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout, &oh_flags) < 0)
+ /* (Note: this is relying on H5D_alloc_storage not calling H5O_msg_write during dataset creation) */
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_LAYOUT_ID, ((fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout, &oh_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
#ifdef H5O_ENABLE_BOGUS
@@ -1397,17 +1284,13 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
done:
- /* Release fill value information */
- if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release fill-value info")
-
/* Release pointer to object header itself */
if(oloc != NULL && oh != NULL)
if(H5O_unprotect(oloc, oh, dxpl_id, oh_flags) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to unprotect dataset object header")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_update_entry_info() */
+} /* end H5D_update_oh_info() */
/*-------------------------------------------------------------------------
@@ -1437,12 +1320,12 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
const H5T_t *type; /* Datatype for dataset */
H5D_t *new_dset = NULL;
int i, ndims;
- unsigned u;
unsigned chunk_ndims = 0; /* Dimensionality of chunk */
- H5P_genplist_t *dc_plist=NULL; /* New Property list */
- hbool_t has_vl_type=FALSE; /* Flag to indicate a VL-type for dataset */
- hbool_t chunk_init=FALSE; /* Flag to indicate that chunk information was initialized */
+ H5P_genplist_t *dc_plist = NULL; /* New Property list */
+ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */
+ hbool_t chunk_init = FALSE; /* Flag to indicate that chunk information was initialized */
H5G_loc_t dset_loc; /* Dataset location */
+ unsigned u; /* Local index variable */
H5D_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5D_create, NULL)
@@ -1455,11 +1338,11 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
HDassert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
/* Get the dataset's datatype */
- if (NULL == (type = H5I_object(type_id)))
+ if(NULL == (type = H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
/* Check if the datatype is "sensible" for use in a dataset */
- if(H5T_is_sensible(type)!=TRUE)
+ if(H5T_is_sensible(type) != TRUE)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible")
/* Check if the datatype is/contains a VL-type */
@@ -1467,12 +1350,12 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
has_vl_type=TRUE;
/* Check if the dataspace has an extent set (or is NULL) */
- if( !(H5S_has_extent(space)) )
+ if(!(H5S_has_extent(space)) )
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "dataspace extent has not been set.")
/* Initialize the dataset object */
- if (NULL==(new_dset = H5FL_CALLOC(H5D_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (new_dset = H5FL_CALLOC(H5D_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set up & reset dataset location */
dset_loc.oloc = &(new_dset->oloc);
@@ -1480,15 +1363,15 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
H5G_loc_reset(&dset_loc);
/* Initialize the shared dataset space */
- if(NULL == (new_dset->shared = H5D_new(dcpl_id,TRUE,has_vl_type)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (new_dset->shared = H5D_new(dcpl_id, TRUE, has_vl_type)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy datatype for dataset */
- if(H5D_init_type(file, new_dset, type_id, type)<0)
+ 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)
+ 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 */
@@ -1499,45 +1382,46 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy dataspace")
/* Set the dataset's dataspace to 'all' selection */
- if(H5S_select_all(new_dset->shared->space,1)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
+ 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)
+ 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 */
- H5O_pline_t dcpl_pline; /* Dataset's I/O pipeline information */
- H5D_alloc_time_t alloc_time; /* Dataset's allocation time */
+ if(new_dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
+ H5D_layout_t *layout; /* Dataset's layout information */
+ H5O_pline_t *pline; /* Dataset's I/O pipeline information */
+ H5O_fill_t *fill; /* Dataset's fill value info */
/* Get new dataset's property list object */
- if (NULL == (dc_plist = H5I_object(new_dset->shared->dcpl_id)))
+ if(NULL == (dc_plist = H5I_object(new_dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list")
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &dcpl_pline) < 0)
+ /* Retrieve the properties we need */
+ pline = &new_dset->shared->dcpl_cache.pline;
+ if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter")
- if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
+ layout = &new_dset->shared->layout.type;
+ if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout")
- if(dcpl_pline.nused > 0 && H5D_CHUNKED != dcpl_layout)
+ if(pline->nused > 0 && H5D_CHUNKED != *layout)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout")
- if(H5P_get(dc_plist, H5D_CRT_ALLOC_TIME_NAME, &alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve space allocation time")
+ fill = &new_dset->shared->dcpl_cache.fill;
+ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve fill value info")
/* Check if the alloc_time is the default and error out */
- if(alloc_time==H5D_ALLOC_TIME_DEFAULT)
+ if(fill->alloc_time == H5D_ALLOC_TIME_DEFAULT)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "invalid space allocation state")
/* Don't allow compact datasets to allocate space later */
- if(dcpl_layout==H5D_COMPACT && alloc_time!=H5D_ALLOC_TIME_EARLY)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset doesn't support late space allocation")
-
- /* Set the alloc_time for the dataset, in case the default was used */
- new_dset->shared->alloc_time=alloc_time;
+ if(*layout == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
/* If MPI VFD is used, no filter support yet. */
- if(IS_H5FD_MPI(file) && dcpl_pline.nused > 0)
+ if(IS_H5FD_MPI(file) && pline->nused > 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet")
/* Chunked datasets are non-default, so retrieve their info here */
@@ -1545,18 +1429,15 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve chunk dimensions")
/* Get the dataset's external file list information */
- if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->shared->efl) < 0)
+ if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->shared->dcpl_cache.efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve external file list")
-
- /* Set the dataset's data storage method */
- new_dset->shared->layout.type=dcpl_layout;
} /* end if */
/* Check if this dataset is going into a parallel file and set space allocation time */
if(IS_H5FD_MPI(file))
- new_dset->shared->alloc_time=H5D_ALLOC_TIME_EARLY;
+ new_dset->shared->dcpl_cache.fill.alloc_time = H5D_ALLOC_TIME_EARLY;
- switch (new_dset->shared->layout.type) {
+ switch(new_dset->shared->layout.type) {
case H5D_CONTIGUOUS:
{
hssize_t tmp_size; /* Temporary holder for raw data size */
@@ -1570,41 +1451,40 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
*/
new_dset->shared->layout.u.contig.addr = HADDR_UNDEF; /* Initialize to no address */
- if ((ndims=H5S_get_simple_extent_dims(new_dset->shared->space, dim, max_dim))<0)
+ if((ndims = H5S_get_simple_extent_dims(new_dset->shared->space, dim, max_dim)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize contiguous storage")
- for (i=1; i<ndims; i++)
- if (max_dim[i]>dim[i])
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "only the first dimension can be extendible")
- if (new_dset->shared->efl.nused>0) {
- hsize_t max_points = H5S_get_npoints_max (new_dset->shared->space);
- hsize_t max_storage = H5O_efl_total_size (&new_dset->shared->efl);
-
- if (H5S_UNLIMITED==max_points) {
- if (H5O_EFL_UNLIMITED!=max_storage)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "unlimited data space but finite storage")
- } else if (max_points * H5T_get_size (type) < max_points) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "data space * type size overflowed")
- } else if (max_points * H5T_get_size (type) > max_storage) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "data space size exceeds external storage size")
+ for(i = 1; i < ndims; i++)
+ if(max_dim[i] > dim[i])
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "only the first dimension can be extendible")
+ if(new_dset->shared->dcpl_cache.efl.nused > 0) {
+ hsize_t max_points = H5S_get_npoints_max(new_dset->shared->space);
+ hsize_t max_storage = H5O_efl_total_size(&new_dset->shared->dcpl_cache.efl);
+
+ if(H5S_UNLIMITED == max_points) {
+ if(H5O_EFL_UNLIMITED != max_storage)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unlimited data space but finite storage")
+ } else if(max_points * H5T_get_size(type) < max_points) {
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "data space * type size overflowed")
+ } else if(max_points * H5T_get_size(type) > max_storage) {
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "data space size exceeds external storage size")
}
/* Set the I/O functions for this layout type */
- new_dset->shared->io_ops.readvv=H5D_efl_readvv;
- new_dset->shared->io_ops.writevv=H5D_efl_writevv;
+ new_dset->shared->io_ops.readvv = H5D_efl_readvv;
+ new_dset->shared->io_ops.writevv = H5D_efl_writevv;
} /* end if */
else {
- if (ndims>0 && max_dim[0]>dim[0])
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "extendible contiguous non-external dataset")
+ if(ndims > 0 && max_dim[0] > dim[0])
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "extendible contiguous non-external dataset")
/* Set the I/O functions for this layout type */
- new_dset->shared->io_ops.readvv=H5D_contig_readvv;
- new_dset->shared->io_ops.writevv=H5D_contig_writevv;
+ new_dset->shared->io_ops.readvv = H5D_contig_readvv;
+ new_dset->shared->io_ops.writevv = H5D_contig_writevv;
} /* end else */
/* Compute the total size of a chunk */
- tmp_size = H5S_GET_EXTENT_NPOINTS(new_dset->shared->space) *
- H5T_get_size(new_dset->shared->type);
- H5_ASSIGN_OVERFLOW(new_dset->shared->layout.u.contig.size,tmp_size,hssize_t,hsize_t);
+ tmp_size = H5S_GET_EXTENT_NPOINTS(new_dset->shared->space) * H5T_get_size(new_dset->shared->type);
+ H5_ASSIGN_OVERFLOW(new_dset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t);
/* Get the sieve buffer size for this dataset */
new_dset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(file);
@@ -1616,12 +1496,13 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */
/* Set up layout information */
- if((ndims=H5S_GET_EXTENT_NDIMS(new_dset->shared->space))<0)
+ if((ndims = H5S_GET_EXTENT_NDIMS(new_dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get rank")
new_dset->shared->layout.u.chunk.ndims = (unsigned)ndims + 1;
- assert((unsigned)(new_dset->shared->layout.u.chunk.ndims) <= NELMTS(new_dset->shared->layout.u.chunk.dim));
+ HDassert((unsigned)(new_dset->shared->layout.u.chunk.ndims) <= NELMTS(new_dset->shared->layout.u.chunk.dim));
- new_dset->shared->layout.u.chunk.addr = HADDR_UNDEF; /* Initialize to no address */
+ /* Initialize to no address */
+ new_dset->shared->layout.u.chunk.addr = HADDR_UNDEF;
/*
* Chunked storage allows any type of data space extension, so we
@@ -1629,8 +1510,8 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
*/
if(chunk_ndims != (unsigned)ndims)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "dimensionality of chunks doesn't match the data space")
- if (new_dset->shared->efl.nused>0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, "external storage not supported with chunked layout")
+ if(new_dset->shared->dcpl_cache.efl.nused > 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "external storage not supported with chunked layout")
/*
* The chunk size of a dimension with a fixed size cannot exceed
@@ -1640,26 +1521,26 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve chunk size")
new_dset->shared->layout.u.chunk.dim[new_dset->shared->layout.u.chunk.ndims-1] = H5T_get_size(new_dset->shared->type);
- if (H5S_get_simple_extent_dims(new_dset->shared->space, NULL, max_dim)<0)
+ if(H5S_get_simple_extent_dims(new_dset->shared->space, NULL, max_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to query maximum dimensions")
- for (u=0; u<new_dset->shared->layout.u.chunk.ndims-1; u++)
+ for(u = 0; u < new_dset->shared->layout.u.chunk.ndims - 1; u++)
if(max_dim[u] != H5S_UNLIMITED && max_dim[u] < new_dset->shared->layout.u.chunk.dim[u])
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "chunk size must be <= maximum dimension size for fixed-sized dimensions")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "chunk size must be <= maximum dimension size for fixed-sized dimensions")
/* Compute the total size of a chunk */
- for (u=1, new_dset->shared->layout.u.chunk.size=new_dset->shared->layout.u.chunk.dim[0]; u<new_dset->shared->layout.u.chunk.ndims; u++)
+ for(u = 1, new_dset->shared->layout.u.chunk.size = new_dset->shared->layout.u.chunk.dim[0]; u < new_dset->shared->layout.u.chunk.ndims; u++)
new_dset->shared->layout.u.chunk.size *= new_dset->shared->layout.u.chunk.dim[u];
/* Set the I/O functions for this layout type */
- new_dset->shared->io_ops.readvv=H5D_istore_readvv;
- new_dset->shared->io_ops.writevv=H5D_istore_writevv;
+ new_dset->shared->io_ops.readvv = H5D_istore_readvv;
+ new_dset->shared->io_ops.writevv = H5D_istore_writevv;
/* Initialize the chunk cache for the dataset */
- if(H5D_istore_init(file,new_dset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize chunk cache")
+ if(H5D_istore_init(file, new_dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize chunk cache")
/* Indicate that the chunk information was initialized */
- chunk_init=TRUE;
+ chunk_init = TRUE;
} /* end case */
break;
@@ -1672,20 +1553,19 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
* Compact dataset is stored in dataset object header message of
* layout.
*/
- tmp_size = H5S_GET_EXTENT_NPOINTS(space) *
- H5T_get_size(new_dset->shared->type);
- H5_ASSIGN_OVERFLOW(new_dset->shared->layout.u.compact.size,tmp_size,hssize_t,size_t);
+ tmp_size = H5S_GET_EXTENT_NPOINTS(space) * H5T_get_size(new_dset->shared->type);
+ H5_ASSIGN_OVERFLOW(new_dset->shared->layout.u.compact.size, tmp_size, hssize_t, size_t);
/* Verify data size is smaller than maximum header message size
* (64KB) minus other layout message fields.
*/
- comp_data_size=H5O_MESG_MAX_SIZE-H5O_layout_meta_size(file, &(new_dset->shared->layout));
+ comp_data_size = H5O_MESG_MAX_SIZE - H5O_layout_meta_size(file, &(new_dset->shared->layout));
if(new_dset->shared->layout.u.compact.size > comp_data_size)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "compact dataset size is bigger than header message maximum size")
/* Set the I/O functions for this layout type */
- new_dset->shared->io_ops.readvv=H5D_compact_readvv;
- new_dset->shared->io_ops.writevv=H5D_compact_writevv;
+ new_dset->shared->io_ops.readvv = H5D_compact_readvv;
+ new_dset->shared->io_ops.writevv = H5D_compact_writevv;
} /* end case */
break;
@@ -1693,14 +1573,10 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space,
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet")
} /* end switch */ /*lint !e788 All appropriate cases are covered */
- /* Update the dataset's entry info. */
- if(H5D_update_entry_info(file, dxpl_id, new_dset) != SUCCEED)
+ /* Update the dataset's object header info. */
+ if(H5D_update_oh_info(file, dxpl_id, new_dset) != SUCCEED)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache")
- /* Get the dataset's DCPL cache info */
- if (H5D_get_dcpl_cache(new_dset->shared->dcpl_id,&new_dset->shared->dcpl_cache)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't fill DCPL cache")
-
/* Add the dataset to the list of opened objects in the file */
if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count")
@@ -1782,11 +1658,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dxpl_id)
/* Shallow copy (take ownership) of the object location object */
if(H5O_loc_copy(&(dataset->oloc), loc->oloc, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
if(H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
/* Check if dataset was already open */
if((shared_fo = H5FO_opened(dataset->oloc.file, dataset->oloc.addr)) == NULL) {
@@ -1864,27 +1740,20 @@ done:
static herr_t
H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
{
- H5O_fill_new_t fill; /* Default fill value */
- unsigned alloc_time_state; /* Allocation time state */
- H5O_fill_t *fill_prop; /* Pointer to dataset's fill value area */
- H5O_pline_t pline; /* I/O pipeline information */
H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_pline_t *pline; /* I/O pipeline information */
+ H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */
+ unsigned alloc_time_state; /* Allocation time state */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_open_oid)
/* check args */
HDassert(dataset);
- /* Portably initialize the fill value */
- HDmemset(&fill, 0, sizeof(H5O_fill_new_t));
- fill.alloc_time = H5D_ALLOC_TIME_LATE;
- fill.fill_time = H5D_FILL_TIME_ALLOC;
- fill.fill_defined = TRUE;
-
/* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */
if(NULL == (dataset->shared = H5D_new(H5P_DATASET_CREATE_DEFAULT, FALSE, FALSE)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Open the dataset object */
if(H5O_open(&(dataset->oloc)) < 0)
@@ -1893,24 +1762,25 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
/* Get the type and space */
if(NULL == (dataset->shared->type = H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, 0, NULL, dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header")
- /* Get a datatype ID for the dataset's datatype */
- if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type))<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
-
if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load space info from dataset header")
+ /* Get a datatype ID for the dataset's datatype */
+ if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
+
/* Get dataset creation property list object */
if(NULL == (plist = H5I_object(dataset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Get the optional filters message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, 0, &pline, dxpl_id)) {
- H5E_clear_stack(NULL);
- HDmemset(&pline, 0, sizeof(pline));
+ pline = &dataset->shared->dcpl_cache.pline;
+ if(NULL != H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, 0, pline, dxpl_id)) {
+ if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline")
} /* end if */
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline")
+ else
+ H5E_clear_stack(NULL);
/*
* Get the raw data layout info. It's actually stored in two locations:
@@ -1922,23 +1792,22 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout.type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
- switch (dataset->shared->layout.type) {
+ switch(dataset->shared->layout.type) {
case H5D_CONTIGUOUS:
/* Compute the size of the contiguous storage for versions of the
* layout message less than version 3 because versions 1 & 2 would
* truncate the dimension sizes to 32-bits of information. - QAK 5/26/04
*/
- if(dataset->shared->layout.version<3) {
+ if(dataset->shared->layout.version < 3) {
hssize_t tmp_size; /* Temporary holder for raw data size */
- tmp_size = H5S_GET_EXTENT_NPOINTS(dataset->shared->space) *
- H5T_get_size(dataset->shared->type);
- H5_ASSIGN_OVERFLOW(dataset->shared->layout.u.contig.size,tmp_size,hssize_t,hsize_t);
+ tmp_size = H5S_GET_EXTENT_NPOINTS(dataset->shared->space) * H5T_get_size(dataset->shared->type);
+ H5_ASSIGN_OVERFLOW(dataset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t);
} /* end if */
/* Set the I/O functions for this layout type */
- dataset->shared->io_ops.readvv=H5D_contig_readvv;
- dataset->shared->io_ops.writevv=H5D_contig_writevv;
+ dataset->shared->io_ops.readvv = H5D_contig_readvv;
+ dataset->shared->io_ops.writevv = H5D_contig_writevv;
/* Get the sieve buffer size for this dataset */
dataset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(dataset->oloc.file);
@@ -1961,19 +1830,19 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk size")
/* Initialize the chunk cache for the dataset */
- if(H5D_istore_init(dataset->oloc.file, dataset)<0)
+ if(H5D_istore_init(dataset->oloc.file, dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize chunk cache")
}
/* Set the I/O functions for this layout type */
- dataset->shared->io_ops.readvv=H5D_istore_readvv;
- dataset->shared->io_ops.writevv=H5D_istore_writevv;
+ dataset->shared->io_ops.readvv = H5D_istore_readvv;
+ dataset->shared->io_ops.writevv = H5D_istore_writevv;
break;
case H5D_COMPACT:
/* Set the I/O functions for this layout type */
- dataset->shared->io_ops.readvv=H5D_compact_readvv;
- dataset->shared->io_ops.writevv=H5D_compact_writevv;
+ dataset->shared->io_ops.readvv = H5D_compact_readvv;
+ dataset->shared->io_ops.writevv = H5D_compact_writevv;
break;
default:
@@ -1981,86 +1850,65 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Point at dataset's copy, to cache it for later */
- fill_prop=&dataset->shared->fill;
+ fill_prop = &dataset->shared->dcpl_cache.fill;
- /* Retrieve & release the previous fill-value settings */
- if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't get fill value")
- if(H5O_msg_reset(H5O_FILL_ID, fill_prop)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
-
- /* Get the new fill value message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, 0, &fill, dxpl_id)) {
+ /* Try to get the new fill value message from the object header */
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, 0, fill_prop, dxpl_id)) {
H5E_clear_stack(NULL);
- HDmemset(&fill, 0, sizeof(fill));
- /* Set the space allocation time appropriately, based on the type of dataset storage */
- switch (dataset->shared->layout.type) {
- case H5D_COMPACT:
- fill.alloc_time=H5D_ALLOC_TIME_EARLY;
- break;
+ /* For backward compatibility, try to retrieve the old fill value message */
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, 0, fill_prop, dxpl_id)) {
+ H5E_clear_stack(NULL);
- case H5D_CONTIGUOUS:
- fill.alloc_time=H5D_ALLOC_TIME_LATE;
- break;
+ /* Set the space allocation time appropriately, based on the type of dataset storage */
+ switch(dataset->shared->layout.type) {
+ case H5D_COMPACT:
+ fill_prop->alloc_time = H5D_ALLOC_TIME_EARLY;
+ break;
- case H5D_CHUNKED:
- fill.alloc_time=H5D_ALLOC_TIME_INCR;
- break;
+ case H5D_CONTIGUOUS:
+ fill_prop->alloc_time = H5D_ALLOC_TIME_LATE;
+ break;
- default:
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet")
- } /* end switch */ /*lint !e788 All appropriate cases are covered */
+ case H5D_CHUNKED:
+ fill_prop->alloc_time = H5D_ALLOC_TIME_INCR;
+ break;
- /* Set the default fill time */
- fill.fill_time = H5D_FILL_TIME_IFSET;
- } /* end if */
- if(fill.fill_defined) {
- if(NULL==H5O_msg_copy(H5O_FILL_ID, &fill, fill_prop))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't copy fill value")
- } else {
- /* For compatibility with v1.4. Retrieve the old fill value message.
- * If size is 0, make it -1 for undefined. */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, 0, fill_prop, dxpl_id)) {
- H5E_clear_stack(NULL);
- HDmemset(fill_prop, 0, sizeof(H5O_fill_t));
+ default:
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet")
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
} /* end if */
- if(fill_prop->size == 0) {
- fill_prop->type = fill_prop->buf = NULL;
+
+ /* If size is 0, make it -1 for undefined. */
+ if(fill_prop->size == 0)
fill_prop->size = (size_t)-1;
- } /* end if */
- } /* end else */
- alloc_time_state=0;
- if( (dataset->shared->layout.type==H5D_COMPACT && fill.alloc_time==H5D_ALLOC_TIME_EARLY)
- || (dataset->shared->layout.type==H5D_CONTIGUOUS && fill.alloc_time==H5D_ALLOC_TIME_LATE)
- || (dataset->shared->layout.type==H5D_CHUNKED && fill.alloc_time==H5D_ALLOC_TIME_INCR))
- alloc_time_state=1;
+ } /* end if */
+ alloc_time_state = 0;
+ if((dataset->shared->layout.type == H5D_COMPACT && fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY)
+ || (dataset->shared->layout.type == H5D_CONTIGUOUS && fill_prop->alloc_time == H5D_ALLOC_TIME_LATE)
+ || (dataset->shared->layout.type == H5D_CHUNKED && fill_prop->alloc_time == H5D_ALLOC_TIME_INCR))
+ alloc_time_state = 1;
/* Set revised fill value properties */
if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set fill value")
- dataset->shared->alloc_time=fill.alloc_time; /* Cache this for later */
- if(H5P_set(plist, H5D_CRT_ALLOC_TIME_NAME, &fill.alloc_time) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set allocation time")
if(H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set allocation time state")
- dataset->shared->fill_time=fill.fill_time; /* Cache this for later */
- if(H5P_set(plist, H5D_CRT_FILL_TIME_NAME, &fill.fill_time) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set fill time")
/* Get the external file list message, which might not exist. Space is
* also undefined when space allocate time is H5D_ALLOC_TIME_LATE. */
- if((dataset->shared->layout.type==H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) {
- HDmemset(&dataset->shared->efl,0,sizeof(H5O_efl_t));
- if(NULL != H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, 0, &dataset->shared->efl, dxpl_id)) {
- if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->efl) < 0)
+ if((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) {
+ if(NULL != H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, 0, &dataset->shared->dcpl_cache.efl, dxpl_id)) {
+ if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list")
/* Override the I/O functions for this layout type */
- dataset->shared->io_ops.readvv=H5D_efl_readvv;
- dataset->shared->io_ops.writevv=H5D_efl_writevv;
+ dataset->shared->io_ops.readvv = H5D_efl_readvv;
+ dataset->shared->io_ops.writevv = H5D_efl_writevv;
} /* end if */
+ else
+ H5E_clear_stack(NULL);
} /* end if */
/*
@@ -2069,22 +1917,14 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
* be fully allocated before I/O can happen.
*/
if((H5F_get_intent(dataset->oloc.file) & H5F_ACC_RDWR)
- && ((dataset->shared->layout.type==H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
+ && ((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
&& IS_H5FD_MPI(dataset->oloc.file)) {
- if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset,H5D_ALLOC_OPEN, TRUE, FALSE)<0)
+ if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset, H5D_ALLOC_OPEN, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage")
} /* end if */
- /* Get the dataset's DCPL cache info */
- if(H5D_get_dcpl_cache(dataset->shared->dcpl_id,&dataset->shared->dcpl_cache)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill DCPL cache")
-
done:
- /* Release fill value information */
- if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release fill-value info")
-
if(ret_value < 0) {
if(H5F_addr_defined(dataset->oloc.addr)) {
if(H5O_close(&(dataset->oloc)) < 0)
@@ -2121,14 +1961,14 @@ done:
herr_t
H5D_close(H5D_t *dataset)
{
- unsigned free_failed=FALSE;
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned free_failed = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_close, FAIL)
/* check args */
- assert(dataset && dataset->oloc.file && dataset->shared);
- assert(dataset->shared->fo_count >0);
+ HDassert(dataset && dataset->oloc.file && dataset->shared);
+ HDassert(dataset->shared->fo_count >0);
/* Dump debugging info */
#ifdef H5D_ISTORE_DEBUG
@@ -2136,21 +1976,20 @@ H5D_close(H5D_t *dataset)
#endif /* H5F_ISTORE_DEBUG */
dataset->shared->fo_count--;
- if(dataset->shared->fo_count ==0)
- {
+ if(dataset->shared->fo_count == 0) {
/* Free the data sieve buffer, if it's been allocated */
if(dataset->shared->cache.contig.sieve_buf) {
- assert(dataset->shared->layout.type!=H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
+ HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
/* Flush the raw data buffer, if its dirty */
- if (dataset->shared->cache.contig.sieve_dirty) {
+ if(dataset->shared->cache.contig.sieve_dirty) {
/* Write dirty data sieve buffer to file */
- if (H5F_block_write(dataset->oloc.file, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
+ if(H5F_block_write(dataset->oloc.file, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
dataset->shared->cache.contig.sieve_size, H5AC_dxpl_id, dataset->shared->cache.contig.sieve_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
- dataset->shared->cache.contig.sieve_dirty=0;
+ dataset->shared->cache.contig.sieve_dirty = FALSE;
} /* end if */
dataset->shared->cache.contig.sieve_buf = H5FL_BLK_FREE (sieve_buf,dataset->shared->cache.contig.sieve_buf);
@@ -2163,7 +2002,7 @@ H5D_close(H5D_t *dataset)
case H5D_CHUNKED:
/* Flush and destroy chunks in the cache */
- if(H5D_istore_dest(dataset,H5AC_dxpl_id)<0)
+ if(H5D_istore_dest(dataset,H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache")
break;
@@ -2176,13 +2015,13 @@ H5D_close(H5D_t *dataset)
} /* end if */
/* Free the buffer for the raw data for compact datasets */
- dataset->shared->layout.u.compact.buf=H5MM_xfree(dataset->shared->layout.u.compact.buf);
+ dataset->shared->layout.u.compact.buf = H5MM_xfree(dataset->shared->layout.u.compact.buf);
break;
default:
- assert ("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
#ifdef NDEBUG
- HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
+ HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
@@ -2190,7 +2029,7 @@ H5D_close(H5D_t *dataset)
* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
- free_failed=(H5I_dec_ref(dataset->shared->type_id)<0 || H5S_close(dataset->shared->space)<0 ||
+ free_failed = (H5I_dec_ref(dataset->shared->type_id) < 0 || H5S_close(dataset->shared->space) < 0 ||
H5I_dec_ref(dataset->shared->dcpl_id) < 0);
/* Remove the dataset from the list of opened objects in the file */
@@ -2205,17 +2044,16 @@ H5D_close(H5D_t *dataset)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header")
/*
- * Free memory. Before freeing the memory set the file pointer to NULL.
- * We always check for a null file pointer in other H5D functions to be
- * sure we're not accessing an already freed dataset (see the assert()
- * above).
- */
+ * Free memory. Before freeing the memory set the file pointer to NULL.
+ * We always check for a null file pointer in other H5D functions to be
+ * sure we're not accessing an already freed dataset (see the HDassert()
+ * above).
+ */
dataset->oloc.file = NULL;
- H5FL_FREE(H5D_shared_t,dataset->shared);
+ H5FL_FREE(H5D_shared_t, dataset->shared);
} /* end if */
- else
- {
+ else {
/* Decrement the ref. count for this object in the top file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
@@ -2226,17 +2064,20 @@ H5D_close(H5D_t *dataset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close")
} /* end else */
+ /* Release the dataset's path info */
if(H5G_name_free(&(dataset->path)) < 0)
- free_failed=TRUE;
+ free_failed = TRUE;
- H5FL_FREE(H5D_t,dataset);
+ /* Free the dataset's memory structure */
+ H5FL_FREE(H5D_t, dataset);
- if (free_failed)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free the type or creation property list, but the dataset was freed anyway.")
+ /* Check if anything failed in the middle... */
+ if(free_failed)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free a component of the dataset, but the dataset was freed anyway.")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5D_close() */
/*-------------------------------------------------------------------------
@@ -2252,45 +2093,43 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_extend (H5D_t *dataset, const hsize_t *size, hid_t dxpl_id)
+H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id)
{
- int changed; /* Flag to indicate that the dataspace was successfully extended */
- H5S_t *space = NULL; /* Dataset's dataspace */
- H5D_fill_value_t fill_status;
- H5D_fill_time_t fill_time;
- herr_t ret_value=SUCCEED; /* Return value */
+ htri_t changed; /* Flag to indicate that the dataspace was successfully extended */
+ H5S_t *space; /* Dataset's dataspace */
+ H5O_fill_t *fill; /* Dataset's fill value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_extend, FAIL)
/* Check args */
- assert (dataset);
- assert (size);
+ HDassert(dataset);
+ HDassert(size);
/* Check if the filters in the DCPL will need to encode, and if so, can they?
* Filters need encoding if fill value is defined and a fill policy is set that requires
* writing on an extend.
*/
- if(! dataset->shared->checked_filters)
- {
- if(H5P_is_fill_value_defined(&(dataset->shared->fill), &fill_status) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Couldn't retrieve fill value from dataset.")
+ fill = &dataset->shared->dcpl_cache.fill;
+ if(!dataset->shared->checked_filters) {
+ H5D_fill_value_t fill_status; /* Whether the fill value is defined */
- if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED)
- {
- if( H5Pget_fill_time(dataset->shared->dcpl_id, &fill_time) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Couldn't retrieve fill time from dataset.")
+ /* Retrieve the "defined" status of the fill value */
+ if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Couldn't retrieve fill value from dataset.")
- if(fill_time == H5D_FILL_TIME_ALLOC ||
- (fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED) )
- {
+ /* See if we can check the filter status */
+ if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
+ if(fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) {
/* Filters must have encoding enabled. Ensure that all filters can be applied */
- if(H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) <0)
+ if(H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters")
dataset->shared->checked_filters = TRUE;
- }
- }
- }
+ } /* end if */
+ } /* end if */
+ } /* end if */
/*
* NOTE: Restrictions on extensions were checked when the dataset was
@@ -2299,11 +2138,12 @@ H5D_extend (H5D_t *dataset, const hsize_t *size, hid_t dxpl_id)
*/
/* Increase the size of the data space */
- space=dataset->shared->space;
- if ((changed=H5S_extend (space, size))<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to increase size of data space")
+ space = dataset->shared->space;
+ if((changed = H5S_extend(space, size)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to increase size of data space")
- if (changed>0){
+ /* Updated the dataset's info if the dataspace was successfully extended */
+ if(changed) {
/* Save the new dataspace in the file if necessary */
if(H5S_write(&(dataset->oloc), space, TRUE, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace")
@@ -2314,14 +2154,14 @@ H5D_extend (H5D_t *dataset, const hsize_t *size, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices")
/* Allocate space for the new parts of the dataset, if appropriate */
- if(dataset->shared->alloc_time == H5D_ALLOC_TIME_EARLY)
+ if(fill->alloc_time == H5D_ALLOC_TIME_EARLY)
if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset, H5D_ALLOC_EXTEND, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5D_extend() */
/*-------------------------------------------------------------------------
@@ -2386,16 +2226,16 @@ H5D_nameof(H5D_t *dataset)
*-------------------------------------------------------------------------
*/
H5T_t *
-H5D_typeof (const H5D_t *dset)
+H5D_typeof(const H5D_t *dset)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_typeof)
- assert (dset);
- assert (dset->shared->type);
+ HDassert(dset);
+ HDassert(dset->shared->type);
FUNC_LEAVE_NOAPI(dset->shared->type)
-}
+} /* end H5D_typeof() */
/*-------------------------------------------------------------------------
@@ -2442,92 +2282,90 @@ H5D_alloc_storage(H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_alloc
hbool_t update_time, hbool_t full_overwrite)
{
struct H5O_layout_t *layout; /* The dataset's layout information */
- unsigned init_space=0; /* Flag to indicate that space should be initialized */
- unsigned addr_set=0; /* Flag to indicate that the dataset's storage address was set */
+ hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */
+ hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_alloc_storage)
/* check args */
- assert (f);
- assert (dset);
+ HDassert(f);
+ HDassert(dset);
/* If the data is stored in external files, don't set an address for the layout
* We assume that external storage is already
* allocated by the caller, or at least will be before I/O is performed.
*/
- if(!(H5S_NULL == H5S_GET_EXTENT_TYPE(dset->shared->space) || dset->shared->efl.nused>0)) {
+ if(!(H5S_NULL == H5S_GET_EXTENT_TYPE(dset->shared->space) || dset->shared->dcpl_cache.efl.nused > 0)) {
/* Get a pointer to the dataset's layout information */
- layout=&(dset->shared->layout);
+ layout = &(dset->shared->layout);
- switch (layout->type) {
+ switch(layout->type) {
case H5D_CONTIGUOUS:
- if(layout->u.contig.addr==HADDR_UNDEF) {
+ if(!H5F_addr_defined(layout->u.contig.addr)) {
/* Reserve space in the file for the entire array */
- if (H5D_contig_create (f, dxpl_id, layout/*out*/)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
+ if(H5D_contig_create(f, dxpl_id, layout/*out*/) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
/* Indicate that we set the storage addr */
- addr_set=1;
+ addr_set = TRUE;
/* Indicate that we should initialize storage space */
- init_space=1;
+ must_init_space = TRUE;
} /* end if */
break;
case H5D_CHUNKED:
- if(layout->u.chunk.addr==HADDR_UNDEF) {
+ if(!H5F_addr_defined(layout->u.chunk.addr)) {
/* Create the root of the B-tree that describes chunked storage */
- if (H5D_istore_create (f, dxpl_id, layout/*out*/)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
+ if(H5D_istore_create(f, dxpl_id, layout/*out*/) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Indicate that we set the storage addr */
- addr_set=1;
+ addr_set = TRUE;
/* Indicate that we should initialize storage space */
- init_space=1;
+ must_init_space = TRUE;
} /* end if */
/* If space allocation is set to 'early' and we are extending
* the dataset, indicate that space should be allocated, so the
* B-tree gets expanded. -QAK
*/
- if(dset->shared->alloc_time == H5D_ALLOC_TIME_EARLY &&
- time_alloc == H5D_ALLOC_EXTEND)
- {
- init_space=1;
- }
+ if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY
+ && time_alloc == H5D_ALLOC_EXTEND)
+ must_init_space = 1;
break;
case H5D_COMPACT:
/* Check if space is already allocated */
if(layout->u.compact.buf==NULL) {
/* Reserve space in layout header message for the entire array. */
- assert(layout->u.compact.size>0);
- if (NULL==(layout->u.compact.buf=H5MM_malloc(layout->u.compact.size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset")
+ HDassert(layout->u.compact.size > 0);
+ if(NULL == (layout->u.compact.buf = H5MM_malloc(layout->u.compact.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset")
if(!full_overwrite)
HDmemset(layout->u.compact.buf, 0, layout->u.compact.size);
layout->u.compact.dirty = TRUE;
/* Indicate that we set the storage addr */
- addr_set=1;
+ addr_set = TRUE;
/* Indicate that we should initialize storage space */
- init_space=1;
+ must_init_space = TRUE;
} /* end if */
break;
default:
- assert ("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
#ifdef NDEBUG
- HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
+ HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Check if we need to initialize the space */
- if(init_space) {
- if (layout->type==H5D_CHUNKED) {
+ if(must_init_space) {
+ if(layout->type == H5D_CHUNKED) {
/* If we are doing incremental allocation and the B-tree got
* created during a H5Dwrite call, don't initialize the storage
* now, wait for the actual writes to each block and let the
@@ -2537,22 +2375,21 @@ H5D_alloc_storage(H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_alloc
* fill values to the chunks they allocate space for. Yes,
* this is icky. -QAK
*/
- if(!(dset->shared->alloc_time==H5D_ALLOC_TIME_INCR && time_alloc==H5D_ALLOC_WRITE)) {
+ if(!(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR && time_alloc == H5D_ALLOC_WRITE))
if(H5D_init_storage(dset, full_overwrite, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
- } /* end if */
} /* end if */
else {
H5D_fill_value_t fill_status; /* The fill value status */
/* Check the dataset's fill-value status */
- if (H5P_is_fill_value_defined(&(dset->shared->fill), &fill_status) < 0)
+ if(H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are filling the dataset on allocation or "if set" and
* the fill value _is_ set, do that now */
- if(dset->shared->fill_time==H5D_FILL_TIME_ALLOC ||
- (dset->shared->fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_USER_DEFINED)) {
+ if(dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC ||
+ (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) {
if(H5D_init_storage(dset, full_overwrite, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
} /* end if */
@@ -2563,7 +2400,7 @@ H5D_alloc_storage(H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_alloc
* set the address. (this is improves forward compatibility).
*/
if(time_alloc != H5D_ALLOC_CREATE && addr_set)
- if(H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_MSG_FLAG_CONSTANT, update_time, &(dset->shared->layout), dxpl_id) < 0)
+ if(H5O_msg_write(&dset->oloc, H5O_LAYOUT_ID, 0, H5O_MSG_FLAG_CONSTANT, update_time, &dset->shared->layout, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message")
} /* end if */
@@ -2593,25 +2430,25 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id)
FUNC_ENTER_NOAPI_NOINIT(H5D_init_storage)
- assert(dset);
+ HDassert(dset);
switch (dset->shared->layout.type) {
case H5D_COMPACT:
{
- hssize_t snpoints; /* Number of points in space (for error checking) */
- size_t npoints; /* Number of points in space */
+ hssize_t snpoints; /* Number of points in space (for error checking) */
+ size_t npoints; /* Number of points in space */
/* Get the number of elements in the dataset's dataspace */
snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
- assert(snpoints>=0);
- H5_ASSIGN_OVERFLOW(npoints,snpoints,hssize_t,size_t);
+ HDassert(snpoints >= 0);
+ H5_ASSIGN_OVERFLOW(npoints, snpoints, hssize_t, size_t);
/* If we will be immediately overwriting the values, don't bother to clear them */
if(!full_overwrite) {
/* If the fill value is defined, initialize the data buffer with it */
- if(dset->shared->fill.buf)
+ if(dset->shared->dcpl_cache.fill.buf)
/* Initialize the cached data buffer with the fill value */
- H5V_array_fill(dset->shared->layout.u.compact.buf, dset->shared->fill.buf, dset->shared->fill.size, npoints);
+ H5V_array_fill(dset->shared->layout.u.compact.buf, dset->shared->dcpl_cache.fill.buf, (size_t)dset->shared->dcpl_cache.fill.size, npoints);
else /* If the fill value is default, zero set data buf. */
HDmemset(dset->shared->layout.u.compact.buf, 0, dset->shared->layout.u.compact.size);
} /* end if */
@@ -2621,10 +2458,9 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id)
case H5D_CONTIGUOUS:
/* Don't write default fill values to external files */
/* If we will be immediately overwriting the values, don't bother to clear them */
- if((dset->shared->efl.nused==0 || dset->shared->fill.buf) && !full_overwrite) {
- if (H5D_contig_fill(dset, dxpl_id)<0)
+ if((dset->shared->dcpl_cache.efl.nused == 0 || dset->shared->dcpl_cache.fill.buf) && !full_overwrite)
+ if(H5D_contig_fill(dset, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset")
- } /* end if */
break;
case H5D_CHUNKED:
@@ -2632,14 +2468,14 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id)
* Allocate file space
* for all chunks now and initialize each chunk with the fill value.
*/
- if (H5D_istore_allocate(dset, dxpl_id, full_overwrite)<0)
+ if(H5D_istore_allocate(dset, dxpl_id, full_overwrite) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset")
break;
default:
- assert ("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
#ifdef NDEBUG
- HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
+ HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
@@ -2676,7 +2512,7 @@ H5Dget_storage_size(hid_t dset_id)
H5TRACE1("h", "i", dset_id);
/* Check args */
- if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
+ if(NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset")
/* Set return value */
@@ -2762,7 +2598,7 @@ H5Dget_offset(hid_t dset_id)
H5TRACE1("a", "i", dset_id);
/* Check args */
- if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
+ if(NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset")
/* Set return value */
@@ -2797,7 +2633,7 @@ H5D_get_offset(const H5D_t *dset)
FUNC_ENTER_NOAPI(H5D_get_offset, HADDR_UNDEF)
- assert(dset);
+ HDassert(dset);
switch(dset->shared->layout.type) {
case H5D_CHUNKED:
@@ -2819,7 +2655,7 @@ H5D_get_offset(const H5D_t *dset)
break;
default:
- assert ("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type")
#endif /* NDEBUG */
@@ -2978,7 +2814,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf)
H5TRACE4("e", "iiix", type_id, space_id, plist_id, buf);
/* Check args */
- if (H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
+ if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
@@ -3031,7 +2867,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
HDassert(buf);
/* Get the allocation info */
- if(H5T_vlen_get_alloc_info(plist_id,&vl_alloc_info)<0)
+ if(H5T_vlen_get_alloc_info(plist_id,&vl_alloc_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Call H5D_iterate with args, etc. */
@@ -3066,7 +2902,7 @@ H5D_vlen_get_buf_size_alloc(size_t size, void *info)
FUNC_ENTER_NOAPI(H5D_vlen_get_buf_size_alloc, NULL)
/* Get a temporary pointer to space for the VL data */
- if ((vlen_bufsize->vl_tbuf=H5FL_BLK_REALLOC(vlen_vl_buf,vlen_bufsize->vl_tbuf,size))!=NULL)
+ if((vlen_bufsize->vl_tbuf=H5FL_BLK_REALLOC(vlen_vl_buf,vlen_bufsize->vl_tbuf,size))!=NULL)
vlen_bufsize->size+=size;
/* Set return value */
@@ -3107,10 +2943,10 @@ static herr_t
H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t *point, void *op_data)
{
H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data;
- H5T_t *dt = NULL;
- herr_t ret_value = 0; /* The correct return value, if this function succeeds */
+ H5T_t *dt; /* Datatype for operation */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_vlen_get_buf_size, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5D_vlen_get_buf_size)
HDassert(op_data);
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
@@ -3120,20 +2956,20 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, co
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Make certain there is enough fixed-length buffer available */
- if((vlen_bufsize->fl_tbuf=H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt))) == NULL)
+ if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- if(H5Sselect_elements(vlen_bufsize->fspace_id, H5S_SELECT_SET, (size_t)1, (const hsize_t **)point)<0)
+ if(H5Sselect_elements(vlen_bufsize->fspace_id, H5S_SELECT_SET, (size_t)1, (const hsize_t **)point) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5Dread(vlen_bufsize->dataset_id, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf)<0)
+ if(H5Dread(vlen_bufsize->dataset_id, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_vlen_get_buf_size() */
+} /* end H5D_vlen_get_buf_size() */
/*-------------------------------------------------------------------------
@@ -3187,7 +3023,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
vlen_bufsize.dataset_id=dataset_id;
/* Get a copy of the dataspace ID */
- if((vlen_bufsize.fspace_id=H5Dget_space(dataset_id))<0)
+ if((vlen_bufsize.fspace_id=H5Dget_space(dataset_id)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy dataspace")
/* Create a scalar for the memory dataspace */
@@ -3201,19 +3037,19 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
/* Get the pointer to the dataset transfer class */
- if (NULL == (pclass = H5I_object(H5P_CLS_DATASET_XFER_g)))
+ if(NULL == (pclass = H5I_object(H5P_CLS_DATASET_XFER_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Change to the custom memory allocation routines for reading VL data */
- if((vlen_bufsize.xfer_pid=H5P_create_id(pclass))<0)
+ if((vlen_bufsize.xfer_pid=H5P_create_id(pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "no dataset xfer plists available")
/* Get the property list struct */
- if (NULL == (plist = H5I_object(vlen_bufsize.xfer_pid)))
+ if(NULL == (plist = H5I_object(vlen_bufsize.xfer_pid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Set the memory manager to the special allocation routine */
- if(H5P_set_vlen_mem_manager(plist,H5D_vlen_get_buf_size_alloc,&vlen_bufsize,NULL,NULL)<0)
+ if(H5P_set_vlen_mem_manager(plist,H5D_vlen_get_buf_size_alloc,&vlen_bufsize,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set VL data allocation routine")
/* Set the initial number of bytes required */
@@ -3223,24 +3059,24 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
ret_value = H5D_iterate(&bogus, type_id, space, H5D_vlen_get_buf_size, &vlen_bufsize);
/* Get the size if we succeeded */
- if(ret_value>=0)
- *size=vlen_bufsize.size;
+ if(ret_value >= 0)
+ *size = vlen_bufsize.size;
done:
- if(vlen_bufsize.fspace_id>0) {
- if(H5I_dec_ref(vlen_bufsize.fspace_id)<0)
+ if(vlen_bufsize.fspace_id > 0) {
+ if(H5I_dec_ref(vlen_bufsize.fspace_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
} /* end if */
- if(vlen_bufsize.mspace_id>0) {
- if(H5I_dec_ref(vlen_bufsize.mspace_id)<0)
+ if(vlen_bufsize.mspace_id > 0) {
+ if(H5I_dec_ref(vlen_bufsize.mspace_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
} /* end if */
- if(vlen_bufsize.fl_tbuf!=NULL)
- H5FL_BLK_FREE(vlen_fl_buf,vlen_bufsize.fl_tbuf);
- if(vlen_bufsize.vl_tbuf!=NULL)
- H5FL_BLK_FREE(vlen_vl_buf,vlen_bufsize.vl_tbuf);
- if(vlen_bufsize.xfer_pid>0) {
- if(H5I_dec_ref(vlen_bufsize.xfer_pid)<0)
+ if(vlen_bufsize.fl_tbuf != NULL)
+ H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf);
+ if(vlen_bufsize.vl_tbuf != NULL)
+ H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf);
+ if(vlen_bufsize.xfer_pid > 0) {
+ if(H5I_dec_ref(vlen_bufsize.xfer_pid) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on property list")
} /* end if */
@@ -3249,24 +3085,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Dset_extent
- *
- * Purpose: Modifies the dimensions of a dataset, based on H5Dextend.
- * Can change to a lower dimension.
+ * Function: H5Dset_extent
*
- * Return: Success: SUCCEED, Failure: FAIL
+ * Purpose: Modifies the dimensions of a dataset, based on H5Dextend.
+ * Can change to a lower dimension.
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Return: Non-negative on success, negative on failure
*
- * Date: April 9, 2002
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * April 9, 2002
*
*-------------------------------------------------------------------------
*/
herr_t
H5Dset_extent(hid_t dset_id, const hsize_t *size)
{
- H5D_t *dset = NULL;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5D_t *dset; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Dset_extent, FAIL)
H5TRACE2("e", "i*h", dset_id, size);
@@ -3283,41 +3118,39 @@ H5Dset_extent(hid_t dset_id, const hsize_t *size)
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Dset_extent() */
/*-------------------------------------------------------------------------
- * Function: H5D_set_extent
- *
- * Purpose: Based in H5D_extend, allows change to a lower dimension,
- * calls H5S_set_extent and H5D_istore_prune_by_extent instead
+ * Function: H5D_set_extent
*
- * Return: Success: SUCCEED, Failure: FAIL
+ * Purpose: Based on H5D_extend, allows change to a lower dimension,
+ * calls H5S_set_extent and H5D_istore_prune_by_extent instead
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Robb Matzke
+ * Return: Non-negative on success, negative on failure
*
- * Date: April 9, 2002
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * April 9, 2002
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
{
- hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
- int rank; /* Dataspace # of dimensions */
- herr_t ret_value = SUCCEED; /* Return value */
- H5S_t *space = NULL;
- int u;
- unsigned shrink = 0; /* Flag to indicate a dimension has shrank */
- unsigned expand = 0; /* Flag to indicate a dimension has grown */
- int changed = 0;
+ 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)
/* Check args */
- assert(dset);
- assert(size);
+ HDassert(dset);
+ HDassert(size);
/*-------------------------------------------------------------------------
* Get the data space
@@ -3332,18 +3165,19 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- for(u = 0; u < rank; u++) {
+ /* Determine if we are shrinking and/or expanding any dimensions */
+ for(u = 0; u < (unsigned)rank; u++) {
if(size[u] < curr_dims[u])
- shrink = 1;
+ shrink = TRUE;
if(size[u] > curr_dims[u])
- expand = 1;
- }
+ expand = TRUE;
+ } /* end for */
/*-------------------------------------------------------------------------
* Modify the size of the data space
*-------------------------------------------------------------------------
*/
- if((changed=H5S_set_extent(space, size)) < 0)
+ 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 */
@@ -3362,7 +3196,7 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices")
/* Allocate space for the new parts of the dataset, if appropriate */
- if(expand && dset->shared->alloc_time==H5D_ALLOC_TIME_EARLY)
+ if(expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY)
if(H5D_alloc_storage(dset->oloc.file, dxpl_id, dset, H5D_ALLOC_EXTEND, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset storage")
@@ -3375,14 +3209,14 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
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 */
- H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */
+ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
/* Fill the DXPL cache values for later use */
- if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ if(H5D_get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
/* Construct dataset I/O info */
- H5D_BUILD_IO_INFO(&io_info,dset,dxpl_cache,dxpl_id,NULL);
+ H5D_BUILD_IO_INFO(&io_info, dset, dxpl_cache, dxpl_id, NULL);
/* Remove excess chunks */
if(H5D_istore_prune_by_extent(&io_info) < 0)
@@ -3396,7 +3230,7 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5D_set_extent() */
/*-------------------------------------------------------------------------
@@ -3407,52 +3241,53 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
- *
* Programmer: Ray Lu
- *
- * Date: August 14, 2002
+ * August 14, 2002
*
*-------------------------------------------------------------------------
*/
herr_t
H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags)
{
- unsigned num_dsets; /* Number of datasets in file */
- hid_t *id_list=NULL; /* list of dataset IDs */
- H5D_t *dataset=NULL; /* Dataset pointer */
- unsigned u; /* Index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t *id_list = NULL; /* Array of dataset IDs */
+ unsigned num_dsets; /* Number of datasets in file */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_flush, FAIL)
/* Check args */
- assert(f);
+ HDassert(f);
/* Retrieve the # of outstanding dataset IDs */
- num_dsets=H5F_get_obj_count(f, H5F_OBJ_DATASET);
+ num_dsets = H5F_get_obj_count(f, H5F_OBJ_DATASET);
/* Check for something to do */
- if(num_dsets>0) {
- H5_CHECK_OVERFLOW(num_dsets,unsigned,size_t);
- if(NULL==(id_list=H5MM_malloc((size_t)num_dsets*sizeof(hid_t))))
+ if(num_dsets > 0) {
+ H5D_t *dataset; /* Dataset pointer */
+ unsigned u; /* Index variable */
+
+ H5_CHECK_OVERFLOW(num_dsets, unsigned, size_t);
+ if(NULL == (id_list = H5MM_malloc((size_t)num_dsets * sizeof(hid_t))))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate memory for ID list")
if(H5F_get_obj_ids(f, H5F_OBJ_DATASET, -1, id_list) != num_dsets)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset ID list")
+
+ /* Iterate through the open datasets */
for(u = 0; u < num_dsets; u++) {
- if(NULL==(dataset=H5I_object_verify(id_list[u], H5I_DATASET)))
+ if(NULL == (dataset = H5I_object_verify(id_list[u], H5I_DATASET)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object")
/* Flush the raw data buffer, if we have a dirty one */
- if (dataset->shared->cache.contig.sieve_buf && dataset->shared->cache.contig.sieve_dirty) {
- assert(dataset->shared->layout.type!=H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
+ if(dataset->shared->cache.contig.sieve_buf && dataset->shared->cache.contig.sieve_dirty) {
+ HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
/* Write dirty data sieve buffer to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
+ if(H5F_block_write(f, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
dataset->shared->cache.contig.sieve_size, dxpl_id, dataset->shared->cache.contig.sieve_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
- dataset->shared->cache.contig.sieve_dirty=0;
+ dataset->shared->cache.contig.sieve_dirty = FALSE;
} /* end if */
/* Flush cached information for each kind of dataset */
@@ -3462,31 +3297,31 @@ H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags)
case H5D_CHUNKED:
/* Flush the raw data cache */
- if (H5D_istore_flush(dataset, dxpl_id, flags & H5F_FLUSH_INVALIDATE) < 0)
+ if(H5D_istore_flush(dataset, dxpl_id, flags & H5F_FLUSH_INVALIDATE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush raw data cache")
break;
case H5D_COMPACT:
if(dataset->shared->layout.u.compact.dirty) {
- if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id)<0)
+ if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
dataset->shared->layout.u.compact.dirty = FALSE;
} /* end if */
break;
default:
- assert ("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
#ifdef NDEBUG
- HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
+ HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
-
- }
+ } /* end for */
} /* end if */
done:
- if(id_list!=NULL)
+ if(id_list)
H5MM_xfree(id_list);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_flush() */
@@ -3509,8 +3344,8 @@ done:
herr_t
H5Ddebug(hid_t dset_id)
{
- H5D_t *dset = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset; /* Dataset to debug */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Ddebug, FAIL)
H5TRACE1("e", "i", dset_id);
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index add8a8b..36cc2b7 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -141,20 +141,20 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
int mpi_code; /* MPI return code */
- unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */
- unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
+ hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
+ hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
#endif /* H5_HAVE_PARALLEL */
- int non_zero_fill_f=(-1); /* Indicate that a non-zero fill-value was used */
- herr_t ret_value=SUCCEED; /* Return value */
+ int non_zero_fill_f = (-1); /* Indicate that a non-zero fill-value was used */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_contig_fill, FAIL)
/* Check args */
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
- assert(dset && H5D_CONTIGUOUS==dset->shared->layout.type);
- assert(H5F_addr_defined(dset->shared->layout.u.contig.addr));
- assert(dset->shared->layout.u.contig.size>0);
- assert(dset->shared->space);
+ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(dset && H5D_CONTIGUOUS == dset->shared->layout.type);
+ HDassert(H5F_addr_defined(dset->shared->layout.u.contig.addr));
+ HDassert(dset->shared->layout.u.contig.size > 0);
+ HDassert(dset->shared->space);
#ifdef H5_HAVE_PARALLEL
/* Retrieve MPI parameters */
@@ -168,7 +168,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank")
/* Set the MPI-capable file driver flag */
- using_mpi=1;
+ using_mpi = TRUE;
/* Fill the DXPL cache values for later use */
if (H5D_get_dxpl_cache(H5AC_ind_dxpl_id,&dxpl_cache)<0)
@@ -188,61 +188,61 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
store.contig.dset_size=dset->shared->layout.u.contig.size;
/* Get size of elements */
- elmt_size=H5T_get_size(dset->shared->type);
- assert(elmt_size>0);
+ elmt_size = H5T_get_size(dset->shared->type);
+ HDassert(elmt_size > 0);
/* Get the number of elements in the dataset's dataspace */
snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
- assert(snpoints>=0);
- H5_ASSIGN_OVERFLOW(npoints,snpoints,hssize_t,size_t);
+ HDassert(snpoints >= 0);
+ H5_ASSIGN_OVERFLOW(npoints, snpoints, hssize_t, size_t);
/* If fill value is not library default, use it to set the element size */
- if(dset->shared->fill.buf)
- elmt_size=dset->shared->fill.size;
+ if(dset->shared->dcpl_cache.fill.buf)
+ elmt_size = dset->shared->dcpl_cache.fill.size;
/*
* Fill the entire current extent with the fill value. We can do
* this quite efficiently by making sure we copy the fill value
* in relatively large pieces.
*/
- ptsperbuf = MAX(1, bufsize/elmt_size);
- bufsize = ptsperbuf*elmt_size;
+ ptsperbuf = MAX(1, bufsize / elmt_size);
+ bufsize = ptsperbuf * elmt_size;
/* Fill the buffer with the user's fill value */
- if(dset->shared->fill.buf) {
+ if(dset->shared->dcpl_cache.fill.buf) {
/* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(non_zero_fill,bufsize))==NULL)
+ if(NULL == (buf = H5FL_BLK_MALLOC(non_zero_fill, bufsize)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
- H5V_array_fill(buf, dset->shared->fill.buf, elmt_size, ptsperbuf);
+ H5V_array_fill(buf, dset->shared->dcpl_cache.fill.buf, elmt_size, ptsperbuf);
/* Indicate that a non-zero fill buffer was used */
- non_zero_fill_f=1;
+ non_zero_fill_f = 1;
} /* end if */
else { /* Fill the buffer with the default fill value */
htri_t buf_avail;
/* Check if there is an already zeroed out buffer available */
- buf_avail=H5FL_BLK_AVAIL(zero_fill,bufsize);
- assert(buf_avail!=FAIL);
+ buf_avail = H5FL_BLK_AVAIL(zero_fill, bufsize);
+ HDassert(buf_avail != FAIL);
/* Allocate temporary buffer (zeroing it if no buffer is available) */
if(!buf_avail)
- buf=H5FL_BLK_CALLOC(zero_fill,bufsize);
+ buf = H5FL_BLK_CALLOC(zero_fill, bufsize);
else
- buf=H5FL_BLK_MALLOC(zero_fill,bufsize);
- if(buf==NULL)
+ buf = H5FL_BLK_MALLOC(zero_fill, bufsize);
+ if(buf == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
/* Indicate that a zero fill buffer was used */
- non_zero_fill_f=0;
+ non_zero_fill_f = 0;
} /* end else */
/* Start at the beginning of the dataset */
offset = 0;
/* Loop through writing the fill value to the dataset */
- while (npoints>0) {
+ while(npoints > 0) {
size = MIN(ptsperbuf, npoints) * elmt_size;
#ifdef H5_HAVE_PARALLEL
@@ -250,18 +250,17 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
if(using_mpi) {
/* Write the chunks out from only one process */
/* !! Use the internal "independent" DXPL!! -QAK */
- if(H5_PAR_META_WRITE==mpi_rank) {
- if (H5D_contig_write(dset, dxpl_cache, H5AC_ind_dxpl_id, &store, offset, size, buf)<0)
+ if(H5_PAR_META_WRITE == mpi_rank)
+ if(H5D_contig_write(dset, dxpl_cache, H5AC_ind_dxpl_id, &store, offset, size, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
- } /* end if */
/* Indicate that blocks are being written */
- blocks_written=1;
+ blocks_written = TRUE;
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
- H5_CHECK_OVERFLOW(size,size_t,hsize_t);
- if (H5D_contig_write(dset, dxpl_cache, dxpl_id, &store, offset, size, buf)<0)
+ H5_CHECK_OVERFLOW(size, size_t, hsize_t);
+ if(H5D_contig_write(dset, dxpl_cache, dxpl_id, &store, offset, size, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
#ifdef H5_HAVE_PARALLEL
} /* end else */
@@ -279,19 +278,19 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
* still writing out fill values and other processes race ahead to data
* in, getting bogus data.
*/
- if (MPI_SUCCESS != (mpi_code=MPI_Barrier(mpi_comm)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Barrier(mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
} /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
/* Free the buffer for fill values */
- if (buf) {
- assert(non_zero_fill_f>=0);
+ if(buf) {
+ HDassert(non_zero_fill_f >= 0);
if(non_zero_fill_f)
- H5FL_BLK_FREE(non_zero_fill,buf);
+ H5FL_BLK_FREE(non_zero_fill, buf);
else
- H5FL_BLK_FREE(zero_fill,buf);
+ H5FL_BLK_FREE(zero_fill, buf);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -313,16 +312,16 @@ done:
herr_t
H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_contig_delete, FAIL)
/* check args */
- assert(f);
- assert(layout);
+ HDassert(f);
+ HDassert(layout);
/* Free the file space for the chunk */
- if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.addr, layout->u.contig.size)<0)
+ if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.addr, layout->u.contig.size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header")
done:
diff --git a/src/H5Dio.c b/src/H5Dio.c
index c143c83..c8f7086 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -667,9 +667,9 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* fill time is NEVER, there is no way to tell whether part of data
* has been overwritten. So just proceed in reading.
*/
- if(nelmts > 0 && dataset->shared->efl.nused==0 &&
- ((dataset->shared->layout.type==H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))) {
+ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
+ ((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))) {
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
@@ -678,15 +678,15 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Should be impossible, but check anyway... */
if(fill_status == H5D_FILL_VALUE_UNDEFINED &&
- (dataset->shared->dcpl_cache.fill_time == H5D_FILL_TIME_ALLOC || dataset->shared->dcpl_cache.fill_time == H5D_FILL_TIME_IFSET))
+ (dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET))
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "read failed: dataset doesn't exist, no data can be read")
/* If we're never going to fill this dataset, just leave the junk in the user's buffer */
- if(dataset->shared->dcpl_cache.fill_time == H5D_FILL_TIME_NEVER)
+ if(dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_NEVER)
HGOTO_DONE(SUCCEED)
/* Go fill the user's selection with the dataset's fill value */
- if(H5D_fill(dataset->shared->dcpl_cache.fill.buf,dataset->shared->type,buf,mem_type,mem_space,dxpl_id) < 0)
+ if(H5D_fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, mem_type, mem_space, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed")
else
HGOTO_DONE(SUCCEED)
@@ -836,7 +836,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* <none needed currently> */
/* Allocate data space and initialize it if it hasn't been. */
- if(nelmts > 0 && dataset->shared->efl.nused==0 &&
+ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused==0 &&
((dataset->shared->layout.type==H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
|| (dataset->shared->layout.type==H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))) {
hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */
@@ -962,11 +962,11 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
FUNC_ENTER_NOAPI_NOINIT(H5D_contig_read)
/* Initialize storage info for this dataset */
- if (dataset->shared->efl.nused>0)
- HDmemcpy(&store.efl,&(dataset->shared->efl),sizeof(H5O_efl_t));
+ if (dataset->shared->dcpl_cache.efl.nused > 0)
+ HDmemcpy(&store.efl, &(dataset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
else {
- store.contig.dset_addr=dataset->shared->layout.u.contig.addr;
- store.contig.dset_size=dataset->shared->layout.u.contig.size;
+ store.contig.dset_addr = dataset->shared->layout.u.contig.addr;
+ store.contig.dset_size = dataset->shared->layout.u.contig.size;
} /* end if */
/* Set dataset storage for I/O info */
@@ -981,9 +981,9 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
H5_timer_begin(&timer);
#endif
/* Sanity check dataset, then read it */
- assert(((dataset->shared->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
- || dataset->shared->efl.nused>0 || 0 == nelmts
+ assert(((dataset->shared->layout.type == H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
+ || dataset->shared->dcpl_cache.efl.nused > 0 || 0 == nelmts
|| dataset->shared->layout.type==H5D_COMPACT);
H5_CHECK_OVERFLOW(nelmts,hsize_t,size_t);
@@ -1095,13 +1095,11 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
H5_timer_begin(&timer);
#endif
/* Sanity check that space is allocated, then read data from it */
- assert(((dataset->shared->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
- || dataset->shared->efl.nused>0 ||
- dataset->shared->layout.type==H5D_COMPACT);
- n = H5D_select_fgath(io_info,
- file_space, &file_iter, smine_nelmts,
- tconv_buf/*out*/);
+ HDassert(((dataset->shared->layout.type == H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
+ || dataset->shared->dcpl_cache.efl.nused > 0 ||
+ dataset->shared->layout.type == H5D_COMPACT);
+ n = H5D_select_fgath(io_info, file_space, &file_iter, smine_nelmts, tconv_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(io_info->stats->stats[1].gath_timer), &timer);
@@ -1225,29 +1223,29 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
FUNC_ENTER_NOAPI_NOINIT(H5D_contig_write)
/* Initialize storage info for this dataset */
- if (dataset->shared->efl.nused>0)
- HDmemcpy(&store.efl,&(dataset->shared->efl),sizeof(H5O_efl_t));
+ if(dataset->shared->dcpl_cache.efl.nused > 0)
+ HDmemcpy(&store.efl, &(dataset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
else {
- store.contig.dset_addr=dataset->shared->layout.u.contig.addr;
- store.contig.dset_size=dataset->shared->layout.u.contig.size;
+ store.contig.dset_addr = dataset->shared->layout.u.contig.addr;
+ store.contig.dset_size = dataset->shared->layout.u.contig.size;
} /* end if */
/* Set dataset storage for I/O info */
- io_info->store=&store;
+ io_info->store = &store;
/*
* If there is no type conversion then write directly from the
* application's buffer. This saves at least one mem-to-mem copy.
*/
- if ( H5Z_xform_noop(dxpl_cache->data_xform_prop) && H5T_path_noop(tpath)) {
+ if(H5Z_xform_noop(dxpl_cache->data_xform_prop) && H5T_path_noop(tpath)) {
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
H5_CHECK_OVERFLOW(nelmts,hsize_t,size_t);
#ifdef H5_HAVE_PARALLEL
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous write failed in collective mode");
+ if(H5D_contig_collective_io(io_info, file_space, mem_space, buf, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous write failed in collective mode")
}
else
#endif
@@ -1255,7 +1253,7 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
if((io_info->ops.write)(io_info, (size_t)nelmts,
H5T_get_size(dataset->shared->type), file_space, mem_space,
(haddr_t)0, buf/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous write failed ");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous write failed ")
}
#ifdef H5S_DEBUG
@@ -1469,11 +1467,11 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
hsize_t smine_start; /*strip mine start loc */
size_t n, smine_nelmts; /*elements per strip */
H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
- hbool_t mem_iter_init=0; /*memory selection iteration info has been initialized */
+ hbool_t mem_iter_init = FALSE; /*memory selection iteration info has been initialized */
H5S_sel_iter_t bkg_iter; /*background iteration info*/
- hbool_t bkg_iter_init=0; /*background iteration info has been initialized */
+ hbool_t bkg_iter_init = FALSE; /*background iteration info has been initialized */
H5S_sel_iter_t file_iter; /*file selection iteration info*/
- hbool_t file_iter_init=0; /*file selection iteration info has been initialized */
+ hbool_t file_iter_init = FALSE; /*file selection iteration info has been initialized */
H5T_bkg_t need_bkg; /*type of background buf*/
uint8_t *tconv_buf = NULL; /*data type conv buffer */
uint8_t *bkg_buf = NULL; /*background buffer */
@@ -1498,34 +1496,34 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
H5_timer_begin(&timer);
#endif
/* Sanity check dataset, then read it */
- assert(((dataset->shared->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
- || dataset->shared->efl.nused>0 || 0 == nelmts
- || dataset->shared->layout.type==H5D_COMPACT);
+ HDassert(((dataset->shared->layout.type == H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
+ || dataset->shared->dcpl_cache.efl.nused > 0 || 0 == nelmts
+ || dataset->shared->layout.type == H5D_COMPACT);
#ifdef H5_HAVE_PARALLEL
/* Check whether the collective mode can be turned off globally*/
#ifndef H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_mpio_chunk_adjust_iomode(io_info,&fm))
- HGOTO_ERROR(H5E_DATASET,H5E_CANTGET,FAIL,"can't adjust collective I/O")
+ if(H5D_mpio_chunk_adjust_iomode(io_info ,&fm))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't adjust collective I/O")
}
#endif /* H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS */
/* Temporarily shut down collective IO for chunking */
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_chunk_collective_io(io_info,&fm,buf,FALSE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunked read failed in collective mode");
+ if(H5D_chunk_collective_io(io_info, &fm, buf, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunked read failed in collective mode")
}
else {/* sequential or independent read */
#endif
/* Get first node in chunk skip list */
- chunk_node=H5SL_first(fm.fsel);
+ chunk_node = H5SL_first(fm.fsel);
while(chunk_node) {
H5D_chunk_info_t *chunk_info; /* chunk information */
/* Get the actual chunk information from the skip list node */
- chunk_info=H5SL_item(chunk_node);
+ chunk_info = H5SL_item(chunk_node);
/* Pass in chunk's coordinates in a union. */
store.chunk.offset = chunk_info->coords;
@@ -1539,7 +1537,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* Advance to next chunk in list */
chunk_node = H5SL_next(chunk_node);
- }
+ } /* end while */
#ifdef H5_HAVE_PARALLEL
}
#endif
@@ -1628,13 +1626,13 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* initialize selection iterator */
if (H5S_select_iter_init(&file_iter, chunk_info->fspace, src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
- file_iter_init=1; /*file selection iteration info has been initialized */
+ file_iter_init = TRUE; /*file selection iteration info has been initialized */
if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
- mem_iter_init=1; /*file selection iteration info has been initialized */
+ mem_iter_init = TRUE; /*file selection iteration info has been initialized */
if (H5S_select_iter_init(&bkg_iter, chunk_info->mspace, dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
- bkg_iter_init=1; /*file selection iteration info has been initialized */
+ bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
/* Pass in chunk's coordinates in a union*/
store.chunk.offset = chunk_info->coords;
@@ -1654,33 +1652,30 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
H5_timer_begin(&timer);
#endif
/* Sanity check that space is allocated, then read data from it */
- assert(((dataset->shared->layout.type==H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
- || (dataset->shared->layout.type==H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
- || dataset->shared->efl.nused>0 || dataset->shared->layout.type==H5D_COMPACT);
- n = H5D_select_fgath(io_info,
- chunk_info->fspace, &file_iter, smine_nelmts,
- tconv_buf/*out*/);
+ HDassert(((dataset->shared->layout.type == H5D_CONTIGUOUS && H5F_addr_defined(dataset->shared->layout.u.contig.addr))
+ || (dataset->shared->layout.type == H5D_CHUNKED && H5F_addr_defined(dataset->shared->layout.u.chunk.addr)))
+ || dataset->shared->dcpl_cache.efl.nused > 0 || dataset->shared->layout.type == H5D_COMPACT);
+ n = H5D_select_fgath(io_info, chunk_info->fspace, &file_iter, smine_nelmts, tconv_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(io_info->stats->stats[1].gath_timer), &timer);
io_info->stats->stats[1].gath_nbytes += n * src_type_size;
io_info->stats->stats[1].gath_ncalls++;
#endif
- if (n!=smine_nelmts)
+ if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
- if (H5T_BKG_YES==need_bkg) {
+ if(H5T_BKG_YES == need_bkg) {
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- n = H5D_select_mgath(buf, chunk_info->mspace, &bkg_iter,
- smine_nelmts, dxpl_cache, bkg_buf/*out*/);
+ n = H5D_select_mgath(buf, chunk_info->mspace, &bkg_iter, smine_nelmts, dxpl_cache, bkg_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(io_info->stats->stats[1].bkg_timer), &timer);
io_info->stats->stats[1].bkg_nbytes += n * dst_type_size;
io_info->stats->stats[1].bkg_ncalls++;
#endif
- if (n!=smine_nelmts)
+ if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
@@ -1692,8 +1687,8 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* Do the data transform after the conversion (since we're using type mem_type) */
if(!H5Z_xform_noop(dxpl_cache->data_xform_prop))
- if( H5Z_xform_eval(dxpl_cache->data_xform_prop, tconv_buf, smine_nelmts, mem_type) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Error performing data transform")
+ if(H5Z_xform_eval(dxpl_cache->data_xform_prop, tconv_buf, smine_nelmts, mem_type) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Error performing data transform")
/*
* Scatter the data into memory.
@@ -1701,14 +1696,13 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
#endif
- status = H5D_select_mscat(tconv_buf, chunk_info->mspace,
- &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/);
+ status = H5D_select_mscat(tconv_buf, chunk_info->mspace, &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(io_info->stats->stats[1].scat_timer), &timer);
io_info->stats->stats[1].scat_nbytes += smine_nelmts * dst_type_size;
io_info->stats->stats[1].scat_ncalls++;
#endif
- if (status<0)
+ if(status < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end for */
@@ -1716,17 +1710,17 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
if(file_iter_init) {
if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- file_iter_init=0;
+ file_iter_init = FALSE;
} /* end if */
if(mem_iter_init) {
if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- mem_iter_init=0;
+ mem_iter_init = FALSE;
} /* end if */
if(bkg_iter_init) {
if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- bkg_iter_init=0;
+ bkg_iter_init = FALSE;
} /* end if */
/* Get the next chunk node in the skip list */
@@ -1748,10 +1742,10 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
- if (tconv_buf && NULL==dxpl_cache->tconv_buf)
- H5FL_BLK_FREE(type_conv,tconv_buf);
- if (bkg_buf && NULL==dxpl_cache->bkgr_buf)
- H5FL_BLK_FREE(type_conv,bkg_buf);
+ if(tconv_buf && NULL == dxpl_cache->tconv_buf)
+ H5FL_BLK_FREE(type_conv, tconv_buf);
+ if(bkg_buf && NULL == dxpl_cache->bkgr_buf)
+ H5FL_BLK_FREE(type_conv, bkg_buf);
/* Release chunk mapping information */
if(H5D_destroy_chunk_map(&fm) < 0)
@@ -2102,13 +2096,13 @@ static herr_t
H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space,
const H5S_t *mem_space, fm_map *fm)
{
- H5S_t *tmp_mspace=NULL; /* Temporary memory dataspace */
- H5S_t *equiv_mspace=NULL; /* Equivalent memory dataspace */
- hbool_t equiv_mspace_init=0;/* Equivalent memory dataspace was created */
+ H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */
+ H5S_t *equiv_mspace = NULL; /* Equivalent memory dataspace */
+ hbool_t equiv_mspace_init = FALSE;/* Equivalent memory dataspace was created */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
hbool_t file_space_normalized = FALSE; /* File dataspace was normalized */
- hid_t f_tid=(-1); /* Temporary copy of file datatype for iteration */
- hbool_t iter_init=0; /* Selection iteration info has been initialized */
+ hid_t f_tid = (-1); /* Temporary copy of file datatype for iteration */
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
H5SL_node_t *curr_node; /* Current node in skip list */
@@ -2137,20 +2131,20 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create equivalent dataspace for scalar space")
/* Indicate that this space needs to be released */
- equiv_mspace_init=1;
+ equiv_mspace_init = TRUE;
/* Set the number of dimensions for the memory dataspace */
- fm->m_ndims=dataset->shared->layout.u.chunk.ndims-1;
+ fm->m_ndims = dataset->shared->layout.u.chunk.ndims - 1;
} /* end else */
else {
- equiv_mspace=(H5S_t *)mem_space; /* Casting away 'const' OK... */
+ equiv_mspace = (H5S_t *)mem_space; /* Casting away 'const' OK... */
/* Set the number of dimensions for the memory dataspace */
- H5_ASSIGN_OVERFLOW(fm->m_ndims,sm_ndims,int,unsigned);
+ H5_ASSIGN_OVERFLOW(fm->m_ndims, sm_ndims, int, unsigned);
} /* end else */
/* Get dim number and dimensionality for each dataspace */
- fm->f_ndims=f_ndims=dataset->shared->layout.u.chunk.ndims-1;
+ fm->f_ndims = f_ndims = dataset->shared->layout.u.chunk.ndims - 1;
if(H5S_get_simple_extent_dims(file_space, fm->f_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
@@ -2201,21 +2195,22 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
fm->last_chunk_info=NULL;
/* Point at the dataspaces */
- fm->file_space=file_space;
- fm->mem_space=equiv_mspace;
- fm->mem_space_copy=equiv_mspace_init; /* Make certain to copy memory dataspace if necessary */
+ fm->file_space = file_space;
+ fm->mem_space = equiv_mspace;
+ fm->mem_space_copy = equiv_mspace_init; /* Make certain to copy memory dataspace if necessary */
/* Get type of selection on disk & in memory */
- if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<H5S_SEL_NONE)
+ if((fsel_type = H5S_GET_SELECT_TYPE(file_space)) < H5S_SEL_NONE)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
- if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<H5S_SEL_NONE)
+ if((fm->msel_type = H5S_GET_SELECT_TYPE(equiv_mspace)) < H5S_SEL_NONE)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
/* If the selection is NONE or POINTS, set the flag to FALSE */
if(fsel_type == H5S_SEL_POINTS || fsel_type == H5S_SEL_NONE)
- sel_hyper_flag = FALSE;
+ sel_hyper_flag = FALSE;
else
- sel_hyper_flag = TRUE;
+ sel_hyper_flag = TRUE;
+
/* Check if file selection is a point selection */
if(!sel_hyper_flag) {
/* Create temporary datatypes for selection iteration */
@@ -2289,14 +2284,14 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
if (H5S_select_iter_init(&(fm->mem_iter), equiv_mspace, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- iter_init=1; /* Selection iteration info has been initialized */
+ iter_init = TRUE; /* Selection iteration info has been initialized */
/* Spaces aren't the same shape, iterate over the memory selection directly */
if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_mem_cb, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
/* Clean up hyperslab stuff, if necessary */
- if(fm->msel_type!=H5S_SEL_POINTS) {
+ if(fm->msel_type != H5S_SEL_POINTS) {
/* Clean memory chunks' hyperslab span "scratch" information */
curr_node=H5SL_first(fm->fsel);
while(curr_node) {
@@ -2329,17 +2324,17 @@ done:
} /* end if */
/* Reset the global dataspace info */
- fm->file_space=NULL;
- fm->mem_space=NULL;
+ fm->file_space = NULL;
+ fm->mem_space = NULL;
if(equiv_mspace_init && equiv_mspace) {
if(H5S_close(equiv_mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
} /* end if */
if(iter_init) {
- if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
+ if(H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- }
+ } /* end if */
if(f_tid!=(-1)) {
if(H5I_dec_ref(f_tid) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 27b2577..77a3530 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -917,11 +917,11 @@ H5D_istore_iter_chunkmap (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt
hsize_t chunk_index;
int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_iter_chunkmap);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_iter_chunkmap)
rank = udata->common.mesg->u.chunk.ndims - 1;
- if(H5V_chunk_index(rank,lt_key->offset,udata->common.mesg->u.chunk.dim,udata->down_chunks,&chunk_index)<0)
+ if(H5V_chunk_index(rank, lt_key->offset, udata->common.mesg->u.chunk.dim, udata->down_chunks, &chunk_index) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
udata->chunk_addr[chunk_index] = addr;
@@ -1366,37 +1366,37 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags)
+H5D_istore_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags)
{
H5D_io_info_t io_info; /* Temporary I/O info object */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
- H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */
+ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- int nerrors=0;
- H5D_rdcc_ent_t *ent=NULL, *next=NULL;
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned nerrors = 0;
+ H5D_rdcc_ent_t *ent, *next;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_istore_flush, FAIL)
/* Fill the DXPL cache values for later use */
- if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ if(H5D_get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
/* Construct dataset I/O info */
- H5D_BUILD_IO_INFO(&io_info,dset,dxpl_cache,dxpl_id,NULL);
+ H5D_BUILD_IO_INFO(&io_info, dset, dxpl_cache, dxpl_id, NULL);
- for (ent=rdcc->head; ent; ent=next) {
+ /* Loop over all entries in the chunk cache */
+ for(ent = rdcc->head; ent; ent = next) {
next = ent->next;
- if ((flags&H5F_FLUSH_INVALIDATE)) {
- if (H5D_istore_preempt(&io_info, ent, TRUE )<0)
+ if((flags & H5F_FLUSH_INVALIDATE)) {
+ if(H5D_istore_preempt(&io_info, ent, TRUE) < 0)
nerrors++;
} else {
- if (H5D_istore_flush_entry(&io_info, ent, FALSE)<0)
+ if(H5D_istore_flush_entry(&io_info, ent, FALSE) < 0)
nerrors++;
}
} /* end for */
-
- if (nerrors)
+ if(nerrors)
HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
done:
@@ -1696,43 +1696,42 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5D_istore_lock(const H5D_io_info_t *io_info,
- H5D_istore_ud1_t *udata, hbool_t relax, unsigned *idx_hint/*in,out*/)
+H5D_istore_lock(const H5D_io_info_t *io_info, H5D_istore_ud1_t *udata,
+ hbool_t relax, unsigned *idx_hint/*in,out*/)
{
- H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */
- const H5O_pline_t *pline=&(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
- const H5O_layout_t *layout=&(dset->shared->layout); /* Dataset layout */
- const H5O_fill_t *fill=&(dset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_time_t fill_time=dset->shared->dcpl_cache.fill_time; /* Fill time */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);/*raw data chunk cache*/
+ H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
+ const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
H5D_rdcc_ent_t *ent = NULL; /*cache entry */
- unsigned idx=0; /*hash index number */
+ unsigned idx = 0; /*hash index number */
hbool_t found = FALSE; /*already in cache? */
+ size_t chunk_size; /*size of a chunk */
+ void *chunk = NULL; /*the file chunk */
unsigned u; /*counters */
- size_t chunk_size=0; /*size of a chunk */
- void *chunk=NULL; /*the file chunk */
void *ret_value; /*return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_istore_lock)
- assert(io_info);
- assert(dset);
- assert(io_info->dxpl_cache);
- assert(io_info->store);
- assert(TRUE==H5P_isa_class(io_info->dxpl_id,H5P_DATASET_XFER));
+ HDassert(io_info);
+ HDassert(dset);
+ HDassert(io_info->dxpl_cache);
+ HDassert(io_info->store);
+ HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER));
/* Get the chunk's size */
- assert(layout->u.chunk.size>0);
- H5_ASSIGN_OVERFLOW(chunk_size,layout->u.chunk.size,hsize_t,size_t);
+ HDassert(layout->u.chunk.size > 0);
+ H5_ASSIGN_OVERFLOW(chunk_size, layout->u.chunk.size, hsize_t, size_t);
/* Search for the chunk in the cache */
- if (rdcc->nslots>0) {
- idx=H5D_HASH(dset->shared,io_info->store->chunk.index);
+ if(rdcc->nslots > 0) {
+ idx = H5D_HASH(dset->shared,io_info->store->chunk.index);
ent = rdcc->slot[idx];
- if (ent) {
- for (u=0, found=TRUE; u<layout->u.chunk.ndims; u++) {
- if (io_info->store->chunk.offset[u]!=ent->offset[u]) {
+ if(ent) {
+ for(u = 0, found = TRUE; u < layout->u.chunk.ndims; u++) {
+ if(io_info->store->chunk.offset[u] != ent->offset[u]) {
found = FALSE;
break;
} /* end if */
@@ -1740,15 +1739,15 @@ H5D_istore_lock(const H5D_io_info_t *io_info,
} /* end if */
} /* end if */
- if (found) {
+ if(found) {
/*
* Already in the cache. Count a hit.
*/
#ifdef H5D_ISTORE_DEBUG
rdcc->nhits++;
#endif /* H5D_ISTORE_DEBUG */
-
- } else if (relax) {
+ } /* end if */
+ else if(relax) {
/*
* Not in the cache, but we're about to overwrite the whole thing
* anyway, so just allocate a buffer for it but don't initialize that
@@ -1760,10 +1759,11 @@ H5D_istore_lock(const H5D_io_info_t *io_info,
HDfflush(stderr);
rdcc->nhits++;
#endif
- if (NULL==(chunk=H5D_istore_chunk_alloc (chunk_size,pline)))
+ if(NULL == (chunk = H5D_istore_chunk_alloc(chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- } else {
+ } /* end if */
+ else {
H5D_istore_ud1_t tmp_udata; /*B-tree pass-through */
haddr_t chunk_addr; /* Address of chunk on disk */
@@ -1812,41 +1812,42 @@ H5D_istore_lock(const H5D_io_info_t *io_info,
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
- if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_size,pline)))
+ if(NULL == (chunk = H5D_istore_chunk_alloc (chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined")
- if(fill_time==H5D_FILL_TIME_ALLOC ||
- (fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_USER_DEFINED)) {
- if (fill && fill->buf) {
+ if(fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) {
+ if(fill->buf) {
/*
* The chunk doesn't exist in the file. Replicate the fill
* value throughout the chunk.
*/
- assert(0==chunk_size % fill->size);
- H5V_array_fill(chunk, fill->buf, fill->size, chunk_size/fill->size);
- } else {
+ HDassert(0 == (chunk_size % (size_t)fill->size));
+ H5V_array_fill(chunk, fill->buf, (size_t)fill->size, chunk_size / fill->size);
+ } /* end if */
+ else {
/*
* The chunk doesn't exist in the file and no fill value was
* specified. Assume all zeros.
*/
- HDmemset (chunk, 0, chunk_size);
+ HDmemset(chunk, 0, chunk_size);
} /* end else */
} /* end if */
#ifdef H5_USING_PURIFY
else
- HDmemset(chunk,0,chunk_size);
+ HDmemset(chunk, 0, chunk_size);
#endif /* H5_USING_PURIFY */
#ifdef H5D_ISTORE_DEBUG
rdcc->ninits++;
#endif /* H5D_ISTORE_DEBUG */
} /* end else */
- }
- assert (found || chunk_size>0);
+ } /* end else */
+ HDassert(found || chunk_size > 0);
- if (!found && rdcc->nslots>0 && chunk_size<=rdcc->nbytes &&
+ if(!found && rdcc->nslots > 0 && chunk_size <= rdcc->nbytes &&
(!ent || !ent->locked)) {
/*
* Add the chunk to the cache only if the slot is not already locked.
@@ -2128,21 +2129,18 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
* the entire I/O operation on the chunk will be skipped. -QAK
*/
if(!H5F_addr_defined(chunk_addr)) {
- const H5O_fill_t *fill=&(dset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_time_t fill_time=dset->shared->dcpl_cache.fill_time; /* Fill time */
- H5D_fill_value_t fill_status;
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);/*raw data chunk cache*/
hbool_t found = FALSE; /*already in cache? */
/* Check if the chunk is in the cache (but hasn't been written to disk yet) */
- if (rdcc->nslots>0) {
- unsigned idx=H5D_HASH(dset->shared, io_info->store->chunk.index); /* Cache entry index */
+ if(rdcc->nslots>0) {
+ unsigned idx = H5D_HASH(dset->shared, io_info->store->chunk.index); /* Cache entry index */
H5D_rdcc_ent_t *ent = rdcc->slot[idx]; /* Cache entry */
/* Potential match... */
- if (ent) {
- for (u=0, found=TRUE; u<dset->shared->layout.u.chunk.ndims; u++) {
- if (io_info->store->chunk.offset[u]!=ent->offset[u]) {
+ if(ent) {
+ for(u = 0, found = TRUE; u < dset->shared->layout.u.chunk.ndims; u++) {
+ if(io_info->store->chunk.offset[u] != ent->offset[u]) {
found = FALSE;
break;
} /* end if */
@@ -2152,47 +2150,50 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
/* If the chunk is in the cache, then it must have valid data */
if(!found) {
+ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_fill_value_t fill_status;
+
/* Check if the fill value is defined */
- if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are never to return fill values, or if we would return them
* but they aren't set, process the entire set of I/O vectors and
* get out now.
*/
- if(fill_time==H5D_FILL_TIME_NEVER ||
- (fill_time==H5D_FILL_TIME_IFSET && fill_status!=H5D_FILL_VALUE_USER_DEFINED)) {
+ if(fill->fill_time == H5D_FILL_TIME_NEVER ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status!=H5D_FILL_VALUE_USER_DEFINED)) {
size_t size; /* Size of sequence in bytes */
size_t v; /* Local index variable */
- ssize_t bytes_processed=0; /* Eventual return value */
+ ssize_t bytes_processed = 0; /* Eventual return value */
/* Work through all the sequences */
- for(u=*mem_curr_seq, v=*chunk_curr_seq; u<mem_max_nseq && v<chunk_max_nseq; ) {
+ for(u = *mem_curr_seq, v = *chunk_curr_seq; u < mem_max_nseq && v < chunk_max_nseq; ) {
/* Choose smallest buffer to write */
- if(chunk_len_arr[v]<mem_len_arr[u])
- size=chunk_len_arr[v];
+ if(chunk_len_arr[v] < mem_len_arr[u])
+ size = chunk_len_arr[v];
else
- size=mem_len_arr[u];
+ size = mem_len_arr[u];
/* Update source information */
- chunk_len_arr[v]-=size;
- chunk_offset_arr[v]+=size;
- if(chunk_len_arr[v]==0)
+ chunk_len_arr[v] -= size;
+ chunk_offset_arr[v] += size;
+ if(chunk_len_arr[v] == 0)
v++;
/* Update destination information */
- mem_len_arr[u]-=size;
- mem_offset_arr[u]+=size;
- if(mem_len_arr[u]==0)
+ mem_len_arr[u] -= size;
+ mem_offset_arr[u] += size;
+ if(mem_len_arr[u] == 0)
u++;
/* Increment number of bytes copied */
- bytes_processed+=(ssize_t)size;
+ bytes_processed += (ssize_t)size;
} /* end for */
/* Update current sequence vectors */
- *mem_curr_seq=u;
- *chunk_curr_seq=v;
+ *mem_curr_seq = u;
+ *chunk_curr_seq = v;
HGOTO_DONE(bytes_processed)
} /* end if */
@@ -2203,19 +2204,19 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
* Lock the chunk, copy from application to chunk, then unlock the
* chunk.
*/
- if (NULL==(chunk=H5D_istore_lock(io_info, &udata, FALSE, &idx_hint)))
+ if(NULL == (chunk = H5D_istore_lock(io_info, &udata, FALSE, &idx_hint)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Use the vectorized memory copy routine to do actual work */
- if((naccessed=H5V_memcpyvv(buf,mem_max_nseq,mem_curr_seq,mem_len_arr,mem_offset_arr,chunk,chunk_max_nseq,chunk_curr_seq,chunk_len_arr,chunk_offset_arr))<0)
+ if((naccessed = H5V_memcpyvv(buf, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, chunk, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr)) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed")
- H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
- if (H5D_istore_unlock(io_info, FALSE, idx_hint, chunk, (size_t)naccessed)<0)
+ H5_CHECK_OVERFLOW(naccessed, ssize_t, size_t);
+ if(H5D_istore_unlock(io_info, FALSE, idx_hint, chunk, (size_t)naccessed) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
/* Set return value */
- ret_value=naccessed;
+ ret_value = naccessed;
} /* end else */
done:
@@ -2675,14 +2676,11 @@ H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline)
* Return: Non-negative on success/Negative on failure
*
* Note: Current implementation relies on cache_size being 0,
- * thus no chunk is cashed and written to disk immediately
+ * thus no chunk is cached and written to disk immediately
* when a chunk is unlocked (via H5F_istore_unlock)
* This should be changed to do a direct flush independent
* of the cache value.
*
- * This routine might be called before the dcpl_cache is set up
- * correctly, so don't use those values.
- *
* Programmer: Albert Cheng
* June 26, 1998
*
@@ -2695,60 +2693,43 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
H5D_storage_t store; /* Dataset storage information */
hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
hsize_t chunk_size; /* Size of chunk in bytes */
- unsigned filter_mask=0; /* Filter mask for chunks that have them */
- H5O_pline_t pline; /* I/O pipeline information */
- hbool_t pline_initialized=FALSE; /* Flag to indicate that pline has valid info */
- H5O_fill_t fill; /* Fill value information */
- H5D_fill_time_t fill_time; /* When to write fill values */
- H5D_fill_value_t fill_status; /* The fill value status */
- unsigned should_fill=0; /* Whether fill values should be written */
- void *chunk=NULL; /* Chunk buffer for writing fill values */
+ unsigned filter_mask = 0; /* Filter mask for chunks that have them */
+ const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
+ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_fill_value_t fill_status; /* The fill value status */
+ hbool_t should_fill = FALSE; /* Whether fill values should be written */
+ void *chunk = NULL; /* Chunk buffer for writing fill values */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
- H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */
+ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
#ifdef H5_HAVE_PARALLEL
- MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
- int mpi_rank=(-1); /* This process's rank */
+ MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
+ int mpi_rank = (-1); /* This process's rank */
int mpi_code; /* MPI return code */
- unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */
- unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
+ hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
+ hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
#endif /* H5_HAVE_PARALLEL */
- int carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
- unsigned chunk_exists; /* Flag to indicate whether a chunk exists already */
- int i; /* Local index variable */
- unsigned u; /* Local index variable */
- H5P_genplist_t *dc_plist; /* Property list */
+ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
int space_ndims; /* Dataset's space rank */
hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */
- herr_t ret_value=SUCCEED; /* Return value */
+ int i; /* Local index variable */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_istore_allocate, FAIL)
/* Check args */
- assert(dset && H5D_CHUNKED==dset->shared->layout.type);
- assert(dset->shared->layout.u.chunk.ndims>0 && dset->shared->layout.u.chunk.ndims<=H5O_LAYOUT_NDIMS);
- assert(H5F_addr_defined(dset->shared->layout.u.chunk.addr));
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
-
- /* Get dataset's creation property list */
- if (NULL == (dc_plist = H5I_object(dset->shared->dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
+ HDassert(dset && H5D_CHUNKED == dset->shared->layout.type);
+ HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ HDassert(H5F_addr_defined(dset->shared->layout.u.chunk.addr));
+ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
/* We only handle simple data spaces so far */
- if ((space_ndims=H5S_get_simple_extent_dims(dset->shared->space, space_dim, NULL))<0)
+ if((space_ndims = H5S_get_simple_extent_dims(dset->shared->space, space_dim, NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple data space info")
space_dim[space_ndims] = dset->shared->layout.u.chunk.dim[space_ndims];
- /* Get necessary properties from dataset creation property list */
- if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get fill value")
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline")
- pline_initialized=TRUE;
- if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time")
-
/* Fill the DXPL cache values for later use */
- if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ if(H5D_get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
#ifdef H5_HAVE_PARALLEL
@@ -2759,24 +2740,24 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator")
/* Get the MPI rank */
- if((mpi_rank = H5F_mpi_get_rank(dset->oloc.file))<0)
+ if((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank")
/* Set the MPI-capable file driver flag */
- using_mpi=1;
+ using_mpi = TRUE;
} /* end if */
#endif /* H5_HAVE_PARALLEL */
/*
- * Setup indice to go through all chunks. (Future improvement
- * should allocate only chunks that have no file space assigned yet.
+ * Setup indice to go through all chunks. (Future improvement:
+ * should allocate only chunks that have no file space assigned yet).
*/
- for (u=0; u<dset->shared->layout.u.chunk.ndims; u++)
+ for(u = 0; u < dset->shared->layout.u.chunk.ndims; u++)
chunk_offset[u] = 0;
chunk_size = dset->shared->layout.u.chunk.size;
/* Check the dataset's fill-value status */
- if (H5P_is_fill_value_defined(&fill, &fill_status) < 0)
+ if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are filling the dataset on allocation or "if set" and
@@ -2784,69 +2765,67 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
* or if there are any pipeline filters defined,
* set the "should fill" flag
*/
- if((!full_overwrite && (fill_time == H5D_FILL_TIME_ALLOC ||
- (fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)))
- || pline.nused > 0)
- should_fill = 1;
+ if((!full_overwrite && (fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)))
+ || pline->nused > 0)
+ should_fill = TRUE;
/* Check if fill values should be written to blocks */
if(should_fill) {
/* Allocate chunk buffer for processes to use when writing fill values */
H5_CHECK_OVERFLOW(chunk_size, hsize_t, size_t);
- if(NULL == (chunk = H5D_istore_chunk_alloc((size_t)chunk_size, &pline)))
+ if(NULL == (chunk = H5D_istore_chunk_alloc((size_t)chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk")
/* Fill the chunk with the proper values */
- if(fill.buf) {
- /*
- * Replicate the fill value throughout the chunk.
- */
- assert(0==chunk_size % fill.size);
- H5V_array_fill(chunk, fill.buf, fill.size, (size_t)chunk_size/fill.size);
- } else {
- /*
- * No fill value was specified, assume all zeros.
- */
- HDmemset (chunk, 0, (size_t)chunk_size);
- } /* end else */
+ if(fill->buf) {
+ /* Replicate the fill value throughout the chunk */
+ HDassert(0 == (chunk_size % (size_t)fill->size));
+ H5V_array_fill(chunk, fill->buf, (size_t)fill->size, (size_t)(chunk_size / fill->size));
+ } /* end if */
+ else
+ /* No fill value was specified, assume all zeros. */
+ HDmemset(chunk, 0, (size_t)chunk_size);
/* Check if there are filters which need to be applied to the chunk */
- if (pline.nused>0) {
- size_t buf_size=(size_t)chunk_size;
- size_t nbytes=(size_t)chunk_size;
+ if(pline->nused > 0) {
+ size_t buf_size = (size_t)chunk_size;
+ size_t nbytes = (size_t)chunk_size;
/* Push the chunk through the filters */
- if (H5Z_pipeline(&pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &buf_size, &chunk)<0)
+ if(H5Z_pipeline(pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &buf_size, &chunk) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed")
/* Keep the number of bytes the chunk turned in to */
- chunk_size=nbytes;
+ chunk_size = nbytes;
} /* end if */
} /* end if */
/* Set up dataset I/O info */
- store.chunk.offset=chunk_offset;
- H5D_BUILD_IO_INFO(&io_info,dset,dxpl_cache,dxpl_id,&store);
+ store.chunk.offset = chunk_offset;
+ H5D_BUILD_IO_INFO(&io_info, dset, dxpl_cache, dxpl_id, &store);
/* Loop over all chunks */
- carry=0;
- while (carry==0) {
+ carry = FALSE;
+ while(!carry) {
+ hbool_t chunk_exists; /* Flag to indicate whether a chunk exists already */
+
/* Check if the chunk exists yet on disk */
- chunk_exists=1;
- if(H5D_istore_get_addr(&io_info,NULL)==HADDR_UNDEF) {
+ chunk_exists = TRUE;
+ if(H5D_istore_get_addr(&io_info, NULL) == HADDR_UNDEF) {
const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
- H5D_rdcc_ent_t *ent = NULL; /*cache entry */
+ H5D_rdcc_ent_t *ent; /*cache entry */
/* Didn't find the chunk on disk */
- chunk_exists = 0;
+ chunk_exists = FALSE;
/* Look for chunk in cache */
for(ent = rdcc->head; ent && !chunk_exists; ent = ent->next) {
/* Assume a match */
- chunk_exists = 1;
+ chunk_exists = TRUE;
for(u = 0; u < dset->shared->layout.u.chunk.ndims && chunk_exists; u++) {
if(ent->offset[u] != chunk_offset[u])
- chunk_exists = 0; /* Reset if no match */
+ chunk_exists = FALSE; /* Reset if no match */
} /* end for */
} /* end for */
} /* end if */
@@ -2874,13 +2853,12 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
if(using_mpi) {
/* Write the chunks out from only one process */
/* !! Use the internal "independent" DXPL!! -QAK */
- if(H5_PAR_META_WRITE==mpi_rank) {
+ if(H5_PAR_META_WRITE == mpi_rank)
if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, udata.common.key.nbytes, H5AC_ind_dxpl_id, chunk) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
- } /* end if */
/* Indicate that blocks are being written */
- blocks_written=1;
+ blocks_written = TRUE;
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
@@ -2893,12 +2871,12 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
} /* end if */
/* Increment indices */
- for (i=(int)dset->shared->layout.u.chunk.ndims-1, carry=1; i>=0 && carry; --i) {
+ for(i = (int)dset->shared->layout.u.chunk.ndims - 1, carry = TRUE; i >= 0 && carry; --i) {
chunk_offset[i] += dset->shared->layout.u.chunk.dim[i];
if (chunk_offset[i] >= space_dim[i])
chunk_offset[i] = 0;
else
- carry = 0;
+ carry = FALSE;
} /* end for */
} /* end while */
@@ -2911,31 +2889,30 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
* them in, getting bogus data.
*/
if (MPI_SUCCESS != (mpi_code=MPI_Barrier(mpi_comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code);
+ HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
} /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
/* Free the chunk for fill values */
- if(chunk!=NULL && pline_initialized)
- chunk=H5D_istore_chunk_xfree(chunk,&pline);
+ if(chunk)
+ chunk = H5D_istore_chunk_xfree(chunk, pline);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_allocate() */
/*-------------------------------------------------------------------------
- * Function: H5D_istore_prune_by_extent
+ * Function: H5D_istore_prune_by_extent
*
- * Purpose: This function searches for chunks that are no longer necessary both in the
- * raw data cache and in the B-tree.
+ * Purpose: This function searches for chunks that are no longer necessary both in the
+ * raw data cache and in the B-tree.
*
- * Return: Success: 0, Failure: -1
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Algorithm: Robb Matzke
+ * Return: Non-negative on success/Negative on failure
*
- * Date: March 27, 2002
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Algorithm: Robb Matzke
+ * March 27, 2002
*
* The algorithm is:
*
@@ -3098,17 +3075,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_istore_prune_extent
- *
- * Purpose: Search for chunks that are no longer necessary in the B-tree.
+ * Function: H5D_istore_prune_extent
*
- * Return: Success: 0, Failure: -1
+ * Purpose: Search for chunks that are no longer necessary in the B-tree.
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: March 26, 2002
+ * Return: Non-negative on success/Negative on failure
*
- * Comments: Called by H5D_prune_by_extent
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * March 26, 2002
*
*-------------------------------------------------------------------------
*/
@@ -3149,18 +3123,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_istore_remove
+ * Function: H5D_istore_remove
*
- * Purpose: Removes chunks that are no longer necessary in the B-tree.
+ * Purpose: Removes chunks that are no longer necessary in the B-tree.
*
- * Return: Success: 0, Failure: -1
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: March 28, 2002
- *
- * Comments: Part of H5B_ISTORE
+ * March 28, 2002
*
*-------------------------------------------------------------------------
*/
@@ -3191,16 +3162,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_istore_initialize_by_extent
+ * Function: H5D_istore_initialize_by_extent
*
- * Purpose: This function searches for chunks that have to be initialized with the fill
- * value both in the raw data cache and in the B-tree.
+ * Purpose: This function searches for chunks that have to be initialized with the fill
+ * value both in the raw data cache and in the B-tree.
*
- * Return: Success: 0, Failure: -1
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: April 4, 2002
+ * April 4, 2002
*
* Comments:
*
@@ -3215,7 +3185,7 @@ done:
herr_t
H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
{
- const H5O_layout_t *layout=&(io_info->dset->shared->layout); /* Dataset layout */
+ const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */
uint8_t *chunk = NULL; /*the file chunk */
unsigned idx_hint = 0; /*input value for H5F_istore_lock */
hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */
@@ -3224,7 +3194,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
hsize_t sub_size[H5O_LAYOUT_NDIMS];
hsize_t naccessed; /*bytes accessed in chunk */
hsize_t end_chunk; /*chunk position counter */
- hsize_t start[H5O_LAYOUT_NDIMS]; /*starting location of hyperslab */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /*starting location of hyperslab */
hsize_t count[H5O_LAYOUT_NDIMS]; /*element count of hyperslab */
hsize_t size[H5O_LAYOUT_NDIMS]; /*current size of dimensions */
H5S_t *space_chunk = NULL; /*dataspace for a chunk */
@@ -3235,34 +3205,18 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
int srank; /*current # of dimensions (signed) */
unsigned rank; /*current # of dimensions */
int i, carry; /*counters */
- unsigned u;
int found = 0; /*initialize this entry */
- H5P_genplist_t *dc_plist; /* Property list */
- H5O_pline_t pline; /* I/O pipeline information */
- H5O_fill_t fill; /* Fill value information */
- H5D_fill_time_t fill_time; /* Fill time information */
H5D_storage_t store; /* Dataset storage information */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_istore_initialize_by_extent, FAIL)
/* Check args */
- assert(io_info);
- assert(io_info->dset && H5D_CHUNKED == layout->type);
- assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
- assert(H5F_addr_defined(layout->u.chunk.addr));
-
- /* Get dataset's creation property list */
- if (NULL == (dc_plist = H5I_object(io_info->dset->shared->dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
-
- /* Get necessary properties from property list */
- if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value")
- if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time")
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline")
+ HDassert(io_info);
+ HDassert(io_info->dset && H5D_CHUNKED == layout->type);
+ HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ HDassert(H5F_addr_defined(layout->u.chunk.addr));
/* Reset start & count arrays */
HDmemset(start, 0, sizeof(start));
@@ -3270,8 +3224,8 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
/* Go get the rank & dimensions */
if((srank = H5S_get_simple_extent_dims(io_info->dset->shared->space, curr_dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions");
- H5_ASSIGN_OVERFLOW(rank,srank,int,unsigned);
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
+ H5_ASSIGN_OVERFLOW(rank, srank, int, unsigned);
/* Copy current dimensions */
for(u = 0; u < rank; u++) {
@@ -3303,17 +3257,17 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
} /* end for */
/* Point to local dataset storage info */
- assert(io_info->store==NULL); /* Make certain we aren't blowing anything away */
- io_info->store=&store;
+ HDassert(io_info->store == NULL); /* Make certain we aren't blowing anything away */
+ io_info->store = &store;
/* Loop over all chunks */
- carry=0;
- while(carry==0) {
+ carry = 0;
+ while(carry == 0) {
for(u = 0, naccessed = 1; u < layout->u.chunk.ndims; u++) {
/* The location and size of the chunk being accessed */
chunk_offset[u] = idx_cur[u] * layout->u.chunk.dim[u];
- sub_size[u] = MIN((idx_cur[u] + 1) * layout->u.chunk.dim[u],
- size[u]) - chunk_offset[u];
+ sub_size[u] = MIN((idx_cur[u] + 1) * layout->u.chunk.dim[u], size[u])
+ - chunk_offset[u];
naccessed *= sub_size[u];
} /* end for */
@@ -3327,19 +3281,20 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
found = 1;
break;
}
- } /* end for */
+ } /* end for */
if(found) {
+ const H5O_fill_t *fill = &io_info->dset->shared->dcpl_cache.fill; /* Fill value information */
/* Calculate the index of this chunk */
- if(H5V_chunk_index(rank,chunk_offset,layout->u.chunk.dim,down_chunks,&store.chunk.index)<0)
+ if(H5V_chunk_index(rank, chunk_offset, layout->u.chunk.dim, down_chunks, &store.chunk.index) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
- store.chunk.offset=chunk_offset;
+ store.chunk.offset = chunk_offset;
if(NULL == (chunk = H5D_istore_lock(io_info, NULL, FALSE, &idx_hint)))
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk")
- if(H5S_select_all(space_chunk,1) < 0)
+ if(H5S_select_all(space_chunk, 1) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select space")
for(u = 0; u < rank; u++)
@@ -3356,8 +3311,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
HDfputs("]\n", stdout);
#endif
- if(H5S_select_hyperslab(space_chunk, H5S_SELECT_NOTB, start, NULL,
- count, NULL) < 0)
+ if(H5S_select_hyperslab(space_chunk, H5S_SELECT_NOTB, start, NULL, count, NULL) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select hyperslab")
/* Fill the selection in the memory buffer */
@@ -3365,7 +3319,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
/* relying on the fill.size, which might be set to 0 if there is */
/* no fill-value defined for the dataset -QAK */
H5_CHECK_OVERFLOW(size[rank],hsize_t,size_t);
- if(H5S_select_fill(fill.buf, (size_t)size[rank], space_chunk, chunk) < 0)
+ if(H5S_select_fill(fill->buf, (size_t)size[rank], space_chunk, chunk) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
if(H5D_istore_unlock(io_info, TRUE, idx_hint, chunk, (size_t)naccessed) < 0)
@@ -3487,11 +3441,11 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
chunks[u] = ((curr_dims[u]+dset->shared->layout.u.chunk.dim[u])-1) / dset->shared->layout.u.chunk.dim[u];
/* Get the "down" sizes for each dimension */
- if(H5V_array_down(rank,chunks,down_chunks)<0)
+ if(H5V_array_down(rank,chunks,down_chunks) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
/* Fill the DXPL cache values for later use */
- if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
/* Construct dataset I/O info */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index c67527d..121fe5c 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -159,12 +159,6 @@ typedef struct H5D_shared_t {
H5O_layout_t layout; /* data layout */
hbool_t checked_filters;/* TRUE if dataset passes can_apply check */
- /* Cache some frequently accessed values from the DCPL */
- H5O_efl_t efl; /* External file list information */
- H5D_alloc_time_t alloc_time; /* Dataset allocation time */
- H5D_fill_time_t fill_time; /* Dataset fill value writing time */
- H5O_fill_t fill; /* Dataset fill value information */
-
/* Buffered/cached information for types of raw data storage*/
struct {
H5D_rdcdc_t contig; /* Information about contiguous data */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 4de95b0..4995bef 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -45,9 +45,7 @@
#define H5D_CRT_CHUNK_DIM_NAME "chunk_ndims" /* Chunk dimensionality */
#define H5D_CRT_CHUNK_SIZE_NAME "chunk_size" /* Chunk size */
#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
-#define H5D_CRT_ALLOC_TIME_NAME "alloc_time" /* Space allocation time */
#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
-#define H5D_CRT_FILL_TIME_NAME "fill_time" /* Time of fill value writing */
#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
#define H5D_CRT_DATA_PIPELINE_NAME "pline" /* Data filter pipeline */
@@ -144,9 +142,9 @@ typedef struct H5D_dxpl_cache_t {
/* Typedef for cached dataset creation property list information */
typedef struct H5D_dcpl_cache_t {
- H5O_pline_t pline; /* I/O pipeline info (H5D_CRT_DATA_PIPELINE_NAME) */
H5O_fill_t fill; /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */
- H5D_fill_time_t fill_time; /* Fill time (H5D_CRT_FILL_TIME_NAME) */
+ H5O_pline_t pline; /* I/O pipeline info (H5D_CRT_DATA_PIPELINE_NAME) */
+ H5O_efl_t efl; /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */
} H5D_dcpl_cache_t;
/*****************************/
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 34a7803..2b4994f 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -44,27 +44,27 @@ typedef enum H5D_layout_t {
/* Values for the space allocation time property */
typedef enum H5D_alloc_time_t {
- H5D_ALLOC_TIME_ERROR =-1,
- H5D_ALLOC_TIME_DEFAULT =0,
- H5D_ALLOC_TIME_EARLY =1,
- H5D_ALLOC_TIME_LATE =2,
- H5D_ALLOC_TIME_INCR =3
+ H5D_ALLOC_TIME_ERROR = -1,
+ H5D_ALLOC_TIME_DEFAULT = 0,
+ H5D_ALLOC_TIME_EARLY = 1,
+ H5D_ALLOC_TIME_LATE = 2,
+ H5D_ALLOC_TIME_INCR = 3
} H5D_alloc_time_t;
/* Values for the status of space allocation */
typedef enum H5D_space_status_t {
- H5D_SPACE_STATUS_ERROR =-1,
- H5D_SPACE_STATUS_NOT_ALLOCATED =0,
- H5D_SPACE_STATUS_PART_ALLOCATED =1,
- H5D_SPACE_STATUS_ALLOCATED =2
+ H5D_SPACE_STATUS_ERROR = -1,
+ H5D_SPACE_STATUS_NOT_ALLOCATED = 0,
+ H5D_SPACE_STATUS_PART_ALLOCATED = 1,
+ H5D_SPACE_STATUS_ALLOCATED = 2
} H5D_space_status_t;
/* Values for time of writing fill value property */
typedef enum H5D_fill_time_t {
- H5D_FILL_TIME_ERROR =-1,
- H5D_FILL_TIME_ALLOC =0,
- H5D_FILL_TIME_NEVER =1,
- H5D_FILL_TIME_IFSET =2
+ H5D_FILL_TIME_ERROR = -1,
+ H5D_FILL_TIME_ALLOC = 0,
+ H5D_FILL_TIME_NEVER = 1,
+ H5D_FILL_TIME_IFSET = 2
} H5D_fill_time_t;
/* Values for fill value status */
diff --git a/src/H5MM.c b/src/H5MM.c
index afe7a3a..6688ff8 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -239,8 +239,6 @@ done:
* matzke@llnl.gov
* Jul 10 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -249,8 +247,8 @@ H5MM_xfree(void *mem)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5MM_xfree);
- if (mem)
+ if(mem)
HDfree(mem);
FUNC_LEAVE_NOAPI(NULL);
-}
+} /* end H5MM_xfree() */
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 14a8c7a..5035e17 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -269,36 +269,34 @@ H5O_efl_copy(const void *_mesg, void *_dest)
size_t u; /* Local index variable */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_efl_copy);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_efl_copy)
/* check args */
- assert(mesg);
- if (!dest) {
- if (NULL==(dest = H5MM_calloc(sizeof(H5O_efl_t))) ||
- NULL==(dest->slot=H5MM_malloc(mesg->nalloc* sizeof(H5O_efl_entry_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
-
- } else if (dest->nalloc<mesg->nalloc) {
+ HDassert(mesg);
+ if(!dest) {
+ if(NULL == (dest = H5MM_calloc(sizeof(H5O_efl_t))) ||
+ NULL == (dest->slot = H5MM_malloc(mesg->nalloc * sizeof(H5O_efl_entry_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ } else if(dest->nalloc < mesg->nalloc) {
H5MM_xfree(dest->slot);
- if (NULL==(dest->slot = H5MM_malloc(mesg->nalloc*
- sizeof(H5O_efl_entry_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ if(NULL == (dest->slot = H5MM_malloc(mesg->nalloc * sizeof(H5O_efl_entry_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
}
dest->heap_addr = mesg->heap_addr;
dest->nalloc = mesg->nalloc;
dest->nused = mesg->nused;
- for (u = 0; u < mesg->nused; u++) {
+ for(u = 0; u < mesg->nused; u++) {
dest->slot[u] = mesg->slot[u];
- dest->slot[u].name = H5MM_xstrdup (mesg->slot[u].name);
- }
+ dest->slot[u].name = H5MM_xstrdup(mesg->slot[u].name);
+ } /* end for */
/* Set return value */
- ret_value=dest;
+ ret_value = dest;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_efl_copy() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 62b8625..4a0b4f3 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -30,38 +30,34 @@
#include "H5Pprivate.h" /* Property lists */
+static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
+static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg);
+static size_t H5O_fill_size(const H5F_t *f, const void *_mesg);
+static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
+ int indent, int fwidth);
static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_fill_new_copy(const void *_mesg, void *_dest);
static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_fill_new_reset(void *_mesg);
static herr_t H5O_fill_new_free(void *_mesg);
-static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
- int indent, int fwidth);
-
-static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
-static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static void *H5O_fill_copy(const void *_mesg, void *_dest);
-static size_t H5O_fill_size(const H5F_t *f, const void *_mesg);
-static herr_t H5O_fill_reset(void *_mesg);
-static herr_t H5O_fill_free(void *_mesg);
static void *H5O_fill_new_get_share(const void *_mesg, H5O_shared_t *sh);
static herr_t H5O_fill_new_set_share(void *_mesg, const H5O_shared_t *sh);
static htri_t H5O_fill_new_is_shared(const void *_mesg);
-static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
+static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
int indent, int fwidth);
/* This message derives from H5O message class, for old fill value before version 1.5 */
const H5O_msg_class_t H5O_MSG_FILL[1] = {{
H5O_FILL_ID, /*message id number */
"fill", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
+ sizeof(H5O_fill_t), /*native message size */
H5O_fill_decode, /*decode message */
H5O_fill_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
+ H5O_fill_new_copy, /*copy the native value */
H5O_fill_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
+ H5O_fill_new_reset, /*free internal memory */
+ H5O_fill_new_free, /* free method */
NULL, /* file delete method */
NULL, /* link method */
H5O_fill_new_get_share, /* get share method */
@@ -80,7 +76,7 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{
const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
H5O_FILL_NEW_ID, /*message id number */
"fill_new", /*message name for debugging */
- sizeof(H5O_fill_new_t), /*native message size */
+ sizeof(H5O_fill_t), /*native message size */
H5O_fill_new_decode, /*decode message */
H5O_fill_new_encode, /*encode message */
H5O_fill_new_copy, /*copy the native value */
@@ -106,9 +102,6 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
/* Revised version of the "new" fill value information */
#define H5O_FILL_VERSION_2 2
-/* Declare a free list to manage the H5O_fill_new_t struct */
-H5FL_DEFINE(H5O_fill_new_t);
-
/* Declare a free list to manage the H5O_fill_t struct */
H5FL_DEFINE(H5O_fill_t);
@@ -134,16 +127,16 @@ H5FL_DEFINE(H5O_fill_t);
static void *
H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
- H5O_fill_new_t *mesg = NULL;
- int version;
- void *ret_value;
+ H5O_fill_t *mesg = NULL;
+ int version;
+ void *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_decode)
HDassert(f);
HDassert(p);
- if(NULL == (mesg = H5FL_CALLOC(H5O_fill_new_t)))
+ if(NULL == (mesg = H5FL_CALLOC(H5O_fill_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Version */
@@ -180,7 +173,7 @@ done:
if(!ret_value && mesg) {
if(mesg->buf)
H5MM_xfree(mesg->buf);
- H5FL_FREE(H5O_fill_new_t,mesg);
+ H5FL_FREE(H5O_fill_t, mesg);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -199,15 +192,13 @@ done:
* Programmer: Robb Matzke
* Wednesday, September 30, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
H5O_fill_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
- H5O_fill_t *mesg = NULL;
- void *ret_value;
+ H5O_fill_t *mesg = NULL; /* Decoded fill value message */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_fill_decode)
@@ -217,14 +208,18 @@ H5O_fill_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (mesg = H5FL_CALLOC(H5O_fill_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
+ /* Set non-zero default fields */
+ mesg->alloc_time = H5D_ALLOC_TIME_LATE;
+ mesg->fill_time = H5D_FILL_TIME_IFSET;
+
/* Fill value size */
UINT32DECODE(p, mesg->size);
- /* Only encode the fill value itself if there is one */
+ /* Only decode the fill value itself if there is one */
if(mesg->size > 0) {
- if(NULL == (mesg->buf = H5MM_malloc(mesg->size)))
+ if(NULL == (mesg->buf = H5MM_malloc((size_t)mesg->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(mesg->buf, p, mesg->size);
+ HDmemcpy(mesg->buf, p, (size_t)mesg->size);
} /* end if */
/* Set return value */
@@ -260,7 +255,7 @@ done:
static herr_t
H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
{
- const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_encode)
@@ -311,7 +306,7 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
static herr_t
H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_encode)
@@ -321,7 +316,7 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
UINT32ENCODE(p, mesg->size);
if(mesg->buf)
- HDmemcpy(p, mesg->buf, mesg->size);
+ HDmemcpy(p, mesg->buf, (size_t)mesg->size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_encode() */
@@ -342,24 +337,25 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
* Programmer: Raymond Lu
* Feb 26, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
H5O_fill_new_copy(const void *_mesg, void *_dest)
{
- const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
- H5O_fill_new_t *dest = (H5O_fill_new_t *)_dest;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ H5O_fill_t *dest = (H5O_fill_t *)_dest;
void *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_copy)
HDassert(mesg);
- if(!dest && NULL == (dest = H5FL_MALLOC(H5O_fill_new_t)))
+ if(!dest && NULL == (dest = H5FL_MALLOC(H5O_fill_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
+ /* Copy fill value attributes */
+ *dest = *mesg;
+
/* Copy shared message information */
if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), &(dest->sh_loc)))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to copy fill value shared info");
@@ -381,12 +377,6 @@ H5O_fill_new_copy(const void *_mesg, void *_dest)
} /* end if */
else
dest->buf = NULL;
- dest->size = mesg->size;
-
- /* Copy three fill value attributes */
- dest->alloc_time = mesg->alloc_time;
- dest->fill_time = mesg->fill_time;
- dest->fill_defined = mesg->fill_defined;
/* Set return value */
ret_value = dest;
@@ -398,7 +388,7 @@ done:
if(dest->type)
H5T_close(dest->type);
if(!_dest)
- H5FL_FREE(H5O_fill_new_t, dest);
+ H5FL_FREE(H5O_fill_t, dest);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -406,70 +396,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_fill_copy
- *
- * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
- * necessary.
- *
- * Return: Success: Ptr to _DEST
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, October 1, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5O_fill_copy(const void *_mesg, void *_dest)
-{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
- H5O_fill_t *dest = (H5O_fill_t *)_dest;
- void *ret_value;
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_fill_copy)
-
- HDassert(mesg);
-
- if(!dest && NULL == (dest = H5FL_CALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
-
- if(mesg->type) {
- if(NULL == (dest->type = H5T_copy(mesg->type, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type")
- } /* end if */
- else
- dest->type = NULL;
-
- if(mesg->buf) {
- if(NULL == (dest->buf = H5MM_malloc(mesg->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dest->buf, mesg->buf, mesg->size);
- } /* end if */
- else
- dest->buf = NULL;
- dest->size = mesg->size;
-
- /* Set return value */
- ret_value = dest;
-
-done:
- if (!ret_value && dest) {
- if(dest->buf)
- H5MM_xfree(dest->buf);
- if (dest->type)
- H5T_close(dest->type);
- if (!_dest)
- H5FL_FREE(H5O_fill_t,dest);
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_fill_copy() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_fill_new_size
*
* Purpose: Returns the size of the raw message in bytes not counting the
@@ -485,14 +411,12 @@ done:
* Programmer: Robb Matzke
* Thursday, October 1, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
H5O_fill_new_size(const H5F_t UNUSED *f, const void *_mesg)
{
- const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
size_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_size)
@@ -526,18 +450,15 @@ H5O_fill_new_size(const H5F_t UNUSED *f, const void *_mesg)
* Programmer: Robb Matzke
* Thursday, October 1, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
H5O_fill_size(const H5F_t UNUSED *f, const void *_mesg)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_size)
- HDassert(f);
HDassert(mesg);
FUNC_LEAVE_NOAPI(4 + mesg->size)
@@ -545,78 +466,69 @@ H5O_fill_size(const H5F_t UNUSED *f, const void *_mesg)
/*-------------------------------------------------------------------------
- * Function: H5O_fill_new_reset
+ * Function: H5O_fill_reset_dyn
*
- * Purpose: Resets a new message to an initial state. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * Purpose: Resets dynamic fill value fields
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, October 1, 1998
- *
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Monday, January 22, 2007
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5O_fill_new_reset(void *_mesg)
+herr_t
+H5O_fill_reset_dyn(H5O_fill_t *fill)
{
- H5O_fill_new_t *mesg = (H5O_fill_new_t *)_mesg;
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset_dyn)
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_reset)
-
- HDassert(mesg);
+ HDassert(fill);
- if(mesg->buf)
- mesg->buf = H5MM_xfree(mesg->buf);
- mesg->size = -1;
- if(mesg->type) {
- H5T_close(mesg->type);
- mesg->type = NULL;
+ if(fill->buf)
+ fill->buf = H5MM_xfree(fill->buf);
+ fill->size = -1;
+ if(fill->type) {
+ H5T_close(fill->type);
+ fill->type = NULL;
} /* end if */
- mesg->alloc_time = (H5D_alloc_time_t)0;
- mesg->fill_time = (H5D_fill_time_t)0;
- mesg->fill_defined = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_fill_new_reset() */
+} /* end H5O_fill_reset_dyn() */
/*-------------------------------------------------------------------------
- * Function: H5O_fill_reset
+ * Function: H5O_fill_new_reset
*
- * Purpose: Resets a message to an initial state
+ * Purpose: Resets a new message to an initial state. The new fill value
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, October 1, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_reset(void *_mesg)
+H5O_fill_new_reset(void *_mesg)
{
- H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
+ H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_reset)
HDassert(mesg);
- if(mesg->buf)
- mesg->buf = H5MM_xfree(mesg->buf);
- mesg->size = 0;
- if(mesg->type) {
- H5T_close(mesg->type);
- mesg->type = NULL;
- } /* end if */
+ /* Reset dynamic fields */
+ H5O_fill_reset_dyn(mesg);
+
+ /* Reset value fields */
+ mesg->alloc_time = H5D_ALLOC_TIME_LATE;
+ mesg->fill_time = H5D_FILL_TIME_IFSET;
+ mesg->fill_defined = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_fill_reset() */
+} /* end H5O_fill_new_reset() */
/*-------------------------------------------------------------------------
@@ -629,44 +541,15 @@ H5O_fill_reset(void *_mesg)
* Programmer: Quincey Koziol
* Thursday, December 5, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_new_free (void *mesg)
+H5O_fill_new_free(void *mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_free)
HDassert(mesg);
- H5FL_FREE(H5O_fill_new_t, mesg);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_fill_new_free() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_fill_free
- *
- * Purpose: Frees the message
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, December 5, 2002
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_fill_free (void *mesg)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_free)
-
- HDassert(mesg);
-
H5FL_FREE(H5O_fill_t, mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -688,12 +571,12 @@ H5O_fill_free (void *mesg)
static void *
H5O_fill_new_get_share(const void *_mesg, H5O_shared_t *sh /*out*/)
{
- const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
- void *ret_value = NULL;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ void *ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_get_share)
- HDassert (mesg);
+ HDassert(mesg);
ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh);
@@ -716,13 +599,13 @@ H5O_fill_new_get_share(const void *_mesg, H5O_shared_t *sh /*out*/)
static herr_t
H5O_fill_new_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh)
{
- H5O_fill_new_t *mesg = (H5O_fill_new_t *)_mesg;
+ H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_set_share)
- HDassert (mesg);
- HDassert (sh);
+ HDassert(mesg);
+ HDassert(sh);
if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
ret_value = FAIL;
@@ -749,7 +632,7 @@ H5O_fill_new_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh)
static htri_t
H5O_fill_new_is_shared(const void *_mesg)
{
- const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_is_shared)
@@ -781,7 +664,7 @@ static herr_t
H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *stream,
int indent, int fwidth)
{
- const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
H5D_fill_value_t fill_status; /* Whether the fill value is defined */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_debug)
@@ -852,7 +735,7 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL
break;
} /* end switch */
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth,
"Size:", mesg->size);
fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
if(mesg->type) {
@@ -882,19 +765,19 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL
*/
static herr_t
H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *stream,
- int indent, int fwidth)
+ int indent, int fwidth)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_debug)
HDassert(f);
HDassert(mesg);
HDassert(stream);
- HDassert(indent>=0);
- HDassert(fwidth>=0);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth,
"Bytes:", mesg->size);
fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
if(mesg->type) {
@@ -926,9 +809,8 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s
*-------------------------------------------------------------------------
*/
herr_t
-H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
+H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_t dxpl_id)
{
- H5O_fill_new_t *fill = _fill;
H5T_path_t *tpath; /* Type conversion info */
void *buf = NULL, *bkg = NULL; /* Conversion buffers */
hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */
@@ -938,12 +820,18 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
HDassert(fill);
HDassert(dset_type);
+ HDassert(fill_changed);
/* No-op cases */
if(!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) {
+ /* Don't need datatype for fill value */
if(fill->type)
H5T_close(fill->type);
fill->type = NULL;
+
+ /* Note that the fill value info has changed */
+ *fill_changed = TRUE;
+
HGOTO_DONE(SUCCEED);
} /* end if */
@@ -955,10 +843,8 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {
- if ((src_id = H5I_register(H5I_DATATYPE,
- H5T_copy(fill->type, H5T_COPY_ALL))) < 0 ||
- (dst_id = H5I_register(H5I_DATATYPE,
- H5T_copy(dset_type, H5T_COPY_ALL))) < 0)
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill->type, H5T_COPY_ALL))) < 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(dset_type, H5T_COPY_ALL))) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type")
/*
@@ -987,6 +873,9 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
H5T_close(fill->type);
fill->type = NULL;
H5_ASSIGN_OVERFLOW(fill->size, H5T_get_size(dset_type), size_t, ssize_t);
+
+ /* Note that the fill value info has changed */
+ *fill_changed = TRUE;
} /* end if */
done:
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 42dea00..d5a2376 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -182,31 +182,24 @@ typedef struct H5O_linfo_t {
} H5O_linfo_t;
/*
- * Fill Value Message. (Old)
- * (Data structure in memory)
- */
-typedef struct H5O_fill_t {
- H5T_t *type; /*type. Null implies same as dataset */
- size_t size; /*number of bytes in the fill value */
- void *buf; /*the fill value */
-} H5O_fill_t;
-
-/*
- * New Fill Value Message. The new fill value message is fill value plus
+ * New Fill Value Message.
+ * (Data structure in memory for both "old" and "new" fill value messages)
+ *
+ * The new fill value message is fill value plus
* space allocation time, fill value writing time, whether fill
* value is defined, and the location of the message if it's shared
*/
-typedef struct H5O_fill_new_t {
+typedef struct H5O_fill_t {
+ H5O_shared_t sh_loc; /* Shared message info (must be first) */
+
H5T_t *type; /*type. Null implies same as dataset */
ssize_t size; /*number of bytes in the fill value */
void *buf; /*the fill value */
H5D_alloc_time_t alloc_time; /* time to allocate space */
H5D_fill_time_t fill_time; /* time to write fill value */
hbool_t fill_defined; /* whether fill value is defined */
-
- H5O_shared_t sh_loc; /* Shared message info (must be first) */
-} H5O_fill_new_t;
+} H5O_fill_t;
/*
* Link message.
@@ -467,7 +460,8 @@ H5_DLL size_t H5O_layout_meta_size(const H5F_t *f, const void *_mesg);
H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
/* Fill value operators */
-H5_DLL herr_t H5O_fill_convert(void *_fill, H5T_t *type, hid_t dxpl_id);
+H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill);
+H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id);
/* Link operators */
H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 7306fd4..97983ec 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -59,17 +59,11 @@
/* Definitions for fill value. size=0 means fill value will be 0 as
* library default; size=-1 means fill value is undefined. */
#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t)
-#define H5D_CRT_FILL_VALUE_DEF {NULL, 0, NULL}
+#define H5D_CRT_FILL_VALUE_DEF {{0, {{NULL, HADDR_UNDEF, FALSE}}}, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE}
#define H5D_CRT_FILL_VALUE_CMP H5P_dcrt_fill_value_cmp
-/* Definitions for space allocation time */
-#define H5D_CRT_ALLOC_TIME_SIZE sizeof(H5D_alloc_time_t)
-#define H5D_CRT_ALLOC_TIME_DEF H5D_ALLOC_TIME_LATE
-#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state"
+/* Definitions for space allocation time state */
#define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned)
#define H5D_CRT_ALLOC_TIME_STATE_DEF 1
-/* Definitions for time of fill value writing */
-#define H5D_CRT_FILL_TIME_SIZE sizeof(H5D_fill_time_t)
-#define H5D_CRT_FILL_TIME_DEF H5D_FILL_TIME_IFSET
/* Definitions for external file list */
#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t)
#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL}
@@ -152,9 +146,7 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
unsigned chunk_ndims = H5D_CRT_CHUNK_DIM_DEF; /* Default rank for chunks */
size_t chunk_size[H5O_LAYOUT_NDIMS] = H5D_CRT_CHUNK_SIZE_DEF; /* Default chunk size */
H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
- H5D_alloc_time_t alloc_time = H5D_CRT_ALLOC_TIME_DEF; /* Default allocation time */
unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
- H5D_fill_time_t fill_time = H5D_CRT_FILL_TIME_DEF; /* Default fill time */
H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
H5O_pline_t pline = H5D_CRT_DATA_PIPELINE_DEF; /* Default I/O pipeline setting */
herr_t ret_value = SUCCEED; /* Return value */
@@ -177,18 +169,10 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
if(H5P_register(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the space allocation time property */
- if(H5P_register(pclass, H5D_CRT_ALLOC_TIME_NAME, H5D_CRT_ALLOC_TIME_SIZE, &alloc_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the space allocation time state property */
if(H5P_register(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the fill value writing time property */
- if(H5P_register(pclass, H5D_CRT_FILL_TIME_NAME, H5D_CRT_FILL_TIME_SIZE, &fill_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the external file list property */
if(H5P_register(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -246,14 +230,8 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
/* Make copies of fill value, external file list, and data pipeline */
- if(src_fill.buf) {
- if(NULL == H5O_msg_copy(H5O_FILL_ID, &src_fill, &dst_fill))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value")
- } /* end if */
- else {
- dst_fill.type = dst_fill.buf = NULL;
- dst_fill.size = src_fill.size;
- } /* end else */
+ if(NULL == H5O_msg_copy(H5O_FILL_ID, &src_fill, &dst_fill))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value")
HDmemset(&dst_efl, 0, sizeof(H5O_efl_t));
if(NULL == H5O_msg_copy(H5O_EFL_ID, &src_efl, &dst_efl))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list")
@@ -293,9 +271,9 @@ done:
static herr_t
H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
{
- H5O_fill_t fill; /* Fill value */
- H5O_efl_t efl; /* External file list */
- H5O_pline_t pline; /* I/O pipeline */
+ H5O_fill_t fill; /* Fill value */
+ H5O_efl_t efl; /* External file list */
+ H5O_pline_t pline; /* I/O pipeline */
H5P_genplist_t *plist; /* Property list */
herr_t ret_value = SUCCEED; /* Return value */
@@ -373,9 +351,17 @@ H5P_dcrt_fill_value_cmp(const void *_fill1, const void *_fill2, size_t UNUSED si
if(fill1->buf == NULL && fill2->buf != NULL) HGOTO_DONE(-1);
if(fill1->buf != NULL && fill2->buf == NULL) HGOTO_DONE(1);
if(fill1->buf != NULL)
- if((cmp_value = HDmemcmp(fill1->buf, fill2->buf, fill1->size)) != 0)
+ if((cmp_value = HDmemcmp(fill1->buf, fill2->buf, (size_t)fill1->size)) != 0)
HGOTO_DONE(cmp_value);
+ /* Check the allocation time for the fill values */
+ if(fill1->alloc_time < fill2->alloc_time) HGOTO_DONE(-1);
+ if(fill1->alloc_time > fill2->alloc_time) HGOTO_DONE(1);
+
+ /* Check the fill time for the fill values */
+ if(fill1->fill_time < fill2->fill_time) HGOTO_DONE(-1);
+ if(fill1->fill_time > fill2->fill_time) HGOTO_DONE(1);
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_dcrt_fill_value_cmp() */
@@ -565,48 +551,52 @@ done:
static herr_t
H5P_set_layout(H5P_genplist_t *plist, H5D_layout_t layout)
{
- unsigned alloc_time_state; /* State of allocation time property */
- herr_t ret_value=SUCCEED; /* return value */
+ unsigned alloc_time_state; /* State of allocation time property */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT(H5P_set_layout);
+ FUNC_ENTER_NOAPI_NOINIT(H5P_set_layout)
/* Get the allocation time state */
if(H5P_get(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time state")
/* If we still have the "default" allocation time, change it according to the new layout */
if(alloc_time_state) {
- H5D_alloc_time_t alloc_time; /* Space allocation time */
+ H5O_fill_t fill; /* Fill value */
+
+ /* Get current fill value info */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
/* Set the default based on layout */
switch(layout) {
case H5D_COMPACT:
- alloc_time=H5D_ALLOC_TIME_EARLY;
+ fill.alloc_time = H5D_ALLOC_TIME_EARLY;
break;
case H5D_CONTIGUOUS:
- alloc_time=H5D_ALLOC_TIME_LATE;
+ fill.alloc_time = H5D_ALLOC_TIME_LATE;
break;
case H5D_CHUNKED:
- alloc_time=H5D_ALLOC_TIME_INCR;
+ fill.alloc_time = H5D_ALLOC_TIME_INCR;
break;
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layou t type")
} /* end switch */
- /* Set new allocation time */
- if(H5P_set(plist, H5D_CRT_ALLOC_TIME_NAME, &alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocat ion time");
+ /* Set updated fill value info */
+ if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocat ion time")
} /* end if */
/* Set layout value */
if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_set_layout() */
@@ -635,23 +625,23 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_layout, FAIL);
+ FUNC_ENTER_API(H5Pset_layout, FAIL)
H5TRACE2("e", "iDl", plist_id, layout);
/* Check arguments */
if (layout < 0 || layout >= H5D_NLAYOUTS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value */
if(H5P_set_layout (plist, layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -682,19 +672,19 @@ H5Pget_layout(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
H5D_layout_t ret_value=H5D_LAYOUT_ERROR;
- FUNC_ENTER_API(H5Pget_layout, H5D_LAYOUT_ERROR);
+ FUNC_ENTER_API(H5Pget_layout, H5D_LAYOUT_ERROR)
H5TRACE1("Dl", "i", plist_id);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID")
/* Get value */
if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -730,40 +720,40 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_chunk, FAIL);
+ FUNC_ENTER_API(H5Pset_chunk, FAIL)
H5TRACE3("e", "iIs*[a1]h", plist_id, ndims, dim);
/* Check arguments */
if (ndims <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality must be positive");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality must be positive")
if (ndims > H5S_MAX_RANK)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality is too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality is too large")
if (!dim)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Initialize chunk dims to 0s */
HDmemset(real_dims,0,sizeof(real_dims));
for (i=0; i<ndims; i++) {
if (dim[i] == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive")
if (dim[i] != (dim[i]&0xffffffff))
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be less than 2^32");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be less than 2^32")
real_dims[i]=(size_t)dim[i]; /* Store user's chunk dimensions */
} /* end for */
if(H5P_set_layout (plist, H5D_CHUNKED) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout")
if(H5P_set(plist, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set chunk dimensionanlity");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set chunk dimensionanlity")
if(H5P_set(plist, H5D_CRT_CHUNK_SIZE_NAME, real_dims) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set chunk size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set chunk size")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -799,27 +789,27 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
H5P_genplist_t *plist; /* Property list pointer */
int ret_value;
- FUNC_ENTER_API(H5Pget_chunk, FAIL);
+ FUNC_ENTER_API(H5Pget_chunk, FAIL)
H5TRACE3("Is", "iIsx", plist_id, max_ndims, dim);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
if(H5D_CHUNKED != layout)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout")
if(H5P_get(plist, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk dimensionality");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk dimensionality")
if(dim) {
int i;
size_t chunk_size[H5O_LAYOUT_NDIMS];
if(H5P_get(plist, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk size")
/* Get the dimension sizes */
for (i=0; i<ndims && i<max_ndims; i++)
@@ -830,7 +820,7 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
ret_value=ndims;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -873,31 +863,31 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pset_external, FAIL);
+ FUNC_ENTER_API(H5Pset_external, FAIL)
H5TRACE4("e", "isoh", plist_id, name, offset, size);
/* Check arguments */
if (!name || !*name)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
if (offset<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset")
if (size<=0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
if(efl.nused > 0 && H5O_EFL_UNLIMITED==efl.slot[efl.nused-1].size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited")
if (H5O_EFL_UNLIMITED!=size) {
for (idx=0, total=size; idx<efl.nused; idx++, total=tmp) {
tmp = total + efl.slot[idx].size;
if (tmp <= total)
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed");
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed")
} /* end for */
} /* end if */
@@ -908,7 +898,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
H5O_efl_entry_t *x = H5MM_realloc (efl.slot, na*sizeof(H5O_efl_entry_t));
if (!x)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
efl.nalloc = na;
efl.slot = x;
}
@@ -920,10 +910,10 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
efl.nused++;
if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set external file list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set external file list")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -955,22 +945,22 @@ H5Pget_external_count(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
int ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_external_count, FAIL);
+ FUNC_ENTER_API(H5Pget_external_count, FAIL)
H5TRACE1("Is", "i", plist_id);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
/* Set return value */
ret_value=(int)efl.nused;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1013,19 +1003,19 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_external, FAIL);
+ FUNC_ENTER_API(H5Pget_external, FAIL)
H5TRACE6("e", "iIuzxxx", plist_id, idx, name_size, name, offset, size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
if (idx>=efl.nused)
- HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range")
/* Return values */
if (name_size>0 && name)
@@ -1036,7 +1026,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*
*size = efl.slot[idx].size;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1086,35 +1076,35 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pmodify_filter, FAIL);
+ FUNC_ENTER_API(H5Pmodify_filter, FAIL)
H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
/* Check args */
if (filter<0 || filter>H5Z_FILTER_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier")
if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
if (cd_nelmts>0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the pipeline property to append to */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
/* Modify the filter parameters of the I/O pipeline */
if(H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
/* Put the I/O pipeline information back into the property list */
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pmodify_filter() */
@@ -1169,35 +1159,35 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_filter, FAIL);
+ FUNC_ENTER_API(H5Pset_filter, FAIL)
H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
/* Check args */
if (filter<0 || filter>H5Z_FILTER_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier")
if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
if (cd_nelmts>0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the pipeline property to append to */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
/* Add the filter to the I/O pipeline */
if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
/* Put the I/O pipeline information back into the property list */
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1232,22 +1222,22 @@ H5Pget_nfilters(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
int ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_nfilters, FAIL);
+ FUNC_ENTER_API(H5Pget_nfilters, FAIL)
H5TRACE1("Is", "i", plist_id);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
/* Set return value */
ret_value=(int)(pline.nused);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1617,7 +1607,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter)
} /* end if */
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Premove_filter() */
@@ -1709,24 +1699,24 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
unsigned int config_flags;
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_szip, FAIL);
+ FUNC_ENTER_API(H5Pset_szip, FAIL)
H5TRACE3("e", "iIuIu", plist_id, options_mask, pixels_per_block);
if(H5Zget_filter_info(H5Z_FILTER_SZIP, &config_flags) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't get filter info")
if(! (config_flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED))
- HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.");
+ HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.")
/* Check arguments */
if ((pixels_per_block%2)==1)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even")
if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is too large");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is too large")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Always set K13 compression (and un-set CHIP compression) */
options_mask &= (~H5_SZIP_CHIP_OPTION_MASK);
@@ -1745,14 +1735,14 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
/* Add the filter */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_SZIP, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline")
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_szip() */
@@ -1779,27 +1769,27 @@ H5Pset_shuffle(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_shuffle, FAIL);
+ FUNC_ENTER_API(H5Pset_shuffle, FAIL)
H5TRACE1("e", "i", plist_id);
/* Check arguments */
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
/* Get the plist structure */
if(NULL == (plist = H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Add the filter */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_SHUFFLE, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data")
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_shuffle() */
@@ -1825,27 +1815,27 @@ H5Pset_nbit(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_nbit, FAIL);
+ FUNC_ENTER_API(H5Pset_nbit, FAIL)
H5TRACE1("e", "i", plist_id);
/* Check arguments */
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
/* Get the plist structure */
if(NULL == (plist = H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Add the nbit filter */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline")
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_nbit() */
@@ -1888,19 +1878,19 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac
unsigned cd_values[2]; /* Filter parameters */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_scaleoffset, FAIL);
+ FUNC_ENTER_API(H5Pset_scaleoffset, FAIL)
H5TRACE3("e", "iZaIs", plist_id, scale_type, scale_factor);
/* Check arguments */
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
if(scale_type!=H5Z_SO_FLOAT_DSCALE && scale_type!=H5Z_SO_FLOAT_ESCALE && scale_type!=H5Z_SO_INT)
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "invalid scale type");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "invalid scale type")
/* Get the plist structure */
if(NULL == (plist = H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set parameters for the filter
* scale_type = 0: floating-point type, filter uses variable-minimum-bits method,
@@ -1915,14 +1905,14 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac
/* Add the scaleoffset filter */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline")
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_scaleoffset() */
@@ -1948,23 +1938,23 @@ H5Pset_fletcher32(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_fletcher32, FAIL);
+ FUNC_ENTER_API(H5Pset_fletcher32, FAIL)
H5TRACE1("e", "i", plist_id);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Add the Fletcher32 checksum as a filter */
if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_FLETCHER32, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline")
if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fletcher32() */
@@ -1995,48 +1985,47 @@ done:
herr_t
H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
{
- H5O_fill_t fill;
- H5T_t *type = NULL;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_fill_t fill; /* Fill value to modify */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pset_fill_value, FAIL);
+ FUNC_ENTER_API(H5Pset_fill_value, FAIL)
H5TRACE3("e", "iix", plist_id, type_id, value);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Get the "basic" fill value structure */
+ /* Get the current fill value */
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
- /* Reset the fill structure */
- if(H5O_msg_reset(H5O_FILL_ID, &fill)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset fill value");
+ /* Release the dynamic fill value components */
+ H5O_fill_reset_dyn(&fill);
if(value) {
- if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ H5T_t *type; /* Datatype for fill value */
+
+ /* Retrieve pointer to datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Set the fill value */
- if (NULL==(fill.type=H5T_copy(type, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data type");
+ if(NULL == (fill.type = H5T_copy(type, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype")
fill.size = H5T_get_size(type);
- if (NULL==(fill.buf=H5MM_malloc(fill.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value");
- HDmemcpy(fill.buf, value, fill.size);
- } else {
- fill.type = fill.buf = NULL;
- fill.size = (size_t)-1;
- }
+ if(NULL == (fill.buf = H5MM_malloc((size_t)fill.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value")
+ HDmemcpy(fill.buf, value, (size_t)fill.size);
+ } /* end if */
+ /* Update fill value in property list */
if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_fill_value() */
/*-------------------------------------------------------------------------
@@ -2045,7 +2034,7 @@ done:
* Purpose: Queries the fill value property of a dataset creation
* property list. The fill value is returned through the VALUE
* pointer and the memory is allocated by the caller. The fill
- * value will be converted from its current data type to the
+ * value will be converted from its current datatype to the
* specified TYPE.
*
* Return: Non-negative on success/Negative on failure
@@ -2053,96 +2042,92 @@ done:
* Programmer: Robb Matzke
* Thursday, October 1, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and get property for
- * generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
{
- H5O_fill_t fill;
- H5T_t *type = NULL; /*data type */
- H5T_path_t *tpath = NULL; /*type conversion info */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_fill_t fill; /* Fill value to retrieve */
+ H5T_t *type; /*datatype */
+ H5T_path_t *tpath; /*type conversion info */
void *buf = NULL; /*conversion buffer */
void *bkg = NULL; /*conversion buffer */
- hid_t src_id = -1; /*source data type id */
- herr_t ret_value=SUCCEED; /* Return value */
- H5P_genplist_t *plist; /* Property list pointer */
+ hid_t src_id = -1; /*source datatype id */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_fill_value, FAIL);
+ FUNC_ENTER_API(H5Pget_fill_value, FAIL)
H5TRACE3("e", "iix", plist_id, type_id, value);
/* Check arguments */
- if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (!value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer");
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(!value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/*
* If no fill value is defined then return an error. We can't even
- * return zero because we don't know the data type of the dataset and
- * data type conversion might not have resulted in zero. If fill value
+ * return zero because we don't know the datatype of the dataset and
+ * datatype conversion might not have resulted in zero. If fill value
* is undefined, also return error.
*/
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
- if(fill.size == (size_t)-1)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+ if(fill.size == -1)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined")
+ /* Check for "default" fill value */
if(fill.size == 0) {
HDmemset(value, 0, H5T_get_size(type));
HGOTO_DONE(SUCCEED);
- }
+ } /* end if */
+
/*
- * Can we convert between the source and destination data types?
+ * Can we convert between the source and destination datatypes?
*/
- if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL, H5AC_dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types");
- src_id = H5I_register(H5I_DATATYPE, H5T_copy (fill.type, H5T_COPY_TRANSIENT));
- if (src_id<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type");
+ if(NULL == (tpath = H5T_path_find(fill.type, type, NULL, NULL, H5AC_dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill.type, H5T_COPY_TRANSIENT));
+ if(src_id < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
/*
* Data type conversions are always done in place, so we need a buffer
* other than the fill value buffer that is large enough for both source
* and destination. The app-supplied buffer might do okay.
*/
- if (H5T_get_size(type)>=H5T_get_size(fill.type)) {
+ if(H5T_get_size(type) >= H5T_get_size(fill.type)) {
buf = value;
- if (H5T_path_bkg(tpath) && NULL==(bkg=H5MM_malloc(H5T_get_size(type))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
- } else {
- if (NULL==(buf=H5MM_malloc(H5T_get_size(fill.type))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
- if (H5T_path_bkg(tpath))
+ if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(type))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ } /* end if */
+ else {
+ if(NULL == (buf = H5MM_malloc(H5T_get_size(fill.type))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ if(H5T_path_bkg(tpath))
bkg = value;
- }
+ } /* end else */
HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
/* Do the conversion */
if(H5T_convert(tpath, src_id, type_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
if(buf != value)
HDmemcpy(value, buf, H5T_get_size(type));
done:
- if (buf!=value)
+ if(buf != value)
H5MM_xfree(buf);
- if (bkg!=value)
+ if(bkg != value)
H5MM_xfree(bkg);
- if (src_id>=0)
+ if(src_id >= 0)
H5I_dec_ref(src_id);
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_fill_value() */
/*-------------------------------------------------------------------------
@@ -2155,23 +2140,20 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- * Extracted from H5P_fill_value_defined, QAK, Dec. 13, 2002
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5P_is_fill_value_defined(const struct H5O_fill_t *fill, H5D_fill_value_t *status)
+H5P_is_fill_value_defined(const H5O_fill_t *fill, H5D_fill_value_t *status)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5P_is_fill_value_defined, FAIL);
+ FUNC_ENTER_NOAPI(H5P_is_fill_value_defined, FAIL)
- assert(fill);
- assert(status);
+ HDassert(fill);
+ HDassert(status);
- /* Check if the fill value was never set */
- if(fill->size == (size_t)-1 && !fill->buf)
+ /* Check if the fill value was "unset" */
+ if(fill->size == -1 && !fill->buf)
*status = H5D_FILL_VALUE_UNDEFINED;
/* Check if the fill value was set to the default fill value by the library */
else if(fill->size == 0 && !fill->buf)
@@ -2181,11 +2163,11 @@ H5P_is_fill_value_defined(const struct H5O_fill_t *fill, H5D_fill_value_t *statu
*status = H5D_FILL_VALUE_USER_DEFINED;
else {
*status = H5D_FILL_VALUE_ERROR;
- HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info")
+ } /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_is_fill_value_defined() */
@@ -2199,37 +2181,34 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
{
- H5P_genplist_t *plist;
- H5O_fill_t fill;
+ H5P_genplist_t *plist; /* Property list to query */
+ H5O_fill_t fill; /* Fill value to query */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_API(H5Pfill_value_defined, FAIL);
+ FUNC_ENTER_API(H5Pfill_value_defined, FAIL)
H5TRACE2("e", "i*DF", plist_id, status);
- assert(status);
+ HDassert(status);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the fill value struct */
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
/* Get the fill-value status */
if(H5P_is_fill_value_defined(&fill, status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pfill_value_defined() */
@@ -2254,36 +2233,41 @@ herr_t
H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
{
H5P_genplist_t *plist; /* Property list pointer */
+ H5O_fill_t fill; /* Fill value property to modify */
unsigned alloc_time_state; /* State of allocation time property */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_alloc_time, FAIL);
+ FUNC_ENTER_API(H5Pset_alloc_time, FAIL)
H5TRACE2("e", "iDa", plist_id, alloc_time);
+ /* Check arguments */
+ if(alloc_time < H5D_ALLOC_TIME_DEFAULT || alloc_time > H5D_ALLOC_TIME_INCR)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid allocation time setting")
+
/* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Check for resetting to default for layout type */
- if(alloc_time==H5D_ALLOC_TIME_DEFAULT) {
+ if(alloc_time == H5D_ALLOC_TIME_DEFAULT) {
H5D_layout_t layout; /* Type of storage layout */
/* Retrieve the storage layout */
if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout")
/* Set the default based on layout */
switch(layout) {
case H5D_COMPACT:
- alloc_time=H5D_ALLOC_TIME_EARLY;
+ alloc_time = H5D_ALLOC_TIME_EARLY;
break;
case H5D_CONTIGUOUS:
- alloc_time=H5D_ALLOC_TIME_LATE;
+ alloc_time = H5D_ALLOC_TIME_LATE;
break;
case H5D_CHUNKED:
- alloc_time=H5D_ALLOC_TIME_INCR;
+ alloc_time = H5D_ALLOC_TIME_INCR;
break;
default:
@@ -2291,21 +2275,28 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
} /* end switch */
/* Reset the "state" of the allocation time property back to the "default" */
- alloc_time_state=1;
+ alloc_time_state = 1;
} /* end if */
else
/* Set the "state" of the allocation time property to indicate the user modified it */
- alloc_time_state=0;
+ alloc_time_state = 0;
+
+ /* Retrieve previous fill value settings */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+
+ /* Update property value */
+ fill.alloc_time = alloc_time;
/* Set values */
- if(H5P_set(plist, H5D_CRT_ALLOC_TIME_NAME, &alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+ if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value")
if(H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pset_alloc_time() */
/*-------------------------------------------------------------------------
@@ -2320,31 +2311,36 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_alloc_time, FAIL);
+ FUNC_ENTER_API(H5Pget_alloc_time, FAIL)
H5TRACE2("e", "ix", plist_id, alloc_time);
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
/* Get values */
- if(!alloc_time || H5P_get(plist, H5D_CRT_ALLOC_TIME_NAME, alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time");
+ if(alloc_time) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_fill_t fill; /* Fill value property to query */
+
+ /* Get the property list structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Retrieve fill value settings */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+
+ /* Set user's value */
+ *alloc_time = fill.alloc_time;
+ } /* end if */
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_alloc_time() */
/*-------------------------------------------------------------------------
@@ -2358,35 +2354,40 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time)
{
H5P_genplist_t *plist; /* Property list pointer */
+ H5O_fill_t fill; /* Fill value property to modify */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_fill_time, FAIL);
+ FUNC_ENTER_API(H5Pset_fill_time, FAIL)
H5TRACE2("e", "iDf", plist_id, fill_time);
/* Check arguments */
- if(fill_time<H5D_FILL_TIME_ALLOC || fill_time>H5D_FILL_TIME_IFSET)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fill time setting");
+ if(fill_time < H5D_FILL_TIME_ALLOC || fill_time > H5D_FILL_TIME_IFSET)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fill time setting")
/* Get the property list structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Retrieve previous fill value settings */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+
+ /* Update property value */
+ fill.fill_time = fill_time;
/* Set values */
- if(H5P_set(plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+ if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_fill_time() */
/*-------------------------------------------------------------------------
@@ -2408,21 +2409,29 @@ done:
herr_t
H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_fill_time, FAIL);
+ FUNC_ENTER_API(H5Pget_fill_time, FAIL)
H5TRACE2("e", "ix", plist_id, fill_time);
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
/* Set values */
- if(!fill_time || H5P_get(plist, H5D_CRT_FILL_TIME_NAME, fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+ if(fill_time) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_fill_t fill; /* Fill value property to query */
+
+ /* Get the property list structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Retrieve fill value settings */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+
+ /* Set user's value */
+ *fill_time = fill.fill_time;
+ } /* end if */
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_fill_time() */
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 9eb3705..83dbb75 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -83,7 +83,7 @@ typedef enum {
H5S_SEL_POINTS = 1, /* Sequence of points selected */
H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */
H5S_SEL_ALL = 3, /* Entire extent selected */
- H5S_SEL_N = 4 /*THIS MUST BE LAST */
+ H5S_SEL_N /*THIS MUST BE LAST */
}H5S_sel_type;
#ifdef __cplusplus
diff --git a/src/H5private.h b/src/H5private.h
index ada1e0d..8a029cb 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -474,29 +474,29 @@
* A macro for detecting over/under-flow when casting between types
*/
#ifndef NDEBUG
-#define H5_CHECK_OVERFLOW(var,vartype,casttype) \
-{ \
- casttype _tmp_overflow=(casttype)(var); \
- assert((var)==(vartype)_tmp_overflow); \
+#define H5_CHECK_OVERFLOW(var, vartype, casttype) \
+{ \
+ casttype _tmp_overflow = (casttype)(var); \
+ assert((var) == (vartype)_tmp_overflow); \
}
#else /* NDEBUG */
-#define H5_CHECK_OVERFLOW(var,vartype,casttype)
+#define H5_CHECK_OVERFLOW(var, vartype, casttype)
#endif /* NDEBUG */
/*
* A macro for detecting over/under-flow when assigning between types
*/
#ifndef NDEBUG
-#define H5_ASSIGN_OVERFLOW(var,expr,exprtype,vartype) \
+#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \
{ \
- exprtype _tmp_overflow=(exprtype)(expr); \
- vartype _tmp_overflow2=(vartype)(_tmp_overflow); \
- assert((vartype)_tmp_overflow==_tmp_overflow2); \
- (var)=_tmp_overflow2; \
+ srctype _tmp_overflow = (srctype)(src); \
+ dsttype _tmp_overflow2 = (dsttype)(_tmp_overflow); \
+ assert((dsttype)_tmp_overflow == _tmp_overflow2); \
+ (dst) = _tmp_overflow2; \
}
#else /* NDEBUG */
-#define H5_ASSIGN_OVERFLOW(var,expr,exprtype,vartype) \
- (var)=(vartype)(expr);
+#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \
+ (dst) = (dsttype)(src);
#endif /* NDEBUG */
/*
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 817ebfc..d7da07d 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -1189,7 +1189,7 @@ test_vltypes_compound_vlstr(void)
hsize_t maxdims[] = {H5S_UNLIMITED};
hsize_t size[] = {SPACE1_DIM1};
hsize_t offset[] = {0};
- unsigned i,j,k; /* counting variables */
+ unsigned i,j; /* counting variables */
s2 *t1, *t2; /* Temporary pointer to VL information */
int val;
herr_t ret; /* Generic return value */