diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-20 19:05:15 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-20 19:05:15 (GMT) |
commit | c403f235f9b7c8d7abdff3836e76cc5724a5f82f (patch) | |
tree | 55e265e60128496b9cf773196e53c6d9f74c79d9 /src | |
parent | 37ef89af1daf8c7a6c31889a16c0b55c184a815e (diff) | |
download | hdf5-c403f235f9b7c8d7abdff3836e76cc5724a5f82f.zip hdf5-c403f235f9b7c8d7abdff3836e76cc5724a5f82f.tar.gz hdf5-c403f235f9b7c8d7abdff3836e76cc5724a5f82f.tar.bz2 |
[svn-r18596] Description:
Bring r18595 from trunk to 1.8 branch:
Clean up compiler warnings
Tested on:
Mac OS X/32 10.6.3 (amazon) w/debug
(too minor to require h5committest)
Diffstat (limited to 'src')
47 files changed, 596 insertions, 326 deletions
@@ -2442,7 +2442,7 @@ H5A_close(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path") attr->shared = NULL; - (void)H5FL_FREE(H5A_t, attr); + attr = H5FL_FREE(H5A_t, attr); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index 63f7e60..613ea77 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1162,10 +1162,10 @@ H5A_dense_copy_file_cb(const H5A_t *attr_src, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") done: - if (attr_dst) { + if(attr_dst) { (void)H5A_free(attr_dst); - (void)H5FL_FREE(H5A_t, attr_dst); - } + attr_dst = H5FL_FREE(H5A_t, attr_dst); + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_dense_copy_file_cb() */ @@ -1188,9 +1188,9 @@ done: if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") if(native) - (void)H5FL_BLK_FREE(native_block, native); + native = H5FL_BLK_FREE(native_block, native); if(child) - (void)H5FL_SEQ_FREE(haddr_t, child); + child = H5FL_SEQ_FREE(haddr_t, child); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_iterate_helper() */ @@ -1773,13 +1773,13 @@ H5B_shared_free(void *_shared) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_shared_free) /* Free the raw B-tree node buffer */ - (void)H5FL_BLK_FREE(page, shared->page); + shared->page = H5FL_BLK_FREE(page, shared->page); /* Free the B-tree native key offsets buffer */ - (void)H5FL_SEQ_FREE(size_t, shared->nkey); + shared->nkey = H5FL_SEQ_FREE(size_t, shared->nkey); /* Free the shared B-tree info */ - (void)H5FL_FREE(H5B_shared_t, shared); + shared = H5FL_FREE(H5B_shared_t, shared); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B_shared_free() */ @@ -623,7 +623,7 @@ H5Dget_create_plist(hid_t dset_id) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end if */ @@ -631,7 +631,7 @@ H5Dget_create_plist(hid_t dset_id) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ @@ -1039,9 +1039,9 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") } /* end if */ if(vlen_bufsize.fl_tbuf != NULL) - (void)H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); + vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) - (void)H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); + vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); if(vlen_bufsize.xfer_pid > 0) { if(H5I_dec_ref(vlen_bufsize.xfer_pid, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on property list") diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 03a3785..ce7deb5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -893,7 +893,7 @@ H5D_chunk_xfree(void *chk, const H5O_pline_t *pline) if(pline->nused > 0) H5MM_xfree(chk); else - (void)H5FL_BLK_FREE(chunk, chk); + chk = H5FL_BLK_FREE(chunk, chk); } /* end if */ FUNC_LEAVE_NOAPI(NULL) @@ -937,7 +937,7 @@ H5D_free_chunk_info(void *item, void UNUSED *key, void UNUSED *opdata) (void)H5S_close(chunk_info->mspace); /* Free the actual chunk info */ - (void)H5FL_FREE(H5D_chunk_info_t, chunk_info); + chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info); FUNC_LEAVE_NOAPI(0) } /* H5D_free_chunk_info() */ @@ -1369,14 +1369,14 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const /* Create a dataspace for the chunk */ if((fspace = H5S_create_simple(fm->f_ndims,fm->chunk_dim,NULL))==NULL) { - (void)H5FL_FREE(H5D_chunk_info_t,chunk_info); + chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk") } /* end if */ /* De-select the chunk space */ if(H5S_select_none(fspace) < 0) { (void)H5S_close(fspace); - (void)H5FL_FREE(H5D_chunk_info_t,chunk_info); + chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace") } /* end if */ @@ -2506,7 +2506,7 @@ H5D_chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * --rdcc->nused; /* Free */ - (void)H5FL_FREE(H5D_rdcc_ent_t, ent); + ent = H5FL_FREE(H5D_rdcc_ent_t, ent); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3885,7 +3885,7 @@ done: while(tmp_stack) { /* Free the stack node and advance the stack pointer */ tmp_stack = tmp_stack->next; - (void)H5FL_FREE(H5D_chunk_prune_stack_t, fill_stack); + fill_stack = H5FL_FREE(H5D_chunk_prune_stack_t, fill_stack); fill_stack = tmp_stack; } /* end while */ @@ -3894,7 +3894,7 @@ done: while(tmp_stack) { /* Free the stack node and advance the stack pointer */ tmp_stack = tmp_stack->next; - (void)H5FL_FREE(H5D_chunk_prune_stack_t, udata.rm_stack); + udata.rm_stack = H5FL_FREE(H5D_chunk_prune_stack_t, udata.rm_stack); udata.rm_stack = tmp_stack; } /* end while */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index d8bf8b0..2c61a6d 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -555,11 +555,11 @@ done: if(H5I_dec_ref(tid_mem, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") if(buf) - (void)H5FL_BLK_FREE(type_conv, buf); + buf = H5FL_BLK_FREE(type_conv, buf); if(reclaim_buf) - (void)H5FL_BLK_FREE(type_conv, reclaim_buf); + reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf); if(bkg) - (void)H5FL_BLK_FREE(type_conv, bkg); + bkg = H5FL_BLK_FREE(type_conv, bkg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_compact_copy() */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 6c1fae6..ca3b09e 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1463,11 +1463,11 @@ done: if(H5I_dec_ref(tid_mem, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") if(buf) - (void)H5FL_BLK_FREE(type_conv, buf); + buf = H5FL_BLK_FREE(type_conv, buf); if(reclaim_buf) - (void)H5FL_BLK_FREE(type_conv, reclaim_buf); + reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf); if(bkg) - (void)H5FL_BLK_FREE(type_conv, bkg); + bkg = H5FL_BLK_FREE(type_conv, bkg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_copy() */ diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 19d21d5..7180c8c 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -338,13 +338,13 @@ done: if(dst_id != (-1) && H5I_dec_ref(dst_id, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") if(tmp_buf) - (void)H5FL_BLK_FREE(type_conv, tmp_buf); + tmp_buf = H5FL_BLK_FREE(type_conv, tmp_buf); if(elem_wb && H5WB_unwrap(elem_wb) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") if(bkg_elem_wb && H5WB_unwrap(bkg_elem_wb) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5D_fill() */ @@ -642,9 +642,9 @@ H5D_fill_release(H5D_fill_buf_info_t *fb_info) fb_info->fill_free_func(fb_info->fill_buf, fb_info->fill_free_info); else { if(fb_info->fill->buf) - (void)H5FL_BLK_FREE(non_zero_fill, fb_info->fill_buf); + fb_info->fill_buf = H5FL_BLK_FREE(non_zero_fill, fb_info->fill_buf); else - (void)H5FL_BLK_FREE(zero_fill, fb_info->fill_buf); + fb_info->fill_buf = H5FL_BLK_FREE(zero_fill, fb_info->fill_buf); } /* end else */ fb_info->fill_buf = NULL; } /* end if */ @@ -683,7 +683,7 @@ H5D_fill_term(H5D_fill_buf_info_t *fb_info) else if(fb_info->mem_type) H5T_close(fb_info->mem_type); if(fb_info->bkg_buf) - (void)H5FL_BLK_FREE(type_conv, fb_info->bkg_buf); + fb_info->bkg_buf = H5FL_BLK_FREE(type_conv, fb_info->bkg_buf); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Dint.c b/src/H5Dint.c index 72c9079..2718aa6 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -562,7 +562,7 @@ done: if(new_dset != NULL) { if(new_dset->dcpl_id != 0) (void)H5I_dec_ref(new_dset->dcpl_id, FALSE); - (void)H5FL_FREE(H5D_shared_t, new_dset); + new_dset = H5FL_FREE(H5D_shared_t, new_dset); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1073,10 +1073,10 @@ done: } /* end if */ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id, FALSE) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") - (void)H5FL_FREE(H5D_shared_t, new_dset->shared); + new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; - (void)H5FL_FREE(H5D_t, new_dset); + new_dset = H5FL_FREE(H5D_t, new_dset); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1168,12 +1168,12 @@ done: /* Free the location--casting away const*/ if(dataset) { if(shared_fo == NULL) /* Need to free shared fo */ - (void)H5FL_FREE(H5D_shared_t, dataset->shared); + dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); - (void)H5FL_FREE(H5D_t, dataset); + dataset = H5FL_FREE(H5D_t, dataset); } /* end if */ if(shared_fo) shared_fo->fo_count--; @@ -1272,6 +1272,8 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) fill_prop->alloc_time = H5D_ALLOC_TIME_INCR; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet") } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -1396,7 +1398,7 @@ H5D_close(H5D_t *dataset) /* Check for cached single element chunk info */ if(dataset->shared->cache.chunk.single_chunk_info) { - (void)H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); + dataset->shared->cache.chunk.single_chunk_info = H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); dataset->shared->cache.chunk.single_chunk_info = NULL; } /* end if */ @@ -1410,6 +1412,8 @@ H5D_close(H5D_t *dataset) dataset->shared->layout.storage.u.compact.buf = H5MM_xfree(dataset->shared->layout.storage.u.compact.buf); break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HDassert("not implemented yet" && 0); #ifdef NDEBUG @@ -1443,7 +1447,7 @@ H5D_close(H5D_t *dataset) */ dataset->oloc.file = NULL; - (void)H5FL_FREE(H5D_shared_t, dataset->shared); + dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1461,7 +1465,7 @@ H5D_close(H5D_t *dataset) free_failed = TRUE; /* Free the dataset's memory structure */ - (void)H5FL_FREE(H5D_t, dataset); + dataset = H5FL_FREE(H5D_t, dataset); /* Check if anything failed in the middle... */ if(free_failed) @@ -1635,6 +1639,8 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al } /* end if */ break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HDassert("not implemented yet" && 0); #ifdef NDEBUG @@ -1750,6 +1756,8 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[], break; } /* end block */ + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HDassert("not implemented yet" && 0); #ifdef NDEBUG @@ -1806,6 +1814,8 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) ret_value = dset->shared->layout.storage.u.compact.size; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset type") } /*lint !e788 All appropriate cases are covered */ @@ -1852,6 +1862,8 @@ H5D_get_offset(const H5D_t *dset) ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type") } /*lint !e788 All appropriate cases are covered */ @@ -991,7 +991,7 @@ H5E_get_current_stack(void) done: if(ret_value == NULL) if(estack_copy) - (void)H5FL_FREE(H5E_t, estack_copy); + estack_copy = H5FL_FREE(H5E_t, estack_copy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_get_current_stack() */ @@ -1158,7 +1158,7 @@ H5E_close_stack(H5E_t *estack) H5E_clear_stack(estack); /* Free the stack structure */ - (void)H5FL_FREE(H5E_t, estack); + estack = H5FL_FREE(H5E_t, estack); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_stack() */ @@ -663,6 +663,18 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) oloc = NULL; break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") } /* end switch */ @@ -938,8 +950,8 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) done: if(!ret_value && f) { if(!shared) - (void)H5FL_FREE(H5F_file_t, f->shared); - (void)H5FL_FREE(H5F_t, f); + f->shared = H5FL_FREE(H5F_file_t, f->shared); + f = H5FL_FREE(H5F_t, f); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1084,7 +1096,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) if(H5FO_top_dest(f) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") f->shared = NULL; - (void)H5FL_FREE(H5F_t, f); + f = H5FL_FREE(H5F_t, f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_dest() */ @@ -1567,6 +1579,17 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) } break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") } /* end switch */ @@ -1809,6 +1832,7 @@ H5F_try_close(H5F_t *f) /* If we've gotten this far (ie. there are no open file IDs in the file/mount hierarchy), fall through to flush & close */ break; + case H5F_CLOSE_DEFAULT: default: HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, unknown file close degree") } /* end switch */ @@ -1188,7 +1188,7 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) } /* end while */ /* Free the free list node */ - (void)H5FL_FREE(H5FL_blk_node_t, head->head); + head->head = H5FL_FREE(H5FL_blk_node_t, head->head); /* Advance to the next free list */ head->head = (H5FL_blk_node_t *)temp; @@ -2338,14 +2338,14 @@ H5FL_fac_term(H5FL_fac_head_t *factory) HDassert(last->next->list == factory); tmp = last->next->next; - (void)H5FL_FREE(H5FL_fac_gc_node_t, last->next); + last->next = H5FL_FREE(H5FL_fac_gc_node_t, last->next); last->next = tmp; if(tmp) tmp->list->prev_gc = last; } else { HDassert(H5FL_fac_gc_head.first->list == factory); tmp = H5FL_fac_gc_head.first->next; - (void)H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); + H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); H5FL_fac_gc_head.first = tmp; if(tmp) tmp->list->prev_gc = NULL; @@ -2396,7 +2396,7 @@ printf("H5FL_fac_term: head->size=%d, head->allocated=%d\n", (int)H5FL_fac_gc_he H5FL_fac_gc_head.first->list->init = 0; /* Free the node from the garbage collection list */ - (void)H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); + H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); H5FL_fac_gc_head.first = tmp; } /* end while */ @@ -234,7 +234,7 @@ H5FO_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) } /* end if */ /* Release the object information */ - (void)H5FL_FREE(H5FO_open_obj_t, open_obj); + open_obj = H5FL_FREE(H5FO_open_obj_t, open_obj); done: FUNC_LEAVE_NOAPI(ret_value) @@ -506,7 +506,7 @@ H5FO_top_decr(const H5F_t *f, haddr_t addr) HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "can't remove object from container") /* Release the object information */ - (void)H5FL_FREE(H5FO_obj_count_t, obj_count); + obj_count = H5FL_FREE(H5FO_obj_count_t, obj_count); } /* end if */ } /* end if */ else diff --git a/src/H5FSsection.c b/src/H5FSsection.c index d367238..6ec4c69 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -712,7 +712,7 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size tracking node's skip list") /* Release free space list node */ - (void)H5FL_FREE(H5FS_node_t, fspace_node); + fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); /* Decrement total number of section sizes managed */ sinfo->tot_size_count--; @@ -898,8 +898,8 @@ done: } /* end if */ if(grp != NULL) { if(grp->shared != NULL) - (void)H5FL_FREE(H5G_shared_t, grp->shared); - (void)H5FL_FREE(H5G_t,grp); + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); + grp = H5FL_FREE(H5G_t, grp); } /* end if */ } /* end if */ @@ -1020,7 +1020,7 @@ H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) /* Add group to list of open objects in file */ if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, FALSE) < 0) { - (void)H5FL_FREE(H5G_shared_t, grp->shared); + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") } /* end if */ @@ -1057,7 +1057,7 @@ done: if(!ret_value && grp) { H5O_loc_free(&(grp->oloc)); H5G_name_free(&(grp->path)); - (void)H5FL_FREE(H5G_t,grp); + grp = H5FL_FREE(H5G_t, grp); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1109,7 +1109,7 @@ done: if(obj_opened) H5O_close(&(grp->oloc)); if(grp->shared) - (void)H5FL_FREE(H5G_shared_t, grp->shared); + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1151,7 +1151,7 @@ H5G_close(H5G_t *grp) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") - (void)H5FL_FREE(H5G_shared_t, grp->shared); + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { /* Decrement the ref. count for this object in the top file */ if(H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) @@ -1173,11 +1173,11 @@ H5G_close(H5G_t *grp) } /* end else */ if(H5G_name_free(&(grp->path)) < 0) { - (void)H5FL_FREE(H5G_t, grp); + grp = H5FL_FREE(H5G_t, grp); HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't free group entry name") } /* end if */ - (void)H5FL_FREE(H5G_t, grp); + grp = H5FL_FREE(H5G_t, grp); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1208,8 +1208,8 @@ H5G_free(H5G_t *grp) HDassert(grp && grp->shared); - (void)H5FL_FREE(H5G_shared_t, grp->shared); - (void)H5FL_FREE(H5G_t, grp); + grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); + grp = H5FL_FREE(H5G_t, grp); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1562,7 +1562,7 @@ H5G_free_visit_visited(void *item, void UNUSED *key, void UNUSED *operator_data/ { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_free_visit_visited) - (void)H5FL_FREE(H5_obj_t, item); + item = H5FL_FREE(H5_obj_t, item); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_free_visit_visited() */ diff --git a/src/H5Goh.c b/src/H5Goh.c index ea51179..d6e3a55 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -148,7 +148,7 @@ H5O_group_free_copy_file_udata(void *_udata) H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline); /* Release space for 'copy file' user data (ginfo struct) */ - (void)H5FL_FREE(H5G_copy_file_ud_t, udata); + udata = H5FL_FREE(H5G_copy_file_ud_t, udata); FUNC_LEAVE_NOAPI_VOID } /* end H5O_group_free_copy_file_udata() */ diff --git a/src/H5Groot.c b/src/H5Groot.c index 1110b19..7470853 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -123,7 +123,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root) if(NULL == (f->shared->root_grp = H5FL_CALLOC(H5G_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") if(NULL == (f->shared->root_grp->shared = H5FL_CALLOC(H5G_shared_t))) { - (void)H5FL_FREE(H5G_t, f->shared->root_grp); + f->shared->root_grp = H5FL_FREE(H5G_t, f->shared->root_grp); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ @@ -687,7 +687,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) } /* end else */ /* Free the node */ - (void)H5FL_FREE(H5I_id_info_t, cur); + cur = H5FL_FREE(H5I_id_info_t, cur); } /* end if */ else { /* Advance to next node */ @@ -1330,15 +1330,14 @@ H5I_remove(hid_t id) /* If there's room, and we can save IDs of this type, then save the struct (and its ID) for future re-use */ - if ((type_ptr->reuse_ids)&&(type_ptr->free_count < MAX_FREE_ID_STRUCTS)) { + if((type_ptr->reuse_ids)&&(type_ptr->free_count < MAX_FREE_ID_STRUCTS)) { curr_id->next = type_ptr->next_id_ptr; type_ptr->next_id_ptr = curr_id; type_ptr->free_count++; - /* Otherwise, just toss it. */ - } else { - (void)H5FL_FREE(H5I_id_info_t, curr_id); } /* end if */ - + /* Otherwise, just toss it. */ + else + curr_id = H5FL_FREE(H5I_id_info_t, curr_id); } else { /* couldn't find the ID in the proper place */ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID") diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 888ce62..3f011ec 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -459,7 +459,7 @@ H5MF_sect_simple_free(H5FS_section_info_t *_sect) HDassert(sect); /* Release the section */ - (void)H5FL_FREE(H5MF_free_section_t, sect); + sect = H5FL_FREE(H5MF_free_section_t, sect); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5MF_sect_simple_free() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 1d9caaa..158f795 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -159,7 +159,7 @@ H5O_ainfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, done: if(ret_value == NULL && ainfo != NULL) - (void)H5FL_FREE(H5O_ainfo_t, ainfo); + ainfo = H5FL_FREE(H5O_ainfo_t, ainfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ainfo_decode() */ @@ -314,7 +314,7 @@ H5O_ainfo_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_ainfo_t, mesg); + mesg = H5FL_FREE(H5O_ainfo_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_ainfo_free() */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 35f02a8..ce8e4af 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -205,7 +205,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned UNUSED mesg_fl HDmemcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t)); /* Release temporary extent information */ - (void)H5FL_FREE(H5S_extent_t, extent); + extent = H5FL_FREE(H5S_extent_t, extent); /* Default to entire dataspace being selected */ if(H5S_select_all(attr->shared->ds, FALSE) < 0) @@ -810,13 +810,34 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in case H5T_CSET_ASCII: s = "ASCII"; break; + case H5T_CSET_UTF8: s = "UTF-8"; break; - default: + + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: sprintf(buf, "H5T_CSET_RESERVED_%d", (int)(mesg->shared->encoding)); s = buf; break; + + case H5T_CSET_ERROR: + default: + sprintf(buf, "Unknown character set: %d", (int)(mesg->shared->encoding)); + s = buf; + break; } /* end switch */ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 7f9dd47..8ba22cc 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -205,7 +205,7 @@ H5O_cont_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_cont_t, mesg); + mesg = H5FL_FREE(H5O_cont_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_cont_free() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 163e525..08ee56b 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -872,7 +872,7 @@ H5O_copy_free_addrmap_cb(void *item, void UNUSED *key, void UNUSED *op_data) HDassert(item); /* Release the item */ - (void)H5FL_FREE(H5O_addr_map_t, item); + item = H5FL_FREE(H5O_addr_map_t, item); FUNC_LEAVE_NOAPI(0) } /* H5O_copy_free_addrmap_cb() */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index fc71d65..fec695e 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -552,6 +552,8 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p dt->shared->force_conv = TRUE; break; + case H5T_NO_CLASS: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown datatype class found") } /* end switch */ @@ -589,7 +591,7 @@ static herr_t H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) { unsigned flags = 0; - char *hdr = (char *)*pp; + uint8_t *hdr = (uint8_t *)*pp; unsigned i; size_t n, z; herr_t ret_value = SUCCEED; /* Return value */ @@ -612,9 +614,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.order) { case H5T_ORDER_LE: break; /*nothing */ + case H5T_ORDER_BE: flags |= 0x01; break; + + case H5T_ORDER_ERROR: + case H5T_ORDER_VAX: + case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") } /* end switch */ @@ -622,9 +629,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.lsb_pad) { case H5T_PAD_ZERO: break; /*nothing */ + case H5T_PAD_ONE: flags |= 0x02; break; + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -632,9 +644,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.msb_pad) { case H5T_PAD_ZERO: break; /*nothing */ + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: case H5T_PAD_ONE: flags |= 0x04; break; + default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -642,9 +659,13 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.u.i.sign) { case H5T_SGN_NONE: break; /*nothing */ + case H5T_SGN_2: flags |= 0x08; break; + + case H5T_SGN_ERROR: + case H5T_NSGN: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "sign scheme is not supported in file format yet") } /* end switch */ @@ -660,13 +681,18 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.order) { case H5T_ORDER_LE: break; /*nothing*/ + case H5T_ORDER_BE: flags |= 0x01; break; + case H5T_ORDER_VAX: /*turn on 1st and 6th (reserved before adding VAX) bits*/ flags |= 0x41; HDassert(dt->shared->version >= H5O_DTYPE_VERSION_3); break; + + case H5T_ORDER_ERROR: + case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") } /* end switch */ @@ -674,9 +700,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.lsb_pad) { case H5T_PAD_ZERO: break; /*nothing */ + case H5T_PAD_ONE: flags |= 0x02; break; + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -684,9 +715,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.msb_pad) { case H5T_PAD_ZERO: break; /*nothing */ + case H5T_PAD_ONE: flags |= 0x04; break; + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -694,9 +730,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.u.f.pad) { case H5T_PAD_ZERO: break; /*nothing */ + case H5T_PAD_ONE: flags |= 0x08; break; + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -704,12 +745,16 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.u.f.norm) { case H5T_NORM_NONE: break; /*nothing */ + case H5T_NORM_MSBSET: flags |= 0x10; break; + case H5T_NORM_IMPLIED: flags |= 0x20; break; + + case H5T_NORM_ERROR: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "normalization scheme is not supported in file format yet") } /* end switch */ @@ -732,9 +777,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.order) { case H5T_ORDER_LE: break; /*nothing */ + case H5T_ORDER_BE: flags |= 0x01; break; + + case H5T_ORDER_ERROR: + case H5T_ORDER_VAX: + case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") } /* end switch */ @@ -762,9 +812,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.order) { case H5T_ORDER_LE: break; /*nothing */ + case H5T_ORDER_BE: flags |= 0x01; break; + + case H5T_ORDER_ERROR: + case H5T_ORDER_VAX: + case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") } /* end switch */ @@ -772,9 +827,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.lsb_pad) { case H5T_PAD_ZERO: break; /*nothing */ + case H5T_PAD_ONE: flags |= 0x02; break; + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -782,9 +842,14 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) switch (dt->shared->u.atomic.msb_pad) { case H5T_PAD_ZERO: break; /*nothing */ + case H5T_PAD_ONE: flags |= 0x04; break; + + case H5T_PAD_ERROR: + case H5T_PAD_BACKGROUND: + case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bit padding is not supported in file format yet") } /* end switch */ @@ -931,7 +996,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) flags |= (dt->shared->u.vlen.type & 0x0f); if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { flags |= (dt->shared->u.vlen.pad & 0x0f) << 4; - flags |= (dt->shared->u.vlen.cset & 0x0f) << 8; + flags |= ((unsigned)dt->shared->u.vlen.cset & 0x0f) << 8; } /* end if */ /* Encode base type of VL information */ @@ -950,7 +1015,8 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) HDassert(dt->shared->version >= dt->shared->parent->shared->version); /* Encode the number of dimensions */ - *(*pp)++ = dt->shared->u.array.ndims; + HDassert(dt->shared->u.array.ndims <= UCHAR_MAX); + *(*pp)++ = (uint8_t)dt->shared->u.array.ndims; /* Drop this information for Version 3 of the format */ if(dt->shared->version < H5O_DTYPE_VERSION_3) { @@ -976,16 +1042,18 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") break; + case H5T_NO_CLASS: + case H5T_NCLASSES: default: /*nothing */ break; } /* end switch */ /* Encode the type's class, version and bit field */ - *hdr++ = ((unsigned)(dt->shared->type) & 0x0f) | (dt->shared->version << 4); - *hdr++ = (flags >> 0) & 0xff; - *hdr++ = (flags >> 8) & 0xff; - *hdr++ = (flags >> 16) & 0xff; + *hdr++ = (uint8_t)(((unsigned)(dt->shared->type) & 0x0f) | (dt->shared->version << 4)); + *hdr++ = (uint8_t)((flags >> 0) & 0xff); + *hdr++ = (uint8_t)((flags >> 8) & 0xff); + *hdr++ = (uint8_t)((flags >> 16) & 0xff); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1114,7 +1182,7 @@ H5O_dtype_copy(const void *_src, void *_dst) /* Was result already allocated? */ if(_dst) { *((H5T_t *) _dst) = *dst; - (void)H5FL_FREE(H5T_t, dst); + dst = H5FL_FREE(H5T_t, dst); dst = (H5T_t *) _dst; } /* end if */ @@ -1249,6 +1317,10 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) ret_value += H5O_dtype_size(f, dt->shared->parent); break; + case H5T_NO_CLASS: + case H5T_STRING: + case H5T_REFERENCE: + case H5T_NCLASSES: default: /*no properties */ break; @@ -1308,8 +1380,8 @@ H5O_dtype_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared); - (void)H5FL_FREE(H5T_t, mesg); + ((H5T_t *) mesg)->shared = H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared); + mesg = H5FL_FREE(H5T_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_dtype_free() */ @@ -1585,6 +1657,8 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, s = "vlen"; break; + case H5T_NO_CLASS: + case H5T_NCLASSES: default: sprintf(buf, "H5T_CLASS_%d", (int)(dt->shared->type)); s = buf; @@ -1646,13 +1720,34 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_CSET_ASCII: s = "ASCII"; break; + case H5T_CSET_UTF8: s = "UTF-8"; break; - default: + + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: sprintf(buf, "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.cset)); s = buf; break; + + case H5T_CSET_ERROR: + default: + sprintf(buf, "Unknown character set: %d", (int)(dt->shared->u.atomic.u.s.cset)); + s = buf; + break; } /* end switch */ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set:", @@ -1662,16 +1757,37 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_STR_NULLTERM: s = "NULL Terminated"; break; + case H5T_STR_NULLPAD: s = "NULL Padded"; break; + case H5T_STR_SPACEPAD: s = "Space Padded"; break; - default: + + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: sprintf(buf, "H5T_STR_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.pad)); s = buf; break; + + case H5T_STR_ERROR: + default: + sprintf(buf, "Unknown string padding: %d", (int)(dt->shared->u.atomic.u.s.pad)); + s = buf; + break; } /* end switch */ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "String Padding:", @@ -1681,9 +1797,13 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_VLEN_SEQUENCE: s = "sequence"; break; + case H5T_VLEN_STRING: s = "string"; break; + + case H5T_VLEN_BADTYPE: + case H5T_VLEN_MAXTYPE: default: sprintf(buf, "H5T_VLEN_%d", dt->shared->u.vlen.type); s = buf; @@ -1696,9 +1816,13 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_LOC_MEMORY: s = "memory"; break; + case H5T_LOC_DISK: s = "disk"; break; + + case H5T_LOC_BADLOC: + case H5T_LOC_MAXLOC: default: sprintf(buf, "H5T_LOC_%d", (int)dt->shared->u.vlen.loc); s = buf; @@ -1713,13 +1837,34 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_CSET_ASCII: s = "ASCII"; break; + case H5T_CSET_UTF8: s = "UTF-8"; break; - default: + + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: sprintf(buf, "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.vlen.cset)); s = buf; break; + + case H5T_CSET_ERROR: + default: + sprintf(buf, "Unknown character set: %d", (int)(dt->shared->u.vlen.cset)); + s = buf; + break; } /* end switch */ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set:", @@ -1729,16 +1874,37 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_STR_NULLTERM: s = "NULL Terminated"; break; + case H5T_STR_NULLPAD: s = "NULL Padded"; break; + case H5T_STR_SPACEPAD: s = "Space Padded"; break; - default: + + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: sprintf(buf, "H5T_STR_RESERVED_%d", (int)(dt->shared->u.vlen.pad)); s = buf; break; + + case H5T_STR_ERROR: + default: + sprintf(buf, "Unknown string padding: %d", (int)(dt->shared->u.vlen.pad)); + s = buf; + break; } /* end switch */ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "String Padding:", @@ -1759,15 +1925,20 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_ORDER_LE: s = "little endian"; break; + case H5T_ORDER_BE: s = "big endian"; break; + case H5T_ORDER_VAX: s = "VAX"; break; + case H5T_ORDER_NONE: s = "none"; break; + + case H5T_ORDER_ERROR: default: sprintf(buf, "H5T_ORDER_%d", dt->shared->u.atomic.order); s = buf; @@ -1791,9 +1962,17 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_PAD_ZERO: s = "zero"; break; + case H5T_PAD_ONE: s = "one"; break; + + case H5T_PAD_BACKGROUND: + s = "background"; + break; + + case H5T_PAD_ERROR: + case H5T_NPAD: default: s = "pad?"; break; @@ -1805,9 +1984,17 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_PAD_ZERO: s = "zero"; break; + case H5T_PAD_ONE: s = "one"; break; + + case H5T_PAD_BACKGROUND: + s = "background"; + break; + + case H5T_PAD_ERROR: + case H5T_NPAD: default: s = "pad?"; break; @@ -1820,15 +2007,22 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_PAD_ZERO: s = "zero"; break; + case H5T_PAD_ONE: s = "one"; break; + + case H5T_PAD_BACKGROUND: + s = "background"; + break; + + case H5T_PAD_ERROR: + case H5T_NPAD: default: - if (dt->shared->u.atomic.u.f.pad < 0) { + if (dt->shared->u.atomic.u.f.pad < 0) sprintf(buf, "H5T_PAD_%d", -(dt->shared->u.atomic.u.f.pad)); - } else { + else sprintf(buf, "bit-%d", dt->shared->u.atomic.u.f.pad); - } s = buf; break; } /* end switch */ @@ -1839,12 +2033,16 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_NORM_IMPLIED: s = "implied"; break; + case H5T_NORM_MSBSET: s = "msb set"; break; + case H5T_NORM_NONE: s = "none"; break; + + case H5T_NORM_ERROR: default: sprintf(buf, "H5T_NORM_%d", (int) (dt->shared->u.atomic.u.f.norm)); s = buf; @@ -1881,9 +2079,13 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, case H5T_SGN_NONE: s = "none"; break; + case H5T_SGN_2: s = "2's comp"; break; + + case H5T_SGN_ERROR: + case H5T_NSGN: default: sprintf(buf, "H5T_SGN_%d", (int) (dt->shared->u.atomic.u.i.sign)); s = buf; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index f403b81..ffea9e6 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -275,7 +275,7 @@ done: if(!ret_value && fill) { if(fill->buf) H5MM_xfree(fill->buf); - (void)H5FL_FREE(H5O_fill_t, fill); + fill = H5FL_FREE(H5O_fill_t, fill); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -335,7 +335,7 @@ done: if(!ret_value && fill) { if(fill->buf) H5MM_xfree(fill->buf); - (void)H5FL_FREE(H5O_fill_t, fill); + fill = H5FL_FREE(H5O_fill_t, fill); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -581,7 +581,7 @@ done: if(dst->type) H5T_close(dst->type); if(!_dst) - (void)H5FL_FREE(H5O_fill_t, dst); + dst = H5FL_FREE(H5O_fill_t, dst); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -783,7 +783,7 @@ H5O_fill_free(void *fill) HDassert(fill); - (void)H5FL_FREE(H5O_fill_t, fill); + fill = H5FL_FREE(H5O_fill_t, fill); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_fill_free() */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 83a6085..622edb3 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -148,7 +148,7 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, done: if(ret_value == NULL) if(ginfo != NULL) - (void)H5FL_FREE(H5O_ginfo_t, ginfo); + ginfo = H5FL_FREE(H5O_ginfo_t, ginfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ginfo_decode() */ @@ -304,7 +304,7 @@ H5O_ginfo_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_ginfo_t, mesg); + mesg = H5FL_FREE(H5O_ginfo_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_ginfo_free() */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 6d20ca9..a34dcc2 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -249,7 +249,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, done: if(ret_value == NULL) if(mesg) - (void)H5FL_FREE(H5O_layout_t, mesg); + mesg = H5FL_FREE(H5O_layout_t, mesg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_decode() */ @@ -503,7 +503,7 @@ H5O_layout_free(void *_mesg) if(H5O_layout_reset(mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources") - (void)H5FL_FREE(H5O_layout_t, mesg); + mesg = H5FL_FREE(H5O_layout_t, mesg); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index ba5ec56..891631f 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -166,7 +166,7 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, done: if(ret_value == NULL) if(linfo != NULL) - (void)H5FL_FREE(H5O_linfo_t, linfo); + linfo = H5FL_FREE(H5O_linfo_t, linfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_linfo_decode() */ @@ -321,7 +321,7 @@ H5O_linfo_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_linfo_t, mesg); + mesg = H5FL_FREE(H5O_linfo_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_linfo_free() */ @@ -424,7 +424,7 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst, done: if(!ret_value) if(linfo_dst) - (void)H5FL_FREE(H5O_linfo_t, linfo_dst); + linfo_dst = H5FL_FREE(H5O_linfo_t, linfo_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_linfo_copy_file() */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 7ddb1e9..ed65ee7 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -254,7 +254,7 @@ done: H5MM_xfree(lnk->u.soft.name); if(lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL) H5MM_xfree(lnk->u.ud.udata); - (void)H5FL_FREE(H5O_link_t, lnk); + lnk = H5FL_FREE(H5O_link_t, lnk); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -578,7 +578,7 @@ H5O_link_free(void *_mesg) /* Free information for link */ H5O_link_reset(lnk); - (void)H5FL_FREE(H5O_link_t, lnk); + lnk = H5FL_FREE(H5O_link_t, lnk); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_link_free() */ diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 1bbcfe3..e71fb50 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -502,7 +502,7 @@ H5O_mtime_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(time_t, mesg); + mesg = H5FL_FREE(time_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_mtime_free() */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 0a50963..89bdd36 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -546,7 +546,7 @@ H5O_pline_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_pline_t, mesg); + mesg = H5FL_FREE(H5O_pline_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_pline_free() */ diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index 2f00e86..e3c6981 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -118,7 +118,7 @@ H5O_refcount_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh done: if(ret_value == NULL && refcount != NULL) - (void)H5FL_FREE(H5O_refcount_t, refcount); + refcount = H5FL_FREE(H5O_refcount_t, refcount); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_refcount_decode() */ @@ -250,7 +250,7 @@ H5O_refcount_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_refcount_t, mesg); + mesg = H5FL_FREE(H5O_refcount_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_refcount_free() */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 231de3b..f4cac40 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -191,7 +191,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, done: if(!ret_value && sdim) { H5S_extent_release(sdim); - (void)H5FL_FREE(H5S_extent_t, sdim); + sdim = H5FL_FREE(H5S_extent_t, sdim); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -419,7 +419,7 @@ H5O_sdspace_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5S_extent_t, mesg); + mesg = H5FL_FREE(H5S_extent_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_sdspace_free() */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index a93a46d..abc4739 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -120,7 +120,7 @@ H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, done: if(ret_value == NULL) { if(stab != NULL) - (void)H5FL_FREE(H5O_stab_t,stab); + stab = H5FL_FREE(H5O_stab_t, stab); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -253,7 +253,7 @@ H5O_stab_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_stab_t, mesg); + mesg = H5FL_FREE(H5O_stab_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_stab_free() */ @@ -339,7 +339,7 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, done: if(!ret_value) if(stab_dst) - (void)H5FL_FREE(H5O_stab_t, stab_dst); + stab_dst = H5FL_FREE(H5O_stab_t, stab_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_stab_copy_file() */ diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index fe31a6d..d4a3801 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -82,7 +82,7 @@ H5O_unknown_free(void *mesg) HDassert(mesg); - (void)H5FL_FREE(H5O_unknown_t, mesg); + mesg = H5FL_FREE(H5O_unknown_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_unknown_free() */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 46a4ee3..67bb101 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -906,7 +906,7 @@ done: H5MM_xfree(prop->name); if(prop->value != NULL) H5MM_xfree(prop->value); - (void)H5FL_FREE(H5P_genprop_t, prop); + prop = H5FL_FREE(H5P_genprop_t, prop); } /* end if */ } /* end if */ @@ -1005,7 +1005,7 @@ done: H5MM_xfree(prop->name); if(prop->value!=NULL) H5MM_xfree(prop->value); - (void)H5FL_FREE(H5P_genprop_t, prop); + prop = H5FL_FREE(H5P_genprop_t, prop); } /* end if */ } /* end if */ @@ -1641,7 +1641,7 @@ done: H5SL_close(plist->del); /* Release the property list itself */ - (void)H5FL_FREE(H5P_genplist_t, plist); + plist = H5FL_FREE(H5P_genplist_t, plist); } /* end if */ } /* end if */ @@ -4414,7 +4414,7 @@ H5P_close(void *_plist) H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); /* Destroy property list object */ - (void)H5FL_FREE(H5P_genplist_t, plist); + plist = H5FL_FREE(H5P_genplist_t, plist); done: /* Release the skip list of 'seen' properties */ @@ -115,10 +115,10 @@ H5RC_decr(H5RC_t *rc) /* Check if we should delete this object now */ if(rc->n == 0) { if((rc->free_func)(rc->o) < 0) { - (void)H5FL_FREE(H5RC_t, rc); + rc = H5FL_FREE(H5RC_t, rc); HGOTO_ERROR(H5E_RS, H5E_CANTFREE, FAIL, "memory release failed") } /* end if */ - (void)H5FL_FREE(H5RC_t, rc); + rc = H5FL_FREE(H5RC_t, rc); } /* end if */ done: @@ -148,7 +148,7 @@ H5RS_wrap(const char *s) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ - ret_value->s = (char*)s; /* (Cast away const OK - QAK) */ + ret_value->s = (char *)s; /* (Cast away const OK - QAK) */ ret_value->wrapped = 1; ret_value->n = 1; @@ -230,8 +230,8 @@ H5RS_decr(H5RS_str_t *rs) /* Decrement reference count for string */ if((--rs->n) == 0) { if(!rs->wrapped) - (void)H5FL_BLK_FREE(str_buf, rs->s); - (void)H5FL_FREE(H5RS_str_t, rs); + rs->s = (char *)H5FL_BLK_FREE(str_buf, rs->s); + rs = H5FL_FREE(H5RS_str_t, rs); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1056,7 +1056,7 @@ H5S_read(const H5O_loc_t *loc, hid_t dxpl_id) done: if(ret_value == NULL) { if(ds != NULL) - (void)H5FL_FREE(H5S_t, ds); + ds = H5FL_FREE(H5S_t, ds); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1617,7 +1617,7 @@ H5S_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") if(H5S_extent_release(extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace") - (void)H5FL_FREE(H5S_extent_t, extent); + extent = H5FL_FREE(H5S_extent_t, extent); /* Initialize to "all" selection. Deserialization relies on valid existing selection. */ if(H5S_select_all(ds, FALSE) < 0) @@ -176,7 +176,7 @@ if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \ HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") \ HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \ - (void)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc-1], (void *)X->forward); \ + X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc-1], (void *)X->forward); \ X->forward = _tmp; \ } /* end if */ \ \ @@ -198,7 +198,7 @@ if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \ HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") \ HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \ - (void)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc+1], (void *)X->forward); \ + X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc+1], (void *)X->forward); \ X->forward = _tmp; \ } /* end if */ \ \ @@ -451,8 +451,8 @@ else \ X->forward[0]->backward = X->backward; \ SLIST->nobjs--; \ - (void)H5FL_FAC_FREE(H5SL_fac_g[0], X->forward); \ - (void)H5FL_FREE(H5SL_node_t, X); \ + X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[0], X->forward); \ + X = H5FL_FREE(H5SL_node_t, X); \ \ HGOTO_DONE(tmp); \ } /* end if */ \ @@ -749,13 +749,13 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) /* Casting away const OK -QAK */ (void)(op)(node->item,(void *)node->key,op_data); - (void)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward); - (void)H5FL_FREE(H5SL_node_t, node); - node=next_node; + node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward); + node = H5FL_FREE(H5SL_node_t, node); + node = next_node; } /* end while */ /* Reset the header pointers */ - (void)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc], slist->header->forward); + slist->header->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc], slist->header->forward); if(NULL == (slist->header->forward = (H5SL_node_t **) H5FL_FAC_MALLOC(H5SL_fac_g[0]))) HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, FAIL, "memory allocation failed") slist->header->forward[0] = NULL; @@ -815,11 +815,11 @@ H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") /* Release header node */ - (void)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc], slist->header->forward); - (void)H5FL_FREE(H5SL_node_t, slist->header); + slist->header->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc], slist->header->forward); + slist->header = H5FL_FREE(H5SL_node_t, slist->header); /* Free skip list object */ - (void)H5FL_FREE(H5SL_t, slist); + slist = H5FL_FREE(H5SL_t, slist); done: FUNC_LEAVE_NOAPI(ret_value) @@ -887,7 +887,7 @@ done: /* Error cleanup */ if(ret_value == NULL) { if(new_slist != NULL) - (void)H5FL_FREE(H5SL_t, new_slist); + new_slist = H5FL_FREE(H5SL_t, new_slist); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1151,8 +1151,8 @@ H5SL_remove_first(H5SL_t *slist) tmp->forward[0]->backward = head; slist->nobjs--; /* Free memory */ - (void)H5FL_FAC_FREE(H5SL_fac_g[0], tmp->forward); - (void)H5FL_FREE(H5SL_node_t, tmp); + tmp->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[0], tmp->forward); + tmp = H5FL_FREE(H5SL_node_t, tmp); /* Reshape the skip list as necessary to maintain 1-2-3 condition */ for(i=0; i < level; i++) { @@ -662,7 +662,7 @@ done: if(list != NULL) { if(list->messages != NULL) H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - (void)H5FL_FREE(H5SM_list_t, list); + list = H5FL_FREE(H5SM_list_t, list); } /* end if */ if(addr != HADDR_UNDEF) H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, size); @@ -2312,7 +2312,7 @@ H5SM_table_free(H5SM_master_table_t *table) H5FL_ARR_FREE(H5SM_index_header_t, table->indexes); - H5FL_FREE(H5SM_master_table_t, table); + table = H5FL_FREE(H5SM_master_table_t, table); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM_table_free() */ @@ -2340,7 +2340,7 @@ H5SM_list_free(H5SM_list_t *list) H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - H5FL_FREE(H5SM_list_t, list); + list = H5FL_FREE(H5SM_list_t, list); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM_list_free() */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index f675287..e7c640f 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -549,7 +549,7 @@ done: if(!ret_value && list) { if(list->messages) H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - (void)H5FL_FREE(H5SM_list_t, list); + list = H5FL_FREE(H5SM_list_t, list); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -95,7 +95,7 @@ H5ST_close_internal(H5ST_ptr_t p) if(p->splitchar) H5ST_close_internal(p->eqkid); H5ST_close_internal(p->hikid); - (void)H5FL_FREE(H5ST_node_t, p); + p = H5FL_FREE(H5ST_node_t, p); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -136,7 +136,7 @@ H5ST_close(H5ST_tree_t *tree) HGOTO_ERROR(H5E_TST, H5E_CANTFREE, FAIL, "can't free TST") /* Free root node itself */ - (void)H5FL_FREE(H5ST_tree_t, tree); + tree = H5FL_FREE(H5ST_tree_t, tree); done: FUNC_LEAVE_NOAPI(ret_value) @@ -632,7 +632,7 @@ H5ST_delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) *root = newp; } /* end else */ - (void)H5FL_FREE(H5ST_node_t, p); + p = H5FL_FREE(H5ST_node_t, p); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5ST_delete_internal() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 0565cf3..74402b1 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1543,7 +1543,7 @@ H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info) } /* end while */ /* Free this span info */ - (void)H5FL_FREE(H5S_hyper_span_info_t, span_info); + span_info = H5FL_FREE(H5S_hyper_span_info_t, span_info); } /* end if */ done: @@ -1586,7 +1586,7 @@ H5S_hyper_free_span (H5S_hyper_span_t *span) } /* end if */ /* Free this span */ - (void)H5FL_FREE(H5S_hyper_span_t, span); + span = H5FL_FREE(H5S_hyper_span_t, span); done: FUNC_LEAVE_NOAPI(ret_value); @@ -3174,30 +3174,29 @@ H5S_hyper_is_regular(const H5S_t *space) * when closing some other data space. --------------------------------------------------------------------------*/ herr_t -H5S_hyper_release (H5S_t *space) +H5S_hyper_release(H5S_t *space) { - herr_t ret_value=SUCCEED; + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5S_hyper_release, FAIL); + FUNC_ENTER_NOAPI(H5S_hyper_release, FAIL) /* Check args */ - assert (space && H5S_SEL_HYPERSLABS==H5S_GET_SELECT_TYPE(space)); + HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); /* Reset the number of points selected */ - space->select.num_elem=0; + space->select.num_elem = 0; /* Release irregular hyperslab information */ - if(space->select.sel_info.hslab->span_lst!=NULL) { - if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans"); + if(space->select.sel_info.hslab->span_lst != NULL) { + if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans") } /* end if */ /* Release space for the hyperslab selection information */ - (void)H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab); - space->select.sel_info.hslab=NULL; + space->select.sel_info.hslab = H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_release() */ @@ -250,10 +250,10 @@ double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0; */ static struct { int npaths; /*number of paths defined */ - int apaths; /*number of paths allocated */ + size_t apaths; /*number of paths allocated */ H5T_path_t **path; /*sorted array of path pointers */ int nsoft; /*number of soft conversions defined */ - int asoft; /*number of soft conversions allocated */ + size_t asoft; /*number of soft conversions allocated */ H5T_soft_t *soft; /*unsorted array of soft conversions */ } H5T_g; @@ -559,8 +559,8 @@ H5T_init_inf(void) FUNC_ENTER_NOAPI_NOINIT(H5T_init_inf) /* Get the float datatype */ - if (NULL==(dst_p=H5I_object(H5T_NATIVE_FLOAT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") dst = &dst_p->shared->u.atomic; /* Check that we can re-order the bytes correctly */ @@ -600,13 +600,13 @@ H5T_init_inf(void) } /* end if */ /* Get the double datatype */ - if (NULL==(dst_p=H5I_object(H5T_NATIVE_DOUBLE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + if(NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") dst = &dst_p->shared->u.atomic; /* Check that we can re-order the bytes correctly */ - if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); + if(H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") /* +Inf */ d = (uint8_t *)&H5T_NATIVE_DOUBLE_POS_INF_g; @@ -757,36 +757,36 @@ H5T_init_interface(void) * Initialize pre-defined native datatypes from code generated during * the library configuration by H5detect. */ - if(H5TN_init_interface()<0) + if(H5TN_init_interface() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Get the atomic datatype structures needed by the initialization code below */ - if(NULL==(native_schar=H5I_object(H5T_NATIVE_SCHAR_g))) + if(NULL == (native_schar = (H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_uchar=H5I_object(H5T_NATIVE_UCHAR_g))) + if(NULL == (native_uchar = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_short=H5I_object(H5T_NATIVE_SHORT_g))) + if(NULL == (native_short = (H5T_t *)H5I_object(H5T_NATIVE_SHORT_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_ushort=H5I_object(H5T_NATIVE_USHORT_g))) + if(NULL == (native_ushort = (H5T_t *)H5I_object(H5T_NATIVE_USHORT_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_int=H5I_object(H5T_NATIVE_INT_g))) + if(NULL == (native_int = (H5T_t *)H5I_object(H5T_NATIVE_INT_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_uint=H5I_object(H5T_NATIVE_UINT_g))) + if(NULL == (native_uint = (H5T_t *)H5I_object(H5T_NATIVE_UINT_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_long=H5I_object(H5T_NATIVE_LONG_g))) + if(NULL == (native_long = (H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_ulong=H5I_object(H5T_NATIVE_ULONG_g))) + if(NULL == (native_ulong = (H5T_t *)H5I_object(H5T_NATIVE_ULONG_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_llong=H5I_object(H5T_NATIVE_LLONG_g))) + if(NULL == (native_llong = (H5T_t *)H5I_object(H5T_NATIVE_LLONG_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_ullong=H5I_object(H5T_NATIVE_ULLONG_g))) + if(NULL == (native_ullong = (H5T_t *)H5I_object(H5T_NATIVE_ULLONG_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_float=H5I_object(H5T_NATIVE_FLOAT_g))) + if(NULL == (native_float = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") - if(NULL==(native_double=H5I_object(H5T_NATIVE_DOUBLE_g))) + if(NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") #if H5_SIZEOF_LONG_DOUBLE !=0 - if(NULL==(native_ldouble=H5I_object(H5T_NATIVE_LDOUBLE_g))) + if(NULL == (native_ldouble = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") #endif @@ -1331,13 +1331,13 @@ H5T_init_interface(void) done: /* General cleanup */ - if (compound!=NULL) + if(compound != NULL) H5T_close(compound); - if (enum_type!=NULL) + if(enum_type != NULL) H5T_close(enum_type); - if (vlen!=NULL) + if(vlen != NULL) H5T_close(vlen); - if (array!=NULL) + if(array != NULL) H5T_close(array); /* Error cleanup */ @@ -1347,8 +1347,8 @@ done: if(copied_dtype) H5T_close(dt); else { - (void)H5FL_FREE(H5T_shared_t, dt->shared); - (void)H5FL_FREE(H5T_t,dt); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); } /* end else */ } /* end if */ } /* end if */ @@ -1410,45 +1410,46 @@ H5T_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_term_interface) - if (H5_interface_initialize_g) { + if(H5_interface_initialize_g) { /* Unregister all conversion functions */ - for (i=0; i<H5T_g.npaths; i++) { + for(i = 0; i < H5T_g.npaths; i++) { path = H5T_g.path[i]; - assert (path); - if (path->func) { + HDassert(path); + if(path->func) { H5T_print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; - if ((path->func)(FAIL, FAIL, &(path->cdata), - (size_t)0, (size_t)0, (size_t)0, - NULL, NULL,H5AC_dxpl_id)<0) { + if((path->func)(FAIL, FAIL, &(path->cdata), (size_t)0, + (size_t)0, (size_t)0, NULL, NULL,H5AC_dxpl_id) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf (H5DEBUG(T), "H5T: conversion function " + fprintf(H5DEBUG(T), "H5T: conversion function " "0x%08lx failed to free private data for " "%s (ignored)\n", (unsigned long)(path->func), path->name); - } + } /* end if */ #endif H5E_clear_stack(NULL); /*ignore the error*/ - } - } + } /* end if */ + } /* end if */ if(path->src) - H5T_close (path->src); + H5T_close(path->src); if(path->dst) - H5T_close (path->dst); - H5FL_FREE(H5T_path_t,path); + H5T_close(path->dst); + path = H5FL_FREE(H5T_path_t, path); H5T_g.path[i] = NULL; - } + } /* end for */ /* Clear conversion tables */ - H5T_g.path = H5MM_xfree(H5T_g.path); - H5T_g.npaths = H5T_g.apaths = 0; - H5T_g.soft = H5MM_xfree(H5T_g.soft); - H5T_g.nsoft = H5T_g.asoft = 0; + H5T_g.path = (H5T_path_t **)H5MM_xfree(H5T_g.path); + H5T_g.npaths = 0; + H5T_g.apaths = 0; + H5T_g.soft = (H5T_soft_t *)H5MM_xfree(H5T_g.soft); + H5T_g.nsoft = 0; + H5T_g.asoft = 0; /* Unlock all datatypes, then free them */ - H5I_search (H5I_DATATYPE, H5T_unlock_cb, NULL, FALSE); + H5I_search(H5I_DATATYPE, H5T_unlock_cb, NULL, FALSE); H5I_dec_type_ref(H5I_DATATYPE); /* Reset all the datatype IDs */ @@ -1657,6 +1658,20 @@ H5Tcopy(hid_t type_id) } break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_GROUP: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype or dataset") } /* end switch */ @@ -1943,12 +1958,12 @@ htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) { unsigned i; - htri_t ret_value=FALSE; /* Return value */ + htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI(H5T_detect_class, FAIL); + FUNC_ENTER_NOAPI(H5T_detect_class, FAIL) - assert(dt); - assert(cls>H5T_NO_CLASS && cls<H5T_NCLASSES); + HDassert(dt); + HDassert(cls > H5T_NO_CLASS && cls < H5T_NCLASSES); /* Consider VL string as a string for API, as a VL for internal use. */ /* (note that this check must be performed before checking if the VL @@ -1959,22 +1974,22 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) HGOTO_DONE(H5T_STRING == cls); /* Check if this type is the correct type */ - if(dt->shared->type==cls) + if(dt->shared->type == cls) HGOTO_DONE(TRUE); /* check for types that might have the correct type as a component */ switch(dt->shared->type) { case H5T_COMPOUND: - for (i=0; i<dt->shared->u.compnd.nmembs; i++) { + for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { htri_t nested_ret; /* Return value from nested call */ /* Check if this field's type is the correct type */ - if(dt->shared->u.compnd.memb[i].type->shared->type==cls) + if(dt->shared->u.compnd.memb[i].type->shared->type == cls) HGOTO_DONE(TRUE); /* Recurse if it's VL, compound, enum or array */ if(H5T_IS_COMPLEX(dt->shared->u.compnd.memb[i].type->shared->type)) - if((nested_ret=H5T_detect_class(dt->shared->u.compnd.memb[i].type, cls, from_api))!=FALSE) + if((nested_ret = H5T_detect_class(dt->shared->u.compnd.memb[i].type, cls, from_api)) != FALSE) HGOTO_DONE(nested_ret); } /* end for */ break; @@ -1984,13 +1999,22 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) case H5T_ENUM: HGOTO_DONE(H5T_detect_class(dt->shared->parent, cls, from_api)); + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_NCLASSES: default: break; } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_detect_class() */ /*------------------------------------------------------------------------- @@ -2265,12 +2289,12 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, assert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers); assert(name && *name); - if (H5T_PERS_HARD==pers) { + if(H5T_PERS_HARD == pers) { /* Only bother to register the path if it's not a no-op path (for this machine) */ if(H5T_cmp(src, dst, FALSE)) { /* Locate or create a new conversion path */ - if (NULL==(new_path=H5T_path_find(src, dst, name, func, dxpl_id, api_call))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path"); + if(NULL == (new_path = H5T_path_find(src, dst, name, func, dxpl_id, api_call))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path") /* * Notify all other functions to recalculate private data since some @@ -2279,24 +2303,24 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, * functions for the members, so adding a new function should cause * the list to be recalculated to use the new function. */ - for (i=0; i<H5T_g.npaths; i++) { - if (new_path != H5T_g.path[i]) + for(i = 0; i < H5T_g.npaths; i++) + if(new_path != H5T_g.path[i]) H5T_g.path[i]->cdata.recalc = TRUE; - } /* end for */ } /* end if */ - } else { + } /* end if */ + else { /* Add function to end of soft list */ - if (H5T_g.nsoft>=H5T_g.asoft) { - size_t na = MAX(32, 2*H5T_g.asoft); - H5T_soft_t *x = H5MM_realloc(H5T_g.soft, na*sizeof(H5T_soft_t)); + if((size_t)H5T_g.nsoft >= H5T_g.asoft) { + size_t na = MAX(32, 2 * H5T_g.asoft); + H5T_soft_t *x; - if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - H5T_g.asoft = (int)na; + if(NULL == (x = (H5T_soft_t *)H5MM_realloc(H5T_g.soft, na * sizeof(H5T_soft_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + H5T_g.asoft = na; H5T_g.soft = x; } /* end if */ - HDstrncpy (H5T_g.soft[H5T_g.nsoft].name, name, (size_t)H5T_NAMELEN); - H5T_g.soft[H5T_g.nsoft].name[H5T_NAMELEN-1] = '\0'; + HDstrncpy(H5T_g.soft[H5T_g.nsoft].name, name, (size_t)H5T_NAMELEN); + H5T_g.soft[H5T_g.nsoft].name[H5T_NAMELEN - 1] = '\0'; H5T_g.soft[H5T_g.nsoft].src = src->shared->type; H5T_g.soft[H5T_g.nsoft].dst = dst->shared->type; H5T_g.soft[H5T_g.nsoft].func = func; @@ -2410,8 +2434,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2420,29 +2442,29 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, { H5T_t *src; /*source data type descriptor */ H5T_t *dst; /*destination data type desc */ - herr_t ret_value=SUCCEED; /*return value */ + herr_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_API(H5Tregister, FAIL); + FUNC_ENTER_API(H5Tregister, FAIL) H5TRACE5("e", "Te*siix", pers, name, src_id, dst_id, func); /* Check args */ - if (H5T_PERS_HARD!=pers && H5T_PERS_SOFT!=pers) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid function persistence"); - if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conversion must have a name for debugging"); - if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - if (!func) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified"); + if(H5T_PERS_HARD != pers && H5T_PERS_SOFT != pers) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid function persistence") + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conversion must have a name for debugging") + if(NULL == (src = (H5T_t *)H5I_object_verify(src_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(NULL == (dst = (H5T_t *)H5I_object_verify(dst_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if(!func) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified") /* Go register the function */ - if(H5T_register(pers,name,src,dst,func,H5AC_ind_dxpl_id,TRUE)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function"); + if(H5T_register(pers, name, src, dst, func, H5AC_ind_dxpl_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Tregister() */ @@ -2490,7 +2512,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if(func && func != soft->func) continue; - HDmemmove(H5T_g.soft + i, H5T_g.soft + i + 1, (H5T_g.nsoft - (i + 1)) * sizeof(H5T_soft_t)); + HDmemmove(H5T_g.soft + i, H5T_g.soft + i + 1, (size_t)(H5T_g.nsoft - (i + 1)) * sizeof(H5T_soft_t)); --H5T_g.nsoft; } /* end for */ } /* end if */ @@ -2518,7 +2540,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end if */ else { /* Remove from table */ - HDmemmove(H5T_g.path + i, H5T_g.path + i + 1, (H5T_g.npaths - (i + 1)) * sizeof(H5T_path_t*)); + HDmemmove(H5T_g.path + i, H5T_g.path + i + 1, (size_t)(H5T_g.npaths - (i + 1)) * sizeof(H5T_path_t*)); --H5T_g.npaths; /* Shut down path */ @@ -2559,33 +2581,30 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, * Programmer: Robb Matzke * Tuesday, January 13, 1998 * - * Modifications: - * Changed to use H5T_unregister wrapper function - QAK, 11/17/99 - * *------------------------------------------------------------------------- */ herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func) { - H5T_t *src=NULL, *dst=NULL; /*data type descriptors */ - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *src, *dst; /*data type descriptors */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tunregister, FAIL); + FUNC_ENTER_API(H5Tunregister, FAIL) H5TRACE5("e", "Te*siix", pers, name, src_id, dst_id, func); /* Check arguments */ - if (src_id>0 && (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src is not a data type"); - if (dst_id>0 && (NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type"); + if(src_id > 0 && (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src is not a data type") + if(dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE)))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type") - if (H5T_unregister(pers,name,src,dst,func,H5AC_ind_dxpl_id)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed"); + if(H5T_unregister(pers, name, src, dst, func, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tunregister() */ /*------------------------------------------------------------------------- @@ -2604,40 +2623,38 @@ done: * Programmer: Robb Matzke * Tuesday, January 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) { - H5T_conv_t ret_value; - H5T_t *src = NULL, *dst = NULL; - H5T_path_t *path = NULL; + H5T_t *src, *dst; + H5T_path_t *path; + H5T_conv_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tfind, NULL); + FUNC_ENTER_API(H5Tfind, NULL) H5TRACE3("x", "ii**x", src_id, dst_id, pcdata); /* Check args */ - if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) || - NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); - if (!pcdata) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer"); + if(NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || + NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + if(!pcdata) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer") /* Find it */ - if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found"); + if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found") - if (pcdata) + if(pcdata) *pcdata = &(path->cdata); /* Set return value */ ret_value = path->func; done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tfind() */ /*------------------------------------------------------------------------- @@ -2655,31 +2672,29 @@ done: * Programmer: Raymond Lu * Friday, Sept 2, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id) { - htri_t ret_value; - H5T_t *src = NULL, *dst = NULL; + H5T_t *src, *dst; + htri_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tcompiler_conv, FAIL) H5TRACE2("t", "ii", src_id, dst_id); /* Check args */ - if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) || - NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE))) + if(NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || + NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") /* Find it */ - if((ret_value=H5T_compiler_conv(src, dst))<0) + if((ret_value = H5T_compiler_conv(src, dst)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tcompiler_conv() */ /*------------------------------------------------------------------------- @@ -2703,43 +2718,39 @@ done: * Programmer: Robb Matzke * Wednesday, June 10, 1998 * - * Modifications: - * Added xfer_parms argument to pass VL datatype custom allocation - * information down the chain. - QAK, 7/1/99 - * *------------------------------------------------------------------------- */ herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background, hid_t dxpl_id) { - H5T_path_t *tpath=NULL; /*type conversion info */ - H5T_t *src=NULL, *dst=NULL; /*unatomized types */ - herr_t ret_value=SUCCEED; /* Return value */ + H5T_path_t *tpath; /*type conversion info */ + H5T_t *src, *dst; /*unatomized types */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tconvert, FAIL); + FUNC_ENTER_API(H5Tconvert, FAIL) H5TRACE6("e", "iiz*x*xi", src_id, dst_id, nelmts, buf, background, dxpl_id); /* Check args */ - if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) || - NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + if(NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || + NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset transfer property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset transfer property list") /* Find the conversion function */ - if (NULL==(tpath=H5T_path_find(src, dst, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); + if(NULL == (tpath = H5T_path_find(src, dst, NULL, NULL, dxpl_id, FALSE))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types") - if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, buf, background, dxpl_id)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); + if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, buf, background, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Tconvert() */ /*------------------------------------------------------------------------- @@ -2756,8 +2767,6 @@ done: * slu@ncsa.uiuc.edu * July 14, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2770,13 +2779,13 @@ H5Tencode(hid_t obj_id, void *buf, size_t *nalloc) H5TRACE3("e", "i*x*z", obj_id, buf, nalloc); /* Check argument and retrieve object */ - if(NULL == (dtype = H5I_object_verify(obj_id, H5I_DATATYPE))) + if(NULL == (dtype = (H5T_t *)H5I_object_verify(obj_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(nalloc == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL pointer for buffer size") /* Go encode the datatype */ - if(H5T_encode(dtype, buf, nalloc) < 0) + if(H5T_encode(dtype, (unsigned char *)buf, nalloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") done: @@ -2804,7 +2813,7 @@ hid_t H5Tdecode(const void *buf) { H5T_t *dt; - hid_t ret_value; + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5Tdecode, FAIL) H5TRACE1("i", "*x", buf); @@ -2814,7 +2823,7 @@ H5Tdecode(const void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer") /* Create datatype by decoding buffer */ - if((dt = H5T_decode(buf)) == NULL) + if(NULL == (dt = H5T_decode((const unsigned char *)buf))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object") /* Register the type and return the ID */ @@ -2908,7 +2917,7 @@ static H5T_t * H5T_decode(const unsigned char *buf) { H5F_t *f = NULL; /* Fake file structure*/ - H5T_t *ret_value; + H5T_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_decode) @@ -2925,7 +2934,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if((ret_value = H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf)) == NULL) + if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") /* Mark datatype as being in memory now */ @@ -3024,6 +3033,9 @@ H5T_create(H5T_class_t type, size_t size) case H5T_ARRAY: /* Array datatype */ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()") + case H5T_NO_CLASS: + case H5T_REFERENCE: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class") } /* end switch */ @@ -3131,7 +3143,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) */ if(old_dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Check if the object is already open */ - if(NULL == (reopened_fo = H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) { + if(NULL == (reopened_fo = (H5T_shared_t *)H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) { /* Clear any errors from H5FO_opened() */ H5E_clear_stack(NULL); @@ -3148,7 +3160,8 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count") new_dt->shared->fo_count = 1; - } else { + } /* end if */ + else { /* The object is already open. Free the H5T_shared_t struct * we had been using and use the one that already exists. * Not terribly efficient. */ @@ -4482,13 +4495,13 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.path[md] = path; } else if(path != table) { HDassert(cmp); - if(H5T_g.npaths >= H5T_g.apaths) { + if((size_t)H5T_g.npaths >= H5T_g.apaths) { size_t na = MAX(128, 2 * H5T_g.apaths); - H5T_path_t **x = H5MM_realloc (H5T_g.path, na * sizeof(H5T_path_t*)); + H5T_path_t **x; - if(!x) + if(NULL == (x = H5MM_realloc(H5T_g.path, na * sizeof(H5T_path_t*)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - H5T_g.apaths = (int)na; + H5T_g.apaths = na; H5T_g.path = x; } /* end if */ if(cmp > 0) @@ -137,7 +137,7 @@ H5WB_wrap(void *buf, size_t buf_size) done: /* Release resources on error */ if(!ret_value && wb) - (void)H5FL_FREE(H5WB_t, wb); + wb = H5FL_FREE(H5WB_t, wb); FUNC_LEAVE_NOAPI(ret_value) } /* end H5WB_wrap() */ diff --git a/src/H5private.h b/src/H5private.h index 440c4a7..93be1ce 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1631,7 +1631,7 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ /* `S' is the name of a function which is being tested to check if its */ /* an API function */ -#define H5_IS_API(S) ('_'!=((char*)S)[2] && '_'!=((char*)S)[3] && (!((char*)S)[4] || '_'!=((char*)S)[4])) +#define H5_IS_API(S) ('_'!=((const char *)S)[2] && '_'!=((const char *)S)[3] && (!((const char *)S)[4] || '_'!=((const char *)S)[4])) /* global library version information string */ extern char H5_lib_vers_info_g[]; |