diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-09 18:20:37 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-09 18:20:37 (GMT) |
commit | 892050a830bd87e32b9a64e388654bc1a9af4cf1 (patch) | |
tree | 2c37bd58bd7b9b5660777809a860c1c4783cbeba | |
parent | 7d8ceade335c6528ba4cdbb386c36e918e02ee44 (diff) | |
download | hdf5-892050a830bd87e32b9a64e388654bc1a9af4cf1.zip hdf5-892050a830bd87e32b9a64e388654bc1a9af4cf1.tar.gz hdf5-892050a830bd87e32b9a64e388654bc1a9af4cf1.tar.bz2 |
[svn-r17979] Description:
Bring r17978 from trunk to 1.8 branch:
Simplify checking for detecting variable-length strings.
Tested on:
Mac OS X/32 10.6.2 (amazon) debug & production
Too minor to require h5committest
-rw-r--r-- | src/H5T.c | 24 | ||||
-rw-r--r-- | test/dsets.c | 4 |
2 files changed, 11 insertions, 17 deletions
@@ -1913,12 +1913,9 @@ H5Tdetect_class(hid_t type, H5T_class_t cls) if(!(cls > H5T_NO_CLASS && cls < H5T_NCLASSES)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype class") - /* Set return value. Consider VL string as a string for API, as a VL for - * internal use. */ - if(H5T_IS_VL_STRING(dt->shared)) - ret_value = (H5T_STRING == cls); - else - ret_value = H5T_detect_class(dt, cls, TRUE); + /* Set return value */ + if((ret_value = H5T_detect_class(dt, cls, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5T_NO_CLASS, "can't get datatype class") done: FUNC_LEAVE_API(ret_value) @@ -1948,7 +1945,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T_detect_class (const H5T_t *dt, H5T_class_t cls, hbool_t from_api) +H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) { unsigned i; htri_t ret_value=FALSE; /* Return value */ @@ -1958,9 +1955,11 @@ H5T_detect_class (const H5T_t *dt, H5T_class_t cls, hbool_t from_api) assert(dt); assert(cls>H5T_NO_CLASS && cls<H5T_NCLASSES); - /* Consider VL string as a string for API, as a VL for internal use. The same - * check is also in H5Tdetect_class. Do it again to check members of nested - * compound type and base type of array and VL type. */ + /* Consider VL string as a string for API, as a VL for internal use. */ + /* (note that this check must be performed before checking if the VL + * string belongs to the H5T_VLEN class, which would otherwise return + * true. -QAK) + */ if(from_api && H5T_IS_VL_STRING(dt->shared)) HGOTO_DONE(H5T_STRING == cls); @@ -1974,11 +1973,6 @@ H5T_detect_class (const H5T_t *dt, H5T_class_t cls, hbool_t from_api) for (i=0; i<dt->shared->u.compnd.nmembs; i++) { htri_t nested_ret; /* Return value from nested call */ - /* Consider VL string as a string for API, as a VL for internal use. - * Do it again here to check members of compound type. */ - if(from_api && H5T_IS_VL_STRING(dt->shared->u.compnd.memb[i].type->shared)) - HGOTO_DONE(H5T_STRING == cls); - /* Check if this field's type is the correct type */ if(dt->shared->u.compnd.memb[i].type->shared->type==cls) HGOTO_DONE(TRUE); diff --git a/test/dsets.c b/test/dsets.c index 9f4b06d..d545c72 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -7289,8 +7289,8 @@ error: static herr_t test_idx_compatible(void) { - hid_t fid; /* File id */ - hid_t did; /* Dataset id */ + hid_t fid = -1; /* File id */ + hid_t did = -1; /* Dataset id */ char *srcdir = HDgetenv("srcdir"); /* where the src code is located */ char filename[FILENAME_BUF_SIZE] = ""; /* old test file name */ |