From 7d9e9bced381139da3b7744b7d2d25b430346a93 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Thu, 3 Jun 2004 13:31:37 -0500 Subject: [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. --- src/H5T.c | 11 ++++++++--- 1 file 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); -- cgit v0.12