From eb5b8163f93e4694ae834bac6f002f6ef895ffe8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 25 May 2012 12:39:07 -0500 Subject: [svn-r22411] reduce compiler warnings by removing unreferenced variables and adding cast Tested: local linux --- CMakeLists.txt | 2 +- examples/h5_attribute.c | 1 - hl/test/test_lite.c | 1 - test/vfd.c | 3 +-- tools/h5dump/h5dump_ddl.c | 7 +++++-- tools/h5dump/h5dump_xml.c | 3 +-- tools/h5jam/h5jam.c | 4 ++-- tools/h5ls/h5ls.c | 16 +++------------- tools/lib/h5tools.c | 9 +++++---- tools/lib/h5tools_dump.c | 13 ++++++------- 10 files changed, 24 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02da1a3..08ad6ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -368,7 +368,7 @@ IF (CMAKE_BUILD_TYPE MATCHES Debug) ADD_DEFINITIONS (-Wall) ENDIF (NOT WIN32) ELSE (CMAKE_BUILD_TYPE MATCHES Debug) - ADD_DEFINITIONS (-UH5_DEBUG_API -DNDEBUG) + ADD_DEFINITIONS (-DNDEBUG) OPTION (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF) IF (HDF5_ENABLE_TRACE) ADD_DEFINITIONS (-DH5_DEBUG_API ) diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 646b395..0ea0153 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -66,7 +66,6 @@ main (void) unsigned i, j; /* Counters */ char string_out[80]; /* Buffer to read string attribute back */ int point_out; /* Buffer to read scalar attribute back */ - int num_attr; /* Number of attributes */ /* * Data initialization. diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index eb00cd7..3fface8 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1816,7 +1816,6 @@ static int test_valid_path(void) herr_t status; FILE *fp = NULL; htri_t path_valid; - char path[10]; const char *data_string_in = "test"; TESTING("H5LTpath_valid"); diff --git a/test/vfd.c b/test/vfd.c index f6e9f06..ca354d9 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1148,11 +1148,10 @@ test_multi_compat(void) { hid_t file=(-1), fapl, fapl2=(-1), dset=(-1), space=(-1); hid_t access_fapl = -1; - char filename[1024], newname[1024], tmp[1024]; + char newname[1024]; char filename_s[1024], newname_s[1024]; char filename_r[1024], newname_r[1024]; int *fhandle2=NULL, *fhandle=NULL; - hsize_t file_size; H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; haddr_t memb_addr[H5FD_MEM_NTYPES]; 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); -- cgit v0.12