diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-23 06:27:57 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-23 06:27:57 (GMT) |
commit | f97d63cb95fa2595e5137a7ac6e0d1282fb5118b (patch) | |
tree | 698d5f3e535b8f77e4ecfb2da9722ab0cb040386 /test | |
parent | 67be45610fd450909038afea54f79e6a91c458cf (diff) | |
download | hdf5-f97d63cb95fa2595e5137a7ac6e0d1282fb5118b.zip hdf5-f97d63cb95fa2595e5137a7ac6e0d1282fb5118b.tar.gz hdf5-f97d63cb95fa2595e5137a7ac6e0d1282fb5118b.tar.bz2 |
[svn-r24869] Description:
Clean up more compiler warnings, plus merge a few Coverity bug fixes from
the hdf5_1_8_coverity branch back to the trunk:
r20877:
Purpose: Fix coverity issue 1723
Description:
Modified test_generate in hl/test_image to close file "f" before exit, even if
an error occurs.
r20879:
Issue 63: change check of return of H5Tget_nmembers to <=0. No need to go
futher if call fails as well as empty.
r20881:
Coverity #659 in Run 46: I changed the Line 442 where it tries to check whether
FLAG_PRINTED is TRUE. But it had just been set to FALSE. I took out the
condition check in the print statement.
Tested on:
Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & Parallel
(too minor to require h5committest)
Diffstat (limited to 'test')
-rw-r--r-- | test/cache_api.c | 4 | ||||
-rw-r--r-- | test/enc_dec_plist.c | 2 | ||||
-rw-r--r-- | test/fillval.c | 16 | ||||
-rw-r--r-- | test/freespace.c | 6 | ||||
-rw-r--r-- | test/gen_cross.c | 18 | ||||
-rw-r--r-- | test/istore.c | 2 | ||||
-rw-r--r-- | test/tselect.c | 5 |
7 files changed, 22 insertions, 31 deletions
diff --git a/test/cache_api.c b/test/cache_api.c index 85b2407..66f8143 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -883,7 +883,6 @@ mdc_api_call_smoke_check(int express_test) hid_t properties; char dset_name[64]; int i, j, k, l, m, n; - int progress_counter; herr_t status; hsize_t dims[2]; hsize_t a_size[2]; @@ -1164,7 +1163,6 @@ mdc_api_call_smoke_check(int express_test) /* initialize all datasets on a round robin basis */ i = 0; - progress_counter = 0; while ( ( pass ) && ( i < DSET_SIZE ) ) { @@ -1249,7 +1247,6 @@ mdc_api_call_smoke_check(int express_test) /* do random reads on all datasets */ n = 0; - progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) { m = rand() % NUM_DSETS; @@ -1376,7 +1373,6 @@ mdc_api_call_smoke_check(int express_test) /* do random reads on data set 0 only */ m = 0; n = 0; - progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) { i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 26bfb84..2d0d732 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -125,7 +125,7 @@ main(void) if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if((H5Pset_chunk(dcpl, 2, &chunk_size)) < 0) + if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0) FAIL_STACK_ERROR if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0) diff --git a/test/fillval.c b/test/fillval.c index 9271f80..fc44f86 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -289,7 +289,7 @@ static int test_getset_vl(hid_t fapl) { hsize_t dims[1] = {2}; - hid_t fileid = (-1), spaceid = (-1), typeid = (-1), datasetid = (-1), plistid = (-1); + hid_t fileid = (-1), spaceid = (-1), dtypeid = (-1), datasetid = (-1), plistid = (-1); char fill_value[] = "aaaa"; char orig_fill_value[] = "aaaa"; char *f1 = fill_value; @@ -299,18 +299,18 @@ test_getset_vl(hid_t fapl) TESTING("property lists, with variable-length datatype"); /* Create string type. */ - if((typeid = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR - if(H5Tset_size(typeid, H5T_VARIABLE) < 0) TEST_ERROR + if((dtypeid = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if(H5Tset_size(dtypeid, H5T_VARIABLE) < 0) TEST_ERROR /* Set up dataset creation property list, with fill value */ if((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - if(H5Pset_fill_value(plistid, typeid, &f1) < 0) TEST_ERROR + if(H5Pset_fill_value(plistid, dtypeid, &f1) < 0) TEST_ERROR /* Modify original fill value string */ fill_value[0] = 'b'; /* Retrieve fill value from property */ - if(H5Pget_fill_value(plistid, typeid, &f2) < 0) TEST_ERROR + if(H5Pget_fill_value(plistid, dtypeid, &f2) < 0) TEST_ERROR /* Verify that the fill value is the original value */ if(HDstrcmp(f2, orig_fill_value)) TEST_ERROR @@ -324,7 +324,7 @@ test_getset_vl(hid_t fapl) /* Write an dataset of this type. */ if((spaceid = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR - if((datasetid = H5Dcreate2(fileid, "Dataset", typeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0) TEST_ERROR + if((datasetid = H5Dcreate2(fileid, "Dataset", dtypeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0) TEST_ERROR /* Close IDs (except datatype) */ if(H5Dclose(datasetid) < 0) TEST_ERROR @@ -341,7 +341,7 @@ test_getset_vl(hid_t fapl) if((plistid = H5Dget_create_plist(datasetid)) < 0) TEST_ERROR /* Query fill value */ - if(H5Pget_fill_value(plistid, typeid, &f2) < 0) TEST_ERROR + if(H5Pget_fill_value(plistid, dtypeid, &f2) < 0) TEST_ERROR /* Verify that the fill value is the original value */ if(HDstrcmp(f2, orig_fill_value)) TEST_ERROR @@ -353,7 +353,7 @@ test_getset_vl(hid_t fapl) if(H5Dclose(datasetid) < 0) TEST_ERROR if(H5Fclose(fileid) < 0) TEST_ERROR if(H5Pclose(plistid) < 0) TEST_ERROR - if(H5Tclose(typeid) < 0) TEST_ERROR + if(H5Tclose(dtypeid) < 0) TEST_ERROR PASSED(); return 0; diff --git a/test/freespace.c b/test/freespace.c index 14b0f9a..9ab0d75 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -191,7 +191,7 @@ typedef struct { hsize_t tot_sect_count; } TEST_iter_ud_t; -static herr_t TEST_sects_cb(const H5FS_section_info_t *_sect, void *_udata); +static herr_t TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata); /* @@ -340,9 +340,9 @@ error: * iteration callback */ static herr_t -TEST_sects_cb(const H5FS_section_info_t *_sect, void *_udata) +TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata) { - const TEST_free_section_t *sect = (const TEST_free_section_t *)_sect; + TEST_free_section_t *sect = (TEST_free_section_t *)_sect; TEST_iter_ud_t *udata = (TEST_iter_ud_t *)_udata; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/test/gen_cross.c b/test/gen_cross.c index bdc2835..3b0a56f 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -24,6 +24,7 @@ * under hdf5/test/ directory. */ +#include <stdio.h> #include "h5test.h" #define H5FILE_NAME "data.h5" @@ -70,7 +71,9 @@ int create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid); int create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid); int create_fletcher_dsets_float(hid_t fid, hid_t fsid, hid_t msid); int create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid); +#ifdef H5_HAVE_FILTER_SZIP int create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid); +#endif /* H5_HAVE_FILTER_SZIP */ int create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid); int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid); @@ -1016,6 +1019,7 @@ error: #endif /* H5_HAVE_FILTER_DEFLATE */ } +#ifdef H5_HAVE_FILTER_SZIP /*------------------------------------------------------------------------- * Function: create_szip_dsets_float @@ -1035,7 +1039,6 @@ error: int create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid) { -#ifdef H5_HAVE_FILTER_SZIP hid_t dataset; /* dataset handles */ hid_t dcpl; float data[NX][NY]; /* data to write */ @@ -1097,15 +1100,8 @@ create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid) if(H5Pclose(dcpl) < 0) TEST_ERROR -#else /* H5_HAVE_FILTER_SZIP */ - const char *not_supported= "Szip filter is not enabled. Can't create the dataset."; - - puts(not_supported); -#endif /* H5_HAVE_FILTER_SZIP */ - return 0; -#ifdef H5_HAVE_FILTER_SZIP error: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -1113,8 +1109,8 @@ error: } H5E_END_TRY; return -1; -#endif /* H5_HAVE_FILTER_SZIP */ } +#endif /* H5_HAVE_FILTER_SZIP */ /*------------------------------------------------------------------------- @@ -1426,9 +1422,13 @@ main (void) if(create_deflate_dsets_float(file, filespace, memspace) < 0) {H5_FAILED(); AT(); return 1;} +#ifdef H5_HAVE_FILTER_SZIP /* Create a dataset of FLOAT with szip filter */ if(create_szip_dsets_float(file, filespace, memspace) < 0) {H5_FAILED(); AT(); return 1;} +#else /* H5_HAVE_FILTER_SZIP */ + puts("Szip filter is not enabled. Can't create the dataset."); +#endif /* H5_HAVE_FILTER_SZIP */ /* Create a dataset of FLOAT with shuffle filter */ if(create_shuffle_dsets_float(file, filespace, memspace) < 0) diff --git a/test/istore.c b/test/istore.c index 217dfc4..d088fe8 100644 --- a/test/istore.c +++ b/test/istore.c @@ -318,7 +318,7 @@ test_extend(hid_t f, const char *prefix, nelmts = 1; } else { for (i=0, nelmts=1; i<(size_t)ndims; i++) { - if (ctr % ndims == i) { + if (ctr % (size_t)ndims == i) { offset[i] = max_corner[i]; size[i] = MIN(1, whole_size[i] - offset[i]); } else { diff --git a/test/tselect.c b/test/tselect.c index 8ca3c24..fed405c 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -2734,7 +2734,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ hid_t dset_type, hid_t xfer_plist) { hbool_t data_ok; - hbool_t start_in_checker[5]; hid_t fapl; /* File access property list */ hid_t fid; /* HDF5 File IDs */ hid_t full_small_cube_sid; /* Dataspace for small cube w/all selection */ @@ -2955,7 +2954,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ * large cube. */ - start_in_checker[0] = TRUE; u = 0; do { if(small_rank_offset > 0) @@ -3063,7 +3061,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start); - start_in_checker[0] = TRUE; u = 0; do { if(0 < small_rank_offset) @@ -3207,7 +3204,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ small_rank, sel_start); - start_in_checker[0] = TRUE; u = 0; do { if(small_rank_offset > 0) @@ -3340,7 +3336,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ small_rank, sel_start); - start_in_checker[0] = TRUE; u = 0; do { if(small_rank_offset > 0) |