From 5ccfe5a72453299c4995b3faaaab1e35c975fde3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 1 Jul 2004 15:03:10 -0500 Subject: [svn-r8783] Purpose: Code cleanup Description: Clean up almost all warnings from Windows builds. Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest --- c++/test/th5s.cpp | 2 +- src/H5Dio.c | 16 ++++++++-------- src/H5FDstdio.c | 2 +- src/H5HG.c | 2 +- src/H5I.c | 6 +++--- src/H5Pdcpl.c | 2 +- src/H5Shyper.c | 10 +++++----- src/H5Spoint.c | 2 +- src/H5Sprivate.h | 2 +- src/H5Sselect.c | 2 +- src/H5TB.c | 11 ++++++++++- src/H5Zszip.c | 3 ++- test/dsets.c | 7 ++++--- test/h5test.c | 2 +- test/ntypes.c | 2 +- tools/h5dump/h5dump.c | 4 ++-- tools/h5ls/h5ls.c | 2 +- 17 files changed, 44 insertions(+), 33 deletions(-) diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 695da54..f00bb03 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -77,7 +77,7 @@ struct space4_struct { unsigned u; float f; char c2; - } space4_data={'v',987123,-3.14,'g'}; /* Test data for 4th dataspace */ + } space4_data={'v',987123,(float)-3.14,'g'}; /* Test data for 4th dataspace */ /*------------------------------------------------------------------------- * diff --git a/src/H5Dio.c b/src/H5Dio.c index 1e6edf7..2fd4a65 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -1151,7 +1151,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, target_size = max_type_size; /* If the buffer is too large to hold all the elements, make it smaller */ else if(target_size>(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -1202,7 +1202,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_start(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -1444,7 +1444,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_start(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -1724,7 +1724,7 @@ H5D_chunk_read(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_startchunk_points; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start)); - smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); + smine_nelmts = (size_t)MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); /* * Gather the data from disk into the data type conversion @@ -2004,7 +2004,7 @@ H5D_chunk_write(hsize_t nelmts, H5D_t *dataset, target_size = max_type_size; /* If the buffer is too large to hold all the elements, make it smaller */ else if(target_size>(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -2074,7 +2074,7 @@ H5D_chunk_write(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_startchunk_points; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start)); - smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); + smine_nelmts = (size_t)MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); /* * Gather the data from disk into the data type conversion diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 958ae97..c15fe35 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -841,7 +841,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, #ifdef WIN32 tempos = ftell(file->fp); - fseek(file->fp,tempos,SEEK_SET); + fseek(file->fp,(long)tempos,SEEK_SET); #endif /* Update EOF if necessary */ if (file->pos>file->eof) diff --git a/src/H5HG.c b/src/H5HG.c index e8be3d7..8541be9 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -794,7 +794,7 @@ H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size) /* Re-allocate the heap information in memory */ if (NULL==(new_chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, heap->size+need))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "new heap allocation failed"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed"); /* Adjust the size of the heap */ old_size=heap->size; diff --git a/src/H5I.c b/src/H5I.c index 79aa81f..aa342a7 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -959,7 +959,7 @@ H5I_dec_ref(hid_t id) /* Check arguments */ grp = H5I_GROUP(id); if (grp <= H5I_BADID || grp >= H5I_NGROUPS) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number"); grp_ptr = H5I_id_group_list_g[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number"); @@ -1062,7 +1062,7 @@ H5I_inc_ref(hid_t id) /* Check arguments */ grp = H5I_GROUP(id); if (grp <= H5I_BADID || grp >= H5I_NGROUPS) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number"); grp_ptr = H5I_id_group_list_g[grp]; if (!grp_ptr || grp_ptr->count<=0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid group"); @@ -1147,7 +1147,7 @@ H5I_get_ref(hid_t id) /* Check arguments */ grp = H5I_GROUP(id); if (grp <= H5I_BADID || grp >= H5I_NGROUPS) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number"); grp_ptr = H5I_id_group_list_g[grp]; if (!grp_ptr || grp_ptr->count<=0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid group"); diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index e7c1152..62e12e6 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -178,7 +178,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive"); if (dim[i] != (dim[i]&0xffffffff)) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be less than 2^32"); - real_dims[i]=dim[i]; /* Store user's chunk dimensions */ + real_dims[i]=(size_t)dim[i]; /* Store user's chunk dimensions */ } /* end for */ layout = H5D_CHUNKED; diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 269b030..f468db0 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -660,13 +660,13 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) while(temp_dim>=0) { if(temp_dim==fast_dim) { size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ - size_t block_elem; /* Number of elements left in a block */ + hsize_t block_elem; /* Number of elements left in a block */ /* Compute the number of elements left in block */ block_elem=tdiminfo[temp_dim].block-iter_offset[temp_dim]; /* Compute the number of actual elements to advance */ - actual_elem=MIN(nelem,block_elem); + actual_elem=(size_t)MIN(nelem,block_elem); /* Move the iterator over as many elements as possible */ iter_offset[temp_dim]+=actual_elem; @@ -731,13 +731,13 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Increment absolute position */ if(curr_dim==fast_dim) { size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ - size_t span_elem; /* Number of elements left in a span */ + hsize_t span_elem; /* Number of elements left in a span */ /* Compute the number of elements left in block */ span_elem=(curr_span->high-abs_arr[curr_dim])+1; /* Compute the number of actual elements to advance */ - actual_elem=MIN(nelem,span_elem); + actual_elem=(size_t)MIN(nelem,span_elem); /* Move the iterator over as many elements as possible */ abs_arr[curr_dim]+=actual_elem; @@ -1590,7 +1590,7 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection) /* Allocate space for the hyperslab selection information */ if((dst->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info"); /* Set temporary pointers */ dst_hslab=dst->select.sel_info.hslab; diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 2f0989b..d34b8a8 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1329,7 +1329,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, /* Choose the minimum number of bytes to sequence through */ H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t); - start_io_left=io_left=MIN(iter->elmt_left,maxelem); + start_io_left=io_left=(size_t)MIN(iter->elmt_left,maxelem); /* Get the dataspace dimensions */ if ((ndims=H5S_get_simple_extent_dims (space, dims, NULL))<0) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 634b5df..659489e 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -267,7 +267,7 @@ H5_DLL herr_t H5S_select_release(H5S_t *ds); H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL herr_t H5S_select_serial_size(const H5S_t *space); +H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space); H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t *buf); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index bdd9c37..1dacbf5 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -234,7 +234,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +hssize_t H5S_select_serial_size(const H5S_t *space) { hssize_t ret_value; /* Return value */ diff --git a/src/H5TB.c b/src/H5TB.c index b74f9df..92caf0a 100644 --- a/src/H5TB.c +++ b/src/H5TB.c @@ -204,12 +204,21 @@ H5TB_int_cmp(const void *k1, const void *k2, int UNUSED cmparg) static int H5TB_hsize_cmp(const void *k1, const void *k2, int UNUSED cmparg) { + int ret_value; + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5TB_hsize_cmp); assert(k1); assert(k2); - FUNC_LEAVE_NOAPI(*(const hsize_t *)k1 - *(const hsize_t *)k2); + if(*(const hsize_t *)k1 < *(const hsize_t *)k2) + ret_value=-1; + else if(*(const hsize_t *)k1 > *(const hsize_t *)k2) + ret_value=1; + else + ret_value=0; + + FUNC_LEAVE_NOAPI(ret_value); } /* end H5TB_hsize_cmp() */ diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 7df0be2..449d832 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -184,7 +184,8 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Set "local" parameter for this dataset's "pixels-per-scanline" */ /* (Use the chunk's fastest changing dimension size) */ - cd_values[H5Z_SZIP_PARM_PPS]=dims[ndims-1]; + assert(ndims>0); + H5_ASSIGN_OVERFLOW(cd_values[H5Z_SZIP_PARM_PPS],dims[ndims-1],hsize_t,unsigned); /* Get datatype's endianness order */ if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR) diff --git a/test/dsets.c b/test/dsets.c index 09587f5..af96dc5 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -801,7 +801,7 @@ test_conv_buffer(hid_t fid) cf->a[j][k][l] = 10*(j+1) + l + k; for (j = 0; j < DIM2; j++) - cf->b[j] = 100.*(j+1) + 0.01*j; + cf->b[j] = (float)(100.*(j+1) + 0.01*j); for (j = 0; j < DIM3; j++) cf->c[j] = 100.*(j+1) + 0.02*j; @@ -3060,9 +3060,10 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - for (i = n = 0; i < DSET_DIM1; i++) + n=0.0; + for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { - points[i][j] = n++; + points[i][j] = (int)n++; points_dbl[i][j] = (double)1.5*n++; } diff --git a/test/h5test.c b/test/h5test.c index d344e0b..7c69e70 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -773,7 +773,7 @@ h5_get_file_size(const char *filename) /* Get the file's statistics */ if (HDstat(filename, &sb)>=0) - return(sb.st_size); + return((off_t)sb.st_size); return(0); } /* end get_file_size() */ diff --git a/test/ntypes.c b/test/ntypes.c index 0e767a7..f4d3337 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -1577,7 +1577,7 @@ test_vl_dtype(hid_t file) tmp=malloc(t2->len*sizeof(unsigned int)); memcpy(tmp, t2->p, t2->len*H5Tget_size(nat_super_type)); - if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, (hsize_t)t2->len, tmp, NULL, H5P_DEFAULT)) + if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) TEST_ERROR; for(k=0; klen; k++) { diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 55f7cef..5f7eabc 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -3647,7 +3647,7 @@ print_enum(hid_t type) /* Convert values to native data type */ if (native > 0) - H5Tconvert(super, native, (hsize_t)nmembs, value, NULL, H5P_DEFAULT); + H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); /* * Sort members by increasing value @@ -5773,7 +5773,7 @@ xml_print_enum(hid_t type) /* Convert values to native data type */ if (native > 0) - H5Tconvert(super, native, (hsize_t)nmembs, value, NULL, H5P_DEFAULT); + H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); /* Sort members by increasing value */ /*not implemented yet */ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 6fdb7ef..8076efd 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -799,7 +799,7 @@ display_enum_type(hid_t type, int ind) } /* Convert values to native data type */ - if (native>0) H5Tconvert(super, native, (hsize_t)nmembs, value, NULL, H5P_DEFAULT); + if (native>0) H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); /* Sort members by increasing value */ /*not implemented yet*/ -- cgit v0.12