diff options
-rw-r--r-- | src/H5Dlayout.c | 2 | ||||
-rw-r--r-- | src/H5Znbit.c | 29 | ||||
-rw-r--r-- | src/H5Zscaleoffset.c | 6 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 6 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 4 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_ddl.c | 4 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_xml.c | 13 | ||||
-rw-r--r-- | tools/src/h5perf/sio_perf.c | 2 |
10 files changed, 38 insertions, 32 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 6c4fc12..6fdec05 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -213,7 +213,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ ret_value++; /* Dimension sizes */ - ret_value += layout->u.chunk.ndims * layout->u.chunk.enc_bytes_per_dim; + ret_value += layout->u.chunk.ndims * (size_t)layout->u.chunk.enc_bytes_per_dim; /* Type of chunk index */ ret_value++; diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 21363bc..905d417 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -975,7 +975,7 @@ H5Z__filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s /* input; decompress */ if (flags & H5Z_FLAG_REVERSE) { - size_out = d_nelmts * cd_values[4]; /* cd_values[4] stores datatype size */ + size_out = d_nelmts * (size_t)cd_values[4]; /* cd_values[4] stores datatype size */ /* allocate memory space for decompressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) @@ -1170,7 +1170,8 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned n = total_size / p.size; for (i = 0; i < n; i++) - H5Z__nbit_decompress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p); + H5Z__nbit_decompress_one_atomic(data, data_offset + i * (size_t)p.size, buffer, j, buf_len, + &p); break; case H5Z_NBIT_ARRAY: @@ -1178,8 +1179,8 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for (i = 0; i < n; i++) { - if (H5Z__nbit_decompress_one_array(data, data_offset + i * base_size, buffer, j, buf_len, - parms, parms_index) < 0) + if (H5Z__nbit_decompress_one_array(data, data_offset + i * (size_t)base_size, buffer, j, + buf_len, parms, parms_index) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") *parms_index = begin_index; } @@ -1190,8 +1191,8 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for (i = 0; i < n; i++) { - if (H5Z__nbit_decompress_one_compound(data, data_offset + i * base_size, buffer, j, buf_len, - parms, parms_index) < 0) + if (H5Z__nbit_decompress_one_compound(data, data_offset + i * (size_t)base_size, buffer, j, + buf_len, parms, parms_index) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") *parms_index = begin_index; } @@ -1291,7 +1292,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff FUNC_ENTER_STATIC /* may not have to initialize to zeros */ - HDmemset(data, 0, d_nelmts * parms[4]); + HDmemset(data, 0, d_nelmts * (size_t)parms[4]); /* initialization before the loop */ j = 0; @@ -1309,7 +1310,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") for (i = 0; i < d_nelmts; i++) - H5Z__nbit_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, &p); + H5Z__nbit_decompress_one_atomic(data, i * (size_t)p.size, buffer, &j, &buf_len, &p); break; case H5Z_NBIT_ARRAY: @@ -1468,7 +1469,7 @@ H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned c p.offset = parms[(*parms_index)++]; n = total_size / p.size; for (i = 0; i < n; i++) - H5Z__nbit_compress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p); + H5Z__nbit_compress_one_atomic(data, data_offset + i * (size_t)p.size, buffer, j, buf_len, &p); break; case H5Z_NBIT_ARRAY: @@ -1476,8 +1477,8 @@ H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned c n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for (i = 0; i < n; i++) { - H5Z__nbit_compress_one_array(data, data_offset + i * base_size, buffer, j, buf_len, parms, - parms_index); + H5Z__nbit_compress_one_array(data, data_offset + i * (size_t)base_size, buffer, j, buf_len, + parms, parms_index); *parms_index = begin_index; } break; @@ -1487,8 +1488,8 @@ H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned c n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for (i = 0; i < n; i++) { - H5Z__nbit_compress_one_compound(data, data_offset + i * base_size, buffer, j, buf_len, parms, - parms_index); + H5Z__nbit_compress_one_compound(data, data_offset + i * (size_t)base_size, buffer, j, buf_len, + parms, parms_index); *parms_index = begin_index; } break; @@ -1574,7 +1575,7 @@ H5Z__nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer p.offset = parms[7]; for (i = 0; i < d_nelmts; i++) - H5Z__nbit_compress_one_atomic(data, i * p.size, buffer, &new_size, &buf_len, &p); + H5Z__nbit_compress_one_atomic(data, i * (size_t)p.size, buffer, &new_size, &buf_len, &p); break; case H5Z_NBIT_ARRAY: diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 5bdc51c..46c1a10 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1240,7 +1240,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu p.minbits = minbits; /* calculate size of output buffer after decompression */ - size_out = d_nelmts * p.size; + size_out = d_nelmts * (size_t)p.size; /* allocate memory space for decompressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) @@ -1403,7 +1403,7 @@ H5Z__scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size) unsigned char *buffer, temp; buffer = (unsigned char *)buf; - for (i = 0; i < d_nelmts * dtype_size; i += dtype_size) + for (i = 0; i < d_nelmts * (size_t)dtype_size; i += dtype_size) for (j = 0; j < dtype_size / 2; j++) { /* swap pair of bytes */ temp = buffer[i + j]; @@ -1681,7 +1681,7 @@ H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned cha unsigned buf_len; /* must initialize to zeros */ - for (i = 0; i < d_nelmts * p.size; i++) + for (i = 0; i < d_nelmts * (size_t)p.size; i++) data[i] = 0; /* initialization before the loop */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 1b0d36f..e8cfacb 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -2063,7 +2063,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, opts->print_percentage = 0; print_pos(opts, elem_idx, 0); if (print_data(opts)) { - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } nfound++; } @@ -2110,7 +2110,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, opts->print_percentage = 0; print_pos(opts, elem_idx, 0); if (print_data(opts)) { - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } nfound++; } @@ -2157,7 +2157,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, opts->print_percentage = 0; print_pos(opts, elem_idx, 0); if (print_data(opts)) { - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } nfound++; } diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 5c1777a..63b6d8f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -292,7 +292,7 @@ build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t **table_out, } if (opts->mode_verbose_level >= 1) - parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n", + parallel_print("Attributes status: %zu common, %zu only in obj1, %zu only in obj2\n", table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2, table_lp->nattrs_only1, table_lp->nattrs_only2); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index db8df16..da55136 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -945,7 +945,7 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec * as TRUE, we should return failure now since the file couldn't be opened with * the VFL driver/VOL connector that was set on the FAPL by the caller. */ - if (fid < 0 && use_specific_driver) + if (use_specific_driver) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to open file using specified FAPL"); /* diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 0fc5d2d..b8c9a19 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2486,7 +2486,7 @@ found_string_type: ctx->need_prefix = TRUE; h5tools_str_reset(buffer); - h5tools_str_append(buffer, "OPAQUE_SIZE \"%s\";", size); + h5tools_str_append(buffer, "OPAQUE_SIZE \"%zu\";", size); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } @@ -2996,7 +2996,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c ctx->need_prefix = TRUE; h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END); + h5tools_str_append(&buffer, "%s %s %" PRId64 " %s", OBJID, BEGIN, oid, END); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 37bb82d..b0bce0c 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -1318,7 +1318,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a j = (int)HDstrlen(op_name) - 1; /* find the last / */ while (j >= 0) { - if (op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\'))) + if (op_name[j] == '/' && (j == 0 || (op_name[j - 1] != '\\'))) break; j--; } @@ -1541,7 +1541,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5 /* find the last / */ while (j >= 0) { - if (attr[j] == '/' && (j == 0 || (j > 0 && attr[j - 1] != '\\'))) + if (attr[j] == '/' && (j == 0 || (attr[j - 1] != '\\'))) break; j--; } diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 19efd6f..5f64d6c 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -591,6 +591,8 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen if (outlen < 22) return 1; + H5_CHECK_OVERFLOW(outlen, int, size_t); + lookup_ret = ref_path_table_lookup(str, &obj_token); if (lookup_ret < 0) { if (HDstrlen(str) == 0) { @@ -600,7 +602,7 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen ref_path_table_gen_fake(str, &obj_token); H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str); - HDsnprintf(outstr, outlen, "xid_%s", obj_tok_str); + HDsnprintf(outstr, (size_t)outlen, "xid_%s", obj_tok_str); H5free_memory(obj_tok_str); return 0; @@ -615,7 +617,7 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen ref_path_table_gen_fake(str, &obj_token); H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str); - HDsnprintf(outstr, outlen, "xid_%s", obj_tok_str); + HDsnprintf(outstr, (size_t)outlen, "xid_%s", obj_tok_str); H5free_memory(obj_tok_str); return 0; @@ -627,7 +629,7 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen } H5Otoken_to_str(loc_id, &obj_token, &obj_tok_str); - HDsnprintf(outstr, outlen, "xid_%s", obj_tok_str); + HDsnprintf(outstr, (size_t)outlen, "xid_%s", obj_tok_str); H5free_memory(obj_tok_str); return 0; @@ -3598,7 +3600,10 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); for (i = 0; i < sz; i++) { - h5tools_str_append(&buffer, "%x ", *(unsigned int *)buf + (i * sizeof(unsigned int))); + unsigned long val = *(unsigned int *)buf + (i * sizeof(unsigned int)); + + H5_CHECK_OVERFLOW(val, unsigned long, unsigned); + h5tools_str_append(&buffer, "%x ", (unsigned)val); } h5tools_str_append(&buffer, "\""); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index f245b92..87b9d65 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -277,7 +277,7 @@ run_test_loop(struct options *opts) } /* print size information */ - output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes); + output_report("Transfer Buffer Size (bytes): %zu\n", buf_bytes); output_report("File Size(MB): %.2f\n", ((double)parms.num_bytes) / ONE_MB); print_indent(0); |