summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-03 18:31:37 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-03 18:31:37 (GMT)
commit7d9e9bced381139da3b7744b7d2d25b430346a93 (patch)
tree73e7d33ab1fdc22a7f66e4895144f6d6e325bce3 /src/H5T.c
parentb4ac48552d74bcd4ad465d61d2fa294420f2525d (diff)
downloadhdf5-7d9e9bced381139da3b7744b7d2d25b430346a93.zip
hdf5-7d9e9bced381139da3b7744b7d2d25b430346a93.tar.gz
hdf5-7d9e9bced381139da3b7744b7d2d25b430346a93.tar.bz2
[svn-r8607] Purpose: bug fix.
Description: After an opaque datatype is created, if no tag is attached, some operations will have trouble to deal with null string of tag. Solution: Initialize opaque's tag as empty string when it's created. Platforms tested: h5committest.
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 11e7899..7a50308 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2616,8 +2616,12 @@ H5T_create(H5T_class_t type, size_t size)
dt->type = type;
if(type==H5T_COMPOUND)
dt->u.compnd.packed=TRUE; /* Start out packed */
- break;
+ 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:
if (sizeof(char)==size) {
subtype = H5T_NATIVE_SCHAR_g;
@@ -3637,8 +3641,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);