summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-10-17 18:41:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-10-17 18:41:42 (GMT)
commit0324f055660fde2ddbdd928b6b674814a9e53210 (patch)
tree9919843f57d954c35f2743c075c460f8cb1f20e5
parent1c45b31cc674a38e32a87a168d50249a6875f821 (diff)
downloadhdf5-0324f055660fde2ddbdd928b6b674814a9e53210.zip
hdf5-0324f055660fde2ddbdd928b6b674814a9e53210.tar.gz
hdf5-0324f055660fde2ddbdd928b6b674814a9e53210.tar.bz2
[svn-r22915] Description:
Bring Coverity changes back to trunk: r20399: Change parse_command_line to free hand structure on error and only "leave()" at end of main. r20400: Purpose: Fix coverity issue 592 Description: Added void cast to call to H5F_sfile_assert_num() in H5F_term)interface(). There is no need to check the return value of this function in general, and there would be nothing to do even if it did fail. r20401: Added free(src_sizes) and free(src_offset). --gh Tested on: Mac OSX/64 10.8.2 (amazon) w/C++, FORTRAN, threadsafe (too minor for h5committest)
-rw-r--r--hl/src/H5TB.c100
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5Fsfile.c8
-rw-r--r--test/links.c87
-rw-r--r--test/mount.c75
-rw-r--r--tools/h5dump/h5dump.c15
6 files changed, 121 insertions, 166 deletions
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index 0013e67..0b6305b 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -1301,7 +1301,6 @@ herr_t H5TBdelete_record( hid_t loc_id,
hsize_t start,
hsize_t nrecords )
{
-
hsize_t nfields;
hsize_t ntotal_records;
hsize_t read_start;
@@ -1316,8 +1315,8 @@ herr_t H5TBdelete_record( hid_t loc_id,
hsize_t mem_size[1];
unsigned char *tmp_buf=NULL;
size_t src_size;
- size_t *src_offset;
- size_t *src_sizes;
+ size_t *src_offset = NULL;
+ size_t *src_sizes = NULL;
hsize_t dims[1];
/*-------------------------------------------------------------------------
@@ -1327,23 +1326,20 @@ herr_t H5TBdelete_record( hid_t loc_id,
/* get the number of records and fields */
if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0)
- return -1;
-
- src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t));
- src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t));
+ goto out;
- if (src_offset == NULL )
- return -1;
- if (src_sizes == NULL )
- return -1;
+ if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ goto out;
+ if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ goto out;
/* get field info */
if (H5TBget_field_info( loc_id, dset_name, NULL, src_sizes, src_offset, &src_size ) < 0)
- return -1;
+ goto out;
/* open the dataset. */
if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
- return -1;
+ goto out;
/*-------------------------------------------------------------------------
* read the records after the deleted one(s)
@@ -1355,14 +1351,12 @@ herr_t H5TBdelete_record( hid_t loc_id,
if ( read_nrecords )
{
- tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size );
-
- if (tmp_buf == NULL )
- return -1;
+ if(NULL == (tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size )))
+ goto out;
/* read the records after the deleted one(s) */
if (H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0)
- return -1;
+ goto out;
/*-------------------------------------------------------------------------
* write the records in another position
@@ -1418,31 +1412,34 @@ herr_t H5TBdelete_record( hid_t loc_id,
/* close dataset */
if (H5Dclose( did ) < 0)
- return -1;
-
- if (tmp_buf !=NULL)
- free( tmp_buf );
- free( src_offset );
- free( src_sizes );
+ goto out;
+ if(tmp_buf)
+ free(tmp_buf);
+ if(src_offset)
+ free(src_offset);
+ if(src_sizes)
+ free(src_sizes);
return 0;
/* error zone */
out:
-
- if (tmp_buf !=NULL )
- free( tmp_buf );
+ if(tmp_buf)
+ free(tmp_buf);
+ if(src_offset)
+ free(src_offset);
+ if(src_sizes)
+ free(src_sizes);
H5E_BEGIN_TRY
{
H5Tclose(mem_type_id);
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
+ H5Sclose(m_sid);
} H5E_END_TRY;
return -1;
-
-
}
/*-------------------------------------------------------------------------
@@ -1641,10 +1638,10 @@ herr_t H5TBadd_records_from( hid_t loc_id,
hsize_t mem_size[1];
hsize_t nfields;
hsize_t ntotal_records;
- unsigned char *tmp_buf;
+ unsigned char *tmp_buf = NULL;
size_t src_size;
- size_t *src_offset;
- size_t *src_sizes;
+ size_t *src_offset = NULL;
+ size_t *src_sizes = NULL;
/*-------------------------------------------------------------------------
* first we get information about type size and offsets on disk
@@ -1653,17 +1650,16 @@ herr_t H5TBadd_records_from( hid_t loc_id,
/* get the number of records and fields */
if (H5TBget_table_info ( loc_id, dset_name1, &nfields, &ntotal_records ) < 0)
- return -1;
-
- src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t));
- src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t));
+ goto out;
- if (src_offset == NULL )
- return -1;
+ if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ goto out;
+ if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ goto out;
/* get field info */
if (H5TBget_field_info( loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0)
- return -1;
+ goto out;
/*-------------------------------------------------------------------------
* Get information about the first table and read it
@@ -1672,7 +1668,7 @@ herr_t H5TBadd_records_from( hid_t loc_id,
/* open the 1st dataset. */
if ((did_1 = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0)
- return -1;
+ goto out;
/* get the datatype */
if ((tid_1 = H5Dget_type( did_1 )) < 0)
@@ -1686,7 +1682,8 @@ herr_t H5TBadd_records_from( hid_t loc_id,
if (( type_size1 = H5Tget_size( tid_1 )) == 0 )
goto out;
- tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 );
+ if(NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 )))
+ goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = start1;
@@ -1719,18 +1716,27 @@ herr_t H5TBadd_records_from( hid_t loc_id,
if (H5Sclose( sid_1 ) < 0)
goto out;
if (H5Tclose( tid_1 ) < 0)
- return -1;
+ goto out;
if (H5Dclose( did_1 ) < 0)
- return -1;
+ goto out;
- free( tmp_buf );
- free( src_offset );
- free( src_sizes );
+ if(tmp_buf)
+ free(tmp_buf);
+ if(src_offset)
+ free(src_offset);
+ if(src_sizes)
+ free(src_sizes);
return 0;
/* error zone */
out:
+ if(tmp_buf)
+ free(tmp_buf);
+ if(src_offset)
+ free(src_offset);
+ if(src_sizes)
+ free(src_sizes);
H5E_BEGIN_TRY
{
H5Dclose(did_1);
@@ -3379,7 +3385,7 @@ int H5TB_find_field( const char *field, const char *field_list )
{
ptrdiff_t count = end - start;
- if(HDstrncmp(start, field, count) == 0 && count == HDstrlen(field) )
+ if(HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field) )
return 1;
start = end + 1;
}
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index f9df1eb..e1e1b05 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -633,7 +633,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad
H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data);
/* Shared file list related routines */
-H5_DLL herr_t H5F_sfile_assert_num(unsigned n);
+H5_DLL void H5F_sfile_assert_num(unsigned n);
/* Routines for creating & destroying "fake" file structures */
H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size);
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index 95e5ad2..a1c6976 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -46,16 +46,14 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL;
*
* Purpose: Sanity checking that shared file list is empty
*
- * Return: SUCCEED/FAIL
+ * Return: none (void)
*
* Programmer: Quincey Koziol
* Monday, July 25, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-herr_t
+void
H5F_sfile_assert_num(unsigned n)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -83,7 +81,7 @@ H5F_sfile_assert_num(unsigned n)
HDassert(count == n);
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED)
+ FUNC_LEAVE_NOAPI_VOID
} /* H5F_sfile_assert_num() */
diff --git a/test/links.c b/test/links.c
index 966802a..d77b371 100644
--- a/test/links.c
+++ b/test/links.c
@@ -1884,7 +1884,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Open first file again with read-only access and check on objects created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -1908,7 +1908,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Verify that new objects can't be created through a read-only external
* link.
@@ -1925,7 +1925,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -6754,8 +6754,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
@@ -6764,16 +6763,14 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now open */
- if(H5F_sfile_assert_num(2) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -6795,8 +6792,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
@@ -6805,24 +6801,21 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now open */
- if(H5F_sfile_assert_num(2) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Release file 1's EFC */
if(H5Fclear_elink_file_cache(fid1) < 0)
TEST_ERROR
/* Verify that only the parent file is now open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -6858,8 +6851,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
@@ -6868,8 +6860,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that files 2 and 3 are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
@@ -6878,16 +6869,14 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(4) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(4);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -6923,8 +6912,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
@@ -6933,8 +6921,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that files 2 and 3 are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
@@ -6943,24 +6930,21 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(4) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(4);
/* Release file 1's EFC */
if(H5Fclear_elink_file_cache(fid1) < 0)
TEST_ERROR
/* Verify that only file 1 is now open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
#ifndef H5_CANNOT_OPEN_TWICE
/*
@@ -6992,8 +6976,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
@@ -7002,16 +6985,14 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7043,8 +7024,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
@@ -7053,24 +7033,21 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Release file 1's EFC */
if(H5Fclear_elink_file_cache(fid1) < 0)
TEST_ERROR
/* Verify that only file 1 is now open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
#endif /* H5_CANNOT_OPEN_TWICE */
/* Close fapl */
@@ -7165,8 +7142,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7212,8 +7188,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7263,8 +7238,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7312,8 +7286,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
diff --git a/test/mount.c b/test/mount.c
index b7180fa..2502bbe 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -1181,7 +1181,7 @@ test_close(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Build the virtual file again */
if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
@@ -1198,7 +1198,7 @@ test_close(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Shut down */
PASSED();
@@ -1810,8 +1810,7 @@ test_missing_unmount(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -1946,8 +1945,7 @@ test_hold_open_file(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2103,8 +2101,7 @@ test_hold_open_group(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2249,8 +2246,7 @@ test_fcdegree_same(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2391,8 +2387,7 @@ test_fcdegree_semi(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2530,8 +2525,7 @@ test_fcdegree_strong(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2733,8 +2727,7 @@ test_acc_perm(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2957,8 +2950,7 @@ test_mult_mount(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3179,8 +3171,7 @@ test_nested_survive(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3295,8 +3286,7 @@ test_close_parent(hid_t fapl)
TEST_ERROR
/* Both underlying shared files should be open still */
- if(H5F_sfile_assert_num(2) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Check the name of "M" is still defined */
*name = '\0';
@@ -3317,16 +3307,14 @@ test_close_parent(hid_t fapl)
TEST_ERROR
/* Just file #2's underlying shared file should be open still */
- if(H5F_sfile_assert_num(1) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close group in file #2, letting file #2 close */
if(H5Gclose(gidM) < 0)
TEST_ERROR
/* All underlying shared file structs should be closed */
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3703,16 +3691,14 @@ test_cut_graph(hid_t fapl)
TEST_ERROR
/* Check that all seven underlying files are still opened */
- if(H5F_sfile_assert_num(7) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(7);
/* Close "M" in file #5, which should close files 2, 4 & 5 */
if(H5Gclose(gidM) < 0)
TEST_ERROR
/* Check that only four underlying files are still opened */
- if(H5F_sfile_assert_num(4) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(4);
/* Unmount file #3 from file #1, cutting the graph */
if(H5Funmount(gidQ, "/B") < 0)
@@ -3720,8 +3706,7 @@ test_cut_graph(hid_t fapl)
/* Check that only three underlying files are still opened */
/* (File #1 should close after being cut off from the graph) */
- if(H5F_sfile_assert_num(3) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Check the name of "Q" is defined in its file */
*name = '\0';
@@ -3749,8 +3734,7 @@ test_cut_graph(hid_t fapl)
TEST_ERROR
/* Verify that all underlying shared files have been closed now */
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3917,16 +3901,14 @@ test_symlink(hid_t fapl)
TEST_ERROR
/* Verify that all 3 underlying shared files are still open */
- if(H5F_sfile_assert_num(3) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Close object opened through soft link */
if(H5Gclose(gidL) < 0)
TEST_ERROR
/* Verify that all underlying shared files have been closed now */
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -4036,8 +4018,7 @@ test_sharedacc(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -4129,16 +4110,14 @@ test_sharedclose(hid_t fapl)
TEST_ERROR
/* Check that file #3 is still open */
- if(H5F_sfile_assert_num(3) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Close group B/C in file #1b. This should close file #1b and #3. */
if(H5Gclose(gid3) < 0)
TEST_ERROR
/* Check that file #3 has been closed */
- if(H5F_sfile_assert_num(2) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Unmount file 2 and close the rest of the handles */
if(H5Funmount(fid1a, "A") < 0)
@@ -4153,8 +4132,7 @@ test_sharedclose(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Create file #1 & its group */
if((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -4197,8 +4175,7 @@ test_sharedclose(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -4324,7 +4301,7 @@ test_multisharedclose(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) < 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2921fb9..85d3bc8 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -932,7 +932,7 @@ parse_mask_list(const char *h_list)
static void
free_handler(struct handler_t *hand, int len)
{
- register int i;
+ int i;
if(hand) {
for (i = 0; i < len; i++) {
@@ -1293,7 +1293,7 @@ parse_start:
if (s->count.data) {
HDfree(s->count.data);
s->count.data = NULL;
- }
+ }
parse_hsize_list(opt_arg, &s->count);
break;
case 'k':
@@ -1423,6 +1423,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
+
/* Disable tools error reporting */
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
@@ -1449,28 +1450,28 @@ main(int argc, const char *argv[])
"to display selected objects");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_bb) {
error_msg("option \"%s\" not available for XML\n", "--boot-block");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_oid == 1) {
error_msg("option \"%s\" not available for XML\n", "--object-ids");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_char == TRUE) {
error_msg("option \"%s\" not available for XML\n", "--string");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (usingdasho) {
error_msg("option \"%s\" not available for XML\n", "--output");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- }
+ }
else {
if (xml_dtd_uri) {
warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri);