summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-07-21 13:54:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-07-21 13:54:23 (GMT)
commitb7dbfc3796ebbf4fedd4fe406c833363591368f0 (patch)
tree7ec59a3792a76ce8276a83b6e1f73fad3841a2f4 /src
parent8dadcdb1016ee6ea9399ac308ab72993eb5329dc (diff)
downloadhdf5-b7dbfc3796ebbf4fedd4fe406c833363591368f0.zip
hdf5-b7dbfc3796ebbf4fedd4fe406c833363591368f0.tar.gz
hdf5-b7dbfc3796ebbf4fedd4fe406c833363591368f0.tar.bz2
[svn-r7243] Purpose:
Bug fix Description: Fix bug with combination of fill-values, chunked datasets and variable-length strings. Platforms tested: FreeBSD 4.8 (sleipnir) h5committest
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 6126350..d741b32 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -39,7 +39,7 @@ static int interface_initialize_g = 0;
/* Local functions */
static herr_t H5D_init_interface(void);
static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id);
-static H5D_t * H5D_new(hid_t dcpl_id, hbool_t creating);
+static H5D_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id,
const H5S_t *space, hid_t dcpl_id, hid_t dxpl_id);
static H5D_t * H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id);
@@ -1242,7 +1242,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5D_t *
-H5D_new(hid_t dcpl_id, hbool_t creating)
+H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
{
H5P_genplist_t *plist; /* Property list created */
H5D_t *new_dset = NULL; /* New dataset object */
@@ -1256,7 +1256,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating)
/* If we are using the default dataset creation property list, during creation
* don't bother to copy it, just increment the reference count
*/
- if(creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
+ if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
/* Copy the default dataset information */
HDmemcpy(new_dset,&H5D_def_dset,sizeof(H5D_t));
@@ -1388,9 +1388,15 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
/* 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)
+ if(fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_DEFAULT) {
dset->fill_time=fill_time=H5D_FILL_TIME_ALLOC;
+ /* Update dataset creation property */
+ assert(dset->dcpl_id!=H5P_DATASET_CREATE_DEFAULT);
+ if (H5P_set(plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill time")
+ } /* end if */
+
/* Don't allow never writing fill values with variable-length types */
if(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")
@@ -1437,6 +1443,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
/* Update dataset creation property */
+ assert(dset->dcpl_id!=H5P_DATASET_CREATE_DEFAULT);
if (H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value")
} /* end if */
@@ -1593,6 +1600,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
unsigned chunk_ndims = 0; /* Dimensionality of chunk */
hsize_t chunk_size[H5O_LAYOUT_NDIMS]={0};
H5P_genplist_t *dc_plist=NULL; /* New Property list */
+ hbool_t has_vl_type=FALSE; /* Flag to indicate a VL-type for dataset */
H5D_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5D_create, NULL)
@@ -1617,8 +1625,12 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
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 */
+ if(H5T_detect_class(type, H5T_VLEN))
+ has_vl_type=TRUE;
+
/* Initialize the dataset object */
- if(NULL == (new_dset = H5D_new(dcpl_id,TRUE)))
+ if(NULL == (new_dset = H5D_new(dcpl_id,TRUE,has_vl_type)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Make the "set local" filter callbacks for this dataset */
@@ -2017,7 +2029,8 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id)
assert (ent);
/* Allocate the dataset structure */
- if(NULL==(dataset = H5D_new(H5P_DATASET_CREATE_DEFAULT,FALSE)))
+ /* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */
+ if(NULL==(dataset = H5D_new(H5P_DATASET_CREATE_DEFAULT,FALSE,FALSE)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Shallow copy (take ownership) of the group entry object */