diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5diff.c | 10 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 10 | ||||
-rw-r--r-- | tools/src/h5import/h5import.c | 9 | ||||
-rw-r--r-- | tools/test/h5diff/dynlib_diff.c | 5 | ||||
-rw-r--r-- | tools/test/h5dump/dynlib_dump.c | 5 | ||||
-rw-r--r-- | tools/test/h5dump/h5dumpgentest.c | 20 | ||||
-rw-r--r-- | tools/test/h5ls/dynlib_ls.c | 5 | ||||
-rw-r--r-- | tools/test/h5repack/h5repackgentest.c | 4 | ||||
-rw-r--r-- | tools/test/perform/pio_engine.c | 6 | ||||
-rw-r--r-- | tools/test/perform/pio_perf.c | 4 |
10 files changed, 48 insertions, 30 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 82c1a50..4babc7d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -912,8 +912,14 @@ h5diff(const char *fname1, parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { char c1, c2; - c1 = (match_list->objs[u].flags[0]) ? 'x' : ' '; - c2 = (match_list->objs[u].flags[1]) ? 'x' : ' '; + if (match_list->objs[u].flags[0]) + c1 = 'x'; + else + c1 = ' '; + if (match_list->objs[u].flags[1]) + c2 = 'x'; + else + c2 = ' '; parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name); } /* end for */ parallel_print ("\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index c93293b..5bd27d4 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -279,8 +279,14 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t parallel_print(" --------------------------------------\n"); for(i = 0; i < (unsigned int) table_lp->nattrs; i++) { char c1, c2; - c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' '; - c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' '; + if (table_lp->attrs[i].exist[0]) + c1 = 'x'; + else + c1 = ' '; + if (table_lp->attrs[i].exist[1]) + c2 = 'x'; + else + c2 = ' '; parallel_print("%5c %6c %-15s\n", c1, c2, table_lp->attrs[i].name); } /* end for */ } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 1eef5ab..c176e33 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4707,14 +4707,17 @@ static int process(struct Options *opt) return (0); } -uint16_t swap_uint16( uint16_t val) +uint16_t swap_uint16(uint16_t val) { - return (val << 8) | (val >> 8); + return (uint16_t)(((val & 0xff) << 8) | ((val & 0xff00) >> 8)); } int16_t swap_int16(int16_t val) { - return (val << 8) | ((val >> 8) & 0xFF); + int16_t ret; + + H5_CHECKED_ASSIGN(ret, int16_t, ((val & 0xff) << 8) | ((val & 0xff00) >> 8), int); + return ret; } uint32_t swap_uint32(uint32_t val) diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 571452e..ceff5e1 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -16,6 +16,7 @@ #include <stdlib.h> #include <stdio.h> #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +79,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 571452e..ceff5e1 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -16,6 +16,7 @@ #include <stdlib.h> #include <stdio.h> #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +79,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 4ceed73..44255ba 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -2565,7 +2565,7 @@ static void gent_bitfields(void) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -2579,7 +2579,7 @@ static void gent_bitfields(void) (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -9814,7 +9814,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for (i = 0; i < nelmts; i++) { - buf[i] = (uint8_t)0xff ^ (uint8_t)i; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); H5Dclose(dset); @@ -9829,7 +9829,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for (i = 0; i < nelmts; i++) { - buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); @@ -9879,7 +9879,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) - buf[i] = (uint8_t)0xff ^ (uint8_t)i; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); H5Dclose(dset); } @@ -9895,7 +9895,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) - buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); @@ -9918,8 +9918,8 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { - buf5[i].a = (uint8_t)0xff ^ (uint8_t)i; - buf5[i].b = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf5[i].a, uint8_t, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t); buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32); buf5[i].d = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64); } @@ -10488,7 +10488,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -10497,7 +10497,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 571452e..ceff5e1 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -16,6 +16,7 @@ #include <stdlib.h> #include <stdio.h> #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +79,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index aaac285..c2398b6 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -266,7 +266,7 @@ generate_uint8be(hbool_t external) { for (i = 0, n = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++) { for (k = 0; k < dims[2]; k++, n++) { - wdata[n] = n * ((n & 1) ? (-1) : (1)); + H5_CHECKED_ASSIGN(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); } } } @@ -296,7 +296,7 @@ generate_f32le(hbool_t external) { /* Generate values */ for (i = 0, k = 0, n = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++, k++, n++) { - wdata[k] = n * 801.1 * ((k % 5 == 1) ? (-1) : (1)); + wdata[k] = (float)(n * 801.1 * ((k % 5 == 1) ? (-1) : (1))); } } diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 77c04ab..5d8474b 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -208,7 +208,7 @@ do_pio(parameters param) bsize = buf_size; /* Actual buffer size */ } else { - snbytes = (off_t)sqrt(nbytes); /* General dataset size */ + snbytes = (off_t)sqrt((double)nbytes); /* General dataset size */ bsize = buf_size * blk_size; /* Actual buffer size */ } @@ -601,7 +601,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* nbytes is always the number of bytes per dataset (1D or 2D). If the dataspace is 2D, snbytes is the size of a side of the dataset square. */ - snbytes = (off_t)sqrt(nbytes); + snbytes = (off_t)sqrt((double)nbytes); /* Contiguous Pattern: */ if (!parms->interleaved) { @@ -1577,7 +1577,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* nbytes is always the number of bytes per dataset (1D or 2D). If the dataspace is 2D, snbytes is the size of a side of the 'dataset square'. */ - snbytes = (off_t)sqrt(nbytes); + snbytes = (off_t)sqrt((double)nbytes); bsize = buf_size * blk_size; diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 9f4d116..5977731 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -1155,9 +1155,9 @@ report_parameters(struct options *opts) recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(pow(opts->num_bpp * opts->min_num_procs,2) + recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->min_num_procs),2) * opts->num_dsets), ":"); - recover_size_and_print((long long)(pow(opts->num_bpp * opts->max_num_procs,2) + recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->max_num_procs),2) * opts->num_dsets), "\n"); HDfprintf(output, "rank %d: Transfer buffer size=", rank); |