From f40381b0eab242182a02b0bb97aed88b37095086 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 13 Aug 2016 04:23:53 -0500 Subject: [svn-r30285] Description: More warning cleanups, bringing the build down to 25 unique types of warnings, with 550 warnings in 122 files (down from 28, 770, and 134). Tested on: MacOSX/64 10.11.5 (amazon) w/serial & parallel (h5committest forthcoming) --- hl/src/H5LT.c | 4 +- hl/test/test_dset_append.c | 2 - src/H5FSpkg.h | 16 +++--- src/H5PL.c | 2 +- test/bittests.c | 64 ++++++++++++------------ test/dtypes.c | 16 +++--- test/error_test.c | 10 ++-- test/fheap.c | 12 ++--- test/fillval.c | 44 +++++++++-------- test/flush1.c | 28 +++-------- test/flush2.c | 15 ++---- test/gheap.c | 68 ++++++++++++------------- test/hyperslab.c | 20 ++++---- test/tchecksum.c | 4 +- test/tfile.c | 19 +++---- test/th5o.c | 34 +++++++------ test/titerate.c | 14 ++++-- test/trefer.c | 28 ++++++----- test/ttst.c | 2 +- test/tunicode.c | 38 +++++++------- tools/h5diff/h5diff_common.c | 9 ++-- tools/h5dump/h5dumpgentest.c | 20 ++++---- tools/h5import/h5importtest.c | 16 +++--- tools/h5jam/h5jamgentest.c | 4 +- tools/lib/io_timer.c | 4 +- tools/misc/h5repart.c | 18 +++---- tools/misc/h5repart_gentest.c | 3 +- tools/perform/chunk.c | 18 +++---- tools/perform/iopipe.c | 18 +++---- tools/perform/overhead.c | 19 +++---- tools/perform/sio_engine.c | 112 +++++++++++++++++++++--------------------- 31 files changed, 331 insertions(+), 350 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 107e238..b7e0b4a 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -894,8 +894,8 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) /* set allocation increment to a percentage of the supplied buffer size, or * a pre-defined minimum increment value, whichever is larger */ - if ((buf_prcnt * buf_size) > min_incr) - alloc_incr = (size_t)(buf_prcnt * buf_size); + if ((size_t)(buf_prcnt * (double)buf_size) > min_incr) + alloc_incr = (size_t)(buf_prcnt * (double)buf_size); else alloc_incr = min_incr; diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 62e86cb..a5c9abc 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -56,14 +56,12 @@ test_dataset_append_notset(hid_t fid) hid_t did = -1; /* Dataset ID */ hid_t sid = -1; /* Dataspace ID */ hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ hid_t ffapl = -1; /* The file's file access property list */ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ int lbuf[10]; /* The data buffers */ - hsize_t file_size; /* File size */ int i, j; /* Local index variables */ h5_stat_t sb1, sb2; /* File info */ diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 54029cc..7e52b5f 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -65,18 +65,18 @@ \ /* Free space header specific fields */ \ + 1 /* Client ID */ \ - + H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \ - + H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \ - + H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \ - + H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \ + 2 /* Number of section classes */ \ + 2 /* Shrink percent */ \ + 2 /* Expand percent */ \ + 2 /* Size of address space for sections (log2 of value) */ \ - + H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \ - + H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \ - + H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \ - + H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \ + + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \ ) /* Size of the free space serialized sections on disk */ diff --git a/src/H5PL.c b/src/H5PL.c index c4d163e..3e67b04 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -433,7 +433,7 @@ H5PL__init_path_table(void) dl_path = (char *)H5MM_xfree(dl_path); dl_path = H5MM_strdup(tempbuf); } -#endif H5_HAVE_WIN32_API +#endif /* H5_HAVE_WIN32_API */ /* Put paths in the path table. They are separated by ":" */ dir = HDstrtok(dl_path, H5PL_PATH_SEPARATOR); diff --git a/test/bittests.c b/test/bittests.c index c4dfe4c..38e419d 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -88,7 +88,7 @@ test_find (void) /* Try all combinations of one byte */ for(i = 0; i < 8 * (int)sizeof(v1); i++) { HDmemset(v1, 0, sizeof v1); - v1[i / 8] = 1 << (i % 8); + v1[i / 8] = (uint8_t)(1 << (i % 8)); n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE); if((ssize_t)i != n) { H5_FAILED(); @@ -120,8 +120,8 @@ test_find (void) /* Try all combinations of one byte */ for (i=0; i<8*(int)sizeof(v1); i++) { - memset (v1, 0xff, sizeof v1); - v1[i/8] &= ~(1<<(i%8)); + HDmemset(v1, 0xff, sizeof v1); + v1[i / 8] &= (uint8_t)~(1 << (i % 8)); n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE); if ((ssize_t)i!=n) { H5_FAILED(); @@ -175,12 +175,12 @@ test_copy (void) TESTING("bit copy operations"); for (i=0; i1) /* if size=6, make a sequence like 011111 */ H5T__bit_set (vector, offset, size-1, 1); else /* if size=1, just set this one bit to 1 */ @@ -517,13 +517,13 @@ test_decrement (void) TESTING("bit decrement operations"); for (i=0; i= start_size[j]) odd = 1; else @@ -1625,7 +1627,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % max_size[j]; + hs_offset[j] = (hsize_t)HDrand() % max_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else @@ -1666,7 +1668,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % extend_size[j]; + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else @@ -1759,7 +1761,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % extend_size[j]; + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else diff --git a/test/flush1.c b/test/flush1.c index f15a05a..f1169ea 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -68,13 +68,8 @@ create_file(char* name, hid_t fapl) /* Write some data */ for(i = 0; i < ds_size[0]; i++) - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ for(j = 0; j < (size_t)ds_size[1]; j++) - the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1); + the_data[i][j] = (double)i / (double)(j + 1); if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) FAIL_STACK_ERROR /* Create some groups */ @@ -124,25 +119,15 @@ extend_file(hid_t file) goto error; /* Write some data */ - for (i=0; i 0.0001F) { + error = HDfabs(the_data[i][j] - (double)i / (double)(j + 1)); + if(error > (double)0.0001F) { H5_FAILED(); printf(" dset[%lu][%lu] = %g\n", (unsigned long)i, (unsigned long)j, the_data[i][j]); - printf(" should be %g\n", - (double)(hssize_t)i/(hssize_t)(j+1)); + printf(" should be %g\n", (double)i / (double)(j + 1)); goto error; } } diff --git a/test/gheap.c b/test/gheap.c index 3f66d35..317e306 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -81,7 +81,7 @@ test_1 (hid_t fapl) H5HG_t obj[1024]; uint8_t out[1024]; uint8_t in[1024]; - int i; + size_t u; size_t size; herr_t status; int nerrors = 0; @@ -104,16 +104,16 @@ test_1 (hid_t fapl) * a clean file, the addresses allocated for the collections should also * be monotonically increasing. */ - for(i = 0; i < 1024; i++) { - size = i + 1; - HDmemset(out, 'A' + i % 26, size); + for(u = 0; u < 1024; u++) { + size = u + 1; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + i); + status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + u); if(status < 0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; - } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) { + } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { H5_FAILED(); puts(" Collection addresses are not monotonically increasing"); nerrors++; @@ -123,11 +123,11 @@ test_1 (hid_t fapl) /* * Now try to read each object back. */ - for(i = 0; i < 1024; i++) { - size = i + 1; - HDmemset(out, 'A' + i % 26, size); + for(u = 0; u < 1024; u++) { + size = u + 1; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + i, in, NULL)) { + if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -177,7 +177,7 @@ test_2 (hid_t fapl) H5HG_t obj[1024]; uint8_t out[1024]; uint8_t in[1024]; - int i; + size_t u; size_t size; int nerrors = 0; char filename[1024]; @@ -197,11 +197,11 @@ test_2 (hid_t fapl) /* * Write the objects, monotonically decreasing in length. */ - for (i=0; i<1024; i++) { - size = 1024-i; - memset (out, 'A'+i%26, size); + for(u = 0; u < 1024; u++) { + size = 1024 - u; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i)<0) { + if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; @@ -211,11 +211,11 @@ test_2 (hid_t fapl) /* * Now try to read each object back. */ - for (i=0; i<1024; i++) { - size = 1024-i; - memset (out, 'A'+i%26, size); + for(u = 0; u < 1024; u++) { + size = 1024 - u; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj+i, in, NULL)) { + if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -263,7 +263,7 @@ test_3 (hid_t fapl) H5F_t *f = NULL; H5HG_t obj[1024]; uint8_t out[1024]; - int i; + size_t u; size_t size; herr_t status; int nerrors = 0; @@ -282,11 +282,11 @@ test_3 (hid_t fapl) } /* Create some stuff */ - for (i=0; i<1024; i++) { - size = i%30+100; - memset (out, 'A'+i%26, size); + for(u = 0; u < 1024; u++) { + size = u % 30 + 100; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i); + status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -295,8 +295,8 @@ test_3 (hid_t fapl) } /* Remove everything */ - for (i=0; i<1024; i++) { - status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i); + for(u = 0; u < 1024; u++) { + status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); @@ -342,7 +342,7 @@ test_4 (hid_t fapl) H5F_t *f = NULL; H5HG_t obj[1024]; uint8_t out[1024]; - int i; + size_t u; size_t size; herr_t status; int nerrors = 0; @@ -360,12 +360,12 @@ test_4 (hid_t fapl) goto error; } - for (i=0; i<1024; i++) { + for(u = 0; u < 1024; u++) { /* Insert */ - size = i%30+100; - memset (out, 'A'+i%26, size); + size = u % 30 + 100; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i); + status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -377,15 +377,15 @@ test_4 (hid_t fapl) * next one has already been inserted. That is, insert A, B, C; * remove B, insert D, E, F; remove E; etc. */ - if (1==i%3) { + if(1 == (u % 3)) { H5Eclear2(H5E_DEFAULT); - status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i-1); + status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u - 1); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); nerrors++; } - memset (obj+i-1, 0, sizeof *obj); + HDmemset(obj + u - 1, 0, sizeof *obj); } } diff --git a/test/hyperslab.c b/test/hyperslab.c index 2cf47b1..9ba5731 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -223,7 +223,7 @@ test_fill(size_t nx, size_t ny, size_t nz, for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++) for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++) ref_value -= dst[u * ny * nz + v * nz + w]; - ref_value += fill_value * dx * dy * dz; + ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz; /* Fill the hyperslab with some value */ H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value); @@ -819,8 +819,8 @@ test_transpose(size_t nx, size_t ny) size[1] = ny; src_stride[0] = 0; src_stride[1] = sizeof(*src); - dst_stride[0] = (ssize_t)((1 - nx * ny) * sizeof(*src)); - dst_stride[1] = (ssize_t)(nx * sizeof(*src)); + dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src)); + dst_stride[1] = (hsize_t)(nx * sizeof(*src)); /* Copy and transpose */ if(nx == ny) @@ -923,7 +923,7 @@ test_sub_super(size_t nx, size_t ny) /* Setup */ size[0] = nx; size[1] = ny; - src_stride[0] = (ssize_t)(2 * ny); + src_stride[0] = (hsize_t)(2 * ny); src_stride[1] = 2; dst_stride[0] = 0; dst_stride[1] = 1; @@ -972,9 +972,9 @@ test_sub_super(size_t nx, size_t ny) src_stride[1] = 1; src_stride[2] = 0; src_stride[3] = 0; - dst_stride[0] = (ssize_t)(2 * ny); - dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny); - dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t)); + dst_stride[0] = (hsize_t)(2 * ny); + dst_stride[1] = (hsize_t)(2 * sizeof(uint8_t) - 4 * ny); + dst_stride[2] = (hsize_t)(2 * ny - 2 * sizeof(uint8_t)); dst_stride[3] = sizeof(uint8_t); /* Copy */ @@ -1144,9 +1144,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) /* Check offsets */ for(u = 0; u < n; u++) { /* Get random coordinate */ - coords[0] = (hssize_t)(HDrandom() % z); - coords[1] = (hssize_t)(HDrandom() % y); - coords[2] = (hssize_t)(HDrandom() % x); + coords[0] = (hsize_t)((size_t)HDrandom() % z); + coords[1] = (hsize_t)((size_t)HDrandom() % y); + coords[2] = (hsize_t)((size_t)HDrandom() % x); /* Get offset of coordinate */ off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords); diff --git a/test/tchecksum.c b/test/tchecksum.c index cb7c023..ca6c227 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -189,7 +189,7 @@ test_chksum_large(void) /* Initialize buffer w/known data */ for(u = 0; u < BUF_LEN; u++) - large_buf[u] = u * 3; + large_buf[u] = (uint8_t)(u * 3); /* Buffer w/real data */ chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf)); @@ -247,7 +247,7 @@ test_checksum(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +H5_ATTR_PURE H5_ATTR_CONST void cleanup_checksum(void) { /* no file to clean */ diff --git a/test/tfile.c b/test/tfile.c index 74f3b86..833d2d9 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1858,7 +1858,7 @@ test_file_open_overlap(void) hid_t did1, did2; hid_t gid; hid_t sid; - int nobjs; /* # of open objects */ + ssize_t nobjs; /* # of open objects */ unsigned intent; herr_t ret; /* Generic return value */ @@ -2197,8 +2197,9 @@ test_file_double_file_dataset_open(hbool_t new_format) hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */ hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */ - char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ - char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ + hsize_t size; /* File size */ + const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ + const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ char* buffer[5]; /* Output buffer */ int wbuf[4] = {1, 2, 3, 4}; /* Input data */ herr_t ret; /* Generic return value */ @@ -2432,8 +2433,8 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(did1, FAIL, "H5Dopen2"); /* First file's get storage size */ - ret = H5Dget_storage_size(did1); - CHECK(ret, FAIL, "H5Dget_storage_size"); + size = H5Dget_storage_size(did1); + CHECK(size, 0, "H5Dget_storage_size"); /* Second file open */ fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -2452,8 +2453,8 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Fclose"); /* Second file's get storage size */ - ret = H5Dget_storage_size(did2); - CHECK(ret, FAIL, "H5Dget_storage_size"); + size = H5Dget_storage_size(did2); + CHECK(size, 0, "H5Dget_storage_size"); /* Second file's dataset close */ ret = H5Dclose(did2); @@ -2775,7 +2776,7 @@ test_rw_noupdate(void) diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); /* Check That Timestamps Are Equal */ - if(diff > 0.0F) { + if(diff > (double)0.0F) { /* Output message about test being performed */ MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time.\n")); } /* end if */ @@ -2808,7 +2809,7 @@ test_rw_noupdate(void) /* Ensure That Timestamps Are Equal */ diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); - ret = (diff > 0.0F); + ret = (diff > (double)0.0F); VERIFY(ret, 0, "Timestamp"); } /* end else */ } /* end test_rw_noupdate() */ diff --git a/test/th5o.c b/test/th5o.c index 3be5d12..125e11b 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -920,6 +920,7 @@ test_h5o_comment(void) const char *dtype_comment = "datatype comment"; char check_comment[64]; ssize_t comment_len = 0; + ssize_t len; herr_t ret; /* Value returned from API calls */ int ret_value; @@ -1008,8 +1009,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(fid, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(fid, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(fid, check_comment, (size_t)comment_len+1); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(file_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1022,8 +1023,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(grp, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(grp, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(grp, check_comment, (size_t)comment_len+1); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(grp_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1036,8 +1037,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(dtype, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(dtype_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1050,8 +1051,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(dset, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(dset, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(dset, check_comment, (size_t)comment_len+1); + CHECK(ret, len, "H5Oget_comment"); ret_value = HDstrcmp(dset_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1092,6 +1093,7 @@ test_h5o_comment_by_name(void) const char *dtype_comment = "datatype comment by name"; char check_comment[64]; ssize_t comment_len = 0; + ssize_t len; herr_t ret; /* Value returned from API calls */ int ret_value; @@ -1179,8 +1181,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment_by_name"); ret_value = HDstrcmp(file_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); @@ -1193,8 +1195,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + len = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment_by_name"); ret_value = HDstrcmp(grp_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); @@ -1203,8 +1205,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(dtype_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); @@ -1213,8 +1215,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + len = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment_by_name"); ret_value = HDstrcmp(dset_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); diff --git a/test/titerate.c b/test/titerate.c index f61842a..9f0b900 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -283,7 +283,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test all objects in group, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Literate"); @@ -308,7 +309,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test all objects in group, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Literate"); @@ -462,7 +464,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Test all attributes on dataset, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Aiterate2"); @@ -488,7 +491,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Test all attributes on dataset, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Aiterate2"); @@ -672,7 +676,7 @@ test_iter_group_large(hid_t fapl) ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); CHECK(ret, FAIL, "H5Literate"); for(i = 1; i < 100; i++) { - hsize_t idx = i; + hsize_t idx = (hsize_t)i; curr_name = &names[i]; ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); diff --git a/test/trefer.c b/test/trefer.c index cb0f44e..433239a 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -84,8 +84,8 @@ test_reference_params(void) int i; /* counting variables */ const char *write_comment = "Foo!"; /* Comments for group */ hid_t ret_id; /* Generic hid_t return value */ + ssize_t name_size; /* Size of reference name */ herr_t ret; /* Generic return value */ - size_t name_size; /* Size of reference name */ /* Output message about test being performed */ MESSAGE(5, ("Testing Reference Parameters\n")); @@ -120,7 +120,7 @@ test_reference_params(void) CHECK(dataset, FAIL, "H5Dcreate2"); for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; + *tu32++ = (unsigned)i * 3; /* Write selection to disk */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -266,6 +266,7 @@ test_reference_obj(void) const char *write_comment="Foo!"; /* Comments for group */ char read_comment[10]; H5O_type_t obj_type; /* Object type */ + ssize_t size; /* Comment length */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -301,7 +302,7 @@ test_reference_obj(void) CHECK(dataset, FAIL, "H5Dcreate2"); for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; + *tu32++ = (unsigned)i * 3; /* Write selection to disk */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -432,8 +433,8 @@ test_reference_obj(void) CHECK(group, FAIL, "H5Rdereference2"); /* Get group's comment */ - ret = H5Oget_comment(group, read_comment, (size_t)10); - CHECK(ret, FAIL, "H5Oget_comment"); + size = H5Oget_comment(group, read_comment, (size_t)10); + CHECK(size, FAIL, "H5Oget_comment"); /* Check for correct comment value */ if(HDstrcmp(write_comment, read_comment) != 0) @@ -557,7 +558,7 @@ test_reference_region(void) CHECK(dset2, FAIL, "H5Dcreate2"); for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++) - *tu8++ = i * 3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -762,7 +763,7 @@ test_reference_region(void) VERIFY(ret, 36, "H5Sget_select_npoints"); ret = (int)H5Sget_select_hyper_nblocks(sid2); VERIFY(ret, 1, "H5Sget_select_hyper_nblocks"); - coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist"); VERIFY(coords[0], 2, "Hyperslab Coordinates"); @@ -790,7 +791,7 @@ test_reference_region(void) VERIFY(ret, 10, "H5Sget_select_npoints"); ret = (int)H5Sget_select_elem_npoints(sid2); VERIFY(ret, 10, "H5Sget_select_elem_npoints"); - coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); VERIFY(coords[0], coord1[0][0], "Element Coordinates"); @@ -945,7 +946,7 @@ test_reference_region_1D(void) CHECK(dset3, FAIL, "H5Dcreate2"); for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -1068,7 +1069,7 @@ test_reference_region_1D(void) VERIFY(ret, 30, "H5Sget_select_npoints"); ret = (int)H5Sget_select_hyper_nblocks(sid3); VERIFY(ret, 15, "H5Sget_select_hyper_nblocks"); - coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist"); VERIFY(coords[0], 2, "Hyperslab Coordinates"); @@ -1120,7 +1121,7 @@ test_reference_region_1D(void) VERIFY(ret, 10, "H5Sget_select_npoints"); ret = (int)H5Sget_select_elem_npoints(sid3); VERIFY(ret, 10, "H5Sget_select_elem_npoints"); - coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); VERIFY(coords[0], coord1[0][0], "Element Coordinates"); @@ -1329,6 +1330,7 @@ test_reference_group(void) char objname[NAME_SIZE]; /* Buffer to store name */ H5O_info_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ + ssize_t size; /* Name length */ herr_t ret; /* Create file with a group and a dataset containing an object reference to the group */ @@ -1409,8 +1411,8 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Gget_info"); VERIFY(ginfo.nlinks, 3, "H5Gget_info"); - ret = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_name_by_idx"); + size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); + CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT); diff --git a/test/ttst.c b/test/ttst.c index 0c47dad..a7c43a2 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -123,7 +123,7 @@ test_tst_init(void) curr_time=HDtime(NULL); HDsrandom((unsigned)curr_time); for(u=0; u>6); - test_string[cur_pos+1] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xC0 | c >> 6); + test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F)); cur_pos += 2; } else if (c < 0x10000) { - test_string[cur_pos] = (0xE0 | c>>12); - test_string[cur_pos+1] = (0x80 | (c>>6 & 0x3F)); - test_string[cur_pos+2] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xE0 | c >> 12); + test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F)); + test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F)); cur_pos += 3; } else if (c < 0x200000) { - test_string[cur_pos] = (0xF0 | c>>18); - test_string[cur_pos+1] = (0x80 | (c>>12 & 0x3F)); - test_string[cur_pos+2] = (0x80 | (c>>6 & 0x3F)); - test_string[cur_pos+3] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xF0 | c >> 18); + test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F)); + test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F)); + test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F)); cur_pos += 4; } @@ -771,13 +773,13 @@ unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos * could confuse printf (e.g., '\n'). */ void dump_string(const char * string) { - unsigned int length; - unsigned int x; + size_t length; + size_t x; printf("The string was:\n %s", string); printf("Or in hex:\n"); - length = strlen(string); + length = HDstrlen(string); for(x=0; xdelta = atof( opt_arg ); /* -d 0 is the same as default */ - if (options->delta == 0) + if (H5_DBL_ABS_EQUAL(options->delta, (double)0.0F)) options->d=0; break; @@ -235,7 +235,7 @@ void parse_command_line(int argc, options->percent = atof( opt_arg ); /* -p 0 is the same as default */ - if (options->percent == 0) + if (H5_DBL_ABS_EQUAL(options->percent, (double)0.0F)) options->p = 0; break; @@ -249,16 +249,17 @@ void parse_command_line(int argc, usage(); h5diff_exit(EXIT_FAILURE); } - options->count = atol( opt_arg ); - + options->count = HDstrtoull(opt_arg, NULL, 0); break; case 'N': options->do_nans = 0; break; + case 'c': options->m_list_not_cmp = 1; break; + case 'e': options->use_system_epsilon = 1; break; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 4506da2..c95ada3 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -376,15 +376,12 @@ typedef struct s1_t { /* "File 82" macros */ /* Name of dataset to create in datafile */ #define F82_DATASETNAME "CompoundComplex1D" -#define F82_DATASETNAME2 "CompoundComplex2D" -#define F82_DATASETNAME3 "CompoundComplex3D" -#define F82_DATASETNAME4 "CompoundComplex4D" /* Dataset dimensions */ #define F82_DIM32 32 #define F82_RANK 1 -#define F82_RANK2 2 -#define F82_RANK3 3 -#define F82_RANK4 4 +//#define F82_RANK2 2 +//#define F82_RANK3 3 +//#define F82_RANK4 4 /* "File 83" macros */ /* Name of dataset to create in datafile */ @@ -9923,9 +9920,9 @@ static void gent_compound_complex2(void) compound buf[F82_DIM32]; /* compound */ - hid_t file, grp=-1, type=-1, space=-1, dset=-1; + hid_t file, type=-1, space=-1, dset=-1; hid_t dset_array_a, dset_array_b, dset_array_c; - hid_t cmpd_tid1, cmpd_tid2, cmpd_tid3; + hid_t cmpd_tid1 = -1, cmpd_tid2 = -1, cmpd_tid3 = -1; size_t i; size_t j, k; unsigned dset_array_ndims; @@ -9937,6 +9934,10 @@ static void gent_compound_complex2(void) if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) { /* CompoundComplex1D */ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) { + hid_t str_type, array; + hsize_t dims[1]; + hid_t nest1, nest2; + /* Insert top-level array members */ dset_array_ndims = 1; dset_array_a_dims[0] = 4; dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims); @@ -9954,8 +9955,6 @@ static void gent_compound_complex2(void) H5Tclose(dset_array_c); /* Insert first nested compound */ - hid_t str_type, array; - hsize_t dims[1]; cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(nested_compound)); H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE); @@ -9977,7 +9976,6 @@ static void gent_compound_complex2(void) H5Tinsert(type, "nested_compound", HOFFSET(compound, d), cmpd_tid1); /* Insert second nested compound */ - hid_t nest1, nest2; cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(multiple_nested_compound)); H5Tinsert(cmpd_tid2, "nested_float", HOFFSET(multiple_nested_compound, a), H5T_IEEE_F32LE); diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index ac839fb..38fd75b 100644 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -119,8 +119,8 @@ main(void) #ifdef H5_SIZEOF_LONG_LONG row4i64[i] = row4i64[i - 1] + rowi4i64; #endif - row4i16[i] = row4i16[i - 1] + rowi4i16; - row4i8[i] = row4i8[i - 1] + rowi4i8; + row4i16[i] = (short)(row4i16[i - 1] + rowi4i16); + row4i8[i] = (char)(row4i8[i - 1] + rowi4i8); } for (j = 1; j < ncol; j++) @@ -131,8 +131,8 @@ main(void) #ifdef H5_SIZEOF_LONG_LONG col4i64[j] = col4i64[j - 1] + coli4i64; #endif - col4i16[j] = col4i16[j - 1] + coli4i16; - col4i8[j] = col4i8[j - 1] + coli4i8; + col4i16[j] = (short)(col4i16[j - 1] + coli4i16); + col4i8[j] = (char)(col4i8[j - 1] + coli4i8); } for (k = 1; k < npln; k++) { @@ -142,8 +142,8 @@ main(void) #ifdef H5_SIZEOF_LONG_LONG pln4i64[k] = pln4i64[k - 1] + plni4i64; #endif - pln4i16[k] = pln4i16[k - 1] + plni4i16; - pln4i8[k] = pln4i8[k - 1] + plni4i8; + pln4i16[k] = (short)(pln4i16[k - 1] + plni4i16); + pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8); } /* @@ -157,8 +157,8 @@ main(void) for (k = 0; k < npln; k++) { b64r3[k][i][j] = row8[i] + col8[j] + pln8[k]; b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k]; - b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k]; - b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k]; + b16i3[k][i][j] = (short)(row4i16[i] + col4i16[j] + pln4i16[k]); + b8i3[k][i][j] = (char)(row4i8[i] + col4i8[j] + pln4i8[k]); } diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 7ae3169..a12b17a 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -248,7 +248,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) space = H5Screate_simple(1, dims, NULL); dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 10; i++) - dset2_1[i] = (float)(i*0.1F+1); + dset2_1[i] = (float)((float)i * 0.1F + 1.0F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); @@ -259,7 +259,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 3; i++) for (j = 0; j < 5; j++) - dset2_2[i][j] = (float)((i+1)*j*0.1F); + dset2_2[i][j] = (float)(((float)i + 1.0F) * (float)j * 0.1F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2); H5Sclose(space); H5Dclose(dataset); diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index 4d79a9b..6053ce9 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -55,9 +55,9 @@ io_time_t *timer_g; /* timer: global for stub functions */ static double sub_time(struct timeval* a, struct timeval* b) { return (((double)a->tv_sec + - ((double)a->tv_usec) / MICROSECOND) - + ((double)a->tv_usec) / (double)MICROSECOND) - ((double)b->tv_sec + - ((double)b->tv_usec) / MICROSECOND)); + ((double)b->tv_usec) / (double)MICROSECOND)); } diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 8657cbc..e44c957 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -194,9 +194,7 @@ main (int argc, char *argv[]) int src, dst=-1; /*source & destination files */ int need_seek=FALSE; /*destination needs to seek? */ int need_write; /*data needs to be written? */ - /*struct stat sb; temporary file stat buffer */ - /*struct _stati64 sb;*/ - h5_stat_t sb; + h5_stat_t sb; /*temporary file stat buffer */ int verbose=FALSE; /*display file names? */ @@ -243,7 +241,7 @@ main (int argc, char *argv[]) family_to_sec2 = TRUE; argno++; } else if ('b'==argv[argno][1]) { - blk_size = get_size (prog_name, &argno, argc, argv); + blk_size = (size_t)get_size (prog_name, &argno, argc, argv); } else if ('m'==argv[argno][1]) { dst_size = get_size (prog_name, &argno, argc, argv); } else { @@ -308,7 +306,7 @@ main (int argc, char *argv[]) if (dst_is_family) n = (size_t)MIN((off_t)n, dst_size-dst_offset); if (left_overs) { n = (size_t)MIN ((off_t)n, left_overs); - left_overs -= n; + left_overs = left_overs - (off_t)n; need_write = FALSE; } else if (src_offsetru_utime.tv_sec)+ - (double)(r_stop->ru_utime.tv_usec)/1000000.0F) - + (double)(r_stop->ru_utime.tv_usec)/(double)1000000.0F) - ((double)(r_start->ru_utime.tv_sec)+ - (double)(r_start->ru_utime.tv_usec)/1000000.0F); + (double)(r_start->ru_utime.tv_usec)/(double)1000000.0F); s_time = ((double)(r_stop->ru_stime.tv_sec)+ - (double)(r_stop->ru_stime.tv_usec)/1000000.0F) - + (double)(r_stop->ru_stime.tv_usec)/(double)1000000.0F) - ((double)(r_start->ru_stime.tv_sec)+ - (double)(r_start->ru_stime.tv_usec)/1000000.0F); + (double)(r_start->ru_stime.tv_usec)/(double)1000000.0F); #endif #ifndef H5_HAVE_SYS_TIMEB e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000000.0F) - + (double)(t_stop->tv_usec)/(double)1000000.0F) - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000000.0F); + (double)(t_start->tv_usec)/(double)1000000.0F); #else e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000.0F) - + (double)(t_stop->tv_usec)/(double)1000.0F) - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000.0F); + (double)(t_start->tv_usec)/(double)1000.0F); #endif bw = (double)nbytes / e_time; @@ -196,7 +196,7 @@ main (void) * 1998-11-06 ptl */ printf ("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0]*size[1])/1024.0F*1024); + (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024); /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/perform/overhead.c b/tools/perform/overhead.c index 277f7a4..98093c7 100644 --- a/tools/perform/overhead.c +++ b/tools/perform/overhead.c @@ -199,7 +199,7 @@ test(fill_t fill_style, const double splits[], int *had = NULL; /*for random filling */ const char *sname=NULL; /*fill style nam */ int mdc_nelmts; /*num meta objs to cache*/ - hsize_t i; + hsize_t i, k; int j; h5_stat_t sb; @@ -236,13 +236,13 @@ test(fill_t fill_style, const double splits[], hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2; break; case FILL_OUTWARD: - j = (int)(cur_size[0]-i)+1; - hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2; + k = (cur_size[0] - i) + 1; + hs_start[0] = k % 2 ? (k / 2) : (hsize_t)((hssize_t)cur_size[0] - (hssize_t)(k / 2)); break; case FILL_RANDOM: for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0]) /*void*/; - hs_start[0] = j; + hs_start[0] = (hsize_t)j; had[j] = 1; break; case FILL_ALL: @@ -265,14 +265,9 @@ test(fill_t fill_style, const double splits[], if (verbose) { if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; if (HDfstat(fd, &sb) < 0) goto error; - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ printf("%4lu %8.3f ***\n", (unsigned long)i, - (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i); + (double)(sb.st_size - (HDoff_t)(i * sizeof(int))) / (double)i); } } @@ -316,8 +311,8 @@ test(fill_t fill_style, const double splits[], if (HDfstat(fd, &sb) < 0) goto error; printf("%-7s %8.3f\n", sname, - (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/ - (hssize_t)cur_size[0]); + (double)(sb.st_size - (HDoff_t)(cur_size[0] * sizeof(int))) / + (double)cur_size[0]); } HDclose(fd); diff --git a/tools/perform/sio_engine.c b/tools/perform/sio_engine.c index 11d8f65..abf1fa6 100644 --- a/tools/perform/sio_engine.c +++ b/tools/perform/sio_engine.c @@ -96,7 +96,7 @@ static herr_t do_fclose(iotype iot, file_descr *fd); static void do_cleanupfile(iotype iot, char *fname); /* global variables */ -static off_t offset[MAX_DIMS]; /* dataset size in bytes */ +static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */ static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */ static int order[MAX_DIMS]; /* dimension access order */ static size_t linear_buf_size; /* linear buffer size */ @@ -406,7 +406,8 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) { int ret_code = SUCCESS; char dname[64]; - long i; + int i; + size_t u; /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ @@ -416,20 +417,20 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) hsize_t h5start[MAX_DIMS]; /*selection start */ hsize_t h5maxdims[MAX_DIMS]; int rank; /*rank of dataset */ - /* Prepare buffer for verifying data */ + + /* Prepare buffer for verifying data */ /* if (parms->verify) memset(buffer,1,linear_buf_size); */ buf_p=(unsigned char *)buffer; - for (i=0; i < linear_buf_size; i++) - buf_p[i]=i%128; + for(u = 0; u < linear_buf_size; u++) + buf_p[u] = u % 128; rank = parms->rank; - for (i=0; iio_type) { @@ -616,20 +617,22 @@ done: * Programmer: Christian Chilan, April, 2008 * Modifications: */ - -static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) +static herr_t +dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) { int cur_dim = order[local_dim]-1; int ret_code = SUCCESS; int k; hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; - long i,j; + hsize_t i; + int j; herr_t hrc; /* iterates according to the dimensions in order array */ for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){ - h5offset[cur_dim] = offset[cur_dim] = i; + h5offset[cur_dim] = (hssize_t)i; + offset[cur_dim] = (HDoff_t)i; if (local_dim > 0){ @@ -641,17 +644,15 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void case POSIXIO: /* initialize POSIX offset in the buffer */ - for (j=0; j < parms->rank; j++) { - buf_offset[j]=0; - } + for(j = 0; j < parms->rank; j++) + buf_offset[j] = 0; buf_p = (unsigned char *)buffer; /* write POSIX buffer */ posix_buffer_write(0, fd, parms, buffer); break; case HDF5: - /* if dimensions are extendable, extend them as needed during - access */ + /* if dimensions are extendable, extend them as needed during access */ if (parms->h5_use_chunks && parms->h5_extendable) { hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims); @@ -659,7 +660,8 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void for (k=0; k < parms->rank; k++){ - if (dims[k] <= h5offset[k]) { + HDassert(h5offset[k] >= 0); + if (dims[k] <= (hsize_t)h5offset[k]) { dims[k] = dims[k]+h5count[k]; hrc=H5Sset_extent_simple(h5dset_space_id,parms->rank,dims,maxdims); VRFY((hrc >= 0), "H5Sset_extent_simple"); @@ -700,20 +702,17 @@ done: * Modifications: */ -static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) +static herr_t +posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) { - int dtype_size = 1; int ret_code = SUCCESS; - long i; - size_t d_offset; - size_t linear_dset_offset = 0; - int j, rc; /* if dimension is not contiguous, call recursively */ if (local_dim < parms->rank-1 && local_dim != cont_dim) { + size_t u; - for (i=0; i < parms->buf_size[local_dim]; i += dtype_size) { - buf_offset[local_dim] = i; + for(u = 0; u < parms->buf_size[local_dim]; u ++) { + buf_offset[local_dim] = u; posix_buffer_write(local_dim+1, fd, parms, buffer); /* if next dimension is cont_dim, it will fill out the buffer @@ -724,17 +723,20 @@ static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parm } /* otherwise, perform contiguous POSIX access */ } else { + HDoff_t d_offset; + HDoff_t linear_dset_offset = 0; + int i, j, rc; buf_offset[local_dim] = 0; /* determine offset in the buffer */ - for (i=0; i < parms->rank; i++){ - d_offset=1; + for(i = 0; i < parms->rank; i++) { + d_offset = 1; - for (j=i+1; j < parms->rank; j++) - d_offset *= parms->dset_size[j]; + for(j = i + 1; j < parms->rank; j++) + d_offset *= (HDoff_t)parms->dset_size[j]; - linear_dset_offset += (offset[i]+buf_offset[i])*d_offset; + linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; } /* only care if seek returns error */ @@ -749,6 +751,7 @@ static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parm buf_p += cont_size; } + done: return ret_code; } @@ -766,7 +769,8 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) char *buffer2 = NULL; /* Buffer for data verification */ int ret_code = SUCCESS; char dname[64]; - long i; + int i; + size_t u; /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ @@ -782,8 +786,8 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end if */ /* Prepare buffer for verifying data */ - for(i = 0; i < linear_buf_size; i++) - buffer2[i] = i % 128; + for(u = 0; u < linear_buf_size; u++) + buffer2[u] = (char)(u % 128); rank = parms->rank; for(i = 0; i < rank; i++) @@ -937,18 +941,21 @@ done: * Modifications: */ -static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, - void *buffer, const char *buffer2) +static herr_t +dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, + const char *buffer2) { int cur_dim = order[local_dim]-1; - int ret_code = SUCCESS; - long i,j; + hsize_t i; + int j; herr_t hrc; + int ret_code = SUCCESS; /* iterate on the current dimension */ for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){ - h5offset[cur_dim] = offset[cur_dim] = i; + h5offset[cur_dim] = (hssize_t)i; + offset[cur_dim] = (HDoff_t)i; /* if traverse in order array is incomplete, recurse */ if (local_dim > 0){ @@ -975,13 +982,6 @@ static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); VRFY((hrc >= 0), "H5Dread"); -#if 0 - for (j=0; jrank-1 && local_dim != cont_dim) { + size_t u; - for (i=0; i < parms->buf_size[local_dim]; i += dtype_size) { - buf_offset[local_dim] = i; + for(u = 0; u < parms->buf_size[local_dim]; u++) { + buf_offset[local_dim] = u; ret_code = posix_buffer_read(local_dim+1, fd, parms, buffer); if (local_dim+1==cont_dim) break; } /* otherwise, perform contiguous POSIX access */ } else { + HDoff_t d_offset; + HDoff_t linear_dset_offset = 0; + int i, j, rc; buf_offset[local_dim] = 0; /* determine offset in buffer */ @@ -1031,9 +1031,9 @@ static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms d_offset=1; for (j=i+1; jrank; j++) - d_offset *= parms->dset_size[j]; + d_offset *= (HDoff_t)parms->dset_size[j]; - linear_dset_offset += (offset[i]+buf_offset[i])*d_offset; + linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; } /* only care if seek returns error */ @@ -1165,7 +1165,7 @@ set_vfd(parameters *param) memb_fapl[mt] = H5P_DEFAULT; sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; - memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10); + memb_addr[mt] = (haddr_t)MAX(mt - 1,0) * (HADDR_MAX / 10); } if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, -- cgit v0.12