From 0a29514b9dd967deb64b53b39e12d6b55177b76c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 17 Apr 2004 23:10:09 -0500 Subject: [svn-r8383] Purpose: Code cleanup Description: Clean up lots of warnings based on those reported from the SGI compilers as well as gcc. Platforms tested: SGI O3900, IRIX64 6.5 (Cheryl's SGI machine) FreeBSD 4.9 (sleipnir) w/ & w/o parallel h5committest --- fortran/src/H5FDmpiof.c | 9 +---- fortran/src/H5Pf.c | 6 +-- fortran/src/H5Rf.c | 2 +- fortran/src/H5Tf.c | 4 +- src/H5Dio.c | 8 ++-- src/H5E.c | 6 +-- src/H5FDfamily.c | 4 +- src/H5FDmpio.c | 2 +- src/H5Pdcpl.c | 4 +- src/H5Smpio.c | 1 - src/H5Tbit.c | 2 +- src/H5Tconv.c | 10 +---- src/H5V.c | 10 ++--- src/H5Vprivate.h | 5 +-- src/H5Zdeflate.c | 2 +- src/H5detect.c | 2 +- test/dsets.c | 34 ++++++++-------- test/dtypes.c | 6 +-- test/error_test.c | 10 ++--- test/hyperslab.c | 10 ++--- test/istore.c | 8 ++-- test/testframe.c | 2 +- test/tfile.c | 1 - test/theap.c | 2 +- test/titerate.c | 6 +-- test/unlink.c | 4 +- testpar/t_mpi.c | 24 +++++------ tools/h5diff/testh5diff.h | 1 - tools/h5diff/testh5diff_attr.c | 2 +- tools/h5diff/testh5diff_dset.c | 20 +--------- tools/h5dump/h5dump.c | 81 ++++++++++++++++++-------------------- tools/h5import/h5import.c | 14 +------ tools/h5ls/h5ls.c | 8 ++-- tools/h5repack/h5repack.h | 2 +- tools/h5repack/h5repack_copy.c | 36 +++++++++-------- tools/h5repack/h5repack_filters.c | 7 ++-- tools/h5repack/h5repack_main.c | 2 +- tools/h5repack/h5repack_opttable.c | 6 +-- tools/h5repack/h5repack_refs.c | 28 ++++++------- tools/h5repack/h5repack_verify.c | 18 ++++----- tools/h5repack/testh5repack_dset.c | 22 ++--------- tools/h5repack/testh5repack_make.c | 25 ++++++------ tools/lib/h5diff.c | 14 +++---- tools/lib/h5diff_array.c | 24 ++++------- tools/lib/h5diff_attr.c | 21 +++++----- tools/lib/h5diff_dset.c | 9 ++--- tools/lib/h5diff_util.c | 2 - tools/lib/h5tools.c | 6 ++- tools/lib/h5tools_filters.c | 1 + tools/lib/h5tools_str.c | 9 ++--- 50 files changed, 230 insertions(+), 312 deletions(-) diff --git a/fortran/src/H5FDmpiof.c b/fortran/src/H5FDmpiof.c index 2992a3b..3189477 100644 --- a/fortran/src/H5FDmpiof.c +++ b/fortran/src/H5FDmpiof.c @@ -112,10 +112,7 @@ nh5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode) herr_t ret; H5FD_mpio_xfer_t c_data_xfer_mode; /* - int CASE; - - CASE = *data_xfer_mode; - switch (CASE) { + switch (*data_xfer_mode) { case H5FD_MPIO_INDEPENDENT_F: c_data_xfer_mode = H5FD_MPIO_INDEPENDENT; @@ -157,7 +154,6 @@ nh5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode) hid_t c_prp_id; herr_t ret; H5FD_mpio_xfer_t c_data_xfer_mode; - int CASE; /* * Call H5Pget_xfer function. @@ -167,8 +163,7 @@ nh5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode) if (ret < 0) return ret_value; *data_xfer_mode = (int_f)c_data_xfer_mode; /* - CASE = c_data_xfer_mode; - switch (CASE) { + switch (c_data_xfer_mode) { case H5FD_MPIO_INDEPENDENT: *data_xfer_mode = H5FD_MPIO_INDEPENDENT_F; diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 9503d81..fb175b4 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -1786,7 +1786,7 @@ nh5pset_fclose_degree_c ( hid_t_f *fapl_id , int_f *degree) { int ret_value = -1; hid_t c_fapl_id; - hid_t c_degree; + H5F_close_degree_t c_degree; c_fapl_id = (hid_t)*fapl_id; c_degree = (H5F_close_degree_t)*degree; @@ -1842,7 +1842,7 @@ nh5pget_buffer_c ( hid_t_f *prp_id , hsize_t_f *size) c_prp_id = (hid_t)*prp_id; c_size = H5Pget_buffer(c_prp_id, NULL, NULL); if ( c_size <= 0 ) return ret_value; - *size = (hsize_t)c_size; + *size = (hsize_t_f)c_size; ret_value = 0; return ret_value; } @@ -2627,7 +2627,7 @@ nh5pget_class_name_c(hid_t_f *class, _fcd name, int_f *name_len) if( c_name == NULL) goto DONE; HD5packFstring(c_name, _fcdtocp(name), (int)*name_len); - ret_value = strlen(c_name); + ret_value = (int_f)HDstrlen(c_name); DONE: HDfree(c_name); diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index fb3f185..06cb6e3 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -53,7 +53,7 @@ nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) HDfree(c_name); if (ret_value_c >= 0) { - *ref=ref_c; + *ref=(int_f)ref_c; ret_value = 0; } diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 3beadcd..cc4b279 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -726,7 +726,7 @@ nh5tget_norm_c ( hid_t_f *type_id , int_f *norm) c_norm = H5Tget_norm(c_type_id); if ( c_norm == 0 ) return ret_value; - *norm = (size_t_f)c_norm; + *norm = (int_f)c_norm; ret_value = 0; return ret_value; } @@ -1578,7 +1578,7 @@ nh5tget_tag_c(hid_t_f* type_id, _fcd tag, int_f* taglen) if (c_tag == NULL ) return ret_value; HD5packFstring(c_tag, _fcdtocp(tag), (int)strlen(c_tag)); - *taglen = strlen(c_tag); + *taglen = (int_f)HDstrlen(c_tag); HDfree(c_tag); ret_value = 0; return ret_value; diff --git a/src/H5Dio.c b/src/H5Dio.c index 9840bf0..c2239b1 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -2694,7 +2694,7 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) } /* end for */ /* Calculate the index of this chunk */ - if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->dim,fm->chunks,fm->down_chunks,&chunk_index)<0) + if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->dim,fm->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Iterate through each chunk in the dataset */ @@ -2806,7 +2806,7 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm) } while(coords[curr_dim]>sel_end[curr_dim]); /* Re-Calculate the index of this chunk */ - if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->dim,fm->chunks,fm->down_chunks,&chunk_index)<0) + if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->dim,fm->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ } /* end while */ @@ -3028,7 +3028,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_file_cb) /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->dim,fm->chunks,fm->down_chunks,&chunk_index)<0) + if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->dim,fm->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory TBBTs */ @@ -3140,7 +3140,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_mem_cb) /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->dim,fm->chunks,fm->down_chunks,&chunk_index)<0) + if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->dim,fm->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory TBBTs */ diff --git a/src/H5E.c b/src/H5E.c index 30e1ce9..9678afc 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -110,7 +110,7 @@ static herr_t H5E_set_current_stack(H5E_t *estack); static herr_t H5E_close_stack(H5E_t *err_stack); static int H5E_get_num(const H5E_t *err_stack); static herr_t H5E_pop(H5E_t *err_stack, size_t count); -static herr_t H5E_clear_entries(H5E_t *estack, unsigned nentries); +static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries); static herr_t H5E_print(const H5E_t *estack, FILE *stream); static herr_t H5E_walk (const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void *client_data); @@ -1685,7 +1685,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_clear_entries(H5E_t *estack, unsigned nentries) +H5E_clear_entries(H5E_t *estack, size_t nentries) { H5E_error_t *error; /* Pointer to error stack entry to clear */ unsigned u; /* Local index variable */ @@ -2083,7 +2083,7 @@ H5E_walk (const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, void } else { H5_CHECK_OVERFLOW(estack->nused-1,size_t,int); for (i=(int)(estack->nused-1); i>=0 && status>=0; i--) - status = (func)(estack->nused-(size_t)(i+1), estack->slot+i, client_data); + status = (func)((unsigned)(estack->nused-(size_t)(i+1)), estack->slot+i, client_data); } #endif /* H5_WANT_H5_V1_6_COMPAT */ if(status<0) diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 558b5b9..c902e9b 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -609,7 +609,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, /* Enlarge member array */ if (file->nmembs>=file->amembs) { - size_t n = MAX(64, 2*file->amembs); + int n = MAX(64, 2*file->amembs); H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); if (!x) @@ -866,7 +866,7 @@ H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa) /* Enlarge member array */ if (u>=file->amembs) { - size_t n = MAX(64, 2*file->amembs); + int n = MAX(64, 2*file->amembs); H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); if (!x) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 7d967c9..a27abca 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1484,7 +1484,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Obtain the data transfer properties */ - xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + xfer_mode = (H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); /* * Set up for a fancy xfer using complex types, or single byte block. We diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index a510f85..1ae97b2 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -325,7 +325,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) /* Add to the list */ if (efl.nused >= efl.nalloc) { - int na = efl.nalloc + H5O_EFL_ALLOC; + size_t na = efl.nalloc + H5O_EFL_ALLOC; H5O_efl_entry_t *x = H5MM_realloc (efl.slot, na*sizeof(H5O_efl_entry_t)); if (!x) @@ -388,7 +388,7 @@ H5Pget_external_count(hid_t plist_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list"); /* Set return value */ - ret_value=efl.nused; + ret_value=(int)efl.nused; done: FUNC_LEAVE_API(ret_value); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 7c732b1..cc1adb4 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -573,7 +573,6 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, case H5S_COMPLEX: /* not yet implemented */ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "complex data spaces are not supported yet"); - break; default: assert("unknown data space type" && 0); diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 79bb296..8bcd1a4 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -196,7 +196,7 @@ H5T_bit_shift (uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) if(!shift_dist) goto done; - if(ABS(shift_dist) >= size) { + if((size_t)ABS(shift_dist) >= size) { H5T_bit_set(buf, offset, size, 0); goto done; } diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 0cd615b..83f001c 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8409,7 +8409,6 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, hssize_t sign; /*source sign bit value */ uint8_t *int_buf; /*buffer for temporary value */ size_t buf_size; /*buffer size for temporary value */ - size_t msize; /*mantissa size after restored implied 1 */ size_t i; /*miscellaneous counters */ size_t first; /*first bit(MSB) in an integer */ ssize_t sfirst; /*a signed version of `first' */ @@ -8590,11 +8589,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, * Restore the implicit bit for mantissa if it's implied. * Equivalent to mantissa |= (hsize_t)1<=dst_num_bits) + if((size_t)indx>=dst_num_bits) ret_value=TRUE; done: @@ -4789,7 +4789,6 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) int uflow=0; /*underflow debug counters*/ size_t i, j, k; /*counters */ int endian; /*machine endianess */ - size_t src_ebias; /* Source type's exponent bias */ size_t dst_ebias; /* Destination type's exponent bias */ size_t src_epos; /* Source type's exponent position */ size_t src_esize; /* Source type's exponent size */ @@ -4881,7 +4880,6 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) /* Get "interesting" values */ src_size = H5Tget_size(src); dst_size = H5Tget_size(dst); - src_ebias=H5Tget_ebias(src); dst_ebias=H5Tget_ebias(dst); H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL); H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,NULL,&dst_msize); @@ -5094,7 +5092,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) /* Special check for denormalized values */ if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { int expo_diff=check_expo[0]-check_expo[1]; - int valid_bits=((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; + int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; double epsilon=1.0; /* Re-scale the mantissas based on any exponent difference */ diff --git a/test/error_test.c b/test/error_test.c index 7e45f3d..ebe0b7e 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -186,11 +186,11 @@ test_error(hid_t file) static herr_t init_error(void) { - ssize_t cls_size = strlen(ERR_CLS_NAME)+1; - char *cls_name = malloc(strlen(ERR_CLS_NAME)+1); - ssize_t msg_size = strlen(ERR_MIN_SUBROUTINE_MSG) + 1; - char *msg = malloc(strlen(ERR_MIN_SUBROUTINE_MSG)+1); - H5E_type_t *msg_type= malloc(sizeof(H5E_type_t)); + ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME)+1; + char *cls_name = HDmalloc(strlen(ERR_CLS_NAME)+1); + ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1; + char *msg = HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1); + H5E_type_t *msg_type= HDmalloc(sizeof(H5E_type_t)); if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS))<0) TEST_ERROR; diff --git a/test/hyperslab.c b/test/hyperslab.c index 556d2f0..f28da01 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -1077,7 +1077,7 @@ test_array_fill(size_t lo, size_t hi) /* Setup */ for(u=0; u CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) || diff --git a/test/tfile.c b/test/tfile.c index 6799968..e2ad1f2 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -836,7 +836,6 @@ test_get_file_id(void) hid_t plist; hsize_t dims[F2_RANK]; herr_t ret; - int numb; /* Create a file */ fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/theap.c b/test/theap.c index 86e0893..8e5105a 100644 --- a/test/theap.c +++ b/test/theap.c @@ -95,7 +95,7 @@ test_heap_init(void) HDsrandom((unsigned long)curr_time); for(u=0; u MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; + stride = MPIO_TEST_WRITE_SIZE - (int)mpi_off; /* set data to some trivial pattern for easy verification */ for (i=0; i MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; + stride = MPIO_TEST_WRITE_SIZE - (int)mpi_off; mrc = MPI_File_read_at(fh, mpi_off, buf, stride, MPI_BYTE, &mpi_stat); VRFY((mrc==MPI_SUCCESS), ""); vrfyerrs=0; for (i=0; i 0) - nerrors = temp; + nerr= temp; } mpi_err = MPI_Barrier(MPI_COMM_WORLD); - return nerrors; + return nerr; } diff --git a/tools/h5diff/testh5diff.h b/tools/h5diff/testh5diff.h index 5d9a651..13c02ea 100644 --- a/tools/h5diff/testh5diff.h +++ b/tools/h5diff/testh5diff.h @@ -14,7 +14,6 @@ #include #include -#include #include "hdf5.h" #include "H5private.h" diff --git a/tools/h5diff/testh5diff_attr.c b/tools/h5diff/testh5diff_attr.c index 5124792..fb6dc39 100644 --- a/tools/h5diff/testh5diff_attr.c +++ b/tools/h5diff/testh5diff_attr.c @@ -29,7 +29,7 @@ */ -void write_attr_in(hid_t loc_id, +static void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */) diff --git a/tools/h5diff/testh5diff_dset.c b/tools/h5diff/testh5diff_dset.c index 44b2445..8158c5e 100644 --- a/tools/h5diff/testh5diff_dset.c +++ b/tools/h5diff/testh5diff_dset.c @@ -29,7 +29,7 @@ */ -void write_dset_in(hid_t loc_id, +static void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */) @@ -75,7 +75,6 @@ void write_dset_in(hid_t loc_id, char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ @@ -89,7 +88,6 @@ void write_dset_in(hid_t loc_id, char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ hvl_t buf53[4][3][2]; /* vlen */ int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ @@ -347,13 +345,6 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - for (i=0; i<3; i++) - for (j=0; j<2; j++) - { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; - } - - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(type_id, "RED", (val = 0, &val)); H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); @@ -533,15 +524,6 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) buf453[i][j][k]=RED; else buf453[i][j][k]=GREEN; - } - } - } - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(type_id, "RED", (val = 0, &val)); H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 2b997f1..f39c47a 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -69,7 +69,9 @@ static void dump_oid(hid_t oid); static void print_enum(hid_t type); static herr_t dump_all(hid_t group, const char *name, void *op_data); static char *lookup_ref_path(hobj_ref_t ); +#ifdef LATER static void check_compression(hid_t); +#endif /* LATER */ static ref_path_table_entry_t *ref_path_table_lookup(const char *); static int xml_name_to_XID(const char *, char *, int , int ); static int get_next_xid(void); @@ -1341,8 +1343,8 @@ dump_all(hid_t group, const char *name, void * op_data) strcat(strcat(tmp2, "/"), targbuf); t_tmp = xml_escape_the_name(strcat(strcat(tmp, "/"), name)); - res = xml_name_to_XID(t_tmp,linkxid,100,1); - res = xml_name_to_XID(prefix,parentxid,100,1); + xml_name_to_XID(t_tmp,linkxid,100,1); + xml_name_to_XID(prefix,parentxid,100,1); res = xml_name_to_XID(tmp2,targetxid,100,0); @@ -1451,7 +1453,6 @@ dump_all(hid_t group, const char *name, void * op_data) dump_header_format->datasetblockend); } else { /* the XML version */ - int res; char *t_tmp; char *t_prefix; char *t_name; @@ -1463,8 +1464,8 @@ dump_all(hid_t group, const char *name, void * op_data) t_tmp = xml_escape_the_name(strcat(strcat(tx_tmp, "/"), name)); t_prefix = xml_escape_the_name(prefix); t_name = xml_escape_the_name(name); - res = xml_name_to_XID( strcat(strcat(tmp,"/"),name), dsetxid,100,1); - res = xml_name_to_XID( prefix ,parentxid,100,1); + xml_name_to_XID( strcat(strcat(tmp,"/"),name), dsetxid,100,1); + xml_name_to_XID( prefix ,parentxid,100,1); printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " "H5Path=\"%s\" Parents=\"%s\" " @@ -1475,7 +1476,7 @@ dump_all(hid_t group, const char *name, void * op_data) (strcmp(prefix, "") ? t_prefix : "/")); indentation(indent + COL); - res = xml_name_to_XID(dset_table->objs[i].objname,pointerxid,100,1); + xml_name_to_XID(dset_table->objs[i].objname,pointerxid,100,1); printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", xmlnsprefix, pointerxid,t_tmp); @@ -3684,9 +3685,8 @@ xml_print_datatype(hid_t type, unsigned in_group) /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - int res; char * dtxid = malloc(100); - res = xml_name_to_XID(type_table->objs[ret].objname,dtxid,100,1); + xml_name_to_XID(type_table->objs[ret].objname,dtxid,100,1); if (!type_table->objs[ret].recorded) { /* 'anonymous' NDT. Use it's object num. as it's name. */ @@ -4052,9 +4052,8 @@ xml_dump_datatype(hid_t type) if (i >= 0) { /* Shared data type, must be entered as an object */ /* These 2 cases are the same now, but may change */ - int res; char * dtxid = malloc(100); - res = xml_name_to_XID(type_table->objs[i].objname,dtxid,100,1); + xml_name_to_XID(type_table->objs[i].objname,dtxid,100,1); if (!type_table->objs[i].recorded) { /* anonymous stored data type: following the dumper's current @@ -4398,7 +4397,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data) static void xml_dump_named_datatype(hid_t type, const char *name) { - int res; char *tmp; char * dtxid; char * parentxid; @@ -4417,8 +4415,8 @@ xml_dump_named_datatype(hid_t type, const char *name) /*char **/t_tmp = xml_escape_the_name(tmp); /*char **/t_prefix = xml_escape_the_name(prefix); /*char **/t_name = xml_escape_the_name(name); - res = xml_name_to_XID(tmp,dtxid,100,1); - res = xml_name_to_XID(prefix,parentxid,100,1); + xml_name_to_XID(tmp,dtxid,100,1); + xml_name_to_XID(prefix,parentxid,100,1); if (strncmp(name, "#", 1) == 0) { /* Special: this is an 'anonymous' NDT, deleted but still in use. @@ -4525,20 +4523,19 @@ xml_dump_group(hid_t gid, const char *name) d_status = EXIT_FAILURE; } else if (group_table->objs[i].displayed) { /* already seen: enter a groupptr */ - int res; char *t_name = xml_escape_the_name(name); char *grpxid = malloc(100); char *parentxid = malloc(100); if (isRoot) { /* probably can't happen! */ - res = xml_name_to_XID("/",grpxid,100,1); + xml_name_to_XID("/",grpxid,100,1); printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", xmlnsprefix,grpxid,"/"); } else { t_objname = xml_escape_the_name(group_table->objs[i].objname); par_name = xml_escape_the_name(par); - res = xml_name_to_XID(tmp,grpxid,100,1); - res = xml_name_to_XID(par,parentxid,100,1); + xml_name_to_XID(tmp,grpxid,100,1); + xml_name_to_XID(par,parentxid,100,1); printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\">\n", xmlnsprefix,t_name, grpxid, get_next_xid(), @@ -4553,8 +4550,8 @@ xml_dump_group(hid_t gid, const char *name) ptrstr = malloc(100); t_objname = xml_escape_the_name(group_table->objs[i].objname); par_name = xml_escape_the_name(par); - res = xml_name_to_XID(par,parentxid,100,1); - res = xml_name_to_XID(group_table->objs[i].objname,ptrstr,100,1); + xml_name_to_XID(par,parentxid,100,1); + xml_name_to_XID(group_table->objs[i].objname,ptrstr,100,1); printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", xmlnsprefix, @@ -4565,19 +4562,18 @@ xml_dump_group(hid_t gid, const char *name) } else { /* first time this group has been seen -- describe it */ - int res; char *t_name = xml_escape_the_name(name); char *grpxid = malloc(100); char *parentxid = malloc(100); if (isRoot) { - res = xml_name_to_XID("/",grpxid,100,1); + xml_name_to_XID("/",grpxid,100,1); printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", xmlnsprefix,grpxid,"/"); } else { char *t_tmp = xml_escape_the_name(tmp); par_name = xml_escape_the_name(par); - res = xml_name_to_XID(tmp,grpxid,100,1); - res = xml_name_to_XID(par,parentxid,100,1); + xml_name_to_XID(tmp,grpxid,100,1); + xml_name_to_XID(par,parentxid,100,1); printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); @@ -4622,19 +4618,18 @@ xml_dump_group(hid_t gid, const char *name) } else { /* only link -- must be first time! */ - int res; char *t_name = xml_escape_the_name(name); char *grpxid = malloc(100); char *parentxid = malloc(100); if (isRoot) { - res = xml_name_to_XID("/",grpxid,100,1); + xml_name_to_XID("/",grpxid,100,1); printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", xmlnsprefix,grpxid,"/"); } else { char *t_tmp = xml_escape_the_name(tmp); par_name = xml_escape_the_name(par); - res = xml_name_to_XID(tmp,grpxid,100,1); - res = xml_name_to_XID(par,parentxid,100,1); + xml_name_to_XID(tmp,grpxid,100,1); + xml_name_to_XID(par,parentxid,100,1); printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", xmlnsprefix,t_name, grpxid, t_tmp, @@ -4804,7 +4799,7 @@ xml_print_strs(hid_t did, int source) char *bp; char *onestring=NULL; hsize_t ssiz; - size_t tsiz, str_size; + size_t tsiz, str_size=0; size_t i; htri_t is_vlstr; @@ -4871,9 +4866,9 @@ xml_print_strs(hid_t did, int source) if(is_vlstr) { onestring = *(char **)bp; if(onestring) - str_size = (size_t)strlen(onestring); + str_size = (size_t)HDstrlen(onestring); } else { - strncpy(onestring, bp, tsiz); + HDstrncpy(onestring, bp, tsiz); str_size = tsiz; } indentation(indent + COL); @@ -4907,6 +4902,7 @@ xml_print_strs(hid_t did, int source) * *------------------------------------------------------------------------- */ +#ifdef LATER static void check_compression(hid_t dcpl) { @@ -4937,6 +4933,8 @@ check_compression(hid_t dcpl) } } } +#endif /* LATER */ + /*------------------------------------------------------------------------- * Function: check_filters * @@ -4966,7 +4964,7 @@ check_filters(hid_t dcpl) if (nfilt <= 0) return; for (i = 0; i < nfilt; i++) { - filter = H5Pget_filter(dcpl, i, &flags, + filter = H5Pget_filter(dcpl, (unsigned)i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf); if (filter == H5Z_FILTER_DEFLATE) { @@ -5033,10 +5031,10 @@ check_filters(hid_t dcpl) } } -static void xml_dump_fill_value(hid_t dcpl, hid_t type) +static void xml_dump_fill_value(hid_t type) { -int sz; -int i; +size_t sz; +size_t i; hsize_t space; void * buf; char * path; @@ -5098,6 +5096,7 @@ char * name; printf("\""); for (i = 0; i < sz; i++) { printf("%x ",*(unsigned int *)buf); + buf = (char *)buf + sizeof(unsigned int); } printf("\"\n"); indentation(indent); @@ -5168,7 +5167,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) { hid_t type, space; hid_t dcpl; - herr_t err; H5D_fill_value_t fvstatus; int maxdims; hsize_t *chsize; @@ -5176,7 +5174,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) int i; H5D_alloc_time_t at; H5D_fill_time_t ft; - int res; hsize_t tempi; char *tmp; char *t_name, *t_tmp, *t_prefix; @@ -5193,8 +5190,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) t_tmp = xml_escape_the_name(tmp); t_prefix = xml_escape_the_name(prefix); - res = xml_name_to_XID(tmp, rstr, 100, 1); - res = xml_name_to_XID(prefix, pstr, 100, 1); + xml_name_to_XID(tmp, rstr, 100, 1); + xml_name_to_XID(prefix, pstr, 100, 1); printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",xmlnsprefix, t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/"); @@ -5279,7 +5276,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) indent += COL; indentation(indent); printf("<%sFillValueInfo ",xmlnsprefix); - err = H5Pget_fill_time(dcpl, &ft); + H5Pget_fill_time(dcpl, &ft); printf("FillTime=\""); switch ( ft ) { case H5D_FILL_TIME_ALLOC: @@ -5296,7 +5293,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) break; } printf("\" "); - err = H5Pget_alloc_time(dcpl, &at); + H5Pget_alloc_time(dcpl, &at); printf("AllocationTime=\""); switch ( at ) { case H5D_ALLOC_TIME_EARLY: @@ -5320,13 +5317,13 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) indentation(indent); printf("<%sFillValue>\n",xmlnsprefix); indent += COL; - err = H5Pfill_value_defined(dcpl, &fvstatus); + H5Pfill_value_defined(dcpl, &fvstatus); if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus==H5D_FILL_VALUE_DEFAULT && ft==H5D_FILL_TIME_IFSET)) { indentation(indent + COL); printf("<%sNoFill/>\n",xmlnsprefix); } else { - xml_dump_fill_value(dcpl,type); + xml_dump_fill_value(type); } indent -= COL; diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 8e073fa..ff1622d 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) break; case 14: /* read data size */ - if (getInputSize(in, HDstrtol(argv[i], NULL, BASE_10)) == -1) + if (getInputSize(in, (int)HDstrtol(argv[i], NULL, BASE_10)) == -1) { (void) fprintf(stderr, err8, argv[i]); goto err; @@ -384,7 +384,6 @@ readIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -418,7 +417,6 @@ readIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -451,7 +449,6 @@ readIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -486,7 +483,6 @@ readIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; #endif /* ifndef WIN32 */ @@ -551,7 +547,6 @@ readUIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -584,7 +579,6 @@ readUIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -617,7 +611,6 @@ readUIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -652,7 +645,6 @@ readUIntegerData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; #endif /* ifndef WIN32 */ @@ -716,7 +708,6 @@ readFloatData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -754,7 +745,6 @@ readFloatData(FILE **strm, struct Input *in) default: (void) fprintf(stderr, err2); return (-1); - break; } break; @@ -1796,12 +1786,10 @@ getCompressionParameter(struct Input *in, FILE** strm) } in->compressionParam = ival; return (0); - break; default: (void) fprintf(stderr, err3); return (-1); - break; } } diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 447119e..d3c30ab 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1537,7 +1537,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) /* Print information about external strorage */ if ((nf = H5Pget_external_count(dcpl))>0) { for (i=0, max_len=0; i0) { for (i=0; iverbose) printf("Warning: Filter not applied to <%s>. Dataset smaller than <%d> bytes\n", - name,options->threshold); + name,(int)options->threshold); return 0; } @@ -346,7 +346,7 @@ int check_szip(hid_t type_id, /* dataset datatype */ unsigned *szip_pixels_per_block /*IN,OUT*/, pack_opt_t *options) { - size_t size; /* size of datatype in bytes */ + size_t size=0; /* size of datatype in bytes */ szip_comp_t szip; int i; unsigned ppb=*szip_pixels_per_block; @@ -360,7 +360,6 @@ int check_szip(hid_t type_id, /* dataset datatype */ { default: return 0; - break; case H5T_INTEGER: case H5T_FLOAT: break; @@ -437,7 +436,7 @@ int check_szip(hid_t type_id, /* dataset datatype */ szip.bits_per_pixel = 64; break; default: - printf("Warning: Invalid numeric type of size <%d> for SZIP\n",size); + printf("Warning: Invalid numeric type of size <%u> for SZIP\n",(unsigned)size); return 0; }} diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 8056fcc..cc3f6ea 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -61,7 +61,7 @@ int main(int argc, char **argv) else if (strcmp(argv[i], "-m") == 0) { options.threshold = parse_number(argv[i+1]); - if (options.threshold==-1) { + if ((int)options.threshold==-1) { printf("Error: Invalid treshold size <%s>\n",argv[i+1]); exit(1); } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index fa7fd11..45dfac5 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -41,7 +41,7 @@ void init_packobject(pack_info_t *obj) } obj->chunk.rank = -1; obj->refobj_id = -1; - obj->layout = -1; + obj->layout = H5D_LAYOUT_ERROR; obj->nfilters = 0; @@ -104,7 +104,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) } table->objs[i].chunk.rank = -1; table->objs[i].refobj_id = -1; - table->objs[i].layout = -1; + table->objs[i].layout = H5D_LAYOUT_ERROR; table->objs[i].nfilters = 0; } return 0; @@ -148,7 +148,7 @@ int options_table_init( pack_opttbl_t **tbl ) } table->objs[i].chunk.rank = -1; table->objs[i].refobj_id = -1; - table->objs[i].layout = -1; + table->objs[i].layout = H5D_LAYOUT_ERROR; table->objs[i].nfilters = 0; } diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 5955a08..e824493 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -52,15 +52,15 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* group ID */ - hid_t grp_out; /* group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=-1; /* group ID */ + hid_t grp_out=-1; /* group ID */ + hid_t dset_in=-1; /* read dataset ID */ + hid_t dset_out=-1; /* write dataset ID */ + hid_t type_in=-1; /* named type ID */ + hid_t dcpl_id=-1; /* dataset creation property list ID */ + hid_t space_id=-1; /* space ID */ + hid_t ftype_id=-1; /* file data type ID */ + hid_t mtype_id=-1; /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ @@ -458,11 +458,11 @@ static int copy_refs_attr(hid_t loc_in, hid_t fidout /* for saving references */ ) { - hid_t attr_id; /* attr ID */ - hid_t attr_out; /* attr ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t attr_id=-1; /* attr ID */ + hid_t attr_out=-1; /* attr ID */ + hid_t space_id=-1; /* space ID */ + hid_t ftype_id=-1; /* file data type ID */ + hid_t mtype_id=-1; /* memory data type ID */ size_t msize; /* memory size of type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index e1c01eb..4f69d5f 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -157,9 +157,9 @@ int h5repack_verify(const char *fname, pack_opt_t *options) { hid_t fid; /* file ID */ - hid_t dset_id; /* dataset ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ + hid_t dset_id=-1; /* dataset ID */ + hid_t dcpl_id=-1; /* dataset creation property list ID */ + hid_t space_id=-1; /* space ID */ int ret=1, i, j; trav_table_t *travt=NULL; @@ -343,12 +343,12 @@ error: int h5repack_cmpdcpl(const char *fname1, const char *fname2) { - hid_t fid1; /* file ID */ - hid_t fid2; /* file ID */ - hid_t dset1; /* dataset ID */ - hid_t dset2; /* dataset ID */ - hid_t dcpl1; /* dataset creation property list ID */ - hid_t dcpl2; /* dataset creation property list ID */ + hid_t fid1=-1; /* file ID */ + hid_t fid2=-1; /* file ID */ + hid_t dset1=-1; /* dataset ID */ + hid_t dset2=-1; /* dataset ID */ + hid_t dcpl1=-1; /* dataset creation property list ID */ + hid_t dcpl2=-1; /* dataset creation property list ID */ trav_table_t *travt1=NULL; trav_table_t *travt2=NULL; int ret=1, i; diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 74ca97e..57a5b27 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -17,7 +17,9 @@ #include "h5repack.h" static void make_dset_reg_ref(hid_t loc_id); +#ifdef LATER static void read_dset_reg_ref(hid_t loc_id); +#endif /* LATER */ @@ -80,7 +82,6 @@ void write_dset_in(hid_t loc_id, char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ @@ -94,7 +95,6 @@ void write_dset_in(hid_t loc_id, char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ hvl_t buf53[4][3][2]; /* vlen */ int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ @@ -360,13 +360,6 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - for (i=0; i<3; i++) - for (j=0; j<2; j++) - { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; - } - - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(type_id, "RED", (val = 0, &val)); H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); @@ -546,15 +539,6 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) buf453[i][j][k]=RED; else buf453[i][j][k]=GREEN; - } - } - } - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(type_id, "RED", (val = 0, &val)); H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); @@ -741,6 +725,7 @@ static void make_dset_reg_ref(hid_t loc_id) *------------------------------------------------------------------------- */ +#ifdef LATER static void read_dset_reg_ref(hid_t loc_id) { hid_t dset1; /* Dataset ID */ @@ -838,3 +823,4 @@ static void read_dset_reg_ref(hid_t loc_id) free(rbuf); free(drbuf); } +#endif /* LATER */ diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index 3b8cb5c..c69abd9 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -20,7 +20,7 @@ int make_all_objects(hid_t loc_id); int make_attributes(hid_t loc_id); int make_special_objects(hid_t loc_id); -int make_early(); +int make_early(void); @@ -245,7 +245,6 @@ int make_special_objects(hid_t loc_id) hid_t dset_id; hid_t space_id; hid_t plist_id; - herr_t status; int fillvalue=2; /*------------------------------------------------------------------------- @@ -290,13 +289,13 @@ int make_special_objects(hid_t loc_id) */ plist_id = H5Pcreate(H5P_DATASET_CREATE); - status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); + H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); space_id = H5Screate_simple(2,dims,NULL); dset_id = H5Dcreate(loc_id,"dset_fill",H5T_NATIVE_INT,space_id,plist_id); - status = H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); - status = H5Pclose(plist_id); - status = H5Dclose(dset_id); - status = H5Sclose(space_id); + H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); + H5Pclose(plist_id); + H5Dclose(dset_id); + H5Sclose(space_id); return 0; @@ -310,15 +309,15 @@ int make_special_objects(hid_t loc_id) * *------------------------------------------------------------------------- */ -int make_early() +int make_early(void) { hsize_t dims[1] ={3000}; hsize_t cdims[1]={30}; - hid_t fid; - hid_t dset_id; - hid_t sid; - hid_t tid; - hid_t dcpl; + hid_t fid=-1; + hid_t dset_id=-1; + hid_t sid=-1; + hid_t tid=-1; + hid_t dcpl=-1; int i; char name[10]; int iter=100; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 38acf82..9ac321b 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -12,13 +12,9 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - +#include #include "h5diff.h" #include "H5private.h" -#include -#include - - /*------------------------------------------------------------------------- * Function: h5diff @@ -375,10 +371,10 @@ int diff( hid_t file1_id, diff_opt_t *options, H5G_obj_t type ) { - hid_t type1_id; - hid_t type2_id; - hid_t grp1_id; - hid_t grp2_id; + hid_t type1_id=-1; + hid_t type2_id=-1; + hid_t grp1_id=-1; + hid_t grp2_id=-1; int ret; H5G_stat_t sb1; H5G_stat_t sb2; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 90a50cd..838cc3d 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -12,12 +12,9 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - +#include #include "h5diff.h" #include "H5private.h" -#include -#include - static int diff_datum(void *_mem1, void *_mem2, @@ -35,7 +32,6 @@ static int diff_datum(void *_mem1, static int diff_native_uchar(unsigned char *mem1, unsigned char *mem2, - size_t type_size, hsize_t i, int rank, hsize_t *acc, @@ -47,7 +43,6 @@ static int diff_native_uchar(unsigned char *mem1, static int diff_char(unsigned char *mem1, unsigned char *mem2, - size_t type_size, hsize_t i, int rank, hsize_t *acc, @@ -119,7 +114,7 @@ int diff_array( void *_mem1, tmp1, tmp2, m_type, - 0, + (hsize_t)0, rank, acc, pos, @@ -270,8 +265,8 @@ int diff_datum( void *_mem1, nmembs = H5Tget_nmembers(m_type); for (j = 0; j < nmembs; j++) { - offset = H5Tget_member_offset(m_type, j); - memb_type = H5Tget_member_type(m_type, j); + offset = H5Tget_member_offset(m_type, (unsigned)j); + memb_type = H5Tget_member_type(m_type, (unsigned)j); nfound+=diff_datum( mem1+offset, mem2+offset, @@ -305,7 +300,6 @@ int diff_datum( void *_mem1, nfound+=diff_char( mem1 + u, mem2 + u, /* offset */ - type_size, i, /* index position */ rank, acc, @@ -329,7 +323,6 @@ int diff_datum( void *_mem1, nfound+=diff_native_uchar( mem1 + u, mem2 + u, /* offset */ - type_size, i, /* index position */ rank, acc, @@ -352,7 +345,6 @@ int diff_datum( void *_mem1, nfound+=diff_native_uchar( mem1 + u, mem2 + u, /* offset */ - type_size, i, /* index position */ rank, acc, @@ -403,7 +395,6 @@ int diff_datum( void *_mem1, nfound+=diff_native_uchar( mem1 + u, mem2 + u, /* offset */ - type_size, i, /* index position */ rank, acc, @@ -466,7 +457,7 @@ int diff_datum( void *_mem1, /* get the number of sequence elements */ nelmts = ((hvl_t *)mem1)->len; - for (j = 0; j < nelmts; j++) + for (j = 0; j < (int)nelmts; j++) nfound+=diff_datum( ((char *)(((hvl_t *)mem1)->p)) + j * size, ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */ @@ -1526,7 +1517,6 @@ int diff_datum( void *_mem1, static int diff_native_uchar(unsigned char *mem1, unsigned char *mem2, - size_t type_size, hsize_t i, int rank, hsize_t *acc, @@ -1620,7 +1610,6 @@ int diff_native_uchar(unsigned char *mem1, static int diff_char(unsigned char *mem1, unsigned char *mem2, - size_t type_size, hsize_t i, int rank, hsize_t *acc, @@ -1823,4 +1812,5 @@ static int diff_region(hid_t region1_id, hid_t region2_id) } return ret; -} \ No newline at end of file +} + diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index ed051f8..65e16ba 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -14,7 +14,6 @@ #include "h5diff.h" #include "H5private.h" -#include /*------------------------------------------------------------------------- @@ -45,14 +44,14 @@ int diff_attr(hid_t loc1_id, diff_opt_t *options ) { - hid_t attr1_id; /* attr ID */ - hid_t attr2_id; /* attr ID */ - hid_t space1_id; /* space ID */ - hid_t space2_id; /* space ID */ - hid_t ftype1_id; /* file data type ID */ - hid_t ftype2_id; /* file data type ID */ - hid_t mtype1_id; /* memory data type ID */ - hid_t mtype2_id; /* memory data type ID */ + hid_t attr1_id=-1; /* attr ID */ + hid_t attr2_id=-1; /* attr ID */ + hid_t space1_id=-1; /* space ID */ + hid_t space2_id=-1; /* space ID */ + hid_t ftype1_id=-1; /* file data type ID */ + hid_t ftype2_id=-1; /* file data type ID */ + hid_t mtype1_id=-1; /* memory data type ID */ + hid_t mtype2_id=-1; /* memory data type ID */ size_t msize1; /* memory size of memory type */ size_t msize2; /* memory size of memory type */ void *buf1=NULL; /* data buffer */ @@ -87,9 +86,9 @@ int diff_attr(hid_t loc1_id, *------------------------------------------------------------------------- */ /* open attribute */ - if ((attr1_id = H5Aopen_idx(loc1_id, i))<0) + if ((attr1_id = H5Aopen_idx(loc1_id, (unsigned)i))<0) goto error; - if ((attr2_id = H5Aopen_idx(loc2_id, i))<0) + if ((attr2_id = H5Aopen_idx(loc2_id, (unsigned)i))<0) goto error; /* get name */ diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 8cd5b32..55a0f73 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -15,7 +15,6 @@ #include "h5diff.h" #include "H5private.h" #include "h5tools.h" -#include /*------------------------------------------------------------------------- * Function: diff_dataset @@ -39,8 +38,8 @@ int diff_dataset( hid_t file1_id, { hid_t dset1_id =-1; hid_t dset2_id =-1; - hid_t dcpl1_id; - hid_t dcpl2_id; + hid_t dcpl1_id=-1; + hid_t dcpl2_id=-1; int gout=0, nfound=0; @@ -146,11 +145,9 @@ int diff_datasetid( hid_t dset1_id, int nfound=0; /* number of differences found */ const char *name1=NULL; /* relative names */ const char *name2=NULL; - int maxdim_diff=0; /* maximum dimensions are different */ - int dim_diff=0; /* current dimensions are different */ hsize_t storage_size1; hsize_t storage_size2; - int i, gout=0; + int i; /* Get the dataspace handle */ if ( (space1_id = H5Dget_space(dset1_id)) < 0 ) diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 9c1d2d1..7af48c4 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -15,8 +15,6 @@ #include "h5diff.h" #include "H5private.h" -#include - /*------------------------------------------------------------------------- * Function: print_pos diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index b07742b..3a5b68a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -53,7 +53,9 @@ FILE *rawdatastream; /* should initialize to stdout but gcc moans about it /* module-scoped variables */ static int h5tools_init_g; /* if h5tools lib has been initialized */ +#ifdef H5_HAVE_PARALLEL static int h5tools_mpi_init_g; /* if MPI_Init() has been called */ +#endif /* H5_HAVE_PARALLEL */ /* Names of VFDs */ static const char *drivernames[]={ @@ -220,7 +222,7 @@ h5tools_get_fapl(const char *driver, unsigned *drivernum, int argc, const char * /* Initialize the MPI library, if it wasn't already */ if(!h5tools_mpi_init_g) { - MPI_Init(&argc, &argv); + MPI_Init(&argc, (char ***)&argv); h5tools_mpi_init_g=1; } /* end if */ @@ -235,7 +237,7 @@ h5tools_get_fapl(const char *driver, unsigned *drivernum, int argc, const char * /* Initialize the MPI library, if it wasn't already */ if(!h5tools_mpi_init_g) { - MPI_Init(&argc, &argv); + MPI_Init(&argc, (char ***)&argv); h5tools_mpi_init_g=1; } /* end if */ diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index c76c3de..bb69798 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -15,6 +15,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf5.h" +#include "h5tools.h" /*------------------------------------------------------------------------- * print a warning message diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 0ed66b4..5398d76 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -43,7 +43,7 @@ /* Variable length string datatype */ #define STR_INIT_LEN 4096 /*initial length */ -static char *h5tools_escape(char *s, size_t size, int escape_spaces); +static char *h5tools_escape(char *s, size_t size); static hbool_t h5tools_is_zero(const void *_mem, size_t size); /*------------------------------------------------------------------------- @@ -753,7 +753,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, char enum_name[1024]; if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) { - h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name), TRUE)); + h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name))); } else { size_t i; n = H5Tget_size(type); @@ -939,8 +939,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, * Function: h5tools_escape * * Purpose: Changes all "funny" characters in S into standard C escape - * sequences. If ESCAPE_SPACES is non-zero then spaces are - * escaped by prepending a backslash. + * sequences. * * Return: Success: S * @@ -956,7 +955,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, *------------------------------------------------------------------------- */ static char * -h5tools_escape(char *s/*in,out*/, size_t size, int escape_spaces) +h5tools_escape(char *s/*in,out*/, size_t size) { register size_t i; size_t n = strlen(s); -- cgit v0.12