summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-04-18 10:24:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-04-18 10:24:39 (GMT)
commitd90f14295aac3335d812e92f2a91baa8c32bd765 (patch)
tree724c8c3fb9280b8b41860910411d9b524b6f9af1 /tools/lib
parent0badac6423ddfeb881345838e3879ad413e52ad1 (diff)
downloadhdf5-d90f14295aac3335d812e92f2a91baa8c32bd765.zip
hdf5-d90f14295aac3335d812e92f2a91baa8c32bd765.tar.gz
hdf5-d90f14295aac3335d812e92f2a91baa8c32bd765.tar.bz2
[svn-r20540] Description:
Bring r20538 & r20539 from trunk to 1.8 branch: Update with new warning flags for gcc 4.6.x Bring Coverity changes back to trunk: r20276: Add recursive is vlen string function. Cleanup resource leaks for issues: 200,202,329,688,811,812 r20277: Check types and close by adding error section: issue 687 r20278: Replaced implicit pointer conversion with (ocrt_info.new_obj != NULL). r20280: Addressed coverity issues 927-929 & 583. The real issue is failure to check file name length -- at least at the H5FD interface level. This needs more work, but at least I have dealt with the issue in H5FDfamily.c r20337: H5O_type_t obj_type = H5O_TYPE_UNKNOWN; r20338: Added udata.name = NULL; to prevent potential uninitialized use after done: label. r20339: coverity issues: 686,828,1670-1673,1707-1711 Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode FreeBSD/32 8.2 (loyalty) w/gcc4.6, in debug mode FreeBSD/64 8.2 (freedom) w/gcc4.6, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug 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 730a1d5..3cce2e5 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -642,30 +642,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
*
@@ -681,48 +673,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;
}