diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-12 18:03:33 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-12 18:03:33 (GMT) |
commit | 4cb39b5a8bb41af11d0da78cf94f5af49f2e47a5 (patch) | |
tree | 1932e9551c5805963ec26641c5dfe7f9ee00d1cc | |
parent | 336bb776ea5a63517c11a70333da6102992bc301 (diff) | |
download | hdf5-4cb39b5a8bb41af11d0da78cf94f5af49f2e47a5.zip hdf5-4cb39b5a8bb41af11d0da78cf94f5af49f2e47a5.tar.gz hdf5-4cb39b5a8bb41af11d0da78cf94f5af49f2e47a5.tar.bz2 |
[svn-r5604] Purpose:
Code cleanup
Description:
Clean up some compiler warnings before the code freeze...
Platforms tested:
FreeBSD 4.5 (sleipnir)
-rw-r--r-- | src/H5B.c | 4 | ||||
-rw-r--r-- | src/H5FL.c | 6 | ||||
-rw-r--r-- | src/H5I.c | 2 | ||||
-rw-r--r-- | src/H5Oefl.c | 4 | ||||
-rw-r--r-- | src/H5Sall.c | 4 | ||||
-rw-r--r-- | src/H5T.c | 24 | ||||
-rw-r--r-- | test/h5test.h | 2 |
7 files changed, 25 insertions, 21 deletions
@@ -2088,8 +2088,8 @@ H5B_copy(H5F_t *f, const H5B_t *old_bt) if (NULL==(ret_value->page=H5FL_BLK_ALLOC(page,size,0)) || NULL==(ret_value->native=H5FL_BLK_ALLOC(native_block,total_native_keysize,0)) || - NULL==(ret_value->child=H5FL_ARR_ALLOC(haddr_t,nkeys,0)) || - NULL==(ret_value->key=H5FL_ARR_ALLOC(H5B_key_t,(nkeys+1),0))) { + NULL==(ret_value->child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)nkeys,0)) || + NULL==(ret_value->key=H5FL_ARR_ALLOC(H5B_key_t,(hsize_t)(nkeys+1),0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node"); } @@ -328,7 +328,7 @@ H5FL_reg_alloc(H5FL_reg_head_t *head, unsigned clear) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(new_obj = H5FL_malloc(sizeof(H5FL_reg_node_t)+head->size))) + if (NULL==(new_obj = H5FL_malloc((hsize_t)(sizeof(H5FL_reg_node_t)+head->size)))) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); #ifdef H5FL_DEBUG @@ -599,7 +599,7 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, hsize_t size) *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_create_list(H5FL_blk_node_t **head, hsize_t size) +H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) { H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ H5FL_blk_node_t *ret_value=NULL; @@ -798,7 +798,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) temp=(H5FL_blk_list_t *)((unsigned char *)block-sizeof(H5FL_blk_list_t)); /* check if there is a free list for native blocks of this size */ - if((free_list=H5FL_blk_find_list(&(head->head),temp->size))==NULL) { + if((free_list=H5FL_blk_find_list(&(head->head),(hsize_t)temp->size))==NULL) { /* No free list available, create a new list node and insert it to the queue */ free_list=H5FL_blk_create_list(&(head->head),temp->size); } /* end if */ @@ -415,7 +415,7 @@ H5I_clear_group(H5I_type_t grp, hbool_t force) /* Free the object regardless of reference count */ if (grp_ptr->free_func && (grp_ptr->free_func)(cur->obj_ptr)<0) { if (force) { -#if H5I_DEBUG +#ifdef H5I_DEBUG if (H5DEBUG(I)) { fprintf(H5DEBUG(I), "H5I: free grp=%d obj=0x%08lx " "failure ignored\n", (int)grp, diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 34fb951..f3e3beb 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -422,7 +422,7 @@ H5O_efl_read (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr, #ifndef NDEBUG hsize_t tempto_read; #endif - hsize_t skip; + hsize_t skip=0; haddr_t cur; ssize_t n; herr_t ret_value = FAIL; @@ -520,7 +520,7 @@ H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr, hsize_t tempto_write; #endif /* NDEBUG */ haddr_t cur; - hsize_t skip; + hsize_t skip=0; herr_t ret_value = FAIL; FUNC_ENTER (H5O_efl_write, FAIL); diff --git a/src/H5Sall.c b/src/H5Sall.c index b088f29..adeda4e 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -201,7 +201,7 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, */ H5_CHECK_OVERFLOW(actual_bytes,hsize_t,size_t); if (H5F_seq_read(f, dxpl_id, layout, pline, fill, efl, file_space, - elmt_size, (size_t)actual_bytes, buf_off, buf/*out*/)<0) { + elmt_size, actual_bytes, buf_off, buf/*out*/)<0) { HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error"); } @@ -263,7 +263,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, */ H5_CHECK_OVERFLOW(actual_bytes,hsize_t,size_t); if (H5F_seq_write(f, dxpl_id, layout, pline, fill, efl, file_space, - elmt_size, (size_t)actual_bytes, buf_off, buf/*out*/)<0) { + elmt_size, actual_bytes, buf_off, buf/*out*/)<0) { HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error"); } @@ -6348,7 +6348,7 @@ char * H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size) { int lt, md, rt; /*indices for binary search */ - int cmp; /*comparison result */ + int cmp=0; /*comparison result */ FUNC_ENTER(H5T_enum_nameof, NULL); @@ -6358,14 +6358,16 @@ H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size) assert(name || 0==size); if (name && size>0) *name = '\0'; + /* Sanity check */ + if (dt->u.enumer.nmembs == 0) { + HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, + "datatype has no members"); + } + /* Do a binary search over the values to find the correct one */ H5T_sort_value(dt, NULL); lt = 0; rt = dt->u.enumer.nmembs; - if (rt == 0) { - HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, - "datatype has no members"); - } md = -1; while (lt<rt) { @@ -6423,7 +6425,7 @@ herr_t H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/) { int lt, md, rt; /*indices for binary search */ - int cmp; /*comparison result */ + int cmp=0; /*comparison result */ FUNC_ENTER(H5T_enum_valueof, FAIL); @@ -6432,14 +6434,16 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/) assert(name && *name); assert(value); + /* Sanity check */ + if (dt->u.enumer.nmembs == 0) { + HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, + "datatype has no members"); + } + /* Do a binary search over the names to find the correct one */ H5T_sort_name(dt, NULL); lt = 0; rt = dt->u.enumer.nmembs; - if (rt == 0) { - HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, - "datatype has no members"); - } md = -1; while (lt<rt) { diff --git a/test/h5test.h b/test/h5test.h index 4a37c40..f3ad742 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -73,8 +73,8 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, hid_t h5_fileaccess(void); void h5_no_hwconv(void); void h5_reset(void); -#ifdef H5_HAVE_PARALLEL void h5_show_hostname(void); +#ifdef H5_HAVE_PARALLEL int h5_set_info_object(void); void h5_dump_info_object(MPI_Info info); #endif |