summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt3
-rw-r--r--src/H5Odtype.c4
-rw-r--r--src/H5T.c45
-rw-r--r--test/dtypes.c136
4 files changed, 112 insertions, 76 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index b02e09a..0ea3559 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -305,6 +305,9 @@ Bug Fixes since HDF5-1.6.0 release
Library
-------
+ - Fixed a bug with named datatypes where a copy of a named datatype
+ used to create a dataset would accidentally use the original
+ named datatype for the dataset's datatype. QAK - 2005/07/23
- Made H5Fget_name() be consistent and always return name of actual
file the ID is in. (Instead of the name of the top file in a
file mounting hierarchy). QAK - 2005/07/19
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 646a9b1..0ab8bc5 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1140,8 +1140,8 @@ H5O_dtype_get_share(H5F_t UNUSED *f, const void *_mesg,
assert (sh);
if (H5F_addr_defined (dt->ent.header)) {
- if(H5T_STATE_NAMED!=dt->shared->state && H5T_STATE_OPEN!=dt->shared->state && H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "datatype state is not valid");
+ /* If the address is defined, this had better be a named datatype */
+ HDassert (H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state);
sh->in_gh = FALSE;
sh->u.ent = dt->ent;
diff --git a/src/H5T.c b/src/H5T.c
index 575a9fe..0d3b830 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -442,10 +442,11 @@ static H5T_t *H5T_decode(const unsigned char *buf);
/* Allocate new datatype info */ \
if (NULL==(dt = H5FL_CALLOC(H5T_t))) \
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \
- if (NULL==(dt->shared = H5FL_CALLOC(H5T_shared_t))) { \
- H5FL_FREE(H5T_t, dt); \
+ dt->ent.header = HADDR_UNDEF; \
+ if (NULL==(dt->shared = H5FL_CALLOC(H5T_shared_t))) { \
+ H5FL_FREE(H5T_t, dt); \
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \
- } \
+ } \
}
@@ -2937,6 +2938,7 @@ H5T_create(H5T_class_t type, size_t size)
case H5T_COMPOUND:
if (NULL==(dt = H5FL_CALLOC(H5T_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ dt->ent.header = HADDR_UNDEF;
if (NULL==(dt->shared = H5FL_CALLOC(H5T_shared_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
dt->shared->type = type;
@@ -2965,6 +2967,7 @@ H5T_create(H5T_class_t type, size_t size)
}
if (NULL==(dt = H5FL_CALLOC(H5T_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ dt->ent.header = HADDR_UNDEF;
if (NULL==(dt->shared = H5FL_CALLOC(H5T_shared_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
dt->shared->type = type;
@@ -3218,8 +3221,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
if (NULL==(new_dt->shared = H5FL_MALLOC(H5T_shared_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- /* Copy actual information */
- new_dt->ent = old_dt->ent;
+ /* Copy shared information (entry information is copied last) */
*(new_dt->shared) = *(old_dt->shared);
/* Copy parent information */
@@ -3233,8 +3235,6 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
* Return an unlocked transient type.
*/
new_dt->shared->state = H5T_STATE_TRANSIENT;
- HDmemset (&(new_dt->ent), 0, sizeof(new_dt->ent));
- new_dt->ent.header = HADDR_UNDEF;
break;
case H5T_COPY_ALL:
@@ -3242,9 +3242,9 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
* Return a transient type (locked or unlocked) or an unopened named
* type. Immutable transient types are degraded to read-only.
*/
- if (H5T_STATE_OPEN==new_dt->shared->state) {
+ if (H5T_STATE_OPEN==old_dt->shared->state) {
new_dt->shared->state = H5T_STATE_NAMED;
- } else if (H5T_STATE_IMMUTABLE==new_dt->shared->state) {
+ } else if (H5T_STATE_IMMUTABLE==old_dt->shared->state) {
new_dt->shared->state = H5T_STATE_RDONLY;
}
break;
@@ -3254,15 +3254,20 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
* Return a transient type (locked or unlocked) or an opened named
* type. Immutable transient types are degraded to read-only.
*/
- if (H5F_addr_defined(new_dt->ent.header)) {
+ if (H5F_addr_defined(old_dt->ent.header)) {
/* Check if the object is already open */
- if((reopened_fo=H5FO_opened(new_dt->ent.file,new_dt->ent.header))==NULL) {
+ if((reopened_fo=H5FO_opened(old_dt->ent.file, old_dt->ent.header))==NULL) {
/* Clear any errors from H5FO_opened() */
H5E_clear_stack(NULL);
- if (H5O_open (&(new_dt->ent))<0)
+
+ /* Open named datatype again */
+ if (H5O_open (&(old_dt->ent))<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type");
- if(H5FO_insert(new_dt->ent.file, new_dt->ent.header,new_dt->shared)<0)
+
+ /* Insert opened named datatype into opened object list for the file */
+ if(H5FO_insert(old_dt->ent.file, old_dt->ent.header, new_dt->shared)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, "can't insert datatype into list of open objects")
+
new_dt->shared->fo_count=1;
} else {
/* The object is already open. Free the H5T_shared_t struct
@@ -3270,10 +3275,11 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
* Not terribly efficient. */
H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt->shared = reopened_fo;
+
reopened_fo->fo_count++;
}
new_dt->shared->state = H5T_STATE_OPEN;
- } else if (H5T_STATE_IMMUTABLE==new_dt->shared->state) {
+ } else if (H5T_STATE_IMMUTABLE==old_dt->shared->state) {
new_dt->shared->state = H5T_STATE_RDONLY;
}
break;
@@ -3386,9 +3392,16 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
} /* end switch */
/* Deep copy of the symbol table entry, if there was one */
- if (H5F_addr_defined(old_dt->ent.header))
+ if ( new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) {
+ if (!H5F_addr_defined(old_dt->ent.header))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "named dataype with invalid address");
if (H5G_ent_copy(&(new_dt->ent), &(old_dt->ent),H5G_COPY_DEEP)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to copy entry");
+ } /* end if */
+ else {
+ HDmemset (&(new_dt->ent), 0, sizeof(new_dt->ent));
+ new_dt->ent.header = HADDR_UNDEF;
+ } /* end else */
/* Set return value */
ret_value=new_dt;
@@ -3994,7 +4007,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Compare the members */
base_size = dt1->shared->parent->shared->size;
for (u=0; u<dt1->shared->u.enumer.nmembs; u++) {
- unsigned idx;
+ unsigned idx = 0;
if(superset) {
unsigned lt = 0, rt; /* Final, left & right key indices */
diff --git a/test/dtypes.c b/test/dtypes.c
index b3ad6c2..7b301f4 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -540,7 +540,7 @@ test_compound_2(void)
const size_t nelmts = NTESTELEM;
const hsize_t four = 4;
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t src_t=-1, dst_t=-1;
+ hid_t st=-1, dt=-1;
hid_t array_dt;
int i;
@@ -565,27 +565,27 @@ test_compound_2(void)
/* Build hdf5 datatypes */
array_dt=H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL);
- if ((src_t=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
- H5Tinsert(src_t, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "c", HOFFSET(struct st, c), array_dt)<0 ||
- H5Tinsert(src_t, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
+ if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
+ H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt)<0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
goto error;
H5Tclose(array_dt);
array_dt=H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL);
- if ((dst_t=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
- H5Tinsert(dst_t, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
- H5Tinsert(dst_t, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT)<0 ||
- H5Tinsert(dst_t, "c", HOFFSET(struct dt, c), array_dt)<0 ||
- H5Tinsert(dst_t, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT)<0 ||
- H5Tinsert(dst_t, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
+ if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
+ H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt)<0 ||
+ H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
goto error;
H5Tclose(array_dt);
/* Perform the conversion */
- if (H5Tconvert(src_t, dst_t, nelmts, buf, bkg, H5P_DEFAULT)<0) goto error;
+ if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) goto error;
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
@@ -615,7 +615,7 @@ test_compound_2(void)
free(buf);
free(bkg);
free(orig);
- if (H5Tclose(src_t)<0 || H5Tclose(dst_t)<0) goto error;
+ if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error;
PASSED();
reset_hdf5();
@@ -657,7 +657,7 @@ test_compound_3(void)
const size_t nelmts = NTESTELEM;
const hsize_t four = 4;
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t src_t=-1, dst_t=-1;
+ hid_t st=-1, dt=-1;
hid_t array_dt;
int i;
@@ -682,25 +682,25 @@ test_compound_3(void)
/* Build hdf5 datatypes */
array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL);
- if ((src_t=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
- H5Tinsert(src_t, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "c", HOFFSET(struct st, c), array_dt)<0 ||
- H5Tinsert(src_t, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
+ if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
+ H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt)<0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
goto error;
H5Tclose(array_dt);
array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL);
- if ((dst_t=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
- H5Tinsert(dst_t, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
- H5Tinsert(dst_t, "c", HOFFSET(struct dt, c), array_dt)<0 ||
- H5Tinsert(dst_t, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
+ if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
+ H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt)<0 ||
+ H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
goto error;
H5Tclose(array_dt);
/* Perform the conversion */
- if (H5Tconvert(src_t, dst_t, nelmts, buf, bkg, H5P_DEFAULT)<0)
+ if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0)
goto error;
/* Compare results */
@@ -729,7 +729,7 @@ test_compound_3(void)
free(buf);
free(bkg);
free(orig);
- if (H5Tclose(src_t)<0 || H5Tclose(dst_t)<0) goto error;
+ if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error;
PASSED();
reset_hdf5();
@@ -775,7 +775,7 @@ test_compound_4(void)
const size_t nelmts = NTESTELEM;
const hsize_t four = 4;
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t src_t=-1, dst_t=-1;
+ hid_t st=-1, dt=-1;
hid_t array_dt;
int i;
@@ -800,27 +800,27 @@ test_compound_4(void)
/* Build hdf5 datatypes */
array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL);
- if ((src_t=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
- H5Tinsert(src_t, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "c", HOFFSET(struct st, c), array_dt)<0 ||
- H5Tinsert(src_t, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
- H5Tinsert(src_t, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
+ if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
+ H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt)<0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
goto error;
H5Tclose(array_dt);
array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL);
- if ((dst_t=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
- H5Tinsert(dst_t, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
- H5Tinsert(dst_t, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT)<0 ||
- H5Tinsert(dst_t, "c", HOFFSET(struct dt, c), array_dt)<0 ||
- H5Tinsert(dst_t, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT)<0 ||
- H5Tinsert(dst_t, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
+ if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
+ H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
+ H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT)<0 ||
+ H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt)<0 ||
+ H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT)<0 ||
+ H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
goto error;
H5Tclose(array_dt);
/* Perform the conversion */
- if (H5Tconvert(src_t, dst_t, nelmts, buf, bkg, H5P_DEFAULT)<0)
+ if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0)
goto error;
/* Compare results */
@@ -851,7 +851,7 @@ test_compound_4(void)
free(buf);
free(bkg);
free(orig);
- if (H5Tclose(src_t)<0 || H5Tclose(dst_t)<0) goto error;
+ if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error;
PASSED();
reset_hdf5();
@@ -1005,7 +1005,7 @@ test_compound_6(void)
const size_t nelmts = NTESTELEM;
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t src_t=-1, dst_t=-1;
+ hid_t st=-1, dt=-1;
int i;
TESTING("compound element growing");
@@ -1022,22 +1022,22 @@ test_compound_6(void)
HDmemcpy(buf, orig, nelmts*sizeof(struct st));
/* Build hdf5 datatypes */
- if ((src_t=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
- H5Tinsert(src_t, "b", HOFFSET(struct st, b), H5T_NATIVE_SHORT)<0 ||
- H5Tinsert(src_t, "d", HOFFSET(struct st, d), H5T_NATIVE_SHORT)<0) {
+ if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_SHORT)<0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_SHORT)<0) {
H5_FAILED();
goto error;
}
- if ((dst_t=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
- H5Tinsert(dst_t, "b", HOFFSET(struct dt, b), H5T_NATIVE_LONG)<0 ||
- H5Tinsert(dst_t, "d", HOFFSET(struct dt, d), H5T_NATIVE_LONG)<0) {
+ if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
+ H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_LONG)<0 ||
+ H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_LONG)<0) {
H5_FAILED();
goto error;
}
/* Perform the conversion */
- if (H5Tconvert(src_t, dst_t, nelmts, buf, bkg, H5P_DEFAULT)<0) {
+ if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) {
H5_FAILED();
goto error;
}
@@ -1062,7 +1062,7 @@ test_compound_6(void)
free(buf);
free(bkg);
free(orig);
- if (H5Tclose(src_t)<0 || H5Tclose(dst_t)<0) {
+ if (H5Tclose(st)<0 || H5Tclose(dt)<0) {
H5_FAILED();
goto error;
}
@@ -2068,7 +2068,7 @@ test_compound_12(void)
* Modifications:
* Raymond Lu
* Wednesday, Febuary 9, 2005
- * Added test for H5Tenum_valueof, H5Tenum_nameof, and
+ * Added test for H5Tenum_valueof, H5Tenum_nameof, and
* H5Tget_member_value.
*-------------------------------------------------------------------------
*/
@@ -2451,7 +2451,7 @@ test_transient (hid_t fapl)
static int
test_named (hid_t fapl)
{
- hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, attr1=-1;
+ hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1;
herr_t status;
static hsize_t ds_size[2] = {10, 20};
hsize_t i,j;
@@ -2575,9 +2575,7 @@ test_named (hid_t fapl)
* first dataset.
*/
if (H5Dclose (dset)<0) goto error;
- if ((dset=H5Dcreate (file, "dset2", t2, space, H5P_DEFAULT))<0) {
- goto error;
- }
+ if ((dset=H5Dcreate (file, "dset2", t2, space, H5P_DEFAULT))<0) goto error;
/* Reopen the second dataset and make sure the type is shared */
if (H5Tclose (t2)<0) goto error;
@@ -2599,9 +2597,30 @@ test_named (hid_t fapl)
if ((t2=H5Tcopy (dset))<0) goto error;
if (H5Tset_precision (t2, 256)<0) goto error;
if (H5Tclose (t2)<0) goto error;
+ if (H5Dclose (dset)<0) goto error;
- /* Clean up */
+ /*
+ * Copy of committed type used as dataset type should not be name type
+ */
+ if ((t2 = H5Tcopy (type))<0) goto error;
+ if ((status=H5Tcommitted (t2))<0) goto error;
+ if (status) {
+ H5_FAILED();
+ HDputs (" Copied type should not be a named type!");
+ goto error;
+ }
+ if ((dset=H5Dcreate (file, "dset3", t2, space, H5P_DEFAULT))<0) goto error;
+ if ((t3 = H5Dget_type (dset))<0) goto error;
+ if ((status=H5Tcommitted (t3))<0) goto error;
+ if (status) {
+ H5_FAILED();
+ HDputs (" Datatype from dataset using copied type should not be a named type!");
+ goto error;
+ }
+ if (H5Tclose (t3)<0) goto error;
if (H5Dclose (dset)<0) goto error;
+
+ /* Clean up */
if (H5Tclose (type)<0) goto error;
if (H5Sclose (space)<0) goto error;
if (H5Fclose (file)<0) goto error;
@@ -2610,6 +2629,7 @@ test_named (hid_t fapl)
error:
H5E_BEGIN_TRY {
+ H5Tclose (t3);
H5Tclose (t2);
H5Tclose (type);
H5Sclose (space);