summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--release_docs/RELEASE.txt55
-rw-r--r--src/H5D.c25
-rw-r--r--test/Makefile.in1
-rw-r--r--test/tmisc.c136
4 files changed, 182 insertions, 35 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 84048d4..396d5e9 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -34,17 +34,18 @@ CONTENTS
New Features
============
-Configuration:
---------------
+ Configuration:
+ --------------
-Library:
---------
+ Library:
+ --------
-Parallel Library:
------------------
+ Parallel Library:
+ -----------------
+
+ Tools:
+ ------
-Tools:
-------
Support for new platforms, languages and compilers.
=======================================
@@ -53,31 +54,27 @@ Support for new platforms, languages and compilers.
Bug Fixes since HDF5-1.6.0 release
==================================
-Library
--------
- - Modified library and file format to support storing indexed storage
- (chunked dataset) B-tree's with non-default internal 'K' values.
- QAK - 2003/07/15
- - Returned H5T_BKG_TEMP support to library after it was accidentally
- removed. QAK - 2003/07/14
-
-Configuration
--------------
-
-Performance
--------------
-
-Tools
------
-
-
-
-Documentation
--------------
+ Library
+ -------
+ - Corrected error with variable-length datatypes and chunked datasets
+ which caused H5Dwrite to fail sometimes. QAK - 2003/07/19
+ - Modified library and file format to support storing indexed storage
+ (chunked dataset) B-tree's with non-default internal 'K' values.
+ QAK - 2003/07/15
+ - Returned H5T_BKG_TEMP support to library after it was accidentally
+ removed. QAK - 2003/07/14
+ Configuration
+ -------------
+ Performance
+ -------------
+ Tools
+ -----
+ Documentation
+ -------------
Platforms Tested
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 */
diff --git a/test/Makefile.in b/test/Makefile.in
index 3c7b79e..fc03b62 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -58,6 +58,7 @@ MOSTLYCLEAN=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5 \
tvlstr.h5 flush.h5 enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 \
tgenprop.h5 tmisc.h5 tmisc2a.h5 tmisc2b.h5 tmisc3.h5 tmisc4a.h5 \
tmisc4b.h5 tmisc5.h5 tmisc6.h5 tmisc7.h5 tmisc8.h5 tmisc9.h5 \
+ tmisc10.h5 tmisc11.h5 tmisc12.h5 \
set_extent_read.h5 set_extent_create.h5 getname.h5 getname1.h5 \
getname2.h5 getname3.h5 sec2_file.h5 family_file000[0-3][0-9].h5 \
multi_file-[rs].h5 core_file new_move_[ab].h5 ntypes.h5 dangle.h5 \
diff --git a/test/tmisc.c b/test/tmisc.c
index 8667cac..a0e8486 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -156,6 +156,14 @@ typedef struct
#define MISC11_SYM_IK 32
#define MISC11_ISTORE_IK 64
+/* Definitions for misc. test #12 */
+#define MISC12_FILE "tmisc12.h5"
+#define MISC12_DSET_NAME "Dataset"
+#define MISC12_SPACE1_RANK 1
+#define MISC12_SPACE1_DIM1 4
+#define MISC12_CHUNK_SIZE 2
+#define MISC12_APPEND_SIZE 5
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -1818,6 +1826,132 @@ test_misc11(void)
/****************************************************************
**
+** test_misc12(): Test that VL-types operate correctly in chunked
+** datasets that are extended.
+**
+****************************************************************/
+static void
+test_misc12(void)
+{
+ const char *wdata [MISC12_SPACE1_DIM1]= {
+ "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty and dedicated to the proposition that all men are created equal.",
+ "Now we are engaged in a great civil war,",
+ "testing whether that nation or any nation so conceived and so dedicated can long endure."
+ };
+ const char *wdata1 [MISC12_APPEND_SIZE]= {
+ "O Gloria inmarcesible! O Jubilo inmortal! En surcos de dolores, el",
+ "bien germina ya! Ceso la horrible noche, La libertad sublime",
+ "derrama las auroras de su invencible luz.",
+ "La humanidad entera, que entre cadenas gime, comprende",
+ "las palabras del que murio en la cruz."
+ };
+ char *rdata [MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE]; /* Information read in */
+ hid_t fid1;
+ hid_t dataset;
+ hid_t sid1, space, memspace;
+ hid_t tid1, cparms;
+ hsize_t dims1[] = {MISC12_SPACE1_DIM1};
+ hsize_t dimsn[] = {MISC12_APPEND_SIZE};
+ hsize_t maxdims1[1] = {H5S_UNLIMITED};
+ hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE};
+ hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE};
+ hssize_t offset[1] = {MISC12_SPACE1_DIM1};
+ hsize_t count[1] = {MISC12_APPEND_SIZE};
+ int i; /* counting variable */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing VL-type in chunked dataset\n"));
+
+ /* This test requirese a relatively "fresh" library environment */
+ ret=H5garbage_collect();
+ CHECK(ret, FAIL, "H5garbage_collect");
+
+ /* Create file */
+ fid1 = H5Fcreate (MISC12_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple (MISC12_SPACE1_RANK, dims1, maxdims1);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tcopy (H5T_C_S1);
+ CHECK(tid1, FAIL, "H5Tcopy");
+
+ ret = H5Tset_size (tid1,H5T_VARIABLE);
+ CHECK(ret, FAIL, "H5Tset_size");
+
+ cparms = H5Pcreate (H5P_DATASET_CREATE);
+ CHECK(cparms, FAIL, "H5Pcreate");
+
+ ret = H5Pset_chunk ( cparms, 1, chkdims1);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+
+ /* Create a dataset */
+ dataset = H5Dcreate (fid1, MISC12_DSET_NAME, tid1, sid1, cparms);
+ CHECK(dataset, FAIL, "H5Dcreate");
+
+ /* Write dataset to disk */
+ ret = H5Dwrite (dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Extend dataset */
+ ret = H5Dextend (dataset, newsize);
+ CHECK(ret, FAIL, "H5Dextend");
+
+ memspace = H5Screate_simple (MISC12_SPACE1_RANK, dimsn, NULL);
+ CHECK(memspace, FAIL, "H5Screate_simple");
+
+ space = H5Dget_space (dataset);
+ CHECK(space, FAIL, "H5Dget_space");
+
+ ret = H5Sselect_hyperslab (space, H5S_SELECT_SET, offset, NULL, count, NULL);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Write data to new portion of dataset */
+ ret = H5Dwrite (dataset, tid1, memspace, space, H5P_DEFAULT, wdata1);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Read all data back */
+ ret= H5Dread (dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Dread");
+
+ for(i=0; i<MISC12_SPACE1_DIM1; i++)
+ if(HDstrcmp(wdata[i],rdata[i])) {
+ num_errs++;
+ printf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n",__LINE__,i,wdata[i],i,rdata[i]);
+ } /* end if */
+ for(; i<(MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE); i++)
+ if(HDstrcmp(wdata1[i-MISC12_SPACE1_DIM1],rdata[i])) {
+ num_errs++;
+ printf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n",__LINE__,i-MISC12_SPACE1_DIM1,wdata1[i-MISC12_SPACE1_DIM1],i,rdata[i]);
+ } /* end if */
+
+ /* Reclaim VL data memory */
+ ret = H5Dvlen_reclaim (tid1, sid1, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Dvlen_reclaim");
+
+ /* Close Everything */
+ ret = H5Dclose (dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Tclose (tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Sclose (space);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose (memspace);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose (sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Pclose (cparms);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Fclose (fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_misc12() */
+
+/****************************************************************
+**
** test_misc(): Main misc. test routine.
**
****************************************************************/
@@ -1838,6 +1972,7 @@ test_misc(void)
test_misc9(); /* Test for opening (not creating) core files */
test_misc10(); /* Test for using dataset creation property lists from old files */
test_misc11(); /* Test for all properties of a file creation property list being stored */
+ test_misc12(); /* Test VL-strings in chunked datasets operating correctly */
} /* test_misc() */
@@ -1872,4 +2007,5 @@ cleanup_misc(void)
HDremove(MISC9_FILE);
HDremove(MISC10_FILE_NEW);
HDremove(MISC11_FILE);
+ HDremove(MISC12_FILE);
}