summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.c61
1 files changed, 23 insertions, 38 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 93a7390..5c8631e 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -637,30 +637,22 @@ h5tools_ncols(const char *s)
htri_t
h5tools_detect_vlen(hid_t tid)
{
- htri_t status;
- htri_t ret = FALSE;
+ htri_t ret;
+
/* recursive detect any vlen data values in type (compound, array ...) */
- status = H5Tdetect_class(tid, H5T_VLEN);
- if ( (status == TRUE) || (status < 0) )
- {
- ret = status;
+ ret = H5Tdetect_class(tid, H5T_VLEN);
+ if((ret == TRUE) || (ret < 0))
goto done;
- }
/* recursive detect any vlen string in type (compound, array ...) */
- status = h5tools_detect_vlen_str(tid);
- if ( (status == TRUE) || (status < 0) )
-
- {
- ret = status;
+ ret = h5tools_detect_vlen_str(tid);
+ if((ret == TRUE) || (ret < 0))
goto done;
- }
done:
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: h5tools_detect_vlen_str
*
@@ -676,48 +668,41 @@ done:
htri_t
h5tools_detect_vlen_str(hid_t tid)
{
- int i = 0;
- int n = 0;
- htri_t ret = FALSE;
H5T_class_t tclass = -1;
- hid_t btid;
- hid_t mtid;
+ htri_t ret = FALSE;
ret = H5Tis_variable_str(tid);
- if ( (ret == TRUE) || (ret < 0) )
+ if((ret == TRUE) || (ret < 0))
goto done;
tclass = H5Tget_class(tid);
- if (tclass == H5T_ARRAY)
- {
- btid = H5Tget_super(tid);
- if (btid < 0)
- {
- ret = (htri_t) btid;
+ if(tclass == H5T_ARRAY || tclass == H5T_VLEN) {
+ hid_t btid = H5Tget_super(tid);
+
+ if(btid < 0) {
+ ret = (htri_t)btid;
goto done;
}
ret = h5tools_detect_vlen_str(btid);
- if ( (ret == TRUE) || (ret < 0) )
- {
+ if((ret == TRUE) || (ret < 0)) {
H5Tclose(btid);
goto done;
}
}
- else if (tclass == H5T_COMPOUND)
- {
- n = H5Tget_nmembers(tid);
- if (n < 0)
- {
+ else if(tclass == H5T_COMPOUND) {
+ int i = 0;
+ int n = H5Tget_nmembers(tid);
+
+ if(n < 0) {
n = ret;
goto done;
}
- for (i = 0; i < n; i++)
- {
- mtid = H5Tget_member_type(tid, i);
+ for(i = 0; i < n; i++) {
+ hid_t mtid = H5Tget_member_type(tid, i);
+
ret = h5tools_detect_vlen_str(mtid);
- if ( (ret == TRUE) || (ret < 0) )
- {
+ if((ret == TRUE) || (ret < 0)) {
H5Tclose(mtid);
goto done;
}