summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2012-05-25 17:39:07 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2012-05-25 17:39:07 (GMT)
commiteb5b8163f93e4694ae834bac6f002f6ef895ffe8 (patch)
treeeb33855fc79c4fd1defd4a48b8f0552cf1589d3f /tools
parentd7bfa3617fefb3d1e0262d8940d687bfa9717667 (diff)
downloadhdf5-eb5b8163f93e4694ae834bac6f002f6ef895ffe8.zip
hdf5-eb5b8163f93e4694ae834bac6f002f6ef895ffe8.tar.gz
hdf5-eb5b8163f93e4694ae834bac6f002f6ef895ffe8.tar.bz2
[svn-r22411] reduce compiler warnings by removing unreferenced variables and adding cast
Tested: local linux
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump_ddl.c7
-rw-r--r--tools/h5dump/h5dump_xml.c3
-rw-r--r--tools/h5jam/h5jam.c4
-rw-r--r--tools/h5ls/h5ls.c16
-rw-r--r--tools/lib/h5tools.c9
-rw-r--r--tools/lib/h5tools_dump.c13
6 files changed, 22 insertions, 30 deletions
diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c
index b8deaf9..22d2a2b 100644
--- a/tools/h5dump/h5dump_ddl.c
+++ b/tools/h5dump/h5dump_ddl.c
@@ -1488,15 +1488,18 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
if(sset) {
unsigned int i;
+ unsigned int ndims;
hid_t sid = H5Dget_space(dsetid);
- int ndims = H5Sget_simple_extent_ndims(sid);
+ int ndims_res = H5Sget_simple_extent_ndims(sid);
H5Sclose(sid);
- if(ndims < 0) {
+ if(ndims_res < 0) {
error_msg("H5Sget_simple_extent_ndims failed\n");
h5tools_setstatus(EXIT_FAILURE);
return;
}
+ else
+ ndims = ndims_res;
if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index 0c48216..1a29659 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -1781,7 +1781,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU
hsize_t nelmts = 1;
int ndims;
int i;
- int depth;
int status = -1;
int stdindent = COL; /* should be 3 */
void *buf = NULL;
@@ -2950,7 +2949,7 @@ xml_print_refs(hid_t did, int source)
string_dataformat.do_escape = display_escape;
outputformat = &string_dataformat;
- for (i = 0; i < ssiz; i++) {
+ for (i = 0; i < (hsize_t)ssiz; i++) {
const char *path = lookup_ref_path(*refbuf);
ctx.indent_level++;
diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c
index 981eead..52eb0aa 100644
--- a/tools/h5jam/h5jam.c
+++ b/tools/h5jam/h5jam.c
@@ -310,7 +310,7 @@ main (int argc, const char *argv[])
leave (EXIT_FAILURE);
}
- fsize = sbuf.st_size;
+ fsize = (off_t)sbuf.st_size;
h5fid = HDopen(input_file, O_RDONLY, 0);
if(h5fid < 0) {
@@ -455,7 +455,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
exit (EXIT_FAILURE);
}
- howmuch = sbuf.st_size;
+ howmuch = (ssize_t)sbuf.st_size;
}
else
howmuch = limit;
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 2171682..0fc0531 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1436,13 +1436,13 @@ dump_dataset_values(hid_t dset)
info = &outputformat;
ctx.indent_level = 2;
- ctx.cur_column = curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
/* Print all the values. */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Data:\n");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0);
ctx.need_prefix = TRUE;
- ctx.cur_column = curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, -1, NULL) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Unable to print data.");
@@ -1619,7 +1619,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
if(H5Aread(attr, p_type, buf) >= 0) {
ctx.need_prefix = TRUE;
ctx.indent_level = 2;
- ctx.cur_column = curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
}
@@ -1672,11 +1672,9 @@ dataset_list1(hid_t dset)
H5S_class_t space_type; /* type of dataspace */
int i;
hsize_t curr_pos = 0; /* total data element position */
- h5tool_link_info_t lnk_info;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1753,7 +1751,6 @@ dataset_list2(hid_t dset, const char UNUSED *name)
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1921,7 +1918,6 @@ datatype_list2(hid_t type, const char UNUSED *name)
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1962,7 +1958,6 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2121,7 +2116,6 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2309,11 +2303,9 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
int retval = 0;
H5O_info_t oi; /* Information for object */
hsize_t curr_pos = 0; /* total data element position */
- h5tool_link_info_t lnk_info;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2820,11 +2812,9 @@ main(int argc, const char *argv[])
/* Check the type of link given */
if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
hsize_t curr_pos = 0; /* total data element position */
- h5tool_link_info_t lnk_info;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- h5tool_format_t outputformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 17639bc..24aa81a 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1051,6 +1051,7 @@ void
init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
{
int i;
+ unsigned j;
HDassert(ctx->ndims);
@@ -1058,8 +1059,8 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
for (i = (ctx->ndims - 2); i >= 0; i--) {
ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1];
}
- for (i = 0; i < ctx->ndims; i++)
- ctx->pos[i] = 0;
+ for (j = 0; j < ctx->ndims; j++)
+ ctx->pos[j] = 0;
}
/*-------------------------------------------------------------------------
@@ -1525,7 +1526,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
if((type_size = H5Tget_size(type_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * numelem)) == NULL)
+ if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer");
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
@@ -1670,7 +1671,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
if((type_size = H5Tget_size(type_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * npoints)) == NULL)
+ if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region");
/* Allocate space for the dimension array */
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 20c1c8f..619a413 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -261,7 +261,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
h5tools_context_t *ctx/*in,out*/, unsigned flags,
hsize_t nelmts, hid_t type, void *_mem)
{
- HERR_INIT(int, SUCCEED)
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
unsigned char *mem = (unsigned char*) _mem;
hsize_t i; /*element counter */
size_t size; /*size of each datum */
@@ -390,7 +390,6 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
h5tools_str_close(&buffer);
}/* else bin */
-CATCH
return ret_value;
}
@@ -430,7 +429,7 @@ h5tools_print_region_data_blocks(hid_t region_id,
hsize_t numelem;
hsize_t numindex;
size_t jndx;
- int indx;
+ unsigned indx;
int type_size;
int ret_value = SUCCEED;
hid_t mem_space = -1;
@@ -466,7 +465,7 @@ h5tools_print_region_data_blocks(hid_t region_id,
if((type_size = H5Tget_size(type_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * numelem)) == NULL)
+ if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer");
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
@@ -781,7 +780,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
hsize_t curr_pos = 0;
hsize_t total_size[H5S_MAX_RANK];
size_t jndx;
- int indx;
+ unsigned indx;
int type_size;
int ret_value = SUCCEED;
unsigned int region_flags; /* buffer extent flags */
@@ -808,7 +807,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
if((type_size = H5Tget_size(type_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * npoints)) == NULL)
+ if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region");
curr_pos = 0;
@@ -1668,7 +1667,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
hid_t type, hid_t space, void *mem)
{
HERR_INIT(herr_t, SUCCEED)
- int i; /*counters */
+ unsigned i; /*counters */
hsize_t nelmts; /*total selected elmts */
ctx->ndims = H5Sget_simple_extent_ndims(space);