diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-18 04:10:09 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-18 04:10:09 (GMT) |
commit | 0a29514b9dd967deb64b53b39e12d6b55177b76c (patch) | |
tree | a0a2fce3c7a13fcdf1deed6c022a47bfb5a2cbf1 | |
parent | 432f394cbbc6f77861501f91dc2fc5c209f3811f (diff) | |
download | hdf5-0a29514b9dd967deb64b53b39e12d6b55177b76c.zip hdf5-0a29514b9dd967deb64b53b39e12d6b55177b76c.tar.gz hdf5-0a29514b9dd967deb64b53b39e12d6b55177b76c.tar.bz2 |
[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
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 */ @@ -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<<src.u.f.msize. */ - if (H5T_NORM_IMPLIED==src.u.f.norm) { + if (H5T_NORM_IMPLIED==src.u.f.norm) H5T_bit_inc(int_buf, src.u.f.msize, 8*buf_size-src.u.f.msize); - msize = src.u.f.msize + 1; - } else - msize = src.u.f.msize; /* * Shift mantissa part by exponent minus mantissa size(right shift), @@ -8759,7 +8755,6 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, hsize_t sign = 0; /*source sign bit value */ hsize_t is_max_neg = 0; /*source is maximal negative value*/ hsize_t do_round = 0; /*whether there is roundup */ - hsize_t trailing = 0; /*whether there is trailing after 1st roundup bit*/ uint8_t *int_buf; /*buffer for temporary value */ size_t buf_size; /*buffer size for temporary value */ size_t i; /*miscellaneous counters */ @@ -8832,7 +8827,6 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, sign = 0; /*source sign bit value */ is_max_neg = 0; /*source is maximal negative value*/ do_round = 0; /*whether there is roundup */ - trailing = 0; /*whether there is trailing after 1st roundup bit*/ /* * If the source and destination buffers overlap then use a @@ -8912,7 +8906,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, * (create a carry) to help conversion. i.e. a character type number 0x80 * is treated as 0x100. */ - sfirst = src.prec-1; + sfirst = (ssize_t)(src.prec-1); is_max_neg = 0; } @@ -1061,7 +1061,7 @@ done: *------------------------------------------------------------------------- */ hsize_t -H5V_array_offset_pre(unsigned n, const hsize_t *total_size, const hsize_t *acc, const hssize_t *offset) +H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset) { hsize_t skip; /*starting point byte offset */ int i; /*counter */ @@ -1070,7 +1070,6 @@ H5V_array_offset_pre(unsigned n, const hsize_t *total_size, const hsize_t *acc, FUNC_ENTER_NOAPI(H5V_array_offset_pre, (HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */ assert(n <= H5V_HYPER_NDIMS); - assert(total_size); assert(acc); assert(offset); @@ -1125,7 +1124,7 @@ H5V_array_offset(unsigned n, const hsize_t *total_size, const hssize_t *offset) HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes") /* Set return value */ - ret_value=H5V_array_offset_pre(n,total_size,acc_arr,offset); + ret_value=H5V_array_offset_pre(n,acc_arr,offset); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1231,7 +1230,7 @@ done: */ herr_t H5V_chunk_index(unsigned ndims, const hssize_t *coord, const hsize_t *chunk, - const hsize_t *nchunks, const hsize_t *down_nchunks, hsize_t *chunk_idx) + const hsize_t *down_nchunks, hsize_t *chunk_idx) { hssize_t scaled_coord[H5V_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ unsigned u; /* Local index variable */ @@ -1243,7 +1242,6 @@ H5V_chunk_index(unsigned ndims, const hssize_t *coord, const hsize_t *chunk, assert(ndims <= H5V_HYPER_NDIMS); assert(coord); assert(chunk); - assert(nchunks); assert(chunk_idx); /* Compute the scaled coordinates for actual coordinates */ @@ -1253,7 +1251,7 @@ H5V_chunk_index(unsigned ndims, const hssize_t *coord, const hsize_t *chunk, } /* end for */ /* Compute the chunk index */ - *chunk_idx=H5V_array_offset_pre(ndims,nchunks,down_nchunks,scaled_coord); /*lint !e772 scaled_coord will always be initialized */ + *chunk_idx=H5V_array_offset_pre(ndims,down_nchunks,scaled_coord); /*lint !e772 scaled_coord will always be initialized */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 998b12b..1247912 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -75,15 +75,14 @@ H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size, size_t count); H5_DLL herr_t H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down); -H5_DLL hsize_t H5V_array_offset_pre(unsigned n, const hsize_t *total_size, +H5_DLL hsize_t H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset); H5_DLL hsize_t H5V_array_offset(unsigned n, const hsize_t *total_size, const hssize_t *offset); H5_DLL herr_t H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *coords); H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hssize_t *coord, - const hsize_t *chunk, const hsize_t *nchunks, const hsize_t *down_nchunks, - hsize_t *chunk_idx); + const hsize_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx); H5_DLL ssize_t H5V_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], const void *_src, diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index ece24ba..250bd3e 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -51,7 +51,7 @@ const H5Z_class_t H5Z_DEFLATE[1] = {{ H5Z_filter_deflate, /* The actual filter function */ }}; -#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil((double)((s)*1.001))+12) +#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*1.001)+12) /*------------------------------------------------------------------------- diff --git a/src/H5detect.c b/src/H5detect.c index f3a5588..fc6d4a7 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -479,7 +479,7 @@ sigbus_handler(int UNUSED signo) static void print_results(int nd, detected_t *d, int na, malign_t *misc_align) { - int byte_order; + int byte_order=0; int i, j; /* Include files */ diff --git a/test/dsets.c b/test/dsets.c index 7cd26c3..deaba61 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1409,7 +1409,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for (i=0; i<size[0]; i++) { for (j=0; j<size[1]/2; j++) { - points[i][j] = HDrandom (); + points[i][j] = (int)HDrandom (); } } if (H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, points)<0) @@ -1515,7 +1515,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for (i=0; i<hs_size[0]; i++) { for (j=0; j<hs_size[1]; j++) { - points[hs_offset[0]+i][hs_offset[1]+j] = HDrandom(); + points[hs_offset[0]+i][hs_offset[1]+j] = (int)HDrandom(); } } if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, @@ -2135,7 +2135,7 @@ test_onebyte_shuffle(hid_t file) for (i= 0;i< 10; i++) for (j = 0; j < 20; j++) - orig_data[i][j] = HDrandom(); + orig_data[i][j] = (unsigned char)HDrandom(); PASSED(); #else @@ -3096,10 +3096,10 @@ static herr_t test_filter_delete(hid_t file) { H5Z_filter_t filtn; /* filter identification number */ - hid_t dsid; /* dataset ID */ - hid_t sid; /* dataspace ID */ - hid_t dcpl; /* dataset creation property list ID */ - hid_t dcpl1; /* dataset creation property list ID */ + hid_t dsid=-1; /* dataset ID */ + hid_t sid=-1; /* dataspace ID */ + hid_t dcpl=-1; /* dataset creation property list ID */ + hid_t dcpl1=-1; /* dataset creation property list ID */ hsize_t dims[2]={20,20}; /* dataspace dimensions */ hsize_t chunk_dims[2]={10,10}; /* chunk dimensions */ int nfilters; /* number of filters in DCPL */ @@ -3213,11 +3213,11 @@ error: static herr_t auxread_fdata(hid_t fid, const char *name) { - hid_t dset_id; /* dataset 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 dset_id=-1; /* dataset 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 */ void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ @@ -3300,10 +3300,10 @@ error: static herr_t test_filters_endianess(void) { - hid_t fid; /* file ID */ - hid_t dsid; /* dataset ID */ - hid_t sid; /* dataspace ID */ - hid_t dcpl; /* dataset creation property list ID */ + hid_t fid=-1; /* file ID */ + hid_t dsid=-1; /* dataset ID */ + hid_t sid=-1; /* dataspace ID */ + hid_t dcpl=-1; /* dataset creation property list ID */ hsize_t dims[1]={2}; /* dataspace dimensions */ hsize_t chunk_dims[1]={2}; /* chunk dimensions */ int buf[2]; @@ -3446,7 +3446,7 @@ main(void) #endif /* Set the random # seed */ - HDsrandom((unsigned long)time(NULL)); + HDsrandom((unsigned long)HDtime(NULL)); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { diff --git a/test/dtypes.c b/test/dtypes.c index 41c5d19..17fdc33 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -4664,7 +4664,7 @@ overflows(unsigned char *origin_bits, dtype_t src_dtype, size_t src_size_bytes, indx = H5T_bit_find((uint8_t *)&sig, 0, 8*sizeof(hsize_t), H5T_BIT_MSB, 1); - if(indx>=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<ARRAY_FILL_SIZE; u++) - src[u]=u; + src[u]=(char)u; /* Fill */ for(w=lo; w<=hi; w++) { @@ -1147,9 +1147,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) /* Check offsets */ for(u=0; u<n; u++) { /* Get random coordinate */ - coords[0] = HDrandom() % z; - coords[1] = HDrandom() % y; - coords[2] = HDrandom() % x; + coords[0] = (hssize_t)(HDrandom() % z); + coords[1] = (hssize_t)(HDrandom() % y); + coords[2] = (hssize_t)(HDrandom() % x); /* Get offset of coordinate */ off=H5V_array_offset(ARRAY_OFFSET_NDIMS,dims,coords); @@ -1227,7 +1227,7 @@ main(int argc, char *argv[]) printf("\n"); /* Set the random # seed */ - HDsrandom((unsigned long)time(NULL)); + HDsrandom((unsigned long)HDtime(NULL)); /* * Open the library explicitly for thread-safe builds, so per-thread diff --git a/test/istore.c b/test/istore.c index 7de1d90..0830ff4 100644 --- a/test/istore.c +++ b/test/istore.c @@ -492,9 +492,9 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, if((mspace=H5Screate_simple(ndims,size,NULL))<0) TEST_ERROR; for (ctr=0; ctr<nblocks; ctr++) { - offset[0] = HDrandom() % (TEST_SPARSE_SIZE-nx); - offset[1] = HDrandom() % (TEST_SPARSE_SIZE-ny); - offset[2] = HDrandom() % (TEST_SPARSE_SIZE-nz); + offset[0] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx)); + offset[1] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny)); + offset[2] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz)); /* Select region in file dataspace */ if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL)<0) TEST_ERROR; @@ -599,7 +599,7 @@ main(int argc, char *argv[]) printf("\n"); /* Set the random # seed */ - HDsrandom((unsigned long)time(NULL)); + HDsrandom((unsigned long)HDtime(NULL)); /* Reset library */ h5_reset(); diff --git a/test/testframe.c b/test/testframe.c index 3411b95..b00bff0 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -173,7 +173,7 @@ void TestInfo(const char *ProgName) void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp) { int CLLoop; /* Command Line Loop */ - int Loop, Loop1; + int Loop; for (CLLoop = 1; CLLoop < argc; CLLoop++) { if ((argc > 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<NUM_ELEMS; u++) /* Generate random numbers from -1000 to 1000 */ - rand_num[u].val=(HDrandom()%2001)-1001; + rand_num[u].val=(int)(HDrandom()%2001)-1001; /* Sort random numbers into increasing order */ HDmemcpy(inc_sort_num,rand_num,sizeof(test_obj)*NUM_ELEMS); diff --git a/test/titerate.c b/test/titerate.c index 7aaaf5f..5396bc7 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -199,7 +199,7 @@ static void test_iter_group(void) for(i=0; i< (int)num_membs; i++) { H5G_obj_t obj_type; /* Type of object in file */ - ret = H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN); CHECK(ret, FAIL, "H5Gget_objname_by_idx"); obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i); @@ -227,7 +227,7 @@ static void test_iter_group(void) for(i=0; i< (int)num_membs; i++) { H5G_obj_t obj_type; /* Type of object in file */ - ret = H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN); CHECK(ret, FAIL, "H5Gget_objname_by_idx"); obj_type = H5Gget_objtype_by_idx(file, (hsize_t)i); @@ -779,7 +779,7 @@ static void test_grp_memb_funcs(void) name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, NAMELEN); CHECK(name_len, FAIL, "H5Gget_objname_by_idx"); - ret = H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN); CHECK(ret, FAIL, "H5Gget_objname_by_idx"); /* Double-check that the length is the same */ diff --git a/test/unlink.c b/test/unlink.c index f6f95cd..80ccd59 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -747,7 +747,7 @@ test_filespace(void) /* Set buffer to different random numbers each time */ for (v=0, tmp_data=data; v<(FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2); v++) - *tmp_data++ = HDrandom(); + *tmp_data++ = (int)HDrandom(); /* Write the buffer to the dataset */ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data)<0) TEST_ERROR; @@ -1826,7 +1826,7 @@ main(void) double rdcc_w0; /* Set the random # seed */ - HDsrandom((unsigned long)time(NULL)); + HDsrandom((unsigned long)HDtime(NULL)); /* Open */ h5_reset(); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index d2d4ca2..37e0070 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -93,11 +93,11 @@ test_mpio_overlap_writes(char *filename) while (mpi_off < MPIO_TEST_WRITE_SIZE){ /* make sure the write does not exceed the TEST_WRITE_SIZE */ if (mpi_off+stride > 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<stride; i++) - buf[i] = (mpi_off+i) & 0x7f; + buf[i] = (char)(mpi_off+i) & 0x7f; mrc = MPI_File_write_at(fh, mpi_off, buf, stride, MPI_BYTE, &mpi_stat); VRFY((mrc==MPI_SUCCESS), ""); @@ -137,14 +137,14 @@ test_mpio_overlap_writes(char *filename) for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ /* make sure it does not read beyond end of data */ if (mpi_off+stride > 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<stride; i++){ char expected; - expected = (mpi_off+i) & 0x7f; + expected = (char)(mpi_off+i) & 0x7f; if ((buf[i] != expected) && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) printf("proc %d: found data error at [%ld], expect %d, got %d\n", @@ -393,7 +393,7 @@ finish: #define USEFSYNC 2 /* request file_sync */ -test_mpio_1wMr(char *filename, int special_request) +static int test_mpio_1wMr(char *filename, int special_request) { char hostname[128]; int mpi_size, mpi_rank; @@ -404,7 +404,7 @@ test_mpio_1wMr(char *filename, int special_request) unsigned char writedata[DIMSIZE], readdata[DIMSIZE]; unsigned char expect_val; int i, irank; - int nerrors = 0; /* number of errors */ + int nerr= 0; /* number of errors */ int atomicity; MPI_Offset mpi_off; MPI_Status mpi_stat; @@ -489,7 +489,7 @@ if (special_request & USEATOM){ /* Only one process writes */ if (mpi_rank==irank){ if (VERBOSE_HI){ - PRINTID; printf("wrote %d bytes at %d\n", DIMSIZE, mpi_off); + PRINTID; printf("wrote %d bytes at %d\n", DIMSIZE, (int)mpi_off); } if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, MPI_BYTE, &mpi_stat)) @@ -560,7 +560,7 @@ if (special_request & USEFSYNC){ PRINTID; printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, readdata[i], expect_val); - nerrors++; + nerr++; } } @@ -568,18 +568,18 @@ if (special_request & USEFSYNC){ if (VERBOSE_HI){ PRINTID; - printf("%d data errors detected\n", nerrors); + printf("%d data errors detected\n", nerr); } { int temp; - MPI_Reduce(&nerrors, &temp, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); + MPI_Reduce(&nerr, &temp, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); if (mpi_rank == 0 && temp > 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 <stdio.h> #include <stdlib.h> -#include <assert.h> #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; i<nf; i++) { - H5Pget_external(dcpl, i, sizeof(f_name), f_name, NULL, NULL); + H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL); n = display_string(NULL, f_name, TRUE); max_len = MAX(max_len, n); } @@ -1550,7 +1550,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) for (i=0; i<max_len; i++) putchar('-'); putchar('\n'); for (i=0, total=0; i<nf; i++) { - if (H5Pget_external(dcpl, i, sizeof(f_name), f_name, &f_offset, + if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size)<0) { HDfprintf(stdout, " #%03d %10Hu %10s %10s ***ERROR*** %s\n", @@ -1578,7 +1578,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) if ((nf = H5Pget_nfilters(dcpl))>0) { for (i=0; i<nf; i++) { cd_nelmts = NELMTS(cd_values); - filt_id = H5Pget_filter(dcpl, i, &filt_flags, &cd_nelmts, + filt_id = H5Pget_filter(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name); f_name[sizeof(f_name)-1] = '\0'; sprintf(s, "Filter-%d:", i); @@ -2009,7 +2009,7 @@ main (int argc, const char *argv[]) iter_t iter; static char root_name[] = "/"; char drivername[50]; - char *preferred_driver=NULL; + const char *preferred_driver=NULL; /* Initialize h5tools lib */ h5tools_init(); diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 8e7e195..b91d516 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -99,7 +99,7 @@ typedef struct { chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ H5D_layout_t layout_g; /*global layout information for the ALL case */ int verbose; /*verbose mode */ - int threshold; /*minimum size to compress, in bytes */ + hsize_t threshold; /*minimum size to compress, in bytes */ } pack_opt_t; diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index c74f5a4..7763bd2 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -141,23 +141,25 @@ int do_copy_objects(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 type_out; /* 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 type_out=-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 */ void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ hsize_t dsize_in; /* input dataset size before filter */ +#ifdef LATER hsize_t dsize_out; /* output dataset size after filter */ +#endif /* LATER */ int i, j; /*------------------------------------------------------------------------- @@ -308,12 +310,14 @@ int do_copy_objects(hid_t fidin, if (copy_attr(dset_in,dset_out,options)<0) goto error; +#ifdef LATER /*------------------------------------------------------------------------- * store the storage sizes *------------------------------------------------------------------------- */ dsize_out=H5Dget_storage_size(dset_out); +#endif /* LATER */ /*close */ if (H5Dclose(dset_out)<0) @@ -482,13 +486,13 @@ int copy_attr(hid_t loc_in, pack_opt_t *options ) { - 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 */ - void *buf; /* data buffer */ + void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 9aacdd3..c8b9b5d 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -143,7 +143,7 @@ int apply_filters(const char* name, /* object name from traverse list */ { if (options->verbose) 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 <stdlib.h> #include "h5diff.h" #include "H5private.h" -#include <stdlib.h> -#include <assert.h> - - /*------------------------------------------------------------------------- * 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 <math.h> #include "h5diff.h" #include "H5private.h" -#include <assert.h> -#include <math.h> - 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 <assert.h> /*------------------------------------------------------------------------- @@ -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 <assert.h> /*------------------------------------------------------------------------- * 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 <assert.h> - /*------------------------------------------------------------------------- * 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); |