summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-02 16:35:43 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-02 16:35:43 (GMT)
commit825a435d3654901a1822cfcef9518fc1e90de23a (patch)
tree57a9d87e617147c41706712d4b45135616d6ea59 /src/H5T.c
parentc287f1ae7937b31002aaaf09a7acee0e26f2698e (diff)
downloadhdf5-825a435d3654901a1822cfcef9518fc1e90de23a.zip
hdf5-825a435d3654901a1822cfcef9518fc1e90de23a.tar.gz
hdf5-825a435d3654901a1822cfcef9518fc1e90de23a.tar.bz2
[svn-r8604] Purpose: bug fix
Description: For opaque datatype, if tag isn't defined, some operations will have trouble because the tag string is null. Solution: Initialize the tag string to empty string after the opaque type is created. Platforms tested: h5committest
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 86a6734..e3379ec 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2601,6 +2601,10 @@ H5T_create(H5T_class_t type, size_t size)
dt->type = type;
if(type==H5T_COMPOUND)
dt->u.compnd.packed=TRUE; /* Start out packed */
+ else if(type==H5T_OPAQUE)
+ /* Initialize the tag in case it's not set later. A null tag will
+ * cause problems for later operations. */
+ dt->u.opaque.tag = H5MM_strdup("");
break;
case H5T_ENUM:
@@ -2629,7 +2633,6 @@ H5T_create(H5T_class_t type, size_t size)
case H5T_ARRAY: /* Array datatype */
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create()");
-
default:
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class");
}
@@ -3586,8 +3589,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
break;
case H5T_OPAQUE:
- HGOTO_DONE(HDstrcmp(dt1->u.opaque.tag,dt2->u.opaque.tag));
-
+ if(dt1->u.opaque.tag && dt2->u.opaque.tag) {
+ HGOTO_DONE(HDstrcmp(dt1->u.opaque.tag,dt2->u.opaque.tag));
+ }
case H5T_ARRAY:
if (dt1->u.array.ndims < dt2->u.array.ndims)
HGOTO_DONE(-1);