diff options
Diffstat (limited to 'src')
97 files changed, 1544 insertions, 1535 deletions
@@ -1903,42 +1903,42 @@ H5B_copy(const H5B_t *old_bt) /* * Check arguments. */ - assert(old_bt); - shared=(H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared); + HDassert(old_bt); + shared = (H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared); HDassert(shared); /* Allocate memory for the new H5B_t object */ - if (NULL==(new_node = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") + if(NULL == (new_node = H5FL_MALLOC(H5B_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") /* Copy the main structure */ - HDmemcpy(new_node,old_bt,sizeof(H5B_t)); + HDmemcpy(new_node, old_bt, sizeof(H5B_t)); - if ( NULL==(new_node->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) || - NULL==(new_node->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") + if(NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || + NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") /* Copy the other structures */ - HDmemcpy(new_node->native,old_bt->native,shared->sizeof_keys); - HDmemcpy(new_node->child,old_bt->child,(sizeof(haddr_t)*shared->two_k)); + HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys); + HDmemcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k)); /* Increment the ref-count on the raw page */ H5RC_INC(new_node->rc_shared); /* Set return value */ - ret_value=new_node; + ret_value = new_node; done: - if(ret_value==NULL) { + if(NULL == ret_value) { if(new_node) { - H5FL_BLK_FREE (native_block,new_node->native); - H5FL_SEQ_FREE (haddr_t,new_node->child); - H5FL_FREE (H5B_t,new_node); + (void)H5FL_BLK_FREE(native_block, new_node->native); + H5FL_SEQ_FREE(haddr_t, new_node->child); + (void)H5FL_FREE(H5B_t, new_node); } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5B_copy */ +} /* end H5B_copy() */ /*------------------------------------------------------------------------- diff --git a/src/H5Bcache.c b/src/H5Bcache.c index b129925..e577dc2 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -334,7 +334,7 @@ H5B_dest(H5F_t UNUSED *f, H5B_t *bt) HDassert(bt->rc_shared); H5FL_SEQ_FREE(haddr_t,bt->child); - H5FL_BLK_FREE(native_block,bt->native); + (void)H5FL_BLK_FREE(native_block,bt->native); H5RC_DEC(bt->rc_shared); H5FL_FREE(H5B_t,bt); @@ -3062,7 +3062,7 @@ done: H5SL_close(cache_ptr->slist_ptr); cache_ptr->magic = 0; - H5FL_FREE(H5C_t, cache_ptr); + (void)H5FL_FREE(H5C_t, cache_ptr); cache_ptr = NULL; } /* end if */ @@ -3323,7 +3323,7 @@ H5C_dest(H5F_t * f, cache_ptr->magic = 0; - H5FL_FREE(H5C_t, cache_ptr); + (void)H5FL_FREE(H5C_t, cache_ptr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3378,7 +3378,7 @@ H5C_dest_empty(H5C_t * cache_ptr) cache_ptr->magic = 0; - H5FL_FREE(H5C_t, cache_ptr); + (void)H5FL_FREE(H5C_t, cache_ptr); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dtest.c b/src/H5Dtest.c index cf4d5b6..f7124f0 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -79,19 +79,19 @@ herr_t H5D_layout_version_test(hid_t did, unsigned *version) { H5D_t *dset; /* Pointer to dataset to query */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5D_layout_version_test, FAIL); + FUNC_ENTER_NOAPI(H5D_layout_version_test, FAIL) /* Check args */ - if (NULL==(dset=H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(version) - *version=dset->shared->layout.version; + *version = dset->shared->layout.version; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D_layout_version_test() */ @@ -118,20 +118,20 @@ herr_t H5D_layout_contig_size_test(hid_t did, hsize_t *size) { H5D_t *dset; /* Pointer to dataset to query */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5D_layout_contig_size_test, FAIL); + FUNC_ENTER_NOAPI(H5D_layout_contig_size_test, FAIL) /* Check args */ - if (NULL==(dset=H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(size) { - assert(dset->shared->layout.type==H5D_CONTIGUOUS); - *size=dset->shared->layout.u.contig.size; + HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); + *size = dset->shared->layout.u.contig.size; } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D_layout_contig_size_test() */ @@ -539,7 +539,7 @@ H5Eget_class_name(hid_t class_id, char *name, size_t size) H5TRACE3("Zs", "i*sz", class_id, name, size); /* Get the error class */ - if(NULL == (cls = H5I_object_verify(class_id, H5I_ERROR_CLASS))) + if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID") /* Retrieve the class name */ @@ -716,7 +716,7 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "message is NULL") /* Get the error class */ - if(NULL == (cls = H5I_object_verify(class_id, H5I_ERROR_CLASS))) + if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID") /* Create the new error message object */ @@ -797,7 +797,7 @@ H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size) H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size); /* Get the message object */ - if(NULL == (msg = H5I_object_verify(msg_id, H5I_ERROR_MSG))) + if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") /* Get the message's text */ @@ -905,7 +905,7 @@ H5E_get_current_stack(void) FUNC_ENTER_NOAPI_NOINIT(H5E_get_current_stack) /* Get a pointer to the current error stack */ - if(NULL == (current_stack = H5E_get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (current_stack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack") /* Allocate a new error stack */ @@ -981,7 +981,7 @@ H5Eset_current_stack(hid_t err_stack) H5TRACE1("e", "i", err_stack); if(err_stack != H5E_DEFAULT) { - if(NULL == (estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the current error stack */ @@ -1158,7 +1158,7 @@ H5Eget_num(hid_t error_stack_id) H5E_clear_stack(NULL); /* Get the error stack to operate on */ - if(NULL == (estack = H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ @@ -1226,7 +1226,7 @@ H5Epop(hid_t err_stack, size_t count) H5E_clear_stack(NULL); /* Get the error stack to operate on */ - if(NULL == (estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ @@ -1289,14 +1289,14 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, H5E_clear_stack(NULL); /* Get the error stack to operate on */ - if(NULL == (estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ /* Check for mis-matches in major & minor error classes */ - if(NULL == (maj_ptr = H5I_object_verify(maj_id, H5I_ERROR_MSG))) + if(NULL == (maj_ptr = (H5E_msg_t *)H5I_object_verify(maj_id, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") - if(NULL == (min_ptr = H5I_object_verify(min_id, H5I_ERROR_MSG))) + if(NULL == (min_ptr = (H5E_msg_t *)H5I_object_verify(min_id, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") if(maj_ptr->cls != min_ptr->cls) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "major and minor errors not from same error class") @@ -1387,7 +1387,7 @@ H5Eclear2(hid_t err_stack) /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); - if(NULL == (estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ @@ -1434,7 +1434,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); - if(NULL == (estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ @@ -1480,7 +1480,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); - if(NULL == (estack = H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ @@ -1525,7 +1525,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else - if(NULL == (estack = H5I_object_verify(estack_id, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Get the automatic error reporting information */ @@ -1577,7 +1577,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else - if(NULL == (estack = H5I_object_verify(estack_id, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the automatic error reporting information */ @@ -1620,7 +1620,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else - if(NULL == (estack = H5I_object_verify(estack_id, H5I_ERROR_STACK))) + if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Check if the error stack reporting function is the "newer" stack type */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index c1a5a21..0997f3c 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -130,7 +130,7 @@ H5Eget_major(H5E_major_t maj) FUNC_ENTER_API_NOCLEAR(H5Eget_major, NULL) /* Get the message object */ - if(NULL == (msg = H5I_object_verify(maj, H5I_ERROR_MSG))) + if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") /* Get the message's text */ @@ -178,7 +178,7 @@ H5Eget_minor(H5E_minor_t min) FUNC_ENTER_API_NOCLEAR(H5Eget_minor, NULL) /* Get the message object */ - if(NULL == (msg = H5I_object_verify(min, H5I_ERROR_MSG))) + if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") /* Get the message's text */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 156e5ed..99048e1 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -238,8 +238,8 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) stream = eprint->stream; /* Get descriptions for the major and minor error numbers */ - maj_ptr = H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG); - min_ptr = H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG); + maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG); + min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG); HDassert(maj_ptr && min_ptr); if(maj_ptr->msg) maj_str = maj_ptr->msg; @@ -354,8 +354,8 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) stream = eprint->stream; /* Get descriptions for the major and minor error numbers */ - maj_ptr = H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG); - min_ptr = H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG); + maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG); + min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG); HDassert(maj_ptr && min_ptr); if(maj_ptr->msg) maj_str = maj_ptr->msg; @@ -350,33 +350,33 @@ done: hid_t H5FD_register(const void *_cls, size_t size, hbool_t app_ref) { - hid_t ret_value; - const H5FD_class_t *cls=(const H5FD_class_t *)_cls; - H5FD_class_t *saved=NULL; + const H5FD_class_t *cls = (const H5FD_class_t *)_cls; + H5FD_class_t *saved = NULL; H5FD_mem_t type; + hid_t ret_value; FUNC_ENTER_NOAPI(H5FD_register, FAIL) /* Check arguments */ - assert(cls); - assert(cls->open && cls->close); - assert(cls->get_eoa && cls->set_eoa); - assert(cls->get_eof); - assert(cls->read && cls->write); - for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) - assert(cls->fl_map[type]>=H5FD_MEM_NOLIST && cls->fl_map[type]<H5FD_MEM_NTYPES); + HDassert(cls); + HDassert(cls->open && cls->close); + HDassert(cls->get_eoa && cls->set_eoa); + HDassert(cls->get_eof); + HDassert(cls->read && cls->write); + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); /* Copy the class structure so the caller can reuse or free it */ - if(NULL==(saved=H5MM_malloc(size))) + if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct") - HDmemcpy(saved,cls,size); + HDmemcpy(saved, cls, size); /* Create the new class ID */ - if((ret_value=H5I_register(H5I_VFL, saved, app_ref)) < 0) + if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") done: - if(ret_value<0) + if(ret_value < 0) if(saved) H5MM_xfree(saved); @@ -452,13 +452,13 @@ H5FD_get_class(hid_t id) FUNC_ENTER_NOAPI(H5FD_get_class, NULL) if(H5I_VFL == H5I_get_type(id)) - ret_value = H5I_object(id); + ret_value = (H5FD_class_t *)H5I_object(id); else { H5P_genplist_t *plist; /* Property list pointer */ hid_t driver_id = -1; /* Get the plist structure */ - if(NULL == (plist = H5I_object(id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") if(TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { @@ -779,17 +779,17 @@ done: herr_t H5FD_fapl_copy(hid_t driver_id, const void *old_fapl, void **copied_fapl) { - H5FD_class_t *driver=NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_class_t *driver; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_fapl_copy, FAIL) /* Check args */ - if(NULL==(driver=H5I_object(driver_id))) + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Copy the file access property list */ - if(H5FD_pl_copy(driver->fapl_copy,driver->fapl_size,old_fapl,copied_fapl) < 0) + if(H5FD_pl_copy(driver->fapl_copy, driver->fapl_size, old_fapl, copied_fapl) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver file access property list") done: @@ -822,7 +822,7 @@ H5FD_fapl_close(hid_t driver_id, void *fapl) /* Check args */ if(driver_id > 0) { - if(NULL == (driver = H5I_object(driver_id))) + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Close the driver for the property list */ @@ -896,17 +896,17 @@ done: herr_t H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl) { - H5FD_class_t *driver=NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_class_t *driver; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_dxpl_copy, FAIL) /* Check args */ - if(NULL==(driver=H5I_object(driver_id))) + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Copy the file access property list */ - if(H5FD_pl_copy(driver->dxpl_copy,driver->dxpl_size,old_dxpl,copied_dxpl) < 0) + if(H5FD_pl_copy(driver->dxpl_copy, driver->dxpl_size, old_dxpl, copied_dxpl) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver data transfer property list") done: @@ -932,18 +932,18 @@ done: herr_t H5FD_dxpl_close(hid_t driver_id, void *dxpl) { - H5FD_class_t *driver=NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_class_t *driver; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_dxpl_close, FAIL) /* Check args */ - if(driver_id>0) { - if(NULL==(driver=H5I_object(driver_id))) + if(driver_id > 0) { + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Close the driver for the property list */ - if(H5FD_pl_close(driver_id,driver->dxpl_free,dxpl) < 0) + if(H5FD_pl_close(driver_id, driver->dxpl_free, dxpl) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed") } /* end if */ @@ -1054,35 +1054,35 @@ H5FD_t * H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_class_t *driver; - H5FD_t *file=NULL; + H5FD_t *file = NULL; hid_t driver_id = -1; - hsize_t meta_block_size=0; - hsize_t sdata_block_size=0; + hsize_t meta_block_size = 0; + hsize_t sdata_block_size = 0; H5P_genplist_t *plist; /* Property list pointer */ H5FD_t *ret_value; FUNC_ENTER_NOAPI(H5FD_open, NULL) /* Get file access property list */ - if(NULL == (plist = H5I_object(fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(0==maxaddr) + if(0 == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") /* Get driver info */ - if(NULL==(driver=H5I_object(driver_id))) + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") - if(NULL==driver->open) + if(NULL == driver->open) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") /* Dispatch to file driver */ - if(HADDR_UNDEF==maxaddr) + if(HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; - if(NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr))) + if(NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") /* @@ -1114,19 +1114,19 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ - if(++file_serial_no==0) { + if(++file_serial_no == 0) { /* (Just error out if we wrap around for now...) */ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number") } /* end if */ - file->fileno=file_serial_no; + file->fileno = file_serial_no; /* Set return value */ - ret_value=file; + ret_value = file; done: /* Can't cleanup 'file' information, since we don't know what type it is */ FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_open() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 22acf89..5c6dc1a 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -297,11 +297,11 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/, FUNC_ENTER_API(H5Pget_fapl_core, FAIL) H5TRACE3("e", "ixx", fapl_id, increment, backing_store); - if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (H5FD_CORE!=H5P_get_driver(plist)) + if(H5FD_CORE != H5P_get_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if (NULL==(fa=H5P_get_driver_info(plist))) + if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") if (increment) @@ -334,12 +334,12 @@ static void * H5FD_core_fapl_get(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; - H5FD_core_fapl_t *fa = NULL; + H5FD_core_fapl_t *fa; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_core_fapl_get, NULL) - if (NULL==(fa=H5MM_calloc(sizeof(H5FD_core_fapl_t)))) + if(NULL == (fa = (H5FD_core_fapl_t *)H5MM_calloc(sizeof(H5FD_core_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") fa->increment = file->increment; @@ -395,12 +395,12 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") if (0==maxaddr || HADDR_UNDEF==maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") - if (ADDR_OVERFLOW(maxaddr)) + if(ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow") - if (H5P_DEFAULT!=fapl_id) { - if(NULL == (plist = H5I_object(fapl_id))) + if(H5P_DEFAULT != fapl_id) { + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = H5P_get_driver_info(plist); + fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist); } /* end if */ /* Build the open flags */ @@ -417,10 +417,10 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, } /* Create the new file struct */ - if (NULL==(file=H5MM_calloc(sizeof(H5FD_core_t)))) + if(NULL == (file = (H5FD_core_t *)H5MM_calloc(sizeof(H5FD_core_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") file->fd = fd; - if (name && *name) + if(name && *name) file->name = H5MM_xstrdup(name); /* @@ -820,12 +820,12 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had H5_ASSIGN_OVERFLOW(new_eof,file->increment*((addr+size)/file->increment),hsize_t,size_t); - if ((addr+size) % file->increment) + if((addr + size) % file->increment) new_eof += file->increment; - if (NULL==file->mem) - x = H5MM_malloc(new_eof); + if(NULL == file->mem) + x = (unsigned char *)H5MM_malloc(new_eof); else - x = H5MM_realloc(file->mem, new_eof); + x = (unsigned char *)H5MM_realloc(file->mem, new_eof); #ifdef H5_CLEAR_MEMORY HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); #endif /* H5_CLEAR_MEMORY */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 5d9058c..c70bfdb 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -277,7 +277,7 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) fa.memb_size = msize; fa.memb_fapl_id = memb_fapl_id; - if(NULL == (plist = H5I_object(fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") ret_value= H5P_set_driver(plist, H5FD_FAMILY, &fa); @@ -321,14 +321,14 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize/*out*/, if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - if (H5FD_FAMILY!=H5P_get_driver(plist)) + if(H5FD_FAMILY != H5P_get_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if (NULL==(fa=H5P_get_driver_info(plist))) + if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - if (msize) + if(msize) *msize = fa->memb_size; - if (memb_fapl_id) { - if(NULL == (plist = H5I_object(fa->memb_fapl_id))) + if(memb_fapl_id) { + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fa->memb_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") *memb_fapl_id = H5P_copy_plist(plist, TRUE); } /* end if */ @@ -365,11 +365,11 @@ H5FD_family_fapl_get(H5FD_t *_file) FUNC_ENTER_NOAPI(H5FD_family_fapl_get, NULL) - if (NULL==(fa=H5MM_calloc(sizeof(H5FD_family_fapl_t)))) + if(NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") fa->memb_size = file->memb_size; - if(NULL == (plist = H5I_object(file->memb_fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->memb_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") fa->memb_fapl_id = H5P_copy_plist(plist, FALSE); @@ -411,7 +411,7 @@ H5FD_family_fapl_copy(const void *_old_fa) FUNC_ENTER_NOAPI(H5FD_family_fapl_copy, NULL) - if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_family_fapl_t)))) + if(NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the fields of the structure */ @@ -423,7 +423,7 @@ H5FD_family_fapl_copy(const void *_old_fa) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") } /* end if */ else { - if(NULL == (plist = H5I_object(old_fa->memb_fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(old_fa->memb_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") new_fa->memb_fapl_id = H5P_copy_plist(plist, FALSE); } /* end else */ @@ -499,17 +499,17 @@ H5FD_family_dxpl_copy(const void *_old_dx) FUNC_ENTER_NOAPI(H5FD_family_dxpl_copy, NULL) - if (NULL==(new_dx=H5MM_malloc(sizeof(H5FD_family_dxpl_t)))) + if(NULL == (new_dx = (H5FD_family_dxpl_t *)H5MM_malloc(sizeof(H5FD_family_dxpl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - memcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t)); + HDmemcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t)); - if(old_dx->memb_dxpl_id==H5P_DATASET_XFER_DEFAULT) { + if(old_dx->memb_dxpl_id == H5P_DATASET_XFER_DEFAULT) { if(H5I_inc_ref(new_dx->memb_dxpl_id, FALSE)<0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") } /* end if */ else { - if(NULL == (plist = H5I_object(old_dx->memb_dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(old_dx->memb_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") new_dx->memb_dxpl_id = H5P_copy_plist(plist, FALSE); } /* end else */ @@ -740,27 +740,29 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, FUNC_ENTER_NOAPI(H5FD_family_open, NULL) /* Check arguments */ - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") - if (0==maxaddr || HADDR_UNDEF==maxaddr) + if(0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") /* Initialize file from file access properties */ - if (NULL==(file=H5MM_calloc(sizeof(H5FD_family_t)))) + if(NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - if (H5P_FILE_ACCESS_DEFAULT==fapl_id) { + if(H5P_FILE_ACCESS_DEFAULT==fapl_id) { file->memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; - if(H5I_inc_ref(file->memb_fapl_id, FALSE)<0) + if(H5I_inc_ref(file->memb_fapl_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") - file->memb_size = 1024*1024*1024; /*1GB. Actual member size to be updated later */ - file->pmem_size = 1024*1024*1024; /*1GB. Member size passed in through property */ + file->memb_size = 1024 * 1024 * 1024; /*1GB. Actual member size to be updated later */ + file->pmem_size = 1024 * 1024 * 1024; /*1GB. Member size passed in through property */ file->mem_newsize = 0; /*New member size used by h5repart only */ - } else { + } /* end if */ + else { H5FD_family_fapl_t *fa; - if(NULL == (plist = H5I_object(fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = H5P_get_driver_info(plist); + fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist); + HDassert(fa); /* New family file size. It's used by h5repart only. */ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) @@ -773,14 +775,14 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, file->memb_fapl_id = fa->memb_fapl_id; } /* end if */ else { - if(NULL == (plist = H5I_object(fa->memb_fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fa->memb_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") file->memb_fapl_id = H5P_copy_plist(plist, FALSE); } /* end else */ file->memb_size = fa->memb_size; /* Actual member size to be updated later */ file->pmem_size = fa->memb_size; /* Member size passed in through property */ file->mem_newsize = fam_newsize; /* New member size passed in through property */ - } + } /* end else */ file->name = H5MM_strdup(name); file->flags = flags; @@ -792,19 +794,19 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique") /* Open all the family members */ - while (1) { + while(1) { sprintf(memb_name, name, file->nmembs); /* Enlarge member array */ - if (file->nmembs>=file->amembs) { - unsigned n = MAX(64, 2*file->amembs); - H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); + if(file->nmembs >= file->amembs) { + unsigned n = MAX(64, 2 * file->amembs); + H5FD_t **x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *)); - if (!x) + if(!x) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members") file->amembs = n; file->memb = x; - } + } /* end if */ /* * Attempt to open file. If the first file cannot be opened then fail; @@ -1059,18 +1061,19 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) FUNC_ENTER_NOAPI(H5FD_family_set_eoa, FAIL) - for (u=0; addr || u<file->nmembs; u++) { + for(u = 0; addr || u < file->nmembs; u++) { /* Enlarge member array */ - if (u>=file->amembs) { - unsigned n = MAX(64, 2*file->amembs); - H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); - if (!x) + if(u >= file->amembs) { + unsigned n = MAX(64, 2 * file->amembs); + H5FD_t **x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *)); + + if(!x) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") file->amembs = n; file->memb = x; file->nmembs = u; - } + } /* end if */ /* Create another file if necessary */ if (u>=file->nmembs || !file->memb[u]) { @@ -1192,7 +1195,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver") - if(offset>(file->memb_size*file->nmembs)) + if(offset > (file->memb_size * file->nmembs)) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "offset is bigger than file size") memb = (int)(offset/file->memb_size); @@ -1242,18 +1245,18 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si * Get the member data transfer property list. If the transfer property * list does not belong to this driver then assume defaults */ - if(NULL == (plist = H5I_object(dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (H5P_DATASET_XFER_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) { - H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist); + if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) { + H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist); - assert(TRUE==H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); assert(dx); memb_dxpl_id = dx->memb_dxpl_id; - } + } /* end if */ /* Read from each member */ - while (size>0) { + while(size > 0) { H5_ASSIGN_OVERFLOW(u,addr /file->memb_size,hsize_t,unsigned); sub = addr % file->memb_size; @@ -1311,7 +1314,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s hsize_t tempreq; unsigned u; /* Local index variable */ H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_family_write, FAIL) @@ -1319,15 +1322,15 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s * Get the member data transfer property list. If the transfer property * list does not belong to this driver then assume defaults. */ - if(NULL == (plist = H5I_object(dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (H5P_DATASET_XFER_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) { - H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist); + if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) { + H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist); - assert(TRUE==H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); - assert(dx); + HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); + HDassert(dx); memb_dxpl_id = dx->memb_dxpl_id; - } + } /* end if */ /* Write to each member */ while (size>0) { diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 9824511..9a34a45 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -192,6 +192,7 @@ static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd size_t size, const void *buf); static herr_t H5FD_log_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +#ifdef OLD_WAY /* * The free list map which causes each request type to use no free lists */ @@ -204,6 +205,7 @@ static herr_t H5FD_log_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); H5FD_MEM_NOLIST, /*lheap*/ \ H5FD_MEM_NOLIST /*ohdr*/ \ } +#endif /* OLD_WAY */ static const H5FD_class_t H5FD_log_g = { "log", /*name */ @@ -358,14 +360,14 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned flags, size_t buf_s if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - fa.logfile=(char*)logfile; - fa.flags=flags; - fa.buf_size=buf_size; - ret_value= H5P_set_driver(plist, H5FD_LOG, &fa); + fa.logfile = (char *)logfile; + fa.flags = flags; + fa.buf_size = buf_size; + ret_value = H5P_set_driver(plist, H5FD_LOG, &fa); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_fapl_log() */ /*------------------------------------------------------------------------- @@ -423,12 +425,12 @@ static void * H5FD_log_fapl_copy(const void *_old_fa) { const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; - H5FD_log_fapl_t *new_fa = H5MM_malloc(sizeof(H5FD_log_fapl_t)); + H5FD_log_fapl_t *new_fa = (H5FD_log_fapl_t *)H5MM_malloc(sizeof(H5FD_log_fapl_t)); void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_log_fapl_copy, NULL) - assert(new_fa); + HDassert(new_fa); /* Copy the general information */ HDmemcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t)); @@ -537,16 +539,17 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") /* Create the new file struct */ - if (NULL==(file=H5MM_calloc(sizeof(H5FD_log_t)))) + if(NULL == (file = (H5FD_log_t *)H5MM_calloc(sizeof(H5FD_log_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = H5P_get_driver_info(plist); + fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist); + HDassert(fa); file->fd = fd; - H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t); + H5_ASSIGN_OVERFLOW(file->eof, sb.st_size, h5_stat_size_t, haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; #ifdef _WIN32 @@ -563,32 +566,32 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, file->fa.flags=fa->flags; /* Check if we are doing any logging at all */ - if(file->fa.flags!=0) { - file->iosize=fa->buf_size; - if(file->fa.flags&H5FD_LOG_FILE_READ) { - file->nread=H5MM_calloc(file->iosize); - assert(file->nread); + if(file->fa.flags != 0) { + file->iosize = fa->buf_size; + if(file->fa.flags & H5FD_LOG_FILE_READ) { + file->nread = (unsigned char *)H5MM_calloc(file->iosize); + HDassert(file->nread); } /* end if */ - if(file->fa.flags&H5FD_LOG_FILE_WRITE) { - file->nwrite=H5MM_calloc(file->iosize); - assert(file->nwrite); + if(file->fa.flags & H5FD_LOG_FILE_WRITE) { + file->nwrite = (unsigned char *)H5MM_calloc(file->iosize); + HDassert(file->nwrite); } /* end if */ - if(file->fa.flags&H5FD_LOG_FLAVOR) { - file->flavor=H5MM_calloc(file->iosize); - assert(file->flavor); + if(file->fa.flags & H5FD_LOG_FLAVOR) { + file->flavor = (unsigned char *)H5MM_calloc(file->iosize); + HDassert(file->flavor); } /* end if */ if(fa->logfile) - file->logfp=HDfopen(fa->logfile,"w"); + file->logfp = HDfopen(fa->logfile, "w"); else - file->logfp=stderr; + file->logfp = stderr; } /* end if */ /* Set return value */ - ret_value=(H5FD_t*)file; + ret_value = (H5FD_t*)file; done: - if(ret_value==NULL) { - if(fd>=0) + if(NULL == ret_value) { + if(fd >= 0) HDclose(fd); } /* end if */ @@ -706,13 +709,13 @@ H5FD_log_close(H5FD_t *_file) } /* end if */ /* Free the logging information */ - if(file->fa.flags&H5FD_LOG_FILE_WRITE) - file->nwrite=H5MM_xfree(file->nwrite); - if(file->fa.flags&H5FD_LOG_FILE_READ) - file->nread=H5MM_xfree(file->nread); - if(file->fa.flags&H5FD_LOG_FLAVOR) - file->flavor=H5MM_xfree(file->flavor); - if(file->logfp!=stderr) + if(file->fa.flags & H5FD_LOG_FILE_WRITE) + file->nwrite = (unsigned char *)H5MM_xfree(file->nwrite); + if(file->fa.flags & H5FD_LOG_FILE_READ) + file->nread = (unsigned char *)H5MM_xfree(file->nread); + if(file->fa.flags & H5FD_LOG_FLAVOR) + file->flavor = (unsigned char *)H5MM_xfree(file->flavor); + if(file->logfp != stderr) fclose(file->logfp); } /* end if */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index eac3f00..4e02a6c 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -326,7 +326,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(MPI_COMM_NULL == comm) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") @@ -393,7 +393,7 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) FUNC_ENTER_API(H5Pget_fapl_mpio, FAIL) H5TRACE3("e", "ixx", fapl_id, comm, info); - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(H5FD_MPIO != H5P_get_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") @@ -471,7 +471,7 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") if(H5FD_MPIO_INDEPENDENT != xfer_mode && H5FD_MPIO_COLLECTIVE != xfer_mode) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode") @@ -517,7 +517,7 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) FUNC_ENTER_API(H5Pget_dxpl_mpio, FAIL) H5TRACE2("e", "ix", dxpl_id, xfer_mode); - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") if(H5FD_MPIO != H5P_get_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") @@ -568,7 +568,7 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") /* Set the transfer mode */ @@ -620,7 +620,7 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") /* Set the transfer mode */ @@ -668,7 +668,7 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") /* Set the transfer mode */ @@ -715,7 +715,7 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") /* Set the transfer mode */ @@ -952,7 +952,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, #endif /* Obtain a pointer to mpio-specific file access properties */ - if(NULL == (plist = (H5P_genplist_t *)H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_get_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 8c25a62..2d6d793 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -207,9 +207,13 @@ static char * my_strdup(const char *s) { char *x; - if (!s) return NULL; - if (NULL==(x=malloc(strlen(s)+1))) return NULL; + + if(!s) + return NULL; + if(NULL == (x = (char *)malloc(strlen(s) + 1))) + return NULL; strcpy(x, s); + return x; } @@ -554,9 +558,9 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, if(H5I_GENPROP_LST != H5Iget_type(fapl_id) || TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1) - if (H5FD_MULTI!=H5Pget_driver(fapl_id)) + if(H5FD_MULTI != H5Pget_driver(fapl_id)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1) - if (NULL==(fa=H5Pget_driver_info(fapl_id))) + if(NULL == (fa= (H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) if (memb_map) @@ -572,7 +576,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, if (memb_name) { for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { if (fa->memb_name[mt]) { - memb_name[mt] = malloc(strlen(fa->memb_name[mt])+1); + memb_name[mt] = (char *)malloc(strlen(fa->memb_name[mt])+1); strcpy(memb_name[mt], fa->memb_name[mt]); } else memb_name[mt] = NULL; @@ -674,7 +678,7 @@ H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1) if (H5FD_MULTI!=H5Pget_driver(dxpl_id)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1) - if (NULL==(dx=H5Pget_driver_info(dxpl_id))) + if(NULL == (dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id))) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) if (memb_dxpl) { @@ -1030,7 +1034,7 @@ static void * H5FD_multi_fapl_copy(const void *_old_fa) { const H5FD_multi_fapl_t *old_fa = (const H5FD_multi_fapl_t*)_old_fa; - H5FD_multi_fapl_t *new_fa = malloc(sizeof(H5FD_multi_fapl_t)); + H5FD_multi_fapl_t *new_fa = (H5FD_multi_fapl_t *)malloc(sizeof(H5FD_multi_fapl_t)); int nerrors = 0; static const char *func="H5FD_multi_fapl_copy"; /* Function Name for error reporting */ @@ -1046,7 +1050,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) if (new_fa->memb_fapl[mt]<0) nerrors++; } if (old_fa->memb_name[mt]) { - new_fa->memb_name[mt] = malloc(strlen(old_fa->memb_name[mt])+1); + new_fa->memb_name[mt] = (char *)malloc(strlen(old_fa->memb_name[mt])+1); assert(new_fa->memb_name[mt]); strcpy(new_fa->memb_name[mt], old_fa->memb_name[mt]); } @@ -1122,7 +1126,7 @@ static void * H5FD_multi_dxpl_copy(const void *_old_dx) { const H5FD_multi_dxpl_t *old_dx = (const H5FD_multi_dxpl_t*)_old_dx; - H5FD_multi_dxpl_t *new_dx = malloc(sizeof(H5FD_multi_dxpl_t)); + H5FD_multi_dxpl_t *new_dx = (H5FD_multi_dxpl_t *)malloc(sizeof(H5FD_multi_dxpl_t)); int nerrors = 0; static const char *func="H5FD_multi_dxpl_copy"; /* Function Name for error reporting */ @@ -1227,14 +1231,14 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, * Initialize the file from the file access properties, using default * values if necessary. */ - if (NULL==(file=calloc((size_t)1, sizeof(H5FD_multi_t)))) + if(NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL) - if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) { + if(H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) { close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE)<0) H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) } - fa = H5Pget_driver_info(fapl_id); + fa = (H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); assert(fa); ALL_MEMBERS(mt) { file->fa.memb_map[mt] = fa->memb_map[mt]; @@ -1785,15 +1789,15 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz H5Eclear2(H5E_DEFAULT); /* Get the data transfer properties */ - if (H5P_FILE_ACCESS_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) { - dx = H5Pget_driver_info(dxpl_id); - } + if(H5P_FILE_ACCESS_DEFAULT != dxpl_id && H5FD_MULTI == H5Pget_driver(dxpl_id)) + dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id); /* Find the file to which this address belongs */ - for (mt=H5FD_MEM_SUPER; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { + for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { mmt = file->fa.memb_map[mt]; - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; - assert(mmt>0 && mmt<H5FD_MEM_NTYPES); + if(H5FD_MEM_DEFAULT == mmt) + mmt = mt; + assert(mmt > 0 && mmt < H5FD_MEM_NTYPES); if (file->fa.memb_addr[mmt]>addr) continue; if (file->fa.memb_addr[mmt]>=start_addr) { @@ -1840,14 +1844,14 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si H5Eclear2(H5E_DEFAULT); /* Get the data transfer properties */ - if (H5P_FILE_ACCESS_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) { - dx = H5Pget_driver_info(dxpl_id); - } + if(H5P_FILE_ACCESS_DEFAULT != dxpl_id && H5FD_MULTI == H5Pget_driver(dxpl_id)) + dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id); /* Find the file to which this address belongs */ - for (mt=H5FD_MEM_SUPER; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { + for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { mmt = file->fa.memb_map[mt]; - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; + if(H5FD_MEM_DEFAULT == mmt) + mmt = mt; assert(mmt>0 && mmt<H5FD_MEM_NTYPES); if (file->fa.memb_addr[mmt]>addr) continue; diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 63b7dc7..1073a87 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -434,11 +434,11 @@ H5FD_sec2_close(H5FD_t *_file) if (HDclose(file->fd)<0) HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - H5FL_FREE(H5FD_sec2_t,file); + (void)H5FL_FREE(H5FD_sec2_t,file); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_sec2_close() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDspace.c b/src/H5FDspace.c index 7bd72cc..9540c8c 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -1405,7 +1405,7 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi if(HADDR_UNDEF == (new_addr = H5FD_alloc(file, type, dxpl_id, new_size))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed") H5_CHECK_OVERFLOW(old_size,hsize_t,size_t); - if(old_size > sizeof(_buf) && NULL == (buf = H5MM_malloc((size_t)old_size))) { + if(old_size > sizeof(_buf) && NULL == (buf = (uint8_t *)H5MM_malloc((size_t)old_size))) { (void)H5FD_free(file, type, dxpl_id, new_addr, new_size); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") } /* end if */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index c66b1ab..f3c59b0 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -370,7 +370,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL) /* Build the return value */ - if(NULL==(file = calloc((size_t)1, sizeof(H5FD_stdio_t)))) + if(NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL) file->fp = f; file->op = H5FD_STDIO_OP_SEEK; @@ -212,11 +212,11 @@ H5FL_reg_init(H5FL_reg_head_t *head) FUNC_ENTER_NOAPI_NOINIT(H5FL_reg_init) /* Allocate a new garbage collection node */ - if (NULL==(new_node = H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the new garbage collection node */ - new_node->list=head; + new_node->list = head; /* Link in to the garbage collection list */ new_node->next=H5FL_reg_gc_head.first; @@ -481,11 +481,11 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) H5MM_xfree(free_list); - free_list=tmp; + free_list = (H5FL_reg_node_t *)tmp; } /* end while */ /* Double check that all the memory on this list is recycled */ - assert(head->list_mem==0); + HDassert(0 == head->list_mem); /* Indicate no free nodes on the free list */ head->list=NULL; @@ -754,11 +754,11 @@ H5FL_blk_init(H5FL_blk_head_t *head) FUNC_ENTER_NOAPI_NOINIT(H5FL_blk_init) /* Allocate a new garbage collection node */ - if (NULL==(new_node = H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the new garbage collection node */ - new_node->pq=head; + new_node->pq = head; /* Link in to the garbage collection list */ new_node->next=H5FL_blk_gc_head.first; @@ -864,7 +864,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* No free list available, or there are no nodes on the list, allocate a new node to give to the user */ else { /* Allocate new node, with room for the page info header and the actual page data */ - if(NULL==(temp=H5FL_malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) + if(NULL == (temp = (H5FL_blk_list_t *)H5FL_malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk") /* Increment the number of blocks allocated */ @@ -1223,22 +1223,22 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) /* Free the block */ H5MM_xfree(list); - list=next; + list = (H5FL_blk_list_t *)next; } /* end while */ /* Free the free list node */ - H5FL_FREE(H5FL_blk_node_t,head->head); + H5FL_FREE(H5FL_blk_node_t, head->head); /* Advance to the next free list */ - head->head=temp; + head->head = (H5FL_blk_node_t *)temp; } /* end while */ /* Indicate no free nodes on the free list */ - head->head=NULL; - head->onlist=0; + head->head = NULL; + head->onlist = 0; /* Double check that all the memory on this list is recycled */ - assert(head->list_mem==0); + HDassert(0 == head->list_mem); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL_blk_gc_list() */ @@ -1373,26 +1373,26 @@ H5FL_arr_init(H5FL_arr_head_t *head) FUNC_ENTER_NOAPI_NOINIT(H5FL_arr_init) /* Allocate a new garbage collection node */ - if (NULL==(new_node = H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) + if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the new garbage collection node */ - new_node->list=head; + new_node->list = head; /* Link in to the garbage collection list */ new_node->next=H5FL_arr_gc_head.first; H5FL_arr_gc_head.first=new_node; /* Allocate room for the free lists */ - if (NULL==(head->list_arr = H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t)))) + if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t)))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the size of each array */ - for(u = 0; u<(size_t)head->maxelem; u++) + for(u = 0; u < (size_t)head->maxelem; u++) head->list_arr[u].size = head->base_size + (head->elem_size * u); /* Indicate that the free list is initialized */ - head->init=1; + head->init = 1; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1532,7 +1532,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(new_obj = H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size))) + if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ @@ -1683,18 +1683,18 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) /* For each free list being garbage collected, walk through the nodes and free them */ arr_free_list=head->list_arr[u].list; while(arr_free_list!=NULL) { - tmp=arr_free_list->next; + tmp = arr_free_list->next; /* Decrement the count of nodes allocated and free the node */ head->allocated--; H5MM_xfree(arr_free_list); - arr_free_list=tmp; + arr_free_list = (H5FL_arr_list_t *)tmp; } /* end while */ /* Indicate no free nodes on the free list */ - head->list_arr[u].list=NULL; - head->list_arr[u].onlist=0; + head->list_arr[u].list = NULL; + head->list_arr[u].onlist = 0; /* Decrement count of free memory on this "array" list */ head->list_mem-=total_mem; diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 1dcced6..c8c5051 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -130,7 +130,7 @@ typedef struct H5FL_reg_head_t { #define H5FL_CALLOC(t) (t *)H5FL_reg_calloc(&(H5FL_REG_NAME(t)) H5FL_TRACK_INFO) /* Free an object of type 't' */ -#define H5FL_FREE(t,obj) H5FL_reg_free(&(H5FL_REG_NAME(t)),obj) +#define H5FL_FREE(t,obj) (t *)H5FL_reg_free(&(H5FL_REG_NAME(t)),obj) /* Re-allocating an object of type 't' is not defined, because these free-lists * only support fixed sized types, like structs, etc.. @@ -119,18 +119,18 @@ H5FO_opened(const H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI_NOFUNC(H5FO_opened) /* Sanity check */ - assert(f); - assert(f->shared); - assert(f->shared->open_objs); - assert(H5F_addr_defined(addr)); + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->open_objs); + HDassert(H5F_addr_defined(addr)); /* Get the object node from the container */ - if((open_obj=H5SL_search(f->shared->open_objs,&addr))!=NULL) { - ret_value=open_obj->obj; - assert(ret_value!=NULL); + if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs,&addr))) { + ret_value = open_obj->obj; + HDassert(ret_value != NULL); } /* end if */ else - ret_value=NULL; + ret_value = NULL; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FO_opened() */ @@ -218,23 +218,23 @@ H5FO_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) FUNC_ENTER_NOAPI(H5FO_delete,FAIL) /* Sanity check */ - assert(f); - assert(f->shared); - assert(f->shared->open_objs); - assert(H5F_addr_defined(addr)); + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->open_objs); + HDassert(H5F_addr_defined(addr)); /* Remove from container */ - if((open_obj=H5SL_remove(f->shared->open_objs,&addr))==NULL) + if(NULL == (open_obj = (H5FO_open_obj_t *)H5SL_remove(f->shared->open_objs, &addr))) HGOTO_ERROR(H5E_CACHE,H5E_CANTRELEASE,FAIL,"can't remove object from container") /* Check if the object was deleted from the file */ if(open_obj->deleted) { - if(H5O_delete(f, dxpl_id, addr)<0) + if(H5O_delete(f, dxpl_id, addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") } /* end if */ /* Release the object information */ - H5FL_FREE(H5FO_open_obj_t,open_obj); + (void)H5FL_FREE(H5FO_open_obj_t, open_obj); done: FUNC_LEAVE_NOAPI(ret_value) @@ -275,10 +275,10 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted) assert(H5F_addr_defined(addr)); /* Get the object node from the container */ - if((open_obj=H5SL_search(f->shared->open_objs,&addr))!=NULL) - open_obj->deleted=deleted; + if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) + open_obj->deleted = deleted; else - ret_value=FAIL; + ret_value = FAIL; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FO_mark() */ @@ -308,19 +308,19 @@ htri_t H5FO_marked(const H5F_t *f, haddr_t addr) { H5FO_open_obj_t *open_obj; /* Information about open object */ - htri_t ret_value=FAIL; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOFUNC(H5FO_marked) /* Sanity check */ - assert(f); - assert(f->shared); - assert(f->shared->open_objs); - assert(H5F_addr_defined(addr)); + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->open_objs); + HDassert(H5F_addr_defined(addr)); /* Get the object node from the container */ - if((open_obj=H5SL_search(f->shared->open_objs,&addr))!=NULL) - ret_value=open_obj->deleted; + if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) + ret_value = open_obj->deleted; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FO_marked() */ @@ -441,12 +441,12 @@ H5FO_top_incr(const H5F_t *f, haddr_t addr) HDassert(H5F_addr_defined(addr)); /* Get the object node from the container */ - if((obj_count = H5SL_search(f->obj_count, &addr)) != NULL) { + if(NULL != (obj_count = (H5FO_obj_count_t *)H5SL_search(f->obj_count, &addr))) { (obj_count->count)++; } /* end if */ else { /* Allocate new opened object information structure */ - if((obj_count = H5FL_MALLOC(H5FO_obj_count_t)) == NULL) + if(NULL == (obj_count = H5FL_MALLOC(H5FO_obj_count_t))) HGOTO_ERROR(H5E_CACHE,H5E_NOSPACE,FAIL,"memory allocation failed") /* Assign information */ @@ -496,17 +496,17 @@ H5FO_top_decr(const H5F_t *f, haddr_t addr) HDassert(H5F_addr_defined(addr)); /* Get the object node from the container */ - if((obj_count = H5SL_search(f->obj_count, &addr)) != NULL) { + if(NULL != (obj_count = (H5FO_obj_count_t *)H5SL_search(f->obj_count, &addr))) { /* Decrement the reference count for the object */ (obj_count->count)--; if(obj_count->count == 0) { /* Remove from container */ - if((obj_count = H5SL_remove(f->obj_count, &addr)) == NULL) + if(NULL == (obj_count = (H5FO_obj_count_t *)H5SL_remove(f->obj_count, &addr))) HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "can't remove object from container") /* Release the object information */ - H5FL_FREE(H5FO_obj_count_t, obj_count); + (void)H5FL_FREE(H5FO_obj_count_t, obj_count); } /* end if */ } /* end if */ else @@ -550,7 +550,7 @@ H5FO_top_count(const H5F_t *f, haddr_t addr) HDassert(H5F_addr_defined(addr)); /* Get the object node from the container */ - if((obj_count = H5SL_search(f->obj_count, &addr)) != NULL) + if(NULL != (obj_count = (H5FO_obj_count_t *)H5SL_search(f->obj_count, &addr))) ret_value = obj_count->count; else ret_value = 0; @@ -184,7 +184,7 @@ HDfprintf(stderr, "%s: Opening free space manager, nclasses = %Zu\n", FUNC, ncla fs_prot.cls_init_udata = cls_init_udata; /* Protect the free space header */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) + if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header") #ifdef QAK HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); @@ -254,7 +254,7 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC); fs_prot.cls_init_udata = NULL; /* Protect the free space header */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE))) + if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header") /* Delete serialized section storage, if there are any */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 8ad9631..acf4eaf 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -181,7 +181,7 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); size = H5FS_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = H5WB_actual(wb, size))) + if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read header from disk */ @@ -320,7 +320,7 @@ HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", F size = H5FS_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = H5WB_actual(wb, size))) + if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to header */ @@ -436,7 +436,7 @@ H5FS_cache_hdr_dest(H5F_t UNUSED *f, H5FS_t *fspace) /* Release the memory for the free space section classes */ if(fspace->sect_cls) - fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls); + fspace->sect_cls = (H5FS_section_class_t *)H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls); /* Free free space info */ H5FL_FREE(H5FS_t, fspace); @@ -713,7 +713,7 @@ HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_typ done: if(buf) - H5FL_BLK_FREE(sect_block, buf); + (void)H5FL_BLK_FREE(sect_block, buf); if(!ret_value && sinfo) (void)H5FS_cache_sinfo_dest(f, sinfo); @@ -941,7 +941,7 @@ HDfprintf(stderr, "%s: sinfo->fspace->alloc_sect_size = %Hu\n", FUNC, sinfo->fsp if(H5F_block_write(f, H5FD_MEM_FSPACE_SINFO, sinfo->fspace->sect_addr, (size_t)sinfo->fspace->sect_size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space sections to disk") - H5FL_BLK_FREE(sect_block, buf); + (void)H5FL_BLK_FREE(sect_block, buf); sinfo->cache_info.is_dirty = FALSE; } /* end if */ @@ -1057,7 +1057,7 @@ H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) } /* end if */ /* Release bins for skip lists */ - sinfo->bins = H5FL_SEQ_FREE(H5FS_bin_t, sinfo->bins); + sinfo->bins = (H5FS_bin_t *)H5FL_SEQ_FREE(H5FS_bin_t, sinfo->bins); /* Release skip list for merging sections */ if(sinfo->merge_list) diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 0ac7b3b..b5d2a6f 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -113,7 +113,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int /* * Load the free space header. */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &fs_prot, NULL, H5AC_READ))) + if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &fs_prot, NULL, H5AC_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Print opening message */ @@ -252,7 +252,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int /* * Load the free space header. */ - if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) + if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Retrieve the client id */ diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 34da067..45d6e74 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -231,7 +231,7 @@ HDfprintf(stderr, "%s: New section info, addr = %a, size = %Hu\n", FUNC, fspace- HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); #endif /* QAK */ /* Protect the free space sections */ - if(NULL == (sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_WRITE))) + if(NULL == (sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_WRITE))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space sections") /* Pin them in the cache */ @@ -455,7 +455,7 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi HDassert(fspace_node->serial_count == 0); /* Remove size tracking list from bin */ - tmp_fspace_node = H5SL_remove(sinfo->bins[bin].bin_list, &fspace_node->sect_size); + tmp_fspace_node = (H5FS_node_t *)H5SL_remove(sinfo->bins[bin].bin_list, &fspace_node->sect_size); if(tmp_fspace_node == NULL || tmp_fspace_node != fspace_node) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") @@ -513,11 +513,11 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "node's bin is empty?") /* Find space node for section's size */ - if((fspace_node = H5SL_search(sinfo->bins[bin].bin_list, §->size)) == NULL) + if((fspace_node = (H5FS_node_t *)H5SL_search(sinfo->bins[bin].bin_list, §->size)) == NULL) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section size node") /* Remove the section's node from the list */ - tmp_sect_node = H5SL_remove(fspace_node->sect_list, §->addr); + tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace_node->sect_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -568,7 +568,7 @@ H5FS_sect_unlink_rest(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, #ifdef QAK HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); #endif /* QAK */ - tmp_sect_node = H5SL_remove(fspace->sinfo->merge_list, §->addr); + tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") } /* end if */ @@ -677,7 +677,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s } /* end if */ else { /* Check for node list of the correct size already */ - fspace_node = H5SL_search(sinfo->bins[bin].bin_list, §->size); + fspace_node = (H5FS_node_t *)H5SL_search(sinfo->bins[bin].bin_list, §->size); } /* end else */ /* Check if we need to create a new skip list for nodes of this size */ @@ -883,7 +883,7 @@ H5FS_sect_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, modified = FALSE; /* Look for neighboring section before new section */ - tmp_sect_node = H5SL_less(fspace->sinfo->merge_list, &(*sect)->addr); + tmp_sect_node = (H5FS_section_info_t *)H5SL_less(fspace->sinfo->merge_list, &(*sect)->addr); /* Check for node before new node able to merge with new node */ if(tmp_sect_node) { @@ -922,7 +922,7 @@ H5FS_sect_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, } /* end if */ /* Look for section after new (or merged) section */ - tmp_sect_node = H5SL_greater(fspace->sinfo->merge_list, &(*sect)->addr); + tmp_sect_node = (H5FS_section_info_t *)H5SL_greater(fspace->sinfo->merge_list, &(*sect)->addr); /* Check for node after new node able to merge with new node */ if(tmp_sect_node) { @@ -980,7 +980,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); #endif /* QAK */ /* Look for neighboring section before new section */ if(fspace->sinfo->merge_list) { - tmp_sect_node = H5SL_less(fspace->sinfo->merge_list, &(*sect)->addr); + tmp_sect_node = (H5FS_section_info_t *)H5SL_less(fspace->sinfo->merge_list, &(*sect)->addr); /* Make certain there isn't a section after the new section */ HDassert(H5SL_greater(fspace->sinfo->merge_list, &(*sect)->addr) == NULL); @@ -1158,11 +1158,11 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Look for large enough free space section in this bin */ if(fspace->sinfo->bins[bin].bin_list) /* Check for large enough list of sections on list */ - if((fspace_node = H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { + if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { const H5FS_section_class_t *cls; /* Class of section */ /* Take first node off of the list (ie. node w/lowest address) */ - if(NULL == (*node = H5SL_remove_first(fspace_node->sect_list))) + if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") /* Get section's class */ @@ -1676,7 +1676,7 @@ HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); HDassert(fspace->sinfo->bins[bin].bin_list); /* Get space node for section's size */ - fspace_node = H5SL_search(fspace->sinfo->bins[bin].bin_list, §->size); + fspace_node = (H5FS_node_t *)H5SL_search(fspace->sinfo->bins[bin].bin_list, §->size); HDassert(fspace_node); /* Adjust serializable/ghost counts */ @@ -1750,7 +1750,7 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN #ifdef QAK HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); #endif /* QAK */ - tmp_sect_node = H5SL_remove(fspace->sinfo->merge_list, §->addr); + tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") } /* end else */ diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 15ca0d9..9d4e6e9 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -63,7 +63,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) HDassert(fwidth >= 0); /* Get property list */ - if(NULL == (plist = H5I_object(f->shared->fcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Retrieve file creation properties */ diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 42a33e0..09e87f2 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -120,8 +120,8 @@ H5F_fake_free(H5F_t *f) if(f) { /* Destroy shared file struct */ if(f->shared) - f->shared = H5FL_FREE(H5F_file_t, f->shared); - H5FL_FREE(H5F_t, f); + f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared); + (void)H5FL_FREE(H5F_t, f); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Fmount.c b/src/H5Fmount.c index b922446..74674c6 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -215,8 +215,8 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, /* Make room in the table */ if(parent->shared->mtab.nmounts >= parent->shared->mtab.nalloc) { unsigned n = MAX(16, 2 * parent->shared->mtab.nalloc); - H5F_mount_t *x = H5MM_realloc(parent->shared->mtab.child, - n * sizeof(parent->shared->mtab.child[0])); + H5F_mount_t *x = (H5F_mount_t *)H5MM_realloc(parent->shared->mtab.child, n * sizeof(parent->shared->mtab.child[0])); + if(!x) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for mount table") parent->shared->mtab.child = x; @@ -463,7 +463,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) { H5G_loc_t loc; H5F_t *child = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fmount, FAIL) H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id); @@ -473,7 +473,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (child = H5I_object_verify(child_id,H5I_FILE))) + if(NULL == (child = (H5F_t *)H5I_object_verify(child_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") if(H5P_DEFAULT == plist_id) plist_id = H5P_FILE_MOUNT_DEFAULT; diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index 354b307..708fbf7 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -219,7 +219,7 @@ H5F_sfile_remove(H5F_file_t *shared) /* Release the shared file node struct */ /* (the shared file info itself is freed elsewhere) */ - H5FL_FREE(H5F_sfile_node_t, curr); + (void)H5FL_FREE(H5F_sfile_node_t, curr); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index cbc5f72..e133b68 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -252,7 +252,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) lf = shared->lf; /* Get the shared file creation property list */ - if(NULL == (c_plist = H5I_object(shared->fcpl_id))) + if(NULL == (c_plist = (H5P_genplist_t *)H5I_object(shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Find the superblock */ @@ -663,7 +663,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5F_super_init, FAIL) /* Get the shared file creation property list */ - if(NULL == (plist = H5I_object(f->shared->fcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* @@ -844,7 +844,7 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5F_super_write, FAIL) /* Get the shared file creation property list */ - if(NULL == (plist = H5I_object(f->shared->fcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Grab values from property list */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 67ea5f7..1d7e514 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -102,7 +102,7 @@ H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, FUNC_ENTER_NOAPI_NOINIT(H5F_get_sohm_mesg_count_test) /* Check arguments */ - if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve count for message type */ @@ -267,7 +267,7 @@ H5G_create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, HDassert(ocrt_info.new_obj); /* Set the return value */ - ret_value = ocrt_info.new_obj; + ret_value = (H5G_t *)ocrt_info.new_obj; done: FUNC_LEAVE_NOAPI(ret_value) @@ -441,15 +441,15 @@ H5Gget_create_plist(hid_t group_id) H5TRACE1("i", "i", group_id); /* Check args */ - if(NULL == (grp = H5I_object_verify(group_id, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Copy the default group creation property list */ - if(NULL == (gcpl_plist = H5I_object(H5P_LST_GROUP_CREATE_g))) + if(NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default group creation property list") if((new_gcpl_id = H5P_copy_plist(gcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") - if(NULL == (new_plist = H5I_object(new_gcpl_id))) + if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_gcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ @@ -872,7 +872,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc) /* Get the file creation property list */ /* (Which is a sub-class of the group creation property class) */ - if(NULL == (fc_plist = H5I_object(f->shared->fcpl_id))) + if(NULL == (fc_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get the group info property */ @@ -914,7 +914,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc) 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))) { - H5FL_FREE(H5G_t, f->shared->root_grp); + (void)H5FL_FREE(H5G_t, f->shared->root_grp); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ @@ -980,7 +980,7 @@ H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Get the property list */ - if(NULL == (gc_plist = H5I_object(gcpl_id))) + if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") /* Get the group info property */ @@ -1019,8 +1019,8 @@ done: } /* end if */ if(grp != NULL) { if(grp->shared != NULL) - H5FL_FREE(H5G_shared_t, grp->shared); - H5FL_FREE(H5G_t,grp); + (void)H5FL_FREE(H5G_shared_t, grp->shared); + (void)H5FL_FREE(H5G_t,grp); } /* end if */ } /* end if */ @@ -1130,7 +1130,7 @@ H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path") /* Check if group was already open */ - if((shared_fo = H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) { + if((shared_fo = (H5G_shared_t *)H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) { /* Clear any errors from H5FO_opened() */ H5E_clear_stack(NULL); @@ -1141,7 +1141,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) { - H5FL_FREE(H5G_shared_t, grp->shared); + (void)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 */ @@ -1178,7 +1178,7 @@ done: if(!ret_value && grp) { H5O_loc_free(&(grp->oloc)); H5G_name_free(&(grp->path)); - H5FL_FREE(H5G_t,grp); + (void)H5FL_FREE(H5G_t,grp); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1230,7 +1230,7 @@ done: if(obj_opened) H5O_close(&(grp->oloc)); if(grp->shared) - H5FL_FREE(H5G_shared_t, grp->shared); + (void)H5FL_FREE(H5G_shared_t, grp->shared); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1272,7 +1272,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") - H5FL_FREE(H5G_shared_t, grp->shared); + (void)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) @@ -1294,11 +1294,11 @@ H5G_close(H5G_t *grp) } /* end else */ if(H5G_name_free(&(grp->path)) < 0) { - H5FL_FREE(H5G_t,grp); + (void)H5FL_FREE(H5G_t, grp); HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't free group entry name") } /* end if */ - H5FL_FREE(H5G_t,grp); + (void)H5FL_FREE(H5G_t, grp); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1329,8 +1329,8 @@ H5G_free(H5G_t *grp) HDassert(grp && grp->shared); - H5FL_FREE(H5G_shared_t, grp->shared); - H5FL_FREE(H5G_t, grp); + (void)H5FL_FREE(H5G_shared_t, grp->shared); + (void)H5FL_FREE(H5G_t, grp); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1622,6 +1622,9 @@ H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) ret_value = (udata->lnk_op.op_func.op_new)(udata->gid, lnk->name, &info, udata->op_data); } break; + + default: + HDassert(0 && "Unknown link op type?!?"); } /* end switch */ done: @@ -1710,7 +1713,7 @@ H5G_free_visit_visited(void *item, void UNUSED *key, void UNUSED *operator_data/ { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_free_visit_visited) - H5FL_FREE(H5_obj_t, item); + (void)H5FL_FREE(H5_obj_t, item); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_free_visit_visited() */ @@ -1759,7 +1762,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) /* Attempt to allocate larger buffer for path */ if(NULL == (new_path = H5MM_realloc(udata->path, len_needed))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate path string") - udata->path = new_path; + udata->path = (char *)new_path; udata->path_buf_size = len_needed; } /* end if */ diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 2e2f215..d060a11 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -164,7 +164,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5G_dense_fh_name_cmp) /* Decode link information */ - if(NULL == (lnk = H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Compare the string values */ diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index b0340a7..f15301e 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -145,7 +145,7 @@ H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t H5O_mesg_operator_t op; /* Message operator */ /* Allocate the link table */ - if((ltable->lnks = H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) + if((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set up user data for iteration */ diff --git a/src/H5Gdense.c b/src/H5Gdense.c index ed53a47..a15d961 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -403,7 +403,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Create serialized form of link */ - if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, link_ptr, lnk) < 0) + if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link") /* Open the fractal heap */ @@ -566,7 +566,7 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda FUNC_ENTER_NOAPI_NOINIT(H5G_dense_lookup_by_idx_fh_cb) /* Decode link information & keep a copy */ - if(NULL == (tmp_lnk = H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, obj))) + if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Copy link information */ @@ -800,7 +800,7 @@ H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5G_dense_bt_ud_t udata; /* User data for iteration callback */ /* Allocate the table to store the links */ - if((ltable->lnks = H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) + if((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set up user data for iteration */ @@ -852,7 +852,7 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) * HDF5 routine, it could attempt to re-protect that direct block for the * heap, causing the HDF5 routine called to fail - QAK) */ - if(NULL == (udata->lnk = H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, obj))) + if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") done: @@ -1047,7 +1047,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_u FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_fh_cb) /* Decode link information */ - if(NULL == (lnk = H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Get the length of the name */ @@ -1245,7 +1245,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_fh_cb) /* Decode link information */ - if(NULL == (lnk = H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Check for removing the link from the creation order index */ @@ -1408,7 +1408,7 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_by_idx_fh_cb) /* Decode link information */ - if(NULL == (udata->lnk = H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, obj))) + if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link") /* Can't operate on link here because the fractal heap block is locked */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index c1b49bc..6a4310f 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -218,7 +218,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) H5O_ginfo_t ginfo; /* Group info property */ /* Get the default property list */ - if(NULL == (gc_plist = H5I_object(H5P_GROUP_CREATE_DEFAULT))) + if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Make a copy of the default property list */ @@ -226,7 +226,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") /* Get pointer to the copied property list */ - if(NULL == (gc_plist = H5I_object(tmp_gcpl))) + if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get the group info property */ diff --git a/src/H5Gent.c b/src/H5Gent.c index e7be62f..7a9e9e5 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -494,7 +494,7 @@ H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream, "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); if(heap) { - lval = H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset); + lval = (const char *)H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset); HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, "Link value:", lval); diff --git a/src/H5Glink.c b/src/H5Glink.c index 75a3e83..6b18c0c 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -240,7 +240,7 @@ H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap, if(ent->type == H5G_CACHED_SLINK) { const char *s; /* Pointer to link value */ - s = H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); + s = (const char *)H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); HDassert(s); /* Copy the link value */ @@ -295,7 +295,7 @@ H5G_ent_to_info(H5F_t *f, H5L_info_t *info, const H5HL_t *heap, if(ent->type == H5G_CACHED_SLINK) { const char *s; /* Pointer to link value */ - s = H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); + s = (const char *)H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); HDassert(s); /* Get the link value size */ @@ -486,7 +486,7 @@ H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, /* Check if the object pointed by the soft link exists in the source file */ if(H5G_loc_info(&grp_loc, tmp_src_lnk.u.soft.name, FALSE, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) { /* Convert soft link to hard link */ - tmp_src_lnk.u.soft.name = H5MM_xfree(tmp_src_lnk.u.soft.name); + tmp_src_lnk.u.soft.name = (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); tmp_src_lnk.type = H5L_TYPE_HARD; tmp_src_lnk.u.hard.addr = oinfo.addr; src_lnk = &tmp_src_lnk; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index f494f99..a3239c2 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -276,7 +276,7 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent, HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:"); - s = H5HL_offset_into(f, udata->heap, key->offset); + s = (const char *)H5HL_offset_into(f, udata->heap, key->offset); HDfprintf(stream, "%s\n", s); } /* end if */ else @@ -369,7 +369,7 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1 size = H5G_node_size_real(f); /* Get a pointer to a buffer that's large enough for node */ - if(NULL == (node = H5WB_actual(wb, size))) + if(NULL == (node = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read the serialized symbol table node. */ @@ -496,7 +496,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ size = H5G_node_size_real(f); /* Get a pointer to a buffer that's large enough for node */ - if(NULL == (node = H5WB_actual(wb, size))) + if(NULL == (node = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Serialize symbol table node into buffer */ @@ -599,21 +599,21 @@ done: static herr_t H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_dest); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_dest) /* * Check arguments. */ - assert(sym); + HDassert(sym); /* Verify that node is clean */ - assert (sym->cache_info.is_dirty==FALSE); + HDassert(sym->cache_info.is_dirty == FALSE); if(sym->entry) - sym->entry = H5FL_SEQ_FREE(H5G_entry_t,sym->entry); - H5FL_FREE(H5G_node_t,sym); + sym->entry = (H5G_entry_t *)H5FL_SEQ_FREE(H5G_entry_t, sym->entry); + (void)H5FL_FREE(H5G_node_t, sym); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_node_dest() */ @@ -760,7 +760,7 @@ done: if(sym != NULL) { if(sym->entry != NULL) H5FL_SEQ_FREE(H5G_entry_t, sym->entry); - H5FL_FREE(H5G_node_t, sym); + (void)H5FL_FREE(H5G_node_t, sym); } /* end if */ } /* end if */ @@ -810,7 +810,7 @@ H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, HDassert(rt_key); /* Get base address of heap */ - base = H5HL_offset_into(f, udata->heap, (size_t)0); + base = (const char *)H5HL_offset_into(f, udata->heap, (size_t)0); HDassert(base); /* Get pointers to string names */ @@ -870,7 +870,7 @@ H5G_node_cmp3(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, HDassert(rt_key); /* Get base address of heap */ - base = H5HL_offset_into(f, udata->heap, (size_t)0); + base = (const char *)H5HL_offset_into(f, udata->heap, (size_t)0); HDassert(base); /* left side */ @@ -938,11 +938,11 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key /* * Load the symbol table node for exclusive access. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node") /* Get base address of heap */ - base = H5HL_offset_into(f, udata->common.heap, (size_t)0); + base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0); HDassert(base); /* @@ -1044,11 +1044,11 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, /* * Load the symbol node. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") /* Get base address of heap */ - base = H5HL_offset_into(f, udata->common.heap, (size_t)0); + base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0); HDassert(base); /* @@ -1087,7 +1087,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(H5G_node_create(f, dxpl_id, H5B_INS_FIRST, NULL, NULL, NULL, new_node_p/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node") - if(NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL, H5AC_WRITE))) + if(NULL == (snrt = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node") HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), @@ -1204,7 +1204,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, HDassert(udata && udata->common.heap); /* Load the symbol table */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") /* "Normal" removal of a single entry from the symbol table node */ @@ -1214,7 +1214,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, const char *base; /* Base of heap */ /* Get base address of heap */ - base = H5HL_offset_into(f, udata->common.heap, (size_t)0); + base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0); /* Find the name with a binary search */ rt = sn->nsyms; @@ -1234,7 +1234,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found") /* Get a pointer to the name of the link */ - if(NULL == (lnk.name = H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off))) + if(NULL == (lnk.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link name") /* Set up rest of link structure */ @@ -1243,7 +1243,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, lnk.cset = H5T_CSET_ASCII; if(sn->entry[idx].type == H5G_CACHED_SLINK) { lnk.type = H5L_TYPE_SOFT; - lnk.u.soft.name = H5HL_offset_into(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset); + lnk.u.soft.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset); } /* end if */ else { lnk.type = H5L_TYPE_HARD; @@ -1414,7 +1414,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad HDassert(udata && udata->heap); /* Protect the symbol table node & local heap while we iterate over entries */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") /* @@ -1428,7 +1428,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad const char *name; /* Pointer to link name in heap */ /* Get the pointer to the name of the link in the heap */ - name = H5HL_offset_into(f, udata->heap, ents[u].name_off); + name = (const char *)H5HL_offset_into(f, udata->heap, ents[u].name_off); HDassert(name); /* Convert the entry to a link */ @@ -1491,7 +1491,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr HDassert(num_objs); /* Find the object node and add the number of symbol entries. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") *num_objs += sn->nsyms; @@ -1536,7 +1536,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add HDassert(udata); /* Get a pointer to the symbol table node */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); /* Find the node, locate the object symbol table entry and retrieve the name */ @@ -1674,7 +1674,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, HDassert(udata); /* load the symbol table into memory from the source file */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") /* get the base address of the heap */ @@ -1742,7 +1742,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, /* Construct link information for eventual insertion */ lnk.type = H5L_TYPE_SOFT; - lnk.u.soft.name = H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset); + lnk.u.soft.name = (char *)H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset); } /* else if */ else HDassert(0 && "Unknown entry type"); @@ -1754,7 +1754,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, /* lnk.name = name; */ /* This will be set in callback */ /* Determine name of source object */ - name = H5HL_offset_into(f, heap, src_ent->name_off); + name = (const char *)H5HL_offset_into(f, heap, src_ent->name_off); HDassert(name); /* Insert the new object in the destination file's group */ @@ -1809,7 +1809,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ * Save information about the symbol table node since we can't lock it * because we're about to call an application function. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") /* Check if the link table needs to be extended */ @@ -1818,7 +1818,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ H5O_link_t *x; /* Pointer to larger array of links */ /* Re-allocate the link table */ - if((x = H5MM_realloc(udata->ltable->lnks, sizeof(H5O_link_t) * na)) == NULL) + if(NULL == (x = (H5O_link_t *)H5MM_realloc(udata->ltable->lnks, sizeof(H5O_link_t) * na))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed") udata->ltable->lnks = x; } /* end if */ @@ -1829,7 +1829,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ unsigned linkno; /* Link allocated */ /* Get pointer to link's name in the heap */ - name = H5HL_offset_into(f, udata->heap, sn->entry[u].name_off); + name = (const char *)H5HL_offset_into(f, udata->heap, sn->entry[u].name_off); HDassert(name); /* Determine the link to operate on in the table */ @@ -1923,7 +1923,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, * If we couldn't load the symbol table node, then try loading the * B-tree node. */ - if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) { + if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) { H5G_bt_common_t udata; /*data to pass through B-tree */ H5E_clear_stack(NULL); /* discard that error */ @@ -1948,7 +1948,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, fprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u); if(heap) { - const char *s = H5HL_offset_into(f, heap, sn->entry[u].name_off); + const char *s = (const char *)H5HL_offset_into(f, heap, sn->entry[u].name_off); if(s) fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s); diff --git a/src/H5Gobj.c b/src/H5Gobj.c index e04c12d..76223b7 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -333,7 +333,7 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) HDassert(grp_oloc); /* Retrieve the "link info" structure */ - if((ret_value = H5O_msg_read(grp_oloc, H5O_LINFO_ID, linfo, dxpl_id))) { + if((ret_value = (H5O_linfo_t *)H5O_msg_read(grp_oloc, H5O_LINFO_ID, linfo, dxpl_id))) { /* Check if we don't know how many links there are */ if(ret_value->nlinks == HSIZET_MAX) { /* Check if we are using "dense" link storage */ diff --git a/src/H5Goh.c b/src/H5Goh.c index 7894194..0ea1799 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -232,7 +232,7 @@ H5O_group_get_oloc(hid_t obj_id) FUNC_ENTER_NOAPI_NOINIT(H5O_group_get_oloc) /* Get the group */ - if(NULL == (grp = H5I_object(obj_id))) + if(NULL == (grp = (H5G_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") /* Get the group's object header location */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index a5280b5..85cd086 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -677,7 +677,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) /* Get name offset in heap */ name_off = ent->name_off; - name = H5HL_offset_into(udata->common.f, udata->heap, name_off); + name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, name_off); HDassert(name); udata->name = H5MM_strdup(name); HDassert(udata->name); @@ -896,7 +896,7 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) HDassert(udata && udata->heap); /* Get a pointer to the link name */ - name = H5HL_offset_into(udata->common.f, udata->heap, ent->name_off); + name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, ent->name_off); HDassert(name); /* Convert the entry to a link */ @@ -175,7 +175,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap info") /* Lock the heap header into memory */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load fractal heap header") /* Point fractal heap wrapper at header and bump it's ref count */ @@ -238,7 +238,7 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) #ifdef QAK HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr); #endif /* QAK */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load fractal heap header") #ifdef QAK HDfprintf(stderr, "%s: hdr->rc = %u, hdr->fspace = %p\n", FUNC, hdr->rc, hdr->fspace); @@ -855,7 +855,7 @@ HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr- H5HF_hdr_t *hdr; /* Another pointer to fractal heap header */ /* Lock the heap header into memory */ - if(NULL == (hdr = H5AC_protect(fh->f, dxpl_id, H5AC_FHEAP_HDR, heap_addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(fh->f, dxpl_id, H5AC_FHEAP_HDR, heap_addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* Set the shared heap header's file context for this operation */ @@ -867,7 +867,7 @@ HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr- } /* end if */ /* Release the fractal heap wrapper */ - H5FL_FREE(H5HF_t, fh); + (void)H5FL_FREE(H5HF_t, fh); done: FUNC_LEAVE_NOAPI(ret_value) @@ -905,7 +905,7 @@ H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) #ifdef QAK HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr); #endif /* QAK */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* Check for files using shared heap header */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 23bc28e..579af46 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -291,7 +291,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); size = H5HF_HEADER_SIZE(hdr); /* Get a pointer to a buffer that's large enough for serialized header */ - if(NULL == (buf = H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read header from disk */ @@ -366,7 +366,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); hdr->heap_size = size + filter_info_size; /* Re-size current buffer */ - if(NULL == (buf = H5WB_actual(wb, hdr->heap_size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, hdr->heap_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read in I/O filter information */ @@ -490,7 +490,7 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a size = hdr->heap_size; /* Get a pointer to a buffer that's large enough for serialized header */ - if(NULL == (buf = H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to serialized header */ @@ -613,7 +613,7 @@ H5HF_cache_hdr_dest(H5F_t UNUSED *f, H5HF_hdr_t *hdr) H5O_msg_reset(H5O_PLINE_ID, &(hdr->pline)); /* Free the shared info itself */ - H5FL_FREE(H5HF_hdr_t, hdr); + (void)H5FL_FREE(H5HF_hdr_t, hdr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_cache_hdr_dest() */ @@ -760,7 +760,7 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock); /* Get a pointer to a buffer that's large enough for serialized indirect block */ - if(NULL == (buf = H5WB_actual(wb, iblock->size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read indirect block from disk */ @@ -963,7 +963,7 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough for serialized indirect block */ - if(NULL == (buf = H5WB_actual(wb, iblock->size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to buffer for serialized indirect block */ @@ -1109,7 +1109,7 @@ HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC); H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks); /* Free fractal heap indirect block info */ - H5FL_FREE(H5HF_indirect_t, iblock); + (void)H5FL_FREE(H5HF_indirect_t, iblock); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1654,7 +1654,7 @@ HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock); dblock->blk = H5FL_BLK_FREE(direct_block, dblock->blk); /* Free fractal heap direct block info */ - H5FL_FREE(H5HF_direct_t, dblock); + (void)H5FL_FREE(H5HF_direct_t, dblock); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index bbbe26f..6f476b8 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -204,7 +204,7 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* * Load the fractal heap header. */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, NULL, NULL, H5AC_READ))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* Print opening message */ @@ -415,7 +415,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, /* * Load the fractal heap header. */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* @@ -445,7 +445,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, dblock->blk_off_size); /* Allocate space for the free space markers */ - if(NULL == (marker = H5MM_calloc(dblock->size))) + if(NULL == (marker = (uint8_t *)H5MM_calloc(dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the free space information for the heap */ @@ -547,7 +547,7 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, /* * Load the fractal heap header. */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* @@ -731,7 +731,7 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, /* * Load the fractal heap header. */ - if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ))) + if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* Initialize the free space information for the heap */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 9de7bb8..9bc5b20 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -507,7 +507,7 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr par_info.entry = par_entry; /* Protect the direct block */ - if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &dblock_size, &par_info, rw))) + if(NULL == (dblock = (H5HF_direct_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &dblock_size, &par_info, rw))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block") /* Set the return value */ diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index b5be676..29af47f 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -113,13 +113,13 @@ H5HF_dtable_init(H5HF_dtable_t *dtable) dtable->max_dir_blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dtable->cparam.max_direct_size); /* Build table of block sizes for each row */ - if(NULL == (dtable->row_block_size = H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) + if(NULL == (dtable->row_block_size = (hsize_t *)H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block size table") - if(NULL == (dtable->row_block_off = H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) + if(NULL == (dtable->row_block_off = (hsize_t *)H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block offset table") - if(NULL == (dtable->row_tot_dblock_free = H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) + if(NULL == (dtable->row_tot_dblock_free = (hsize_t *)H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table total direct block free space table") - if(NULL == (dtable->row_max_dblock_free = H5MM_malloc(dtable->max_root_rows * sizeof(size_t)))) + if(NULL == (dtable->row_max_dblock_free = (size_t *)H5MM_malloc(dtable->max_root_rows * sizeof(size_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table max. direct block free space table") tmp_block_size = dtable->cparam.start_block_size; acc_block_off = dtable->cparam.start_block_size * dtable->cparam.width; diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 7fedc48..d76e8a9 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -805,7 +805,7 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries") } /* end if */ else - iblock->child_iblocks = H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks); + iblock->child_iblocks = (H5HF_indirect_ptr_t *)H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks); } /* end if */ /* Mark indirect block as dirty */ @@ -1200,7 +1200,7 @@ HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr par_info.entry = par_entry; /* Protect the indirect block */ - if(NULL == (iblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &iblock_nrows, &par_info, rw))) + if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &iblock_nrows, &par_info, rw))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block") *did_protect = TRUE; } /* end if */ diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 81ae03d..9e95c4e 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -407,7 +407,7 @@ H5HF_man_iter_reset(H5HF_block_iter_t *biter) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") /* Free the current location context */ - H5FL_FREE(H5HF_block_loc_t, curr_loc); + (void)H5FL_FREE(H5HF_block_loc_t, curr_loc); /* Advance to next location */ curr_loc = next_loc; @@ -504,7 +504,7 @@ H5HF_man_iter_up(H5HF_block_iter_t *biter) up_loc = biter->curr->up; /* Release this location */ - H5FL_FREE(H5HF_block_loc_t, biter->curr); + (void)H5FL_FREE(H5HF_block_loc_t, biter->curr); /* Point location to next location up */ biter->curr = up_loc; diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 62af976..769b273 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -333,7 +333,7 @@ H5HF_sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) /* Allocate & initialize the class-private (i.e. private shared) information * for this type of section */ - if(NULL == (cls_prvt = H5MM_malloc(sizeof(H5HF_sect_private_t)))) + if(NULL == (cls_prvt = (H5HF_sect_private_t *)H5MM_malloc(sizeof(H5HF_sect_private_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") cls_prvt->hdr = hdr; cls->cls_private = cls_prvt; @@ -372,7 +372,7 @@ H5HF_sect_term_cls(H5FS_section_class_t *cls) HDassert(cls); /* Get pointer to class private info */ - cls_prvt = cls->cls_private; + cls_prvt = (H5HF_sect_private_t *)cls->cls_private; /* Decrement reference count on heap header */ if(H5HF_hdr_decr(cls_prvt->hdr) < 0) @@ -461,7 +461,7 @@ H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on section's indirect block") /* Release the section */ - H5FL_FREE(H5HF_free_section_t, sect); + (void)H5FL_FREE(H5HF_free_section_t, sect); done: FUNC_LEAVE_NOAPI(ret_value) @@ -522,7 +522,7 @@ done: } /* end if */ /* Release the section */ - H5FL_FREE(H5HF_free_section_t, sect); + (void)H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -2159,7 +2159,7 @@ H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t * HDassert(sect); /* Retrieve class private information */ - cls_prvt = cls->cls_private; + cls_prvt = (H5HF_sect_private_t *)cls->cls_private; hdr = cls_prvt->hdr; #ifdef QAK @@ -2464,7 +2464,7 @@ done: HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on shared indirect block") /* Release the section */ - H5FL_FREE(H5HF_free_section_t, sect); + (void)H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -2514,7 +2514,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); sect->u.indirect.dir_nrows = 1; /* Allocate space for the derived row sections */ - if(NULL == (sect->u.indirect.dir_rows = H5MM_malloc(sizeof(H5HF_free_section_t *)))) + if(NULL == (sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *)))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "allocation failed for row section pointer array") /* Atatch the new row section to indirect section */ @@ -2605,7 +2605,7 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); sect->u.indirect.dir_nrows = 0; /* Allocate space for the derived row sections */ - if(NULL == (sect->u.indirect.dir_rows = H5MM_malloc(sizeof(H5HF_free_section_t *) * dir_nrows))) + if(NULL == (sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * dir_nrows))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") } /* end if */ else { @@ -2642,7 +2642,7 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); sect->u.indirect.indir_nents = (indirect_end_entry - indirect_start_entry) + 1; /* Allocate space for the child indirect sections */ - if(NULL == (sect->u.indirect.indir_ents = H5MM_malloc(sizeof(H5HF_free_section_t *) * sect->u.indirect.indir_nents))) + if(NULL == (sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * sect->u.indirect.indir_nents))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array") } /* end if */ else { @@ -3228,7 +3228,7 @@ HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirec HDassert(sect->u.indirect.indir_ents); /* Eliminate direct rows for this section */ - sect->u.indirect.dir_rows = H5MM_xfree(sect->u.indirect.dir_rows); + sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.dir_rows); /* Make new "first row" in indirect section */ if(row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW) @@ -3310,7 +3310,7 @@ HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_of /* Set up direct row & indirect entry information for peer section */ peer_sect->u.indirect.dir_nrows = peer_dir_nrows; - if(NULL == (peer_sect->u.indirect.dir_rows = H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_dir_nrows))) + if(NULL == (peer_sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_dir_nrows))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") peer_sect->u.indirect.indir_nents = 0; peer_sect->u.indirect.indir_ents = NULL; @@ -3365,7 +3365,7 @@ HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_of HDassert(sect->u.indirect.dir_nrows == 0); /* Eliminate direct rows for this section */ - sect->u.indirect.dir_rows = H5MM_xfree(sect->u.indirect.dir_rows); + sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.dir_rows); } /* end else */ done: @@ -3497,7 +3497,7 @@ HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); /* Adjust indirect entry information */ sect->u.indirect.indir_nents--; if(sect->u.indirect.indir_nents == 0) - sect->u.indirect.indir_ents = H5MM_xfree(sect->u.indirect.indir_ents); + sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); } /* end if */ else { H5HF_free_section_t *peer_sect; /* Peer indirect section */ @@ -3571,7 +3571,7 @@ HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); peer_sect->u.indirect.dir_nrows = 0; peer_sect->u.indirect.dir_rows = NULL; peer_sect->u.indirect.indir_nents = peer_nentries; - if(NULL == (peer_sect->u.indirect.indir_ents = H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_nentries))) + if(NULL == (peer_sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array") /* Transfer child indirect sections between current & peer sections */ @@ -3582,7 +3582,7 @@ HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); /* Eliminate indirect entries for this section, if appropriate */ if(sect->u.indirect.indir_nents == 0) - sect->u.indirect.indir_ents = H5MM_xfree(sect->u.indirect.indir_ents); + sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); #ifdef QAK HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indirect.indir_nents); #endif /* QAK */ @@ -3623,7 +3623,7 @@ HDfprintf(stderr, "%s: peer_sect->u.indirect.rc = %u\n", FUNC, peer_sect->u.indi HDassert(sect->u.indirect.indir_nents == 0); /* Eliminate indirect entries for this section */ - sect->u.indirect.indir_ents = H5MM_xfree(sect->u.indirect.indir_ents); + sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); } /* end else */ /* Decrement # of sections which depend on this row */ @@ -3912,7 +3912,7 @@ HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); H5HF_free_section_t **new_dir_rows; /* Pointer to new array of direct row pointers */ /* Extend the first section's row array */ - if(NULL == (new_dir_rows = H5MM_realloc(sect1->u.indirect.dir_rows, sizeof(H5HF_free_section_t *) * new_dir_nrows1))) + if(NULL == (new_dir_rows = (H5HF_free_section_t **)H5MM_realloc(sect1->u.indirect.dir_rows, sizeof(H5HF_free_section_t *) * new_dir_nrows1))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") sect1->u.indirect.dir_rows = new_dir_rows; @@ -3958,7 +3958,7 @@ HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); H5HF_free_section_t **new_indir_ents; /* Pointer to new array of indirect entries */ /* Extend the first section's entry array */ - if(NULL == (new_indir_ents = H5MM_realloc(sect1->u.indirect.indir_ents, sizeof(H5HF_free_section_t *) * new_indir_nents1))) + if(NULL == (new_indir_ents = (H5HF_free_section_t **)H5MM_realloc(sect1->u.indirect.indir_ents, sizeof(H5HF_free_section_t *) * new_indir_nents1))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") sect1->u.indirect.indir_ents = new_indir_ents; @@ -4114,7 +4114,7 @@ HDfprintf(stderr, "%s: par_entry = %u, par_row = %u, par_col = %u\n", FUNC, par_ /* Allocate space for the child indirect sections */ par_sect->u.indirect.indir_nents = 1; - if(NULL == (par_sect->u.indirect.indir_ents = H5MM_malloc(sizeof(H5HF_free_section_t *)))) + if(NULL == (par_sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *)))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array") /* Attach sections together */ @@ -4387,10 +4387,10 @@ H5HF_sect_indirect_free(H5HF_free_section_t *sect) HDassert(sect); /* Release the memory for tracking direct rows */ - sect->u.indirect.dir_rows = H5MM_xfree(sect->u.indirect.dir_rows); + sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.dir_rows); /* Release the memory for tracking indirect entries */ - sect->u.indirect.indir_ents = H5MM_xfree(sect->u.indirect.indir_ents); + sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); /* Check for live reference to an indirect block */ if(sect->sect_info.state == H5FS_SECT_LIVE) { @@ -108,13 +108,6 @@ #define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \ H5HG_SIZEOF_OBJHDR(f)+2)) -/* - * Makes a global heap object pointer undefined, or checks whether one is - * defined. - */ -#define H5HG_undef(HGP) ((HGP)->idx=0) -#define H5HG_defined(HGP) ((HGP)->idx!=0) - /* Private typedefs */ /* PRIVATE PROTOTYPES */ @@ -268,18 +261,18 @@ HDmemset(heap->chunk, 0, size); #endif /* OLD_WAY */ /* Add this heap to the beginning of the CWFS list */ - if (NULL==f->shared->cwfs) { - f->shared->cwfs = H5MM_malloc (H5HG_NCWFS * sizeof(H5HG_heap_t*)); - if (NULL==(f->shared->cwfs)) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \ - "memory allocation failed"); + if(NULL == f->shared->cwfs) { + f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5HG_NCWFS * sizeof(H5HG_heap_t *)); + if(NULL == (f->shared->cwfs)) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") f->shared->cwfs[0] = heap; f->shared->ncwfs = 1; - } else { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, - MIN (f->shared->ncwfs, H5HG_NCWFS-1)*sizeof(H5HG_heap_t*)); + } /* end if */ + else { + HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, + MIN(f->shared->ncwfs, H5HG_NCWFS - 1) * sizeof(H5HG_heap_t *)); f->shared->cwfs[0] = heap; - f->shared->ncwfs = MIN (H5HG_NCWFS, f->shared->ncwfs+1); + f->shared->ncwfs = MIN(H5HG_NCWFS, f->shared->ncwfs+1); } /* Add the heap to the cache */ @@ -457,24 +450,24 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, * free space than this heap. */ if (!f->shared->cwfs) { - f->shared->cwfs = H5MM_malloc (H5HG_NCWFS*sizeof(H5HG_heap_t*)); - if (NULL==f->shared->cwfs) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5HG_NCWFS * sizeof(H5HG_heap_t *)); + if(NULL == f->shared->cwfs) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") f->shared->ncwfs = 1; f->shared->cwfs[0] = heap; - } else if (H5HG_NCWFS==f->shared->ncwfs) { - for (i=H5HG_NCWFS-1; i>=0; --i) { - if (f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, i * sizeof(H5HG_heap_t*)); + } else if(H5HG_NCWFS == f->shared->ncwfs) { + for(i = H5HG_NCWFS - 1; i >= 0; --i) { + if(f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { + HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, i * sizeof(H5HG_heap_t *)); f->shared->cwfs[0] = heap; break; - } - } + } /* end if */ + } /* end for */ } else { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, f->shared->ncwfs*sizeof(H5HG_heap_t*)); + HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *)); f->shared->ncwfs += 1; f->shared->cwfs[0] = heap; - } + } /* end else */ ret_value = heap; @@ -562,29 +555,29 @@ H5HG_dest (H5F_t *f, H5HG_heap_t *heap) { int i; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_dest); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_dest) /* Check arguments */ - assert (heap); + HDassert(heap); /* Verify that node is clean */ - assert (heap->cache_info.is_dirty==FALSE); + HDassert(heap->cache_info.is_dirty == FALSE); - for (i=0; i<f->shared->ncwfs; i++) { - if (f->shared->cwfs[i]==heap) { + for(i = 0; i < f->shared->ncwfs; i++) { + if(f->shared->cwfs[i] == heap) { f->shared->ncwfs -= 1; - HDmemmove (f->shared->cwfs+i, f->shared->cwfs+i+1, (f->shared->ncwfs-i) * sizeof(H5HG_heap_t*)); + HDmemmove(f->shared->cwfs + i, f->shared->cwfs + i + 1, (f->shared->ncwfs - i) * sizeof(H5HG_heap_t *)); break; - } - } + } /* end if */ + } /* end for */ if(heap->chunk) - heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); + heap->chunk = H5FL_BLK_FREE(heap_chunk, heap->chunk); if(heap->obj) - heap->obj = H5FL_SEQ_FREE(H5HG_obj_t,heap->obj); - H5FL_FREE (H5HG_heap_t,heap); + heap->obj = (H5HG_obj_t *)H5FL_SEQ_FREE(H5HG_obj_t, heap->obj); + (void)H5FL_FREE(H5HG_heap_t, heap); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HG_dest() */ @@ -1036,7 +1029,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* HDassert(H5F_addr_defined(addr)); - if ( NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_WRITE)) ) + if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_WRITE)) ) HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); /* Split the free space to make room for the new object */ @@ -1105,7 +1098,7 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/, HDassert(hobj); /* Load the heap */ - if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ))) + if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap") HDassert(hobj->idx < heap->nused); @@ -1191,7 +1184,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) if(adjust!=0) { /* Load the heap */ - if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) + if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); assert (hobj->idx<heap->nused); @@ -1254,7 +1247,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Load the heap */ - if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) + if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); assert (hobj->idx<heap->nused); diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index 0e5aff8..43c1ed0 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -73,7 +73,7 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, assert(indent >= 0); assert(fwidth >= 0); - if (NULL == (h = H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_READ))) + if (NULL == (h = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load global heap collection"); fprintf(stream, "%*sGlobal Heap Collection...\n", indent, ""); @@ -627,24 +627,24 @@ H5HL_dest(H5F_t UNUSED *f, H5HL_t *heap) { H5HL_free_t *fl; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_dest); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_dest) /* check arguments */ - assert(heap); + HDassert(heap); /* Verify that node is clean */ - assert (heap->cache_info.is_dirty==FALSE); + HDassert(heap->cache_info.is_dirty == FALSE); if(heap->chunk) - heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); - while (heap->freelist) { + heap->chunk = H5FL_BLK_FREE(heap_chunk, heap->chunk); + while(heap->freelist) { fl = heap->freelist; heap->freelist = fl->next; - H5FL_FREE(H5HL_free_t,fl); - } - H5FL_FREE(H5HL_t,heap); + (void)H5FL_FREE(H5HL_free_t, fl); + } /* end while */ + (void)H5FL_FREE(H5HL_t, heap); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HL_dest() */ @@ -758,7 +758,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) HDassert(f); HDassert(H5F_addr_defined(addr)); - if(NULL == (ret_value = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, rw))) + if(NULL == (ret_value = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, rw))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap") done: @@ -844,8 +844,6 @@ done: * matzke@llnl.gov * Jul 17 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5HL_free_t * @@ -853,13 +851,16 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_remove_free); - if (fl->prev) fl->prev->next = fl->next; - if (fl->next) fl->next->prev = fl->prev; + if(fl->prev) + fl->prev->next = fl->next; + if(fl->next) + fl->next->prev = fl->prev; - if (!fl->prev) heap->freelist = fl->next; + if(!fl->prev) + heap->freelist = fl->next; - FUNC_LEAVE_NOAPI(H5FL_FREE(H5HL_free_t,fl)); -} + FUNC_LEAVE_NOAPI((H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl)); +} /* end H5HL_remove_free() */ /*------------------------------------------------------------------------- @@ -1312,7 +1313,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) sizeof_hdr= H5HL_SIZEOF_HDR(f); /* Get heap pointer */ - if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE))) + if (NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); /* Check if the heap is contiguous on disk */ @@ -1377,7 +1378,7 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) HDassert(size); /* Get heap pointer */ - if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) + if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") /* Set the size to return */ @@ -1419,7 +1420,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) HDassert(heap_size); /* Get heap pointer */ - if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) + if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") /* Get the total size of the local heap */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index f4211f8..1ebb14f 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -70,7 +70,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int assert(indent >= 0); assert(fwidth >= 0); - if (NULL == (h = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) + if (NULL == (h = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); fprintf(stream, "%*sLocal Heap...\n", indent, ""); @@ -91,7 +91,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int * Traverse the free list and check that all free blocks fall within * the heap and that no two free blocks point to the same region of * the heap. */ - if (NULL==(marker = H5MM_calloc(h->heap_alloc))) + if (NULL==(marker = (uint8_t *)H5MM_calloc(h->heap_alloc))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); @@ -235,11 +235,11 @@ H5HP_sink_max(H5HP_t *heap, size_t loc) } /* end while */ /* Put object into heap at correct location */ - heap->heap[loc].val=val; - heap->heap[loc].obj=obj; + heap->heap[loc].val = val; + heap->heap[loc].obj = (H5HP_info_t *)obj; /* Update heap location for object */ - heap->heap[loc].obj->heap_loc=loc; + heap->heap[loc].obj->heap_loc = loc; FUNC_LEAVE_NOAPI(ret_value); } /* end H5HP_sink_max() */ @@ -304,11 +304,11 @@ H5HP_sink_min(H5HP_t *heap, size_t loc) } /* end while */ /* Put object into heap at correct location */ - heap->heap[loc].val=val; - heap->heap[loc].obj=obj; + heap->heap[loc].val = val; + heap->heap[loc].obj = (H5HP_info_t *)obj; /* Update heap location for object */ - heap->heap[loc].obj->heap_loc=loc; + heap->heap[loc].obj->heap_loc = loc; FUNC_LEAVE_NOAPI(ret_value); } /* end H5HP_sink_min() */ @@ -489,9 +489,9 @@ H5HP_insert(H5HP_t *heap, int val, void *obj) } /* end if */ /* Insert new object at end of heap */ - heap->heap[heap->nobjs].val=val; - heap->heap[heap->nobjs].obj=obj; - heap->heap[heap->nobjs].obj->heap_loc=heap->nobjs; + heap->heap[heap->nobjs].val = val; + heap->heap[heap->nobjs].obj = (H5HP_info_t *)obj; + heap->heap[heap->nobjs].obj->heap_loc = heap->nobjs; /* Restore heap condition */ if(heap->type==H5HP_MAX_HEAP) { @@ -146,10 +146,10 @@ DESCRIPTION static herr_t H5I_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_init_interface); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_init_interface) - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5I_init_interface() */ /*------------------------------------------------------------------------- @@ -175,31 +175,32 @@ H5I_term_interface(void) { H5I_id_type_t *type_ptr; H5I_type_t type; - int n=0; + int n = 0; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_term_interface); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_term_interface) - if (H5_interface_initialize_g) { + if(H5_interface_initialize_g) { /* How many types are still being used? */ - for (type=(H5I_type_t)0; type<H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { - if ((type_ptr=H5I_id_type_list_g[type]) && type_ptr->id_list) + for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) { + if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->id_list) n++; - } + } /* end for */ /* If no types are used then clean up */ - if (0==n) { - for (type=(H5I_type_t)0; type<H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { + if(0 == n) { + for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { type_ptr = H5I_id_type_list_g[type]; H5MM_xfree(type_ptr); H5I_id_type_list_g[type] = NULL; - } - } + } /* end for */ + } /* end if */ /* Mark interface closed */ H5_interface_initialize_g = 0; - } - FUNC_LEAVE_NOAPI(n); -} + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5I_term_interface() */ /*------------------------------------------------------------------------- @@ -226,17 +227,19 @@ H5I_term_interface(void) * *------------------------------------------------------------------------- */ -H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) +H5I_type_t +H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) { - H5I_type_t ret_value; - FUNC_ENTER_API(H5Iregister_type, H5I_BADID); + H5I_type_t ret_value; /* Return value */ - /* Call H5I_register_type with a value of 0 to get a new type */ - ret_value = H5I_register_type((H5I_type_t)0, hash_size, reserved, free_func); + FUNC_ENTER_API(H5Iregister_type, H5I_BADID) + + /* Call H5I_register_type with a value of 0 to get a new type */ + ret_value = H5I_register_type((H5I_type_t)0, hash_size, reserved, free_func); done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Iregister_type() */ /*------------------------------------------------------------------------- @@ -276,100 +279,94 @@ done: * *------------------------------------------------------------------------- */ - -H5I_type_t H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved, H5I_free_t free_func) +H5I_type_t +H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved, + H5I_free_t free_func) { - H5I_type_t ret_value=H5I_BADID; /* type ID to return */ - H5I_id_type_t *type_ptr = NULL; /*ptr to the atomic type*/ - int i; - int done; - - FUNC_ENTER_NOAPI(H5I_register_type, H5I_BADID); - - /* Check that type_id is either a library type or zero */ - if(type_id < 0 || type_id >= H5I_NTYPES) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_BADID, "invalid type ID"); - } - - if(type_id == 0) /* Generate a new H5I_type_t value */ - { - /* Increment the number of types*/ - if (H5I_next_type < MAX_NUM_TYPES) - { - ret_value = H5I_next_type; - H5_INC_ENUM(H5I_type_t, H5I_next_type); - } - else - { - done = 0; - /* Look for a free type to give out */ - for(i = H5I_NTYPES; i < MAX_NUM_TYPES && done==0; i++) - { - if(H5I_id_type_list_g[i] == NULL) - { - /* Found a free type ID */ - ret_value = (H5I_type_t)i; - done = 1; - } - } - - /* Verify that we found a type to give out */ - if(done == 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded."); - } - } - else /* type_id is a library type; use this value. */ - { - ret_value = type_id; - } - - /* Initialize the type */ + H5I_id_type_t *type_ptr = NULL; /*ptr to the atomic type*/ + H5I_type_t ret_value = H5I_BADID; /* type ID to return */ + + FUNC_ENTER_NOAPI(H5I_register_type, H5I_BADID) + + /* Check that type_id is either a library type or zero */ + if(type_id < 0 || type_id >= H5I_NTYPES) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_BADID, "invalid type ID") + + if(type_id == 0) { /* Generate a new H5I_type_t value */ + /* Increment the number of types*/ + if(H5I_next_type < MAX_NUM_TYPES) { + ret_value = H5I_next_type; + H5_INC_ENUM(H5I_type_t, H5I_next_type); + } + else { + hbool_t done; /* Indicate that search was successful */ + int i; /* Local index variable */ + + /* Look for a free type to give out */ + done = FALSE; + for(i = H5I_NTYPES; i < MAX_NUM_TYPES && done == FALSE; i++) { + if(NULL == H5I_id_type_list_g[i]) { + /* Found a free type ID */ + ret_value = (H5I_type_t)i; + done = TRUE; + } /* end if */ + } /* end for */ + + /* Verify that we found a type to give out */ + if(done == FALSE) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded.") + } /* end else */ + } /* end if */ + else /* type_id is a library type; use this value. */ + ret_value = type_id; + + /* Initialize the type */ + /* Check arguments */ #ifdef HASH_SIZE_POWER_2 - if (!POWER_OF_TWO(hash_size) || hash_size == 1) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_BADID, "invalid hash size"); + if(!POWER_OF_TWO(hash_size) || hash_size == 1) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_BADID, "invalid hash size") #endif /* HASH_SIZE_POWER_2 */ - if (H5I_id_type_list_g[ret_value] == NULL) { - /* Allocate the type information for new type */ - if (NULL==(type_ptr = H5MM_calloc(sizeof(H5I_id_type_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed"); - H5I_id_type_list_g[ret_value] = type_ptr; - } else { - /* Get the pointer to the existing type */ - type_ptr = H5I_id_type_list_g[ret_value]; - } - - if (type_ptr->count == 0) { - /* Initialize the ID type structure for new types */ - type_ptr->hash_size = hash_size; - type_ptr->reserved = reserved; - type_ptr->wrapped = 0; - type_ptr->ids = 0; - type_ptr->nextid = reserved; - type_ptr->free_func = free_func; - type_ptr->id_list = H5MM_calloc(hash_size*sizeof(H5I_id_info_t *)); - if (NULL==type_ptr->id_list) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed"); - } + if(NULL == H5I_id_type_list_g[ret_value]) { + /* Allocate the type information for new type */ + if(NULL == (type_ptr = (H5I_id_type_t *)H5MM_calloc(sizeof(H5I_id_type_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed") + H5I_id_type_list_g[ret_value] = type_ptr; + } /* end if */ + else { + /* Get the pointer to the existing type */ + type_ptr = H5I_id_type_list_g[ret_value]; + } /* end else */ + + if(type_ptr->count == 0) { + /* Initialize the ID type structure for new types */ + type_ptr->hash_size = hash_size; + type_ptr->reserved = reserved; + type_ptr->wrapped = 0; + type_ptr->ids = 0; + type_ptr->nextid = reserved; + type_ptr->free_func = free_func; + type_ptr->id_list = (H5I_id_info_t **)H5MM_calloc(hash_size * sizeof(H5I_id_info_t *)); + if(NULL == type_ptr->id_list) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed") + } /* end if */ /* Increment the count of the times this type has been initialized */ type_ptr->count++; - done: - if(ret_value == H5I_BADID) /* Clean up on error */ - { - if (type_ptr != NULL) - { - H5MM_xfree(type_ptr->id_list); - H5MM_xfree(type_ptr); - } - } +done: + if(ret_value == H5I_BADID) { /* Clean up on error */ + if(type_ptr != NULL) { + H5MM_xfree(type_ptr->id_list); + H5MM_xfree(type_ptr); + } /* end if */ + } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_register_type() */ + /*------------------------------------------------------------------------- * Function: H5Itype_exists * @@ -388,21 +385,22 @@ H5I_type_t H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned rese * *------------------------------------------------------------------------- */ -htri_t H5Itype_exists(H5I_type_t type) +htri_t +H5Itype_exists(H5I_type_t type) { htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_API(H5Itype_exists, FAIL); + FUNC_ENTER_API(H5Itype_exists, FAIL) - if (type<=H5I_BADID || type>=H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if (H5I_id_type_list_g[type] == NULL) + if(NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Itype_exists() */ /*------------------------------------------------------------------------- @@ -429,37 +427,37 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members) +herr_t +H5Inmembers(H5I_type_t type, hsize_t *num_members) { int ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Inmembers, FAIL); + FUNC_ENTER_API(H5Inmembers, FAIL) - if( H5I_IS_LIB_TYPE( type ) ) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Validate parameters. This needs to be done here, instead of letting * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ - if (type<=H5I_BADID || type>=H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); - if (NULL==H5I_id_type_list_g[type]) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if(NULL == H5I_id_type_list_g[type]) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") - if (num_members) - { + if(num_members) { int members; - if ((members = H5I_nmembers(type)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members"); + if((members = H5I_nmembers(type)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members") - *num_members=(hsize_t)members; - } + *num_members = (hsize_t)members; + } /* end if */ done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Inmembers() */ /*------------------------------------------------------------------------- @@ -485,19 +483,19 @@ H5I_nmembers(H5I_type_t type) H5I_id_type_t *type_ptr = NULL; int ret_value; - FUNC_ENTER_NOAPI(H5I_nmembers, FAIL); + FUNC_ENTER_NOAPI(H5I_nmembers, FAIL) - if (type<=H5I_BADID || type>=H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); - if (NULL==(type_ptr=H5I_id_type_list_g[type]) || type_ptr->count<=0) + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->count <= 0) HGOTO_DONE(0); /* Set return value */ H5_ASSIGN_OVERFLOW(ret_value, type_ptr->ids, unsigned, int); done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_nmembers() */ /*------------------------------------------------------------------------- @@ -518,22 +516,21 @@ done: * Modifications: *------------------------------------------------------------------------- */ -herr_t H5Iclear_type(H5I_type_t type, hbool_t force) +herr_t +H5Iclear_type(H5I_type_t type, hbool_t force) { - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Iclear_type, FAIL); + FUNC_ENTER_API(H5Iclear_type, FAIL) - if( H5I_IS_LIB_TYPE( type ) ) - { - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - ret_value = H5I_clear_type(type, force, TRUE); + ret_value = H5I_clear_type(type, force, TRUE); - done: - FUNC_LEAVE_API(ret_value); -} +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Iclear_type() */ /*------------------------------------------------------------------------- @@ -573,45 +570,45 @@ herr_t H5Iclear_type(H5I_type_t type, hbool_t force) herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) { - H5I_id_type_t *type_ptr = NULL; /* ptr to the atomic type */ - H5I_id_info_t *cur=NULL; /* Current node being worked with */ - H5I_id_info_t *next=NULL; /* Next node in list */ - H5I_id_info_t *last=NULL; /* Last node seen */ - H5I_id_info_t *tmp=NULL; /* Temporary node ptr */ - int ret_value = SUCCEED; - unsigned delete_node; /* Flag to indicate node should be removed from linked list */ - unsigned i; + H5I_id_type_t *type_ptr; /* ptr to the atomic type */ + unsigned i; /* Local index variable */ + int ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5I_clear_type, FAIL); + FUNC_ENTER_NOAPI(H5I_clear_type, FAIL) - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(type_ptr == NULL || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* * Call free method for all objects in type regardless of their reference * counts. Ignore the return value from from the free method and remove * object from type regardless if FORCE is non-zero. */ - for (i=0; i<type_ptr->hash_size; i++) { - for (cur=type_ptr->id_list[i]; cur; cur=next) { + for(i = 0; i < type_ptr->hash_size; i++) { + H5I_id_info_t *cur; /* Current node being worked with */ + H5I_id_info_t *next; /* Next node in list */ + + for(cur = type_ptr->id_list[i]; cur; cur = next) { + hbool_t delete_node; /* Flag to indicate node should be removed from linked list */ + /* * Do nothing to the object if the reference count is larger than * one and forcing is off. */ - if (!force && (cur->count - (!app_ref * cur->app_count)) >1) { - next=cur->next; + if(!force && (cur->count - (!app_ref * cur->app_count)) > 1) { + next = cur->next; continue; } /* end if */ /* Check for a 'free' function and call it, if it exists */ - if (type_ptr->free_func && (type_ptr->free_func)(cur->obj_ptr)<0) { - if (force) { + if(type_ptr->free_func && (type_ptr->free_func)(cur->obj_ptr) < 0) { + if(force) { #ifdef H5I_DEBUG - if (H5DEBUG(I)) { + if(H5DEBUG(I)) { fprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " "failure ignored\n", (int)type, (unsigned long)(cur->obj_ptr)); @@ -619,20 +616,23 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) #endif /*H5I_DEBUG*/ /* Indicate node should be removed from list */ - delete_node=1; + delete_node = TRUE; } /* end if */ else { /* Indicate node should _NOT_ be remove from list */ - delete_node=0; + delete_node = FALSE; } /* end else */ } /* end if */ else { /* Indicate node should be removed from list */ - delete_node=1; + delete_node = TRUE; } /* end else */ /* Check if we should delete this node or not */ if(delete_node) { + H5I_id_info_t *last; /* Last node seen */ + H5I_id_info_t *tmp; /* Temporary node ptr */ + /* Decrement the number of IDs in the type */ (type_ptr->ids)--; @@ -644,28 +644,28 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) /* list, because the node's 'free' callback could have */ /* make an H5I call, which could potentially change the */ /* order of the nodes on the list - QAK) */ - last=NULL; - tmp=type_ptr->id_list[i]; - while(tmp!=cur) { - assert(tmp!=NULL); - last=tmp; - tmp=tmp->next; + last = NULL; + tmp = type_ptr->id_list[i]; + while(tmp != cur) { + HDassert(tmp != NULL); + last = tmp; + tmp = tmp->next; } /* end while */ /* Delete the node from the list */ - if(last==NULL) { + if(NULL == last) { /* Node at head of list, just advance the list head to next node */ - assert(type_ptr->id_list[i]==cur); + HDassert(type_ptr->id_list[i] == cur); type_ptr->id_list[i] = next; } /* end if */ else { /* Node in middle of list, jump over it */ - assert(last->next==cur); - last->next=next; + HDassert(last->next == cur); + last->next = next; } /* end else */ /* Free the node */ - H5FL_FREE(H5I_id_info_t,cur); + (void)H5FL_FREE(H5I_id_info_t, cur); } /* end if */ else { /* Advance to next node */ @@ -675,8 +675,8 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_clear_type() */ /*------------------------------------------------------------------------- @@ -691,28 +691,27 @@ done: * Return: Zero on success/Negative on failure * * Programmer: Nathaniel Furrer - * James Laird + * James Laird * * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5Idestroy_type(H5I_type_t type) +herr_t +H5Idestroy_type(H5I_type_t type) { - herr_t ret_value; + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Idestroy_type, FAIL); + FUNC_ENTER_API(H5Idestroy_type, FAIL) - if( H5I_IS_LIB_TYPE( type ) ) - { - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - ret_value = H5I_destroy_type(type); + ret_value = H5I_destroy_type(type); - done: - FUNC_LEAVE_API(ret_value); -} +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Idestroy_type() */ /*------------------------------------------------------------------------- @@ -726,37 +725,39 @@ herr_t H5Idestroy_type(H5I_type_t type) * Return: Zero on success/Negative on failure * * Programmer: Nathaniel Furrer - * James Laird + * James Laird * * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5I_destroy_type(H5I_type_t type) +herr_t +H5I_destroy_type(H5I_type_t type) { - herr_t ret_value = FAIL; - H5I_id_type_t *type_ptr = NULL; /* ptr to the atomic type */ + H5I_id_type_t *type_ptr; /* ptr to the atomic type */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5I_destroy_type, FAIL); + FUNC_ENTER_NOAPI(H5I_destroy_type, FAIL) - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(type_ptr == NULL || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + + /* Close/clear/destroy all IDs for this type */ + H5I_clear_type(type, TRUE, FALSE); + H5E_clear_stack(NULL); /*don't care about errors*/ - H5I_clear_type(type, TRUE, FALSE); - H5E_clear_stack(NULL); /*don't care about errors*/ - H5MM_xfree(type_ptr->id_list); + H5MM_xfree(type_ptr->id_list); - H5MM_free(type_ptr); - H5I_id_type_list_g[type] = NULL; - ret_value = 0; + H5MM_free(type_ptr); + H5I_id_type_list_g[type] = NULL; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_destroy_type() */ /*------------------------------------------------------------------------- @@ -775,22 +776,21 @@ done: * *------------------------------------------------------------------------- */ -hid_t H5Iregister(H5I_type_t type, void *object) +hid_t +H5Iregister(H5I_type_t type, void *object) { - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Iregister, H5I_INVALID_HID); + FUNC_ENTER_API(H5Iregister, H5I_INVALID_HID) - if( H5I_IS_LIB_TYPE( type ) ) - { - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - ret_value = H5I_register(type, object, TRUE); + ret_value = H5I_register(type, object, TRUE); - done: - FUNC_LEAVE_API(ret_value); -} +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Iregister() */ /*------------------------------------------------------------------------- @@ -822,25 +822,25 @@ hid_t H5Iregister(H5I_type_t type, void *object) hid_t H5I_register(H5I_type_t type, void *object, hbool_t app_ref) { - H5I_id_type_t *type_ptr=NULL; /*ptr to the type */ - H5I_id_info_t *id_ptr=NULL; /*ptr to the new ID information */ + H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_info_t *id_ptr; /*ptr to the new ID information */ hid_t new_id; /*new ID */ unsigned hash_loc; /*new item's hash table location*/ hid_t next_id; /*next ID to check */ - hid_t ret_value=SUCCEED; /*return value */ H5I_id_info_t *curr_id; /*ptr to the current atom */ unsigned i; /*counter */ + hid_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_NOAPI(H5I_register, FAIL); + FUNC_ENTER_NOAPI(H5I_register, FAIL) /* Check arguments */ - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); - if ((id_ptr = H5FL_MALLOC(H5I_id_info_t)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(NULL == type_ptr || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) + HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the struct & it's ID */ new_id = H5I_MAKE(type, type_ptr->nextid); @@ -851,8 +851,8 @@ H5I_register(H5I_type_t type, void *object, hbool_t app_ref) id_ptr->next = NULL; /* hash bucket already full, prepend to front of chain */ - hash_loc = type_ptr->nextid % (unsigned) type_ptr->hash_size; - if (type_ptr->id_list[hash_loc] != NULL) + hash_loc = type_ptr->nextid % (unsigned)type_ptr->hash_size; + if(type_ptr->id_list[hash_loc] != NULL) id_ptr->next = type_ptr->id_list[hash_loc]; /* Insert into the type */ @@ -865,53 +865,55 @@ H5I_register(H5I_type_t type, void *object, hbool_t app_ref) * wrapping around, thus necessitating checking for duplicate IDs being * handed out. */ - if (type_ptr->nextid > (unsigned)ID_MASK) { + if(type_ptr->nextid > (unsigned)ID_MASK) { type_ptr->wrapped = 1; type_ptr->nextid = type_ptr->reserved; - } + } /* end if */ /* * If we've wrapped around then we need to check for duplicate id's being * handed out. */ - if (type_ptr->wrapped) { + if(type_ptr->wrapped) { /* * Make sure we check all available ID's. If we're about at the end * of the range then wrap around and check the beginning values. If * we check all possible values and didn't find any free ones *then* * we can fail. */ - for (i=type_ptr->reserved; i<ID_MASK; i++) { + for(i = type_ptr->reserved; i < ID_MASK; i++) { /* Handle end of range by wrapping to beginning */ - if (type_ptr->nextid>(unsigned)ID_MASK) + if(type_ptr->nextid > (unsigned)ID_MASK) type_ptr->nextid = type_ptr->reserved; /* new ID to check for */ next_id = H5I_MAKE(type, type_ptr->nextid); - hash_loc = H5I_LOC (type_ptr->nextid, type_ptr->hash_size); + hash_loc = H5I_LOC(type_ptr->nextid, type_ptr->hash_size); curr_id = type_ptr->id_list[hash_loc]; - if (curr_id == NULL) + if(curr_id == NULL) break; /* Ha! this is not likely... */ - while (curr_id) { - if (curr_id->id == next_id) + while(curr_id) { + if(curr_id->id == next_id) break; curr_id = curr_id->next; - } - if (!curr_id) + } /* end while */ + if(!curr_id) break; /* must not have found a match */ type_ptr->nextid++; - } + } /* end for */ - if (i>=(unsigned)ID_MASK) + if(i >= (unsigned)ID_MASK) /* All the IDs are gone! */ - HGOTO_ERROR(H5E_ATOM, H5E_NOIDS, FAIL, "no IDs available in type"); - } + HGOTO_ERROR(H5E_ATOM, H5E_NOIDS, FAIL, "no IDs available in type") + } /* end if */ + + /* Set return value */ ret_value = new_id; - done: - FUNC_LEAVE_NOAPI(ret_value); -} +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_register() */ /*------------------------------------------------------------------------- @@ -933,20 +935,20 @@ H5I_register(H5I_type_t type, void *object, hbool_t app_ref) void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ + H5I_id_info_t *id_ptr; /*ptr to the new atom */ void *ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(H5I_object, NULL); + FUNC_ENTER_NOAPI(H5I_object, NULL) /* General lookup of the ID */ - if (NULL!=(id_ptr = H5I_find_id(id))) { + if(NULL != (id_ptr = H5I_find_id(id))) { /* Get the object pointer to return */ ret_value = id_ptr->obj_ptr; } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end if */ /*------------------------------------------------------------------------- @@ -969,23 +971,24 @@ done: * *------------------------------------------------------------------------- */ -void *H5Iobject_verify(hid_t id, H5I_type_t id_type) +void * +H5Iobject_verify(hid_t id, H5I_type_t id_type) { - void * ret_value; /* Return value */ + void * ret_value; /* Return value */ - FUNC_ENTER_API(H5Iobject_verify, NULL); + FUNC_ENTER_API(H5Iobject_verify, NULL) - if( H5I_IS_LIB_TYPE( id_type ) ) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") + if(H5I_IS_LIB_TYPE(id_type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - if(id_type < 1 || id_type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") + if(id_type < 1 || id_type >= H5I_next_type) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") - ret_value = H5I_object_verify(id, id_type); + ret_value = H5I_object_verify(id, id_type); done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Iobject_verify() */ /*------------------------------------------------------------------------- @@ -1012,18 +1015,18 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ void *ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(H5I_object_verify, NULL); + FUNC_ENTER_NOAPI(H5I_object_verify, NULL) - assert(id_type>=1 && id_type<H5I_next_type); + HDassert(id_type >= 1 && id_type < H5I_next_type); /* Verify that the type of the ID is correct & lookup the ID */ - if(id_type == H5I_TYPE(id) && NULL!=(id_ptr = H5I_find_id(id))) { + if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I_find_id(id))) { /* Get the object pointer to return */ ret_value = id_ptr->obj_ptr; } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ @@ -1051,16 +1054,16 @@ H5I_get_type(hid_t id) { H5I_type_t ret_value = H5I_BADID; - FUNC_ENTER_NOAPI(H5I_get_type, H5I_BADID); + FUNC_ENTER_NOAPI(H5I_get_type, H5I_BADID) - if (id>0) + if(id > 0) ret_value = H5I_TYPE(id); - assert(ret_value>=H5I_BADID && ret_value<H5I_next_type); + HDassert(ret_value >= H5I_BADID && ret_value < H5I_next_type); done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_get_type() */ /*------------------------------------------------------------------------- @@ -1086,19 +1089,19 @@ done: H5I_type_t H5Iget_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; + H5I_type_t ret_value = H5I_BADID; /* Return value */ - FUNC_ENTER_API(H5Iget_type, H5I_BADID); + FUNC_ENTER_API(H5Iget_type, H5I_BADID) H5TRACE1("It", "i", id); ret_value = H5I_get_type(id); - if (ret_value <= H5I_BADID || ret_value >= H5I_next_type || NULL==H5I_object(id)) + if(ret_value <= H5I_BADID || ret_value >= H5I_next_type || NULL == H5I_object(id)) HGOTO_DONE(H5I_BADID); done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Iget_type() */ /*------------------------------------------------------------------------- @@ -1121,21 +1124,22 @@ done: * *------------------------------------------------------------------------- */ -void *H5Iremove_verify(hid_t id, H5I_type_t id_type) +void * +H5Iremove_verify(hid_t id, H5I_type_t id_type) { - void * ret_value; /* Return value */ + void * ret_value; /* Return value */ - FUNC_ENTER_API(H5Iremove_verify, NULL); + FUNC_ENTER_API(H5Iremove_verify, NULL) - if( H5I_IS_LIB_TYPE( id_type ) ) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") + if(H5I_IS_LIB_TYPE(id_type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - /* Remove the id */ - ret_value = H5I_remove_verify(id, id_type); + /* Remove the id */ + ret_value = H5I_remove_verify(id, id_type); - done: - FUNC_LEAVE_API(ret_value); -} +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Iremove_verify() */ /*------------------------------------------------------------------------- @@ -1162,19 +1166,17 @@ H5I_remove_verify(hid_t id, H5I_type_t id_type) { void * ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(H5I_remove_verify, NULL); + FUNC_ENTER_NOAPI(H5I_remove_verify, NULL) - /* Argument checking will be performed by H5I_remove() */ + /* Argument checking will be performed by H5I_remove() */ /* Verify that the type of the ID is correct */ if(id_type == H5I_TYPE(id)) - { ret_value = H5I_remove(id); - } done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_remove_verify() */ @@ -1198,57 +1200,57 @@ done: void * H5I_remove(hid_t id) { - H5I_id_type_t *type_ptr = NULL;/*ptr to the atomic type */ + H5I_id_type_t *type_ptr; /*ptr to the atomic type */ H5I_id_info_t *curr_id; /*ptr to the current atom */ H5I_id_info_t *last_id; /*ptr to the last atom */ H5I_type_t type; /*atom's atomic type */ unsigned hash_loc; /*atom's hash table location */ void * ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(H5I_remove, NULL); + FUNC_ENTER_NOAPI(H5I_remove, NULL) /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type"); + if(type_ptr == NULL || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") /* Get the bucket in which the ID is located */ - hash_loc = (unsigned) H5I_LOC(id, type_ptr->hash_size); + hash_loc = (unsigned)H5I_LOC(id, type_ptr->hash_size); curr_id = type_ptr->id_list[hash_loc]; - if (curr_id == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID"); + if(NULL == curr_id) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID") last_id = NULL; - while (curr_id != NULL) { - if (curr_id->id == id) + while(curr_id != NULL) { + if(curr_id->id == id) break; last_id = curr_id; curr_id = curr_id->next; - } + } /* end while */ - if (curr_id != NULL) { - if (last_id == NULL) { + if(curr_id != NULL) { + if(last_id == NULL) { /* ID is the first in the chain */ type_ptr->id_list[hash_loc] = curr_id->next; } else { last_id->next = curr_id->next; } ret_value = curr_id->obj_ptr; - H5FL_FREE(H5I_id_info_t,curr_id); + (void)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"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID") } /* Decrement the number of IDs in the type */ (type_ptr->ids)--; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_remove() */ /*------------------------------------------------------------------------- @@ -1273,19 +1275,19 @@ H5Idec_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API(H5Idec_ref, FAIL); + FUNC_ENTER_API(H5Idec_ref, FAIL) H5TRACE1("Is", "i", id); /* Check arguments */ - if (id<0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID"); + if(id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual decrement operation */ - if((ret_value = H5I_dec_ref(id, TRUE))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count"); + if((ret_value = H5I_dec_ref(id), TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Idec_ref() */ @@ -1340,22 +1342,22 @@ H5I_dec_ref(hid_t id, hbool_t app_ref) H5I_id_info_t *id_ptr; /*ptr to the new ID */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_dec_ref, FAIL); + FUNC_ENTER_NOAPI(H5I_dec_ref, FAIL) /* Sanity check */ - assert(id>=0); + HDassert(id >= 0); /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(NULL == type_ptr || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") /* General lookup of the ID */ - if ((id_ptr=H5I_find_id(id))==NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID"); + if(NULL == (id_ptr=H5I_find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* * If this is the last reference to the object then invoke the type's @@ -1367,8 +1369,8 @@ H5I_dec_ref(hid_t id, hbool_t app_ref) * * Beware: the free method may call other H5I functions. */ - if (1==id_ptr->count) { - if (!type_ptr->free_func || (type_ptr->free_func)(id_ptr->obj_ptr)>=0) { + if(1 == id_ptr->count) { + if(!type_ptr->free_func || (type_ptr->free_func)(id_ptr->obj_ptr) >= 0) { H5I_remove(id); ret_value = 0; } else { @@ -1383,8 +1385,8 @@ H5I_dec_ref(hid_t id, hbool_t app_ref) } done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_ref() */ /*------------------------------------------------------------------------- @@ -1407,19 +1409,19 @@ H5Iinc_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API(H5Iinc_ref, FAIL); + FUNC_ENTER_API(H5Iinc_ref, FAIL) H5TRACE1("Is", "i", id); /* Check arguments */ - if (id<0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID"); + if(id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual increment operation */ - if((ret_value = H5I_inc_ref(id, TRUE))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count"); + if((ret_value = H5I_inc_ref(id), TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ @@ -1452,33 +1454,34 @@ H5I_inc_ref(hid_t id, hbool_t app_ref) H5I_id_info_t *id_ptr; /*ptr to the ID */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_inc_ref, FAIL); + FUNC_ENTER_NOAPI(H5I_inc_ref, FAIL) /* Sanity check */ - assert(id>=0); + HDassert(id >= 0); /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->count<=0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(!type_ptr || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* General lookup of the ID */ - if (NULL==(id_ptr=H5I_find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID"); + if(NULL == (id_ptr = H5I_find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Adjust reference counts */ ++(id_ptr->count); if (app_ref) ++(id_ptr->app_count); + /* Set return value */ ret_value = app_ref ? id_ptr->app_count : id_ptr->count; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_inc_ref() */ /*------------------------------------------------------------------------- @@ -1501,19 +1504,19 @@ H5Iget_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API(H5Iget_ref, FAIL); + FUNC_ENTER_API(H5Iget_ref, FAIL) H5TRACE1("Is", "i", id); /* Check arguments */ - if (id<0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID"); + if(id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual retrieve operation */ - if((ret_value = H5I_get_ref(id, TRUE))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count"); + if((ret_value = H5I_get_ref(id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ @@ -1546,28 +1549,28 @@ H5I_get_ref(hid_t id, hbool_t app_ref) H5I_id_info_t *id_ptr; /*ptr to the ID */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_get_ref, FAIL); + FUNC_ENTER_NOAPI(H5I_get_ref, FAIL) /* Sanity check */ - assert(id>=0); + HDassert(id >= 0); /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->count<=0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(!type_ptr || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* General lookup of the ID */ - if (NULL==(id_ptr=H5I_find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID"); + if(NULL == (id_ptr = H5I_find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Set return value */ ret_value = app_ref ? id_ptr->app_count : id_ptr->count; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_ref() */ @@ -1592,24 +1595,22 @@ H5Iinc_type_ref(H5I_type_t type) { int ret_value; /* Return value */ - FUNC_ENTER_API(H5Iinc_type_ref, FAIL); + FUNC_ENTER_API(H5Iinc_type_ref, FAIL) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type<=0 || type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type"); + if(type <= 0 || type >= H5I_next_type) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - if( H5I_IS_LIB_TYPE( type ) ) - { - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual increment operation */ - if((ret_value = H5I_inc_type_ref(type))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID type ref count"); + if((ret_value = H5I_inc_type_ref(type)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID type ref count") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ @@ -1636,22 +1637,22 @@ H5I_inc_type_ref(H5I_type_t type) H5I_id_type_t *type_ptr; /* ptr to the type */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_inc_type_ref, FAIL); + FUNC_ENTER_NOAPI(H5I_inc_type_ref, FAIL) /* Sanity check */ - assert(type>0 && type < H5I_next_type); + HDassert(type > 0 && type < H5I_next_type); /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr ) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(!type_ptr) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ - ret_value=++(type_ptr->count); + ret_value = ++(type_ptr->count); done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_inc_type_ref() */ /*------------------------------------------------------------------------- @@ -1678,22 +1679,21 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5Idec_type_ref(H5I_type_t type) +herr_t +H5Idec_type_ref(H5I_type_t type) { - herr_t ret_value; + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Idec_type_ref, FAIL); + FUNC_ENTER_API(H5Idec_type_ref, FAIL) - if( H5I_IS_LIB_TYPE( type ) ) - { - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - ret_value = H5I_dec_type_ref(type); + ret_value = H5I_dec_type_ref(type); - done: - FUNC_LEAVE_API(ret_value); -} +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Idec_type_ref() */ /*------------------------------------------------------------------------- @@ -1724,38 +1724,36 @@ herr_t H5Idec_type_ref(H5I_type_t type) herr_t H5I_dec_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr = NULL; /* ptr to the atomic type */ - herr_t ret_value = FAIL; + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_dec_type_ref, FAIL); + FUNC_ENTER_NOAPI(H5I_dec_type_ref, FAIL) - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(type_ptr == NULL || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* * Decrement the number of users of the atomic type. If this is the * last user of the type then release all atoms from the type and - * free all memory it used. The free function is invoked for each atom - * being freed. + * free all memory it used. The free function is invoked for each atom + * being freed. */ - if (1==type_ptr->count) - { - H5I_destroy_type(type); - ret_value = 0; - } - else - { + if(1 == type_ptr->count) { + H5I_destroy_type(type); + ret_value = 0; + } /* end if */ + else { --(type_ptr->count); - ret_value = type_ptr->count; - } + ret_value = type_ptr->count; + } /* end else */ - done: - FUNC_LEAVE_NOAPI(ret_value); -} +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_dec_type_ref() */ /*------------------------------------------------------------------------- @@ -1779,24 +1777,22 @@ H5Iget_type_ref(H5I_type_t type) { int ret_value; /* Return value */ - FUNC_ENTER_API(H5Iget_type_ref, FAIL); + FUNC_ENTER_API(H5Iget_type_ref, FAIL) H5TRACE1("Is", "It", type); /* Check arguments */ - if (type<=0 || type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type"); + if(type <= 0 || type >= H5I_next_type) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - if( H5I_IS_LIB_TYPE( type ) ) - { - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } + if(H5I_IS_LIB_TYPE(type)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual retrieve operation */ - if((ret_value = H5I_get_type_ref(type))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID type ref count"); + if((ret_value = H5I_get_type_ref(type)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID type ref count") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ @@ -1823,21 +1819,21 @@ H5I_get_type_ref(H5I_type_t type) H5I_id_type_t *type_ptr; /*ptr to the type */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_get_type_ref, FAIL); + FUNC_ENTER_NOAPI(H5I_get_type_ref, FAIL) /* Sanity check */ - assert(type>=0); + HDassert(type >= 0); /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr ) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type"); + if(!type_ptr) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ - ret_value=type_ptr->count; + ret_value = type_ptr->count; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type_ref() */ @@ -1865,13 +1861,14 @@ done: * *------------------------------------------------------------------------- */ -void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) +void * +H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) { void * ret_value; /* Return value */ FUNC_ENTER_API(H5Isearch, NULL) - if( H5I_IS_LIB_TYPE( type ) ) + if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") ret_value = H5I_search(type, func, key); @@ -1909,29 +1906,30 @@ done: void * H5I_search(H5I_type_t type, H5I_search_func_t func, void *key) { - H5I_id_type_t *type_ptr = NULL; /*ptr to the type */ - H5I_id_info_t *id_ptr = NULL; /*ptr to the new ID */ - H5I_id_info_t *next_id = NULL; /*ptr to the next ID */ - unsigned i; /*counter */ + H5I_id_type_t *type_ptr; /*ptr to the type */ void *ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(H5I_search, NULL); + FUNC_ENTER_NOAPI(H5I_search, NULL) /* Check arguments */ - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number"); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if (type_ptr == NULL || type_ptr->count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type"); + if(type_ptr == NULL || type_ptr->count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") /* Only iterate through hash table if there are IDs in group */ if(type_ptr->ids > 0) { + H5I_id_info_t *id_ptr; /*ptr to the new ID */ + H5I_id_info_t *next_id; /*ptr to the next ID */ + unsigned i; /*counter */ + /* Start at the beginning of the array */ - for (i=0; i<type_ptr->hash_size; i++) { + for(i = 0; i < type_ptr->hash_size; i++) { id_ptr = type_ptr->id_list[i]; - while (id_ptr) { - next_id= id_ptr->next; /* Protect against ID being deleted in callback */ - if ((*func)(id_ptr->obj_ptr, id_ptr->id, key)) + while(id_ptr) { + next_id = id_ptr->next; /* Protect against ID being deleted in callback */ + if((*func)(id_ptr->obj_ptr, id_ptr->id, key)) HGOTO_DONE(id_ptr->obj_ptr); /*found the item*/ id_ptr = next_id; } /* end while */ @@ -1939,7 +1937,7 @@ H5I_search(H5I_type_t type, H5I_search_func_t func, void *key) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_search() */ @@ -1967,42 +1965,42 @@ H5I_find_id(hid_t id) H5I_id_info_t *id_ptr; /*ptr to the new ID */ H5I_type_t type; /*ID's type */ unsigned hash_loc; /*bucket pointer */ - H5I_id_info_t *ret_value = NULL; /*return value */ + H5I_id_info_t *ret_value; /*return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_find_id); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_find_id) /* Check arguments */ type = H5I_TYPE(id); - assert(type > H5I_BADID && type < H5I_next_type); + HDassert(type > H5I_BADID && type < H5I_next_type); type_ptr = H5I_id_type_list_g[type]; - assert(type_ptr && type_ptr->count > 0); + HDassert(type_ptr && type_ptr->count > 0); /* Get the bucket in which the ID is located */ hash_loc = (unsigned)H5I_LOC(id, type_ptr->hash_size); id_ptr = type_ptr->id_list[hash_loc]; /* Scan the bucket's linked list for a match */ - last_id=NULL; - while (id_ptr) { - if (id_ptr->id == id) { + last_id = NULL; + while(id_ptr) { + if(id_ptr->id == id) { /* If we found an object, move it to the front of the list, if it isn't there already */ - if(last_id!=NULL) { - last_id->next=id_ptr->next; - id_ptr->next=type_ptr->id_list[hash_loc]; - type_ptr->id_list[hash_loc]=id_ptr; + if(last_id != NULL) { + last_id->next = id_ptr->next; + id_ptr->next = type_ptr->id_list[hash_loc]; + type_ptr->id_list[hash_loc] = id_ptr; } /* end if */ break; } /* end if */ - last_id=id_ptr; + last_id = id_ptr; id_ptr = id_ptr->next; } /* end while */ /* Set the return value */ ret_value = id_ptr; - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I_find_id() */ /*------------------------------------------------------------------------- @@ -2067,17 +2065,17 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - hid_t ret_value; + hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Iget_file_id, FAIL); + FUNC_ENTER_API(H5Iget_file_id, FAIL) H5TRACE1("i", "i", obj_id); - if((ret_value = H5I_get_file_id(obj_id, TRUE))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID"); + if((ret_value = H5I_get_file_id(obj_id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Iget_file_id() */ /*------------------------------------------------------------------------- @@ -2157,7 +2155,7 @@ H5I_debug(H5I_type_t type) unsigned int iu; herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5I_debug, FAIL); + FUNC_ENTER_NOAPI(H5I_debug, FAIL) fprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; @@ -2213,7 +2211,7 @@ H5I_debug(H5I_type_t type) } /* end for */ done: - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5I_debug() */ #endif /* H5I_DEBUG_OUTPUT */ @@ -2071,7 +2071,7 @@ H5L_get_val_real(const H5O_link_t *lnk, void *buf, size_t size) if(H5L_TYPE_SOFT == lnk->type) { /* Copy to output buffer */ if(size > 0 && buf) { - HDstrncpy(buf, lnk->u.soft.name, size); + HDstrncpy((char *)buf, lnk->u.soft.name, size); if(HDstrlen(lnk->u.soft.name) >= size) ((char *)buf)[size - 1] = '\0'; } /* end if */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index ac4fe17..1830097 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -107,9 +107,9 @@ H5L_getenv_prefix_name(char **env_prefix/*in,out*/) *env_prefix = strret + 1; *strret = '\0'; } - return(retptr); + FUNC_LEAVE_NOAPI(retptr) -} +} /* end H5L_getenv_prefix_name() */ /*-------------------------------------------------------------------------- @@ -135,7 +135,7 @@ H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/) fname_len = HDstrlen(file_name); /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = H5MM_malloc(prefix_len + fname_len + 2))) + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") /* Copy the prefix into the buffer */ @@ -471,7 +471,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer") /* Encode the external link information */ - p = ext_link_buf; + p = (uint8_t *)ext_link_buf; *p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */ HDstrcpy((char *)p, file_name); /* Name of file containing external link's object */ p += HDstrlen(file_name) + 1; @@ -177,7 +177,7 @@ H5MM_xstrdup(const char *s) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5MM_xstrdup) if(s) { - ret_value = H5MM_malloc(HDstrlen(s) + 1); + ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1); HDassert(ret_value); HDstrcpy(ret_value, s); } /* end if */ @@ -210,17 +210,17 @@ H5MM_strdup(const char *s) { char *ret_value; - FUNC_ENTER_NOAPI(H5MM_strdup, NULL); + FUNC_ENTER_NOAPI(H5MM_strdup, NULL) - if (!s) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, NULL, "null string"); - if (NULL==(ret_value = H5MM_malloc(HDstrlen(s) + 1))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(!s) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "null string") + if(NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDstrcpy(ret_value, s); done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MM_strdup() */ /*------------------------------------------------------------------------- @@ -147,14 +147,14 @@ H5MP_new_page(H5MP_pool_t *mp, size_t page_size) /* Allocate page */ if(page_size > mp->page_size) { - if(NULL == (new_page = H5MM_malloc(page_size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for page") + if(NULL == (new_page = (H5MP_page_t *)H5MM_malloc(page_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for page") new_page->free_size = page_size - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)); new_page->fac_alloc = FALSE; } /* end if */ else { - if((new_page = H5FL_FAC_MALLOC(mp->page_fac)) == NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for page") + if(NULL == (new_page = (H5MP_page_t *)H5FL_FAC_MALLOC(mp->page_fac))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for page") new_page->free_size = mp->max_size; new_page->fac_alloc = TRUE; } /* end else */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 15613c2..2a9d403 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -156,7 +156,7 @@ H5O_ainfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, done: if(ret_value == NULL && ainfo != NULL) - H5FL_FREE(H5O_ainfo_t, ainfo); + (void)H5FL_FREE(H5O_ainfo_t, ainfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ainfo_decode() */ @@ -311,7 +311,7 @@ H5O_ainfo_free(void *mesg) HDassert(mesg); - H5FL_FREE(H5O_ainfo_t, mesg); + (void)H5FL_FREE(H5O_ainfo_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_ainfo_free() */ @@ -433,7 +433,7 @@ H5O_ainfo_copy_file(H5F_t UNUSED *file_src, void *mesg_src, done: /* Release destination attribute information on failure */ if(ret_value == NULL && ainfo_dst != NULL) - H5FL_FREE(H5O_ainfo_t, ainfo_dst); + (void)H5FL_FREE(H5O_ainfo_t, ainfo_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_ainfo_copy_file() */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index f90e95a..fd53a6d 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -1506,7 +1506,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) */ /* Free memory for chunk image */ - H5FL_BLK_FREE(chunk_image, oh->chunk[null_msg->chunkno].image); + (void)H5FL_BLK_FREE(chunk_image, oh->chunk[null_msg->chunkno].image); /* Remove chunk from list of chunks */ if(null_msg->chunkno < (oh->nchunks - 1)) diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index cdbd94e..5bccc46 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -1024,7 +1024,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Check for shared message */ if(mesg->flags & H5O_MSG_FLAG_SHARED) { /* Update the shared attribute in the SOHM storage */ - if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, mesg->native, NULL) < 0) + if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, (H5A_t *)mesg->native, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage") } /* end if */ else { @@ -1383,8 +1383,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, reference count on shared attributes) */ /* Find out whether the attribute has been opened */ if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, - (atable.attrs[u])->shared->name)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") + (atable.attrs[u])->shared->name)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. If not, still use the message in the attribute table. */ diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 40cc1c8..2311212 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -96,7 +96,7 @@ H5O_btreek_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_fl HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") /* Allocate space for message */ - if(NULL == (mesg = H5MM_calloc(sizeof(H5O_btreek_t)))) + if(NULL == (mesg = (H5O_btreek_t *)H5MM_calloc(sizeof(H5O_btreek_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for v1 B-tree 'K' message") /* Retrieve non-default B-tree 'K' values */ @@ -172,7 +172,7 @@ H5O_btreek_copy(const void *_mesg, void *_dest) /* Sanity check */ HDassert(mesg); - if(!dest && NULL == (dest = H5MM_malloc(sizeof(H5O_btreek_t)))) + if(!dest && NULL == (dest = (H5O_btreek_t *)H5MM_malloc(sizeof(H5O_btreek_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for shared message table message") /* All this message requires is a shallow copy */ diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 433b178..b3f178d 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -205,7 +205,7 @@ H5O_cont_free(void *mesg) HDassert(mesg); - H5FL_FREE(H5O_cont_t, mesg); + (void)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 91400f5..767a2d2 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -861,7 +861,7 @@ H5O_copy_free_addrmap_cb(void *item, void UNUSED *key, void UNUSED *op_data) HDassert(item); /* Release the item */ - H5FL_FREE(H5O_addr_map_t, item); + (void)H5FL_FREE(H5O_addr_map_t, item); FUNC_LEAVE_NOAPI(0) } /* H5O_copy_free_addrmap_cb() */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 01fd925..279f328 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -402,7 +402,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i } /* end for */ /* debug each message */ - if(NULL == (sequence = H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned)))) + if(NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") for(i = 0, mesg_total = 0; i < oh->nmesgs; i++) { const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */ @@ -498,7 +498,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i else HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, ""); } /* end for */ - sequence = H5MM_xfree(sequence); + sequence = (unsigned *)H5MM_xfree(sequence); if(mesg_total != chunk_total) HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); @@ -536,7 +536,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDassert(indent >= 0); HDassert(fwidth >= 0); - if(NULL == (oh = H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* debug */ diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 7ee37a0..9aafe41 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -97,7 +97,7 @@ H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_f HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") /* Allocate space for message */ - if(NULL == (mesg = H5MM_calloc(sizeof(H5O_drvinfo_t)))) + if(NULL == (mesg = (H5O_drvinfo_t *)H5MM_calloc(sizeof(H5O_drvinfo_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message") /* Retrieve driver name */ @@ -110,8 +110,8 @@ H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_f HDassert(mesg->len); /* Allocate space for buffer */ - if(NULL == (mesg->buf = H5MM_malloc(mesg->len))) { - mesg = H5MM_xfree(mesg); + if(NULL == (mesg->buf = (uint8_t *)H5MM_malloc(mesg->len))) { + mesg = (H5O_drvinfo_t *)H5MM_xfree(mesg); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info buffer") } /* end if */ @@ -188,16 +188,16 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest) /* Sanity check */ HDassert(mesg); - if(!dest && NULL == (dest = H5MM_malloc(sizeof(H5O_drvinfo_t)))) + if(!dest && NULL == (dest = (H5O_drvinfo_t *)H5MM_malloc(sizeof(H5O_drvinfo_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for shared message table message") /* Shallow copy the fields */ *dest = *mesg; /* Copy the buffer */ - if(NULL == (dest->buf = H5MM_malloc(mesg->len))) { + if(NULL == (dest->buf = (uint8_t *)H5MM_malloc(mesg->len))) { if(dest != _dest) - dest = H5MM_xfree(dest); + dest = (H5O_drvinfo_t *)H5MM_xfree(dest); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } /* end if */ HDmemcpy(dest->buf, mesg->buf, mesg->len); @@ -270,7 +270,7 @@ H5O_drvinfo_reset(void *_mesg) HDassert(mesg); /* reset */ - mesg->buf = H5MM_xfree(mesg->buf); + mesg->buf = (uint8_t *)H5MM_xfree(mesg->buf); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_drvinfo_reset() */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 5090f9b..ee51e1c 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -100,7 +100,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, HDassert(f); HDassert(p); - if(NULL == (mesg = H5MM_calloc(sizeof(H5O_efl_t)))) + if(NULL == (mesg = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Version */ @@ -126,7 +126,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, if(NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") - s = H5HL_offset_into(f, heap, 0); + s = (const char *)H5HL_offset_into(f, heap, 0); HDassert(s && !*s); @@ -136,7 +136,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, #endif /* Decode the file list */ - mesg->slot = H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)); + mesg->slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)); if(NULL == mesg->slot) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -146,7 +146,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, /* Name */ H5F_DECODE_LENGTH (f, p, mesg->slot[u].name_offset); - s = H5HL_offset_into(f, heap, mesg->slot[u].name_offset); + s = (const char *)H5HL_offset_into(f, heap, mesg->slot[u].name_offset); HDassert(s && *s); mesg->slot[u].name = H5MM_xstrdup (s); HDassert(mesg->slot[u].name); @@ -262,12 +262,12 @@ H5O_efl_copy(const void *_mesg, void *_dest) /* check args */ HDassert(mesg); if(!dest) { - if(NULL == (dest = H5MM_calloc(sizeof(H5O_efl_t))) || - NULL == (dest->slot = H5MM_malloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) + if(NULL == (dest = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t))) || + NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_malloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } else if(dest->nalloc < mesg->nalloc) { H5MM_xfree(dest->slot); - if(NULL == (dest->slot = H5MM_malloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) + if(NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_malloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } dest->heap_addr = mesg->heap_addr; @@ -354,11 +354,11 @@ H5O_efl_reset(void *_mesg) /* reset */ for(u = 0; u < mesg->nused; u++) - mesg->slot[u].name = H5MM_xfree(mesg->slot[u].name); + mesg->slot[u].name = (char *)H5MM_xfree(mesg->slot[u].name); mesg->heap_addr = HADDR_UNDEF; mesg->nused = mesg->nalloc = 0; if(mesg->slot) - mesg->slot = H5MM_xfree(mesg->slot); + mesg->slot = (H5O_efl_entry_t *)H5MM_xfree(mesg->slot); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_efl_reset() */ @@ -435,7 +435,7 @@ H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t *file_dst, HDassert(file_dst); /* Allocate space for the destination efl */ - if(NULL == (efl_dst = H5MM_calloc(sizeof(H5O_efl_t)))) + if(NULL == (efl_dst = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the "top level" information */ @@ -462,7 +462,7 @@ H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t *file_dst, /* allocate array of external file entries */ if(efl_src->nalloc > 0) { size = efl_src->nalloc * sizeof(H5O_efl_entry_t); - if((efl_dst->slot = H5MM_calloc(size)) == NULL) + if((efl_dst->slot = (H5O_efl_entry_t *)H5MM_calloc(size)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy content from the source. Need to update later */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 850a86a..2323fff 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, unsigned UNUSED mesg_fla done: if(ret_value == NULL) if(ginfo != NULL) - H5FL_FREE(H5O_ginfo_t, ginfo); + (void)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); - H5FL_FREE(H5O_ginfo_t, mesg); + (void)H5FL_FREE(H5O_ginfo_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_ginfo_free() */ diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index d96fe82..d1eb2c0 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -166,7 +166,7 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, done: if(ret_value == NULL) if(linfo != NULL) - H5FL_FREE(H5O_linfo_t, linfo); + (void)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); - H5FL_FREE(H5O_linfo_t, mesg); + (void)H5FL_FREE(H5O_linfo_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_linfo_free() */ @@ -391,7 +391,7 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst, HDassert(cpy_info); /* Copy the source message */ - if(NULL == (linfo_dst = H5O_linfo_copy(linfo_src, NULL))) + if(NULL == (linfo_dst = (H5O_linfo_t *)H5O_linfo_copy(linfo_src, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed") /* If we are performing a 'shallow hierarchy' copy, and the links in this @@ -422,7 +422,7 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst, done: if(!ret_value) if(linfo_dst) - H5FL_FREE(H5O_linfo_t, linfo_dst); + (void)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 bdbe055..39cbfc6 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -198,7 +198,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length") /* Get the link's name */ - if(NULL == (lnk->name = H5MM_malloc(len + 1))) + if(NULL == (lnk->name = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(lnk->name, p, len); lnk->name[len] = '\0'; @@ -216,7 +216,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, UINT16DECODE(p, len) if(len == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length") - if(NULL == (lnk->u.soft.name = H5MM_malloc((size_t)len + 1))) + if(NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(lnk->u.soft.name, p, len); lnk->u.soft.name[len] = '\0'; @@ -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); - H5FL_FREE(H5O_link_t, lnk); + (void)H5FL_FREE(H5O_link_t, lnk); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -535,12 +535,12 @@ H5O_link_reset(void *_mesg) if(lnk) { /* Free information for link (but don't free link pointer) */ if(lnk->type == H5L_TYPE_SOFT) - lnk->u.soft.name = H5MM_xfree(lnk->u.soft.name); + lnk->u.soft.name = (char *)H5MM_xfree(lnk->u.soft.name); else if (lnk->type >= H5L_TYPE_UD_MIN) { if(lnk->u.ud.size > 0) lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata); } /* end if */ - lnk->name = H5MM_xfree(lnk->name); + lnk->name = (char *)H5MM_xfree(lnk->name); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -570,7 +570,7 @@ H5O_link_free(void *_mesg) /* Free information for link */ H5O_link_reset(lnk); - H5FL_FREE(H5O_link_t, lnk); + (void)H5FL_FREE(H5O_link_t, lnk); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_link_free() */ @@ -837,7 +837,7 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * default: if(lnk->type >= H5L_TYPE_UD_MIN) { if(lnk->type == H5L_TYPE_EXTERNAL) { - const char * objname = (const char *)lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1); + const char *objname = (const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External File Name:", lnk->u.ud.udata); diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 0ff185f..888d975 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1423,7 +1423,7 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, HDassert(mesg); /* Get the property list */ - if(NULL == (ocpl = H5I_object(ocpl_id))) + if(NULL == (ocpl = (H5P_genplist_t *)H5I_object(ocpl_id))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, 0, "not a property list") /* Get any object header status flags set by properties */ diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 18e35f2..d67b5ce 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -496,16 +496,16 @@ H5O_mtime_reset(void UNUSED *_mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_mtime_free (void *mesg) +H5O_mtime_free(void *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_free); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_free) - assert (mesg); + HDassert(mesg); - H5FL_FREE(time_t,mesg); + (void)H5FL_FREE(time_t, mesg); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_mtime_free() */ /*------------------------------------------------------------------------- diff --git a/src/H5Oname.c b/src/H5Oname.c index 3b84f75..915546b 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -90,29 +90,29 @@ H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flag H5O_name_t *mesg; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_name_decode); + FUNC_ENTER_NOAPI_NOINIT(H5O_name_decode) /* check args */ - assert(f); - assert(p); + HDassert(f); + HDassert(p); /* decode */ - if (NULL==(mesg = H5MM_calloc(sizeof(H5O_name_t))) || - NULL==(mesg->s = H5MM_malloc (HDstrlen((const char*)p)+1))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - HDstrcpy(mesg->s, (const char*)p); + if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t))) || + NULL == (mesg->s = (char *)H5MM_malloc(HDstrlen((const char *)p) + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HDstrcpy(mesg->s, (const char *)p); /* Set return value */ - ret_value=mesg; + ret_value = mesg; done: - if(ret_value==NULL) { + if(NULL == ret_value) { if(mesg) - H5MM_xfree (mesg); + H5MM_xfree(mesg); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_name_decode() */ /*------------------------------------------------------------------------- @@ -174,24 +174,25 @@ H5O_name_copy(const void *_mesg, void *_dest) H5O_name_t *dest = (H5O_name_t *) _dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_name_copy); + FUNC_ENTER_NOAPI_NOINIT(H5O_name_copy) /* check args */ - assert(mesg); - if (!dest && NULL==(dest = H5MM_calloc(sizeof(H5O_name_t)))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HDassert(mesg); + + if(!dest && NULL == (dest = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy */ *dest = *mesg; - if((dest->s = H5MM_xstrdup(mesg->s))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(NULL == (dest->s = H5MM_xstrdup(mesg->s))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set return value */ - ret_value=dest; + ret_value = dest; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_name_copy() */ /*------------------------------------------------------------------------- @@ -253,16 +254,16 @@ H5O_name_reset(void *_mesg) { H5O_name_t *mesg = (H5O_name_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_name_reset); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_name_reset) /* check args */ - assert(mesg); + HDassert(mesg); /* reset */ - mesg->s = H5MM_xfree(mesg->s); + mesg->s = (char *)H5MM_xfree(mesg->s); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_name_reset() */ /*------------------------------------------------------------------------- diff --git a/src/H5Opline.c b/src/H5Opline.c index 73b71ef..593e629 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -543,9 +543,9 @@ H5O_pline_free(void *mesg) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_free) - HDassert (mesg); + HDassert(mesg); - H5FL_FREE(H5O_pline_t, mesg); + (void)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 77e05f2..b2f02b2 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, unsigned UNUSED mesg_ done: if(ret_value == NULL && refcount != NULL) - H5FL_FREE(H5O_refcount_t, refcount); + (void)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); - H5FL_FREE(H5O_refcount_t, mesg); + (void)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 d272379..fe7bf02 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -190,7 +190,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, done: if(!ret_value && sdim) { H5S_extent_release(sdim); - H5FL_FREE(H5S_extent_t, sdim); + (void)H5FL_FREE(H5S_extent_t, sdim); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -414,7 +414,7 @@ H5O_sdspace_free(void *mesg) HDassert(mesg); - H5FL_FREE(H5S_extent_t, mesg); + (void)H5FL_FREE(H5S_extent_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_sdspace_free() */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index aba4ddd..c1ea7de 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -151,7 +151,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough for message */ - if(NULL == (mesg_ptr = H5WB_actual(wb, mesg_size))) + if(NULL == (mesg_ptr = (uint8_t *)H5WB_actual(wb, mesg_size))) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "can't get actual buffer") /* Retrieve the message from the heap */ diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index ed32fda..74fe739 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -88,7 +88,7 @@ H5O_shmesg_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, HDassert(f); HDassert(p); - if(NULL == (mesg = H5MM_calloc(sizeof(H5O_shmesg_table_t)))) + if(NULL == (mesg = (H5O_shmesg_table_t *)H5MM_calloc(sizeof(H5O_shmesg_table_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for shared message table message") /* Retrieve version, table address, and number of indexes */ @@ -163,7 +163,7 @@ H5O_shmesg_copy(const void *_mesg, void *_dest) /* Sanity check */ HDassert(mesg); - if(!dest && NULL == (dest = H5MM_malloc(sizeof(H5O_shmesg_table_t)))) + if(!dest && NULL == (dest = (H5O_shmesg_table_t *)H5MM_malloc(sizeof(H5O_shmesg_table_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for shared message table message") /* All this message requires is a shallow copy */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 521a358..9524f43 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -99,32 +99,32 @@ static void * H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { - H5O_stab_t *stab=NULL; + H5O_stab_t *stab = NULL; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_stab_decode); + FUNC_ENTER_NOAPI_NOINIT(H5O_stab_decode) /* check args */ - assert(f); - assert(p); + HDassert(f); + HDassert(p); /* decode */ - if (NULL==(stab = H5FL_CALLOC(H5O_stab_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(NULL == (stab = H5FL_CALLOC(H5O_stab_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5F_addr_decode(f, &p, &(stab->btree_addr)); H5F_addr_decode(f, &p, &(stab->heap_addr)); /* Set return value */ - ret_value=stab; + ret_value = stab; done: - if(ret_value==NULL) { - if(stab!=NULL) - H5FL_FREE(H5O_stab_t,stab); + if(ret_value == NULL) { + if(stab != NULL) + (void)H5FL_FREE(H5O_stab_t,stab); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_stab_decode() */ /*------------------------------------------------------------------------- @@ -247,16 +247,16 @@ H5O_stab_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED * *------------------------------------------------------------------------- */ static herr_t -H5O_stab_free (void *mesg) +H5O_stab_free(void *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_free); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_free) - assert (mesg); + HDassert(mesg); - H5FL_FREE(H5O_stab_t,mesg); + (void)H5FL_FREE(H5O_stab_t, mesg); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_stab_free() */ /*------------------------------------------------------------------------- @@ -283,7 +283,7 @@ H5O_stab_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *mesg) HDassert(mesg); /* Free the file space for the symbol table */ - if(H5G_stab_delete(f, dxpl_id, mesg) < 0) + if(H5G_stab_delete(f, dxpl_id, (const H5O_stab_t *)mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table") done: @@ -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) - H5FL_FREE(H5O_stab_t, stab_dst); + (void)H5FL_FREE(H5O_stab_t, stab_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_stab_copy_file() */ diff --git a/src/H5Otest.c b/src/H5Otest.c index 359c312..8116ffa 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -107,7 +107,7 @@ H5O_is_attr_dense_test(hid_t oid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for attribute info stored */ @@ -169,7 +169,7 @@ H5O_is_attr_empty_test(hid_t oid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for attribute info stored */ @@ -247,7 +247,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for attribute info stored */ @@ -322,7 +322,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for attribute info stored */ @@ -395,7 +395,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Locate "unknown" message */ diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index 5b0a38a..fe31a6d 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -82,7 +82,7 @@ H5O_unknown_free(void *mesg) HDassert(mesg); - H5FL_FREE(H5O_unknown_t, mesg); + (void)H5FL_FREE(H5O_unknown_t, mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_unknown_free() */ @@ -128,7 +128,7 @@ H5Pcopy(hid_t id) /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id)) { - if((ret_value = H5P_copy_plist(obj, TRUE)) < 0) + if((ret_value = H5P_copy_plist((H5P_genplist_t *)obj, TRUE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list"); } /* end if */ /* Must be property classes */ @@ -136,7 +136,7 @@ H5Pcopy(hid_t id) H5P_genclass_t *copy_class; /* Copy of class */ /* Copy the class */ - if((copy_class = H5P_copy_pclass(obj)) == NULL) + if((copy_class = H5P_copy_pclass((H5P_genclass_t *)obj)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property class"); /* Get an atom for the copied class */ @@ -196,39 +196,39 @@ H5Pcreate_class(hid_t parent, const char *name, H5P_genclass_t *pclass = NULL; /* Property list class created */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Pcreate_class, FAIL); + FUNC_ENTER_API(H5Pcreate_class, FAIL) H5TRACE8("i", "i*sx*xx*xx*x", parent, name, cls_create, create_data, cls_copy, copy_data, cls_close, close_data); /* Check arguments. */ if(H5P_DEFAULT!=parent && (H5I_GENPROP_CLS!=H5I_get_type(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name"); - if((create_data!=NULL && cls_create==NULL) - || (copy_data!=NULL && cls_copy==NULL) - || (close_data!=NULL && cls_close==NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data specified, but no callback provided"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name") + if((create_data != NULL && cls_create == NULL) + || (copy_data != NULL && cls_copy == NULL) + || (close_data != NULL && cls_close == NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data specified, but no callback provided") /* Get the pointer to the parent class */ - if(parent==H5P_DEFAULT) - par_class=NULL; - else if(NULL == (par_class = H5I_object(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class"); + if(parent == H5P_DEFAULT) + par_class = NULL; + else if(NULL == (par_class = (H5P_genclass_t *)H5I_object(parent))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class") /* Create the new property list class */ - if(NULL==(pclass=H5P_create_class(par_class, name, 0, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class"); + if(NULL == (pclass = H5P_create_class(par_class, name, 0, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") done: - if(ret_value<0 && pclass) + if(ret_value < 0 && pclass) H5P_close_class(pclass); - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Pcreate_class() */ @@ -264,7 +264,7 @@ H5Pcreate(hid_t cls_id) H5TRACE1("i", "i", cls_id); /* Check arguments. */ - if(NULL == (pclass = H5I_object_verify(cls_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); /* Create the new property list */ @@ -445,7 +445,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close); /* Check arguments. */ - if(NULL == (pclass = H5I_object_verify(cls_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name"); @@ -614,7 +614,7 @@ H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, prp_delete, prp_copy, prp_cmp, prp_close); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name") @@ -671,7 +671,7 @@ H5Pset(hid_t plist_id, const char *name, void *value) H5TRACE3("e", "i*s*x", plist_id, name, value); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); @@ -727,14 +727,14 @@ H5Pexist(hid_t id, const char *name) /* Check for the existance of the property in the list or class */ if(H5I_GENPROP_LST == H5I_get_type(id)) { - if(NULL == (plist = H5I_object(id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if((ret_value = H5P_exist_plist(plist, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property does not exist in list"); } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { - if(NULL == (pclass = H5I_object(id))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); if((ret_value = H5P_exist_pclass(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property does not exist in class"); @@ -789,7 +789,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property size"); if(H5I_GENPROP_LST == H5I_get_type(id)) { - if(NULL == (plist = H5I_object(id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ @@ -798,7 +798,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { - if(NULL == (pclass = H5I_object(id))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ @@ -844,7 +844,7 @@ H5Pget_class(hid_t plist_id) H5TRACE1("i", "i", plist_id); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Retrieve the property list class */ @@ -907,14 +907,14 @@ H5Pget_nprops(hid_t id, size_t *nprops) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property nprops pointer"); if(H5I_GENPROP_LST == H5I_get_type(id)) { - if(NULL == (plist = H5I_object(id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if(H5P_get_nprops_plist(plist, nprops) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in plist"); } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { - if(NULL == (pclass = H5I_object(id))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); if(H5P_get_nprops_pclass(pclass, nprops, FALSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in pclass"); @@ -967,12 +967,12 @@ H5Pequal(hid_t id1, hid_t id2) /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id1)) { - if(H5P_cmp_plist(obj1, obj2) == 0) + if(H5P_cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2) == 0) ret_value = TRUE; } /* end if */ /* Must be property classes */ else { - if(H5P_cmp_class(obj1, obj2) == 0) + if(H5P_cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) ret_value = TRUE; } /* end else */ @@ -1152,7 +1152,7 @@ H5Pget(hid_t plist_id, const char *name, void *value) H5TRACE3("e", "i*s*x", plist_id, name, value); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); @@ -1204,7 +1204,7 @@ H5Premove(hid_t plist_id, const char *name) H5TRACE2("e", "i*s", plist_id, name); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); @@ -1283,7 +1283,7 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Must be property classes */ else { - if(H5P_copy_prop_pclass(dst_obj, src_obj, name) < 0) + if(H5P_copy_prop_pclass((H5P_genclass_t *)dst_obj, (H5P_genclass_t *)src_obj, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes"); } /* end else */ @@ -1323,7 +1323,7 @@ H5Punregister(hid_t pclass_id, const char *name) H5TRACE2("e", "i*s", pclass_id, name); /* Check arguments. */ - if(NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); @@ -1411,7 +1411,7 @@ H5Pget_class_name(hid_t pclass_id) FUNC_ENTER_API(H5Pget_class_name, NULL); /* Check arguments. */ - if(NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class"); /* Get the property list class name */ @@ -1446,33 +1446,33 @@ hid_t H5Pget_class_parent(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ - H5P_genclass_t *parent=NULL; /* Parent's property class */ + H5P_genclass_t *parent = NULL; /* Parent's property class */ hid_t ret_value; /* return value */ - FUNC_ENTER_API(H5Pget_class_parent, FAIL); + FUNC_ENTER_API(H5Pget_class_parent, FAIL) H5TRACE1("i", "i", pclass_id); /* Check arguments. */ - if(NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") /* Retrieve the property class's parent */ - if((parent = H5P_get_class_parent(pclass)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list"); + if(NULL == (parent = H5P_get_class_parent(pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list") /* Increment the outstanding references to the class object */ if(H5P_access_class(parent, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") done: - if(ret_value<0 && parent) + if(ret_value < 0 && parent) H5P_close_class(parent); - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Pget_class_parent() */ diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 1234735..208fcb2 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -257,7 +257,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, prp_set, prp_get, prp_delete, prp_copy, prp_close); /* Check arguments. */ - if(NULL == (pclass = H5I_object_verify(cls_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name"); @@ -426,7 +426,7 @@ H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value, prp_delete, prp_copy, prp_close); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name") diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 8bc263a..f3bb05b 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -323,7 +323,7 @@ H5P_dxfr_create(hid_t dxpl_id, void UNUSED *create_data) FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_create) /* Check arguments */ - if(NULL == (plist = H5I_object(dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get the driver information */ @@ -372,9 +372,9 @@ H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void UNUSED *copy_data) FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_copy) - if(NULL == (dst_plist = H5I_object(dst_dxpl_id))) + if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(NULL == (src_plist = H5I_object(src_dxpl_id))) + if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Get values from old property list */ @@ -424,7 +424,7 @@ H5P_dxfr_close(hid_t dxpl_id, void UNUSED *close_data) FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_close) /* Check arguments */ - if(NULL == (plist = H5I_object(dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index dd4a56f..8d8177a 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -312,7 +312,7 @@ H5P_facc_create(hid_t fapl_id, void UNUSED *copy_data) FUNC_ENTER_NOAPI_NOINIT(H5P_facc_create) /* Check argument */ - if(NULL == (plist = H5I_object(fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Retrieve driver ID property */ @@ -362,7 +362,7 @@ H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void UNUSED *copy_data) FUNC_ENTER_NOAPI_NOINIT(H5P_facc_copy) /* Get driver ID from source property list */ - if(NULL == (src_plist = H5I_object(src_fapl_id))) + if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") if(H5P_get(src_plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") @@ -376,7 +376,7 @@ H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") /* Set the driver for the destination property list */ - if(NULL == (dst_plist = H5I_object(dst_fapl_id))) + if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") if(H5FD_fapl_open(dst_plist, driver_id, driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") @@ -413,7 +413,7 @@ H5P_facc_close(hid_t fapl_id, void UNUSED *close_data) FUNC_ENTER_NOAPI(H5P_facc_close, FAIL) /* Check argument */ - if(NULL == (plist = H5I_object(fapl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get driver ID property */ @@ -577,17 +577,17 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive void *driver_info; /* VFL driver info */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_set_driver, FAIL); + FUNC_ENTER_NOAPI(H5P_set_driver, FAIL) - if (NULL==H5I_object_verify(new_driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID"); + if(NULL == H5I_object_verify(new_driver_id, H5I_VFL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") - if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) { + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { /* Get the current driver information */ if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info") /* Close the driver for the property list */ if(H5FD_fapl_close(driver_id, driver_info)<0) @@ -596,26 +596,26 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive /* Set the driver for the property list */ if(H5FD_fapl_open(plist, new_driver_id, new_driver_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) { + } else if(TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER)) { /* Get the current driver information */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID"); - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info"); + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") + if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info") /* Close the driver for the property list */ - if(H5FD_dxpl_close(driver_id, driver_info)<0) + if(H5FD_dxpl_close(driver_id, driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver") /* Set the driver for the property list */ - if(H5FD_dxpl_open(plist, new_driver_id, new_driver_info)<0) + if(H5FD_dxpl_open(plist, new_driver_id, new_driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") } else { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list") } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_set_driver() */ @@ -650,23 +650,23 @@ herr_t H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Pset_driver, FAIL); + FUNC_ENTER_API(H5Pset_driver, FAIL) H5TRACE3("e", "ii*x", plist_id, new_driver_id, new_driver_info); /* Check arguments */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - if (NULL==H5I_object_verify(new_driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID"); + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if(NULL == H5I_object_verify(new_driver_id, H5I_VFL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") /* Set the driver */ - if(H5P_set_driver(plist,new_driver_id,new_driver_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info"); + if(H5P_set_driver(plist, new_driver_id, new_driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Pset_driver() */ @@ -763,17 +763,17 @@ H5Pget_driver(hid_t plist_id) H5P_genplist_t *plist; /* Property list pointer */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Pget_driver, FAIL); + FUNC_ENTER_API(H5Pget_driver, FAIL) H5TRACE1("i", "i", plist_id); - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") ret_value = H5P_get_driver(plist); done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_driver() */ /*------------------------------------------------------------------------- @@ -859,14 +859,14 @@ H5Pget_driver_info(hid_t plist_id) FUNC_ENTER_API(H5Pget_driver_info, NULL); - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") - if((ret_value=H5P_get_driver_info(plist))==NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTGET,NULL,"can't get driver info"); + if(NULL == (ret_value = H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver_info() */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 37912e6..a7bad06 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -406,7 +406,7 @@ H5P_init_interface(void) /* Check for parent class */ if(lib_class->par_class_id) { /* Get the pointer to the parent class */ - if(NULL == (par_pclass = H5I_object(*lib_class->par_class_id))) + if(NULL == (par_pclass = (H5P_genclass_t *)H5I_object(*lib_class->par_class_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") } /* end if */ @@ -588,7 +588,7 @@ H5P_copy_pclass(H5P_genclass_t *pclass) curr_node=H5SL_first(pclass->props); while(curr_node!=NULL) { /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(H5SL_item(curr_node),H5P_PROP_WITHIN_CLASS)) == NULL) + if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property"); /* Insert the initialized property into the property list */ @@ -712,11 +712,11 @@ H5P_copy_plist(H5P_genplist_t *old_plist, hbool_t app_ref) curr_node=H5SL_first(old_plist->props); while(curr_node) { /* Get a pointer to the node's property */ - tmp=H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Make a copy of the list's property */ - if((new_prop=H5P_dup_prop(tmp,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); + if(NULL == (new_prop = H5P_dup_prop(tmp, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") /* Call property copy callback, if it exists */ if(new_prop->copy) { @@ -757,7 +757,7 @@ H5P_copy_plist(H5P_genplist_t *old_plist, hbool_t app_ref) curr_node=H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ - tmp=H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only "copy" properties we haven't seen before */ if(nseen==0 || H5SL_search(seen,tmp->name) == NULL) { @@ -848,27 +848,27 @@ done: static H5P_genprop_t * H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) { - H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ + H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_dup_prop); + FUNC_ENTER_NOAPI_NOINIT(H5P_dup_prop) - assert(oprop); - assert(type!=H5P_PROP_WITHIN_UNKNOWN); + HDassert(oprop); + HDassert(type != H5P_PROP_WITHIN_UNKNOWN); /* Allocate the new property */ - if(NULL==(prop = H5FL_MALLOC (H5P_genprop_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(NULL == (prop = H5FL_MALLOC(H5P_genprop_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy basic property information */ - HDmemcpy(prop,oprop,sizeof(H5P_genprop_t)); + HDmemcpy(prop, oprop, sizeof(H5P_genprop_t)); /* Check if we should duplicate the name or share it */ /* Duplicating property for a class */ - if(type==H5P_PROP_WITHIN_CLASS) { - assert(oprop->type==H5P_PROP_WITHIN_CLASS); - assert(oprop->shared_name==0); + if(type == H5P_PROP_WITHIN_CLASS) { + HDassert(oprop->type == H5P_PROP_WITHIN_CLASS); + HDassert(oprop->shared_name == 0); /* Duplicate name */ prop->name = H5MM_xstrdup(oprop->name); @@ -878,48 +878,48 @@ H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) /* Check if we are duplicating a property from a list or a class */ /* Duplicating a property from a list */ - if(oprop->type==H5P_PROP_WITHIN_LIST) { + if(oprop->type == H5P_PROP_WITHIN_LIST) { /* If the old property's name wasn't shared, we have to copy it here also */ if(!oprop->shared_name) prop->name = H5MM_xstrdup(oprop->name); } /* end if */ /* Duplicating a property from a class */ else { - assert(oprop->type==H5P_PROP_WITHIN_CLASS); - assert(oprop->shared_name==0); + HDassert(oprop->type == H5P_PROP_WITHIN_CLASS); + HDassert(oprop->shared_name == 0); /* Share the name */ - prop->shared_name=1; + prop->shared_name = 1; /* Set the type */ - prop->type=type; + prop->type = type; } /* end else */ } /* end else */ /* Duplicate current value, if it exists */ - if(oprop->value!=NULL) { - assert(prop->size>0); - if(NULL==(prop->value = H5MM_malloc (prop->size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - HDmemcpy(prop->value,oprop->value,prop->size); + if(oprop->value != NULL) { + HDassert(prop->size > 0); + if(NULL == (prop->value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HDmemcpy(prop->value, oprop->value, prop->size); } /* end if */ /* Set return value */ - ret_value=prop; + ret_value = prop; done: /* Free any resources allocated */ - if(ret_value==NULL) { - if(prop!=NULL) { - if(prop->name!=NULL) + if(ret_value == NULL) { + if(prop != NULL) { + if(prop->name != NULL) H5MM_xfree(prop->name); - if(prop->value!=NULL) + if(prop->value != NULL) H5MM_xfree(prop->value); - H5FL_FREE(H5P_genprop_t,prop); + (void)H5FL_FREE(H5P_genprop_t, prop); } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_dup_prop() */ @@ -1014,7 +1014,7 @@ done: H5MM_xfree(prop->name); if(prop->value!=NULL) H5MM_xfree(prop->value); - H5FL_FREE(H5P_genprop_t,prop); + (void)H5FL_FREE(H5P_genprop_t, prop); } /* end if */ } /* end if */ @@ -1083,40 +1083,40 @@ H5P_find_prop_plist(H5P_genplist_t *plist, const char *name) { H5P_genprop_t *ret_value; /* Property pointer return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_find_prop_plist); + FUNC_ENTER_NOAPI_NOINIT(H5P_find_prop_plist) - assert(plist); - assert(name); + HDassert(plist); + HDassert(name); /* Check if the property has been deleted from list */ - if(H5SL_search(plist->del,name)!=NULL) { - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,NULL,"can't find property in skip list"); + if(H5SL_search(plist->del,name) != NULL) { + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") } /* end if */ else { /* Get the property data from the skip list */ - if((ret_value=H5SL_search(plist->props,name)) == NULL) { + if(NULL == (ret_value = (H5P_genprop_t *)H5SL_search(plist->props, name))) { H5P_genclass_t *tclass; /* Temporary class pointer */ /* Couldn't find property in list itself, start searching through class info */ - tclass=plist->pclass; - while(tclass!=NULL) { + tclass = plist->pclass; + while(tclass != NULL) { /* Find the property in the class */ - if((ret_value=H5SL_search(tclass->props,name))!=NULL) + if(NULL != (ret_value = (H5P_genprop_t *)H5SL_search(tclass->props, name))) /* Got pointer to property - leave now */ break; /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* Check if we haven't found the property */ - if(ret_value==NULL) - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,NULL,"can't find property in skip list"); + if(ret_value == NULL) + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,NULL,"can't find property in skip list") } /* end else */ } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_find_prop_plist() */ @@ -1143,17 +1143,17 @@ H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *ret_value; /* Property pointer return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_find_prop_pclass); + FUNC_ENTER_NOAPI_NOINIT(H5P_find_prop_pclass) - assert(pclass); - assert(name); + HDassert(pclass); + HDassert(name); /* Get the property from the skip list */ - if((ret_value=H5SL_search(pclass->props,name)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,NULL,"can't find property in skip list"); + if(NULL == (ret_value = (H5P_genprop_t *)H5SL_search(pclass->props, name))) + HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,NULL,"can't find property in skip list") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_find_prop_pclass() */ @@ -1190,7 +1190,7 @@ H5P_free_prop(H5P_genprop_t *prop) if(prop->shared_name==0) H5MM_xfree(prop->name); - H5FL_FREE(H5P_genprop_t,prop); + (void)H5FL_FREE(H5P_genprop_t, prop); FUNC_LEAVE_NOAPI(SUCCEED); } /* H5P_free_prop() */ @@ -1336,7 +1336,8 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) case H5P_MOD_ERR: case H5P_MOD_MAX: - assert(0 && "Invalid H5P class modification"); + default: + HDassert(0 && "Invalid H5P class modification"); } /* end switch */ /* Check if we can release the class information now */ @@ -1353,7 +1354,7 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) H5SL_destroy(pclass->props,H5P_free_prop_cb,&make_cb); } /* end if */ - H5FL_FREE(H5P_genclass_t,pclass); + (void)H5FL_FREE(H5P_genclass_t, pclass); /* Reduce the number of dependent classes on parent class also */ if(par_class!=NULL) @@ -1500,7 +1501,7 @@ done: /* Free any resources allocated */ if(ret_value==NULL) if(pclass!=NULL) - H5FL_FREE(H5P_genclass_t,pclass); + (void)H5FL_FREE(H5P_genclass_t, pclass); FUNC_LEAVE_NOAPI(ret_value) } /* H5P_create_class() */ @@ -1586,7 +1587,7 @@ H5P_create(H5P_genclass_t *pclass) curr_node=H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ - tmp=H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only "create" properties we haven't seen before */ if(H5SL_search(seen,tmp->name) == NULL) { @@ -1641,7 +1642,7 @@ done: H5SL_close(plist->del); /* Release the property list itself */ - H5FL_FREE(H5P_genplist_t,plist); + (void)H5FL_FREE(H5P_genplist_t, plist); } /* end if */ } /* end if */ @@ -1908,10 +1909,10 @@ H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, /* Walk through the properties in the old class */ curr_node=H5SL_first(pclass->props); - while(curr_node!=NULL) { + while(curr_node != NULL) { /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(H5SL_item(curr_node),H5P_PROP_WITHIN_CLASS)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); + if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) + HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Insert the initialized property into the property list */ if(H5P_add_prop(new_class->props,pcopy) < 0) @@ -1950,7 +1951,7 @@ done: H5MM_xfree(new_prop->name); if(new_prop->value!=NULL) H5MM_xfree(new_prop->value); - H5FL_FREE(H5P_genprop_t,new_prop); + (void)H5FL_FREE(H5P_genprop_t, new_prop); } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value); @@ -2162,7 +2163,7 @@ done: H5MM_xfree(new_prop->name); if(new_prop->value!=NULL) H5MM_xfree(new_prop->value); - H5FL_FREE(H5P_genprop_t,new_prop); + (void)H5FL_FREE(H5P_genprop_t, new_prop); } /* end if */ } /* end if */ @@ -2219,7 +2220,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Find property in changed list */ - if((prop=H5SL_search(plist->props,name))!=NULL) { + if(NULL != (prop = (H5P_genprop_t *)H5SL_search(plist->props, name))) { /* Check for property size >0 */ if(prop->size==0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); @@ -2258,7 +2259,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) while(tclass!=NULL) { if(tclass->nprops>0) { /* Find the property in the class */ - if((prop=H5SL_search(tclass->props,name))!=NULL) { + if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */ /* Check for property size >0 */ @@ -2821,8 +2822,8 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) if(tnode1 != NULL && tnode2 == NULL) HGOTO_DONE(1); /* Compare the two properties */ - prop1 = H5SL_item(tnode1); - prop2 = H5SL_item(tnode2); + prop1 = (H5P_genprop_t *)H5SL_item(tnode1); + prop2 = (H5P_genprop_t *)H5SL_item(tnode2); if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0) HGOTO_DONE(cmp_value); @@ -2893,8 +2894,8 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2) if(tnode1 != NULL && tnode2 == NULL) HGOTO_DONE(1); /* Compare the two deleted properties */ - name1 = H5SL_item(tnode1); - name2 = H5SL_item(tnode2); + name1 = (const char *)H5SL_item(tnode1); + name2 = (const char *)H5SL_item(tnode2); if((cmp_value = HDstrcmp(name1, name2)) != 0) HGOTO_DONE(cmp_value); @@ -2921,8 +2922,8 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2) if(tnode1 != NULL && tnode2 == NULL) HGOTO_DONE(1); /* Compare the two properties */ - prop1 = H5SL_item(tnode1); - prop2 = H5SL_item(tnode2); + prop1 = (H5P_genprop_t *)H5SL_item(tnode1); + prop2 = (H5P_genprop_t *)H5SL_item(tnode2); if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0) HGOTO_DONE(cmp_value); @@ -3027,9 +3028,9 @@ H5P_isa_class(hid_t plist_id, hid_t pclass_id) FUNC_ENTER_NOAPI(H5P_isa_class, FAIL); /* Check arguments. */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - if(NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); /* Compare the property list's class against the other class */ @@ -3069,23 +3070,23 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void * +H5P_genplist_t * H5P_object_verify(hid_t plist_id, hid_t pclass_id) { - void *ret_value; /* return value */ + H5P_genplist_t *ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_object_verify, NULL); + FUNC_ENTER_NOAPI(H5P_object_verify, NULL) /* Compare the property list's class against the other class */ if(H5P_isa_class(plist_id, pclass_id) != TRUE) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, NULL, "property list is not a member of the class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, NULL, "property list is not a member of the class") /* Get the plist structure */ - if(NULL == (ret_value = H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(NULL == (ret_value = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_object_verify() */ @@ -3157,7 +3158,7 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_ HDassert(iter_func); /* Get the property list object */ - if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Create the skip list to hold names of properties already seen */ @@ -3169,7 +3170,7 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_ curr_node = H5SL_first(plist->props); while(curr_node != NULL) { /* Get pointer to property from node */ - tmp = H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Check if we've found the correctly indexed property */ if(curr_idx>=*idx) { @@ -3200,7 +3201,7 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_ curr_node=H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ - tmp=H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only call iterator callback for properties we haven't seen * before and that haven't been deleted @@ -3313,7 +3314,7 @@ H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *ite assert(iter_func); /* Get the property list object */ - if(NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); /* Cycle through the properties and call the callback */ @@ -3322,7 +3323,7 @@ H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *ite while(curr_node!=NULL) { if(curr_idx>=*idx) { /* Get the property for the node */ - prop=H5SL_item(curr_node); + prop = (H5P_genprop_t *)H5SL_item(curr_node); /* Call the callback function */ ret_value=(*iter_func)(pclass_id,prop->name,iter_data); @@ -3573,7 +3574,7 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Find property */ - if((prop=H5SL_search(plist->props,name))!=NULL) { + if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { /* Check for property size >0 */ if(prop->size==0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); @@ -3610,7 +3611,7 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) while(tclass!=NULL) { if(tclass->nprops>0) { /* Find the property in the class */ - if((prop=H5SL_search(tclass->props,name))!=NULL) { + if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { /* Check for property size >0 */ if(prop->size==0) HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size"); @@ -3719,7 +3720,7 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); /* Get the property node from the changed property skip list */ - if((prop=H5SL_search(plist->props,name))!=NULL) { + if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { /* Pass value to 'close' callback, if it exists */ if(prop->del!=NULL) { /* Call user's callback */ @@ -3851,7 +3852,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) assert(name); /* Get the objects to operate on */ - if(NULL == (src_plist = H5I_object(src_id)) || NULL == (dst_plist = H5I_object(dst_id))) + if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_id)) || NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); /* If the property exists in the destination alread */ @@ -4011,7 +4012,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) assert(name); /* Get the property node from the skip list */ - if((prop=H5SL_search(pclass->props,name)) == NULL) + if((prop = (H5P_genprop_t *)H5SL_search(pclass->props,name)) == NULL) HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list"); /* Remove the property from the skip list */ @@ -4094,7 +4095,7 @@ H5P_close(void *_plist) curr_node=H5SL_first(plist->props); while(curr_node!=NULL) { /* Get pointer to property from node */ - tmp=H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Call property close callback, if it exists */ if(tmp->close) { @@ -4127,7 +4128,7 @@ H5P_close(void *_plist) curr_node=H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ - tmp=H5SL_item(curr_node); + tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only "delete" properties we haven't seen before * and that haven't already been deleted @@ -4183,11 +4184,11 @@ H5P_close(void *_plist) H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); /* Destroy property list object */ - H5FL_FREE(H5P_genplist_t,plist); + (void)H5FL_FREE(H5P_genplist_t, plist); done: /* Release the skip list of 'seen' properties */ - if(seen!=NULL) + if(seen != NULL) H5SL_close(seen); FUNC_LEAVE_NOAPI(ret_value); @@ -4276,7 +4277,7 @@ H5P_get_class_path(H5P_genclass_t *pclass) /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - if(NULL==(ret_value=H5MM_malloc(par_path_len+1+my_path_len+1))) + if(NULL == (ret_value = (char *)H5MM_malloc(par_path_len + 1 + my_path_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name"); /* Build the full path for this class */ @@ -4320,24 +4321,24 @@ done: H5P_genclass_t * H5P_open_class_path(const char *path) { - char *tmp_path=NULL; /* Temporary copy of the path */ + char *tmp_path = NULL; /* Temporary copy of the path */ char *curr_name; /* Pointer to current component of path name */ char *delimit; /* Pointer to path delimiter during traversal */ H5P_genclass_t *curr_class; /* Pointer to class during path traversal */ H5P_genclass_t *ret_value; /* Return value */ H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */ - FUNC_ENTER_NOAPI_NOINIT(H5P_open_class_path); + FUNC_ENTER_NOAPI_NOINIT(H5P_open_class_path) - assert(path); + HDassert(path); /* Duplicate the path to use */ - tmp_path=H5MM_xstrdup(path); - assert(tmp_path); + tmp_path = H5MM_xstrdup(path); + HDassert(tmp_path); /* Find the generic property class with this full path */ - curr_name=tmp_path; - curr_class=NULL; + curr_name = tmp_path; + curr_class = NULL; while((delimit=HDstrchr(curr_name,'/'))!=NULL) { /* Change the delimiter to terminate the string */ *delimit='\0'; @@ -4347,7 +4348,7 @@ H5P_open_class_path(const char *path) check_info.name=curr_name; /* Find the class with this name & parent by iterating over the open classes */ - if((curr_class=H5I_search(H5I_GENPROP_CLS,H5P_check_class,&check_info)) == NULL) + if(NULL == (curr_class = (H5P_genclass_t *)H5I_search(H5I_GENPROP_CLS, H5P_check_class, &check_info))) HGOTO_ERROR (H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class"); /* Advance the pointer in the path to the start of the next component */ @@ -4357,22 +4358,22 @@ H5P_open_class_path(const char *path) /* Should be pointing to the last component in the path name now... */ /* Set up the search structure */ - check_info.parent=curr_class; - check_info.name=curr_name; + check_info.parent = curr_class; + check_info.name = curr_name; /* Find the class with this name & parent by iterating over the open classes */ - if((curr_class=H5I_search(H5I_GENPROP_CLS,H5P_check_class,&check_info)) == NULL) - HGOTO_ERROR (H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class"); + if(NULL == (curr_class = (H5P_genclass_t *)H5I_search(H5I_GENPROP_CLS, H5P_check_class, &check_info))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") /* Copy it */ - if((ret_value=H5P_copy_pclass(curr_class)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class"); + if(NULL == (ret_value = H5P_copy_pclass(curr_class))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class") done: /* Free the duplicated path */ H5MM_xfree(tmp_path); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_open_class_path() */ diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 48e4fec..823f107 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -63,18 +63,18 @@ H5P_get_class_path_test(hid_t pclass_id) H5P_genclass_t *pclass; /* Property class to query */ char *ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5P_get_class_path_test, NULL); + FUNC_ENTER_NOAPI(H5P_get_class_path_test, NULL) /* Check arguments. */ - if (NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) + if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class"); /* Get the property list class path */ - if ((ret_value=H5P_get_class_path(pclass))==NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class"); + if(NULL == (ret_value = H5P_get_class_path(pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_get_class_path_test() */ @@ -149,10 +149,10 @@ H5P_reset_external_file_test(hid_t dcpl_id) H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_reset_external_file_test, FAIL); + FUNC_ENTER_NOAPI(H5P_reset_external_file_test, FAIL) /* Check arguments */ - if(NULL == (plist = H5I_object(dcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* get external file list */ @@ -168,6 +168,6 @@ H5P_reset_external_file_test(hid_t dcpl_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_reset_external_file_test() */ @@ -324,7 +324,7 @@ H5S_close(H5S_t *ds) H5S_extent_release(&ds->extent); /* Release the main structure */ - H5FL_FREE(H5S_t, ds); + (void)H5FL_FREE(H5S_t, ds); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1014,7 +1014,7 @@ H5S_read(const H5O_loc_t *loc, hid_t dxpl_id) done: if(ret_value == NULL) { if(ds != NULL) - H5FL_FREE(H5S_t, ds); + (void)H5FL_FREE(H5S_t, ds); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1576,7 +1576,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") - H5FL_FREE(H5S_extent_t, extent); + (void)H5FL_FREE(H5S_extent_t, extent); /* Initialize to "all" selection. Deserialization relies on valid existing selection. */ if(H5S_select_all(ds, FALSE) < 0) @@ -235,7 +235,7 @@ done: if(table_addr != HADDR_UNDEF) H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)H5SM_TABLE_SIZE(f)); if(table != NULL) - H5FL_FREE(H5SM_master_table_t, table); + (void)H5FL_FREE(H5SM_master_table_t, table); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -268,7 +268,7 @@ H5SM_type_to_flag(unsigned type_id, unsigned *type_flag) /* Fall through... */ case H5O_SDSPACE_ID: - case H5O_DTYPE_ID: + case H5O_DTYPE3_ID: case H5O_FILL_NEW_ID: case H5O_PLINE_ID: case H5O_ATTR_ID: @@ -638,7 +638,7 @@ done: if(list != NULL) { if(list->messages != NULL) H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - H5FL_FREE(H5SM_list_t, list); + (void)H5FL_FREE(H5SM_list_t, list); } /* end if */ if(addr != HADDR_UNDEF) H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, size); @@ -2246,7 +2246,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to open object header") /* Load the object header from the cache */ - if(NULL == (oh = H5AC_protect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") } /* end if */ else diff --git a/src/H5Sall.c b/src/H5Sall.c index c603251..a306aac 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -825,23 +825,24 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5Sselect_all (hid_t spaceid) +herr_t +H5Sselect_all(hid_t spaceid) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - herr_t ret_value=SUCCEED; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Sselect_all, FAIL); + FUNC_ENTER_API(H5Sselect_all, FAIL) /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Call internal routine to do the work */ if((ret_value = H5S_select_all(space, TRUE)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sselect_all() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 2680e2a..502c095 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1246,7 +1246,7 @@ H5S_hyper_span_scratch (H5S_hyper_span_info_t *spans, void *scr_value) /* Check if we've already set this down span tree */ if(spans->scratch!=scr_value) { /* Set the tree's scratch pointer */ - spans->scratch=scr_value; + spans->scratch = (H5S_hyper_span_info_t *)scr_value; /* Set the scratch pointers in all the nodes */ span=spans->head; @@ -1543,7 +1543,7 @@ H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info) } /* end while */ /* Free this span info */ - H5FL_FREE(H5S_hyper_span_info_t,span_info); + (void)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 */ - H5FL_FREE(H5S_hyper_span_t,span); + (void)H5FL_FREE(H5S_hyper_span_t, span); done: FUNC_LEAVE_NOAPI(ret_value); @@ -1904,22 +1904,22 @@ H5S_get_select_hyper_nblocks(H5S_t *space) hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - hssize_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + hssize_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sget_select_hyper_nblocks, FAIL); + FUNC_ENTER_API(H5Sget_select_hyper_nblocks, FAIL) H5TRACE1("Hs", "i", spaceid); /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection"); + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") ret_value = H5S_get_select_hyper_nblocks(space); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sget_select_hyper_nblocks() */ @@ -2582,28 +2582,28 @@ herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t buf[/*numblocks*/]) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - herr_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + herr_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sget_select_hyper_blocklist, FAIL); + FUNC_ENTER_API(H5Sget_select_hyper_blocklist, FAIL) H5TRACE4("e", "ihh*[a2]h", spaceid, startblock, numblocks, buf); /* Check args */ - if(buf==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer"); - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + if(buf == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") /* Go get the correct number of blocks */ - if(numblocks>0) - ret_value = H5S_get_select_hyper_blocklist(space,0,startblock,numblocks,buf); + if(numblocks > 0) + ret_value = H5S_get_select_hyper_blocklist(space, 0, startblock, numblocks, buf); else ret_value=SUCCEED; /* Successfully got 0 blocks... */ done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sget_select_hyper_blocklist() */ @@ -3193,7 +3193,7 @@ H5S_hyper_release (H5S_t *space) } /* end if */ /* Release space for the hyperslab selection information */ - H5FL_FREE(H5S_hyper_sel_t,space->select.sel_info.hslab); + (void)H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab); space->select.sel_info.hslab=NULL; done: @@ -6264,24 +6264,24 @@ herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ + H5S_t *space; /* Dataspace to modify selection of */ unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Sselect_hyperslab, FAIL); H5TRACE6("e", "iSs*h*h*h*h", space_id, op, start, stride, count, block); /* Check args */ - if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - if (H5S_SCALAR==H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space"); - if (H5S_NULL==H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space"); - if(start==NULL || count==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified"); - if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + if(H5S_SCALAR == H5S_GET_EXTENT_TYPE(space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space") + if(H5S_NULL == H5S_GET_EXTENT_TYPE(space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space") + if(start == NULL || count == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified") + if(!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID)) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") if(stride!=NULL) { /* Check for 0-sized strides */ for(u=0; u<space->extent.rank; u++) { diff --git a/src/H5Snone.c b/src/H5Snone.c index 88ab67f..a5885a1 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -775,23 +775,24 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5Sselect_none (hid_t spaceid) +herr_t +H5Sselect_none(hid_t spaceid) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - herr_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Sselect_none, FAIL); + FUNC_ENTER_API(H5Sselect_none, FAIL) /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Change to "none" selection */ - if((ret_value=H5S_select_none(space))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); + if(H5S_select_none(space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sselect_none() */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index cf7751e..a93e274 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -401,7 +401,7 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") - if(NULL == (new_node->pnt = H5MM_malloc(space->extent.rank * sizeof(hsize_t)))) + if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(space->extent.rank * sizeof(hsize_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") /* Copy over the coordinates */ @@ -481,12 +481,12 @@ H5S_point_release (H5S_t *space) while(curr!=NULL) { next=curr->next; H5MM_xfree(curr->pnt); - H5FL_FREE(H5S_pnt_node_t,curr); + (void)H5FL_FREE(H5S_pnt_node_t, curr); curr=next; } /* end while */ /* Free & reset the point list header */ - H5FL_FREE(H5S_pnt_list_t,space->select.sel_info.pnt_lst); + (void)H5FL_FREE(H5S_pnt_list_t, space->select.sel_info.pnt_lst); space->select.sel_info.pnt_lst=NULL; /* Reset the number of elements in the selection */ @@ -600,12 +600,12 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection) new_head=NULL; while(curr!=NULL) { /* Create each point */ - if((new_node=H5FL_MALLOC(H5S_pnt_node_t))==NULL) + if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new_node->pnt = H5MM_malloc(src->extent.rank*sizeof(hsize_t)))==NULL) + if((new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank*sizeof(hsize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - HDmemcpy(new_node->pnt,curr->pnt,(src->extent.rank*sizeof(hsize_t))); - new_node->next=NULL; + HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t))); + new_node->next = NULL; /* Keep the order the same when copying */ if(new_head==NULL) @@ -694,22 +694,22 @@ done: hssize_t H5Sget_select_elem_npoints(hid_t spaceid) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - hssize_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + hssize_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sget_select_elem_npoints, FAIL); + FUNC_ENTER_API(H5Sget_select_elem_npoints, FAIL) H5TRACE1("Hs", "i", spaceid); /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_POINTS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection"); + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection") ret_value = H5S_GET_SELECT_NPOINTS(space); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sget_select_elem_npoints() */ @@ -852,41 +852,41 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf) uint32_t rank; /* Rank of points */ size_t num_elem=0; /* Number of elements in selection */ hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */ - unsigned i,j; /* local counting variables */ - herr_t ret_value; /* return value */ + unsigned i, j; /* local counting variables */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_point_deserialize); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_deserialize) /* Check args */ - assert(space); - assert(buf); + HDassert(space); + HDassert(buf); /* Deserialize points to select */ - buf+=16; /* Skip over selection header */ - UINT32DECODE(buf,rank); /* decode the rank of the point selection */ - if(rank!=space->extent.rank) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace"); - UINT32DECODE(buf,num_elem); /* decode the number of points */ + buf += 16; /* Skip over selection header */ + UINT32DECODE(buf, rank); /* decode the rank of the point selection */ + if(rank != space->extent.rank) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace") + UINT32DECODE(buf, num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ - if((coord = H5MM_malloc(num_elem*rank*sizeof(hsize_t)))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); + if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") /* Retrieve the coordinates from the buffer */ - for(tcoord=coord,i=0; i<num_elem; i++) - for(j=0; j<(unsigned)rank; j++,tcoord++) + for(tcoord = coord, i = 0; i < num_elem; i++) + for(j = 0; j < (unsigned)rank; j++, tcoord++) UINT32DECODE(buf, *tcoord); /* Select points */ - if((ret_value=H5S_select_elements(space,op,num_elem,(const hsize_t **)coord))<0) + if(H5S_select_elements(space,op,num_elem,(const hsize_t *)coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: /* Free the coordinate array if necessary */ - if(coord!=NULL) + if(coord != NULL) H5MM_xfree(coord); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_deserialize() */ @@ -987,24 +987,24 @@ herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t buf[/*numpoints*/]) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - herr_t ret_value; /* return value */ + H5S_t *space; /* Dataspace to modify selection of */ + herr_t ret_value; /* return value */ - FUNC_ENTER_API(H5Sget_select_elem_pointlist, FAIL); + FUNC_ENTER_API(H5Sget_select_elem_pointlist, FAIL) H5TRACE4("e", "ihh*[a2]h", spaceid, startpoint, numpoints, buf); /* Check args */ - if(buf==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer"); - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_POINTS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection"); + if(NULL == buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection") - ret_value = H5S_get_select_elem_pointlist(space,startpoint,numpoints,buf); + ret_value = H5S_get_select_elem_pointlist(space, startpoint, numpoints, buf); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sget_select_elem_pointlist() */ @@ -1348,14 +1348,14 @@ herr_t H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ + H5S_t *space; /* Dataspace to modify selection of */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Sselect_elements, FAIL) H5TRACE4("e", "iSsz*h", spaceid, op, num_elem, coord); /* Check args */ - if(NULL == (space = H5I_object_verify(spaceid, H5I_DATASPACE))) + if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") if(H5S_SCALAR == H5S_GET_EXTENT_TYPE(space)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space") diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 43f79b9..c62a7b7 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -148,4 +148,5 @@ H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); #ifdef __cplusplus } #endif -#endif +#endif /* _H5Spublic_H */ + diff --git a/src/H5Stest.c b/src/H5Stest.c index 85693da..787cdef 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -52,16 +52,16 @@ htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2) { - H5S_t *space1 = NULL; /* Pointer to 1st dataspace */ - H5S_t *space2 = NULL; /* Pointer to 2nd dataspace */ + H5S_t *space1; /* Pointer to 1st dataspace */ + H5S_t *space2; /* Pointer to 2nd dataspace */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5S_select_shape_same_test, FAIL) /* Get dataspace structures */ - if(NULL == (space1 = H5I_object_verify(sid1, H5I_DATASPACE))) + if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(NULL == (space2 = H5I_object_verify(sid2, H5I_DATASPACE))) + if(NULL == (space2 = (H5S_t *)H5I_object_verify(sid2, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check if the dataspace selections are the same shape */ @@ -94,13 +94,13 @@ done: htri_t H5S_get_rebuild_status_test(hid_t space_id) { - H5S_t *space = NULL; /* Pointer to 1st dataspace */ + H5S_t *space; /* Pointer to 1st dataspace */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5S_get_rebuild_status_test, FAIL) /* Get dataspace structures */ - if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") ret_value = space->select.sel_info.hslab->diminfo_valid; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 948a6eb..a5340a6 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -395,10 +395,10 @@ H5T_bit_set (uint8_t *buf, size_t offset, size_t size, hbool_t value) *------------------------------------------------------------------------- */ ssize_t -H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, +H5T_bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value) { - ssize_t base=(ssize_t)offset; + ssize_t base = (ssize_t)offset; ssize_t idx, i; size_t iu; ssize_t ret_value=(-1); /* Return value */ @@ -407,78 +407,81 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_find); /* Some functions call this with value=TRUE */ - assert (TRUE==1); - - switch (direction) { - case H5T_BIT_LSB: - /* Calculate index */ - idx = (ssize_t)(offset / 8); - offset %= 8; - - /* Beginning */ - if (offset) { - for (iu=offset; iu<8 && size>0; iu++, size--) { - if (value==(hbool_t)((buf[idx]>>iu) & 0x01)) - HGOTO_DONE(8*idx+(ssize_t)iu - base); - } - offset = 0; - idx++; - } - /* Middle */ - while (size>=8) { - if ((value?0x00:0xff)!=buf[idx]) { - for (i=0; i<8; i++) { - if (value==(hbool_t)((buf[idx]>>i) & 0x01)) - HGOTO_DONE(8*idx+i - base); - } - } - size -= 8; - idx++; - } - /* End */ - for (i=0; i<(ssize_t)size; i++) { - if (value==(hbool_t)((buf[idx]>>i) & 0x01)) - HGOTO_DONE(8*idx+i - base); - } - break; - - case H5T_BIT_MSB: - /* Calculate index */ - idx = (ssize_t)((offset+size-1) / 8); - offset %= 8; - - /* Beginning */ - if (size>8-offset && (offset+size)%8) { - for (iu=(offset+size)%8; iu>0; --iu, --size) { - if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) - HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base); - } - --idx; - } - /* Middle */ - while (size>=8) { - if ((value?0x00:0xff)!=buf[idx]) { - for (i=7; i>=0; --i) { - if (value==(hbool_t)((buf[idx]>>i) & 0x01)) - HGOTO_DONE(8*idx+i - base); - } - } - size -= 8; - --idx; - } - /* End */ - if (size>0) { - for (iu=offset+size; iu>offset; --iu) { - if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) - HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base); - } - } - break; - } + HDassert(TRUE == 1); + + switch(direction) { + case H5T_BIT_LSB: + /* Calculate index */ + idx = (ssize_t)(offset / 8); + offset %= 8; + + /* Beginning */ + if (offset) { + for (iu=offset; iu<8 && size>0; iu++, size--) { + if (value==(hbool_t)((buf[idx]>>iu) & 0x01)) + HGOTO_DONE(8*idx+(ssize_t)iu - base); + } + offset = 0; + idx++; + } + /* Middle */ + while (size>=8) { + if ((value?0x00:0xff)!=buf[idx]) { + for (i=0; i<8; i++) { + if (value==(hbool_t)((buf[idx]>>i) & 0x01)) + HGOTO_DONE(8*idx+i - base); + } + } + size -= 8; + idx++; + } + /* End */ + for (i=0; i<(ssize_t)size; i++) { + if (value==(hbool_t)((buf[idx]>>i) & 0x01)) + HGOTO_DONE(8*idx+i - base); + } + break; + + case H5T_BIT_MSB: + /* Calculate index */ + idx = (ssize_t)((offset+size-1) / 8); + offset %= 8; + + /* Beginning */ + if (size>8-offset && (offset+size)%8) { + for (iu=(offset+size)%8; iu>0; --iu, --size) { + if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) + HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base); + } + --idx; + } + /* Middle */ + while (size>=8) { + if ((value?0x00:0xff)!=buf[idx]) { + for (i=7; i>=0; --i) { + if (value==(hbool_t)((buf[idx]>>i) & 0x01)) + HGOTO_DONE(8*idx+i - base); + } + } + size -= 8; + --idx; + } + /* End */ + if (size>0) { + for (iu=offset+size; iu>offset; --iu) { + if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) + HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base); + } + } + break; + + default: + HDassert(0 && "Unknown bit search direction"); + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5T_bit_find() */ /*------------------------------------------------------------------------- @@ -468,20 +468,20 @@ done: static herr_t H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback) - assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id)); - assert (H5I_DATATYPE==H5I_get_type(type_id)); + HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check if the property list is non-default */ - if(dcpl_id!=H5P_DATASET_CREATE_DEFAULT) { + if(dcpl_id != H5P_DATASET_CREATE_DEFAULT) { H5P_genplist_t *dc_plist; /* Dataset creation property list object */ H5D_layout_t dcpl_layout; /* Dataset's layout information */ /* Get dataset creation property list object */ - if (NULL == (dc_plist = H5I_object(dcpl_id))) + if(NULL == (dc_plist = H5I_object(dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Get layout information */ @@ -518,19 +518,19 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Get ID for dataspace to pass to filter routines */ - if ((space_id=H5I_register (H5I_DATASPACE, space, FALSE))<0) { + if((space_id = H5I_register(H5I_DATASPACE, space, FALE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* end if */ /* Iterate over filters */ - for (u=0; u<dcpl_pline.nused; u++) { + for(u = 0; u < dcpl_pline.nused; u++) { H5Z_class_t *fclass; /* Individual filter information */ /* Get filter information */ - if (NULL==(fclass=H5Z_find(dcpl_pline.filter[u].id))) { + if(NULL == (fclass = H5Z_find(dcpl_pline.filter[u].id))) { /* Ignore errors from optional filters */ - if (dcpl_pline.filter[u].flags & H5Z_FLAG_OPTIONAL) + if(dcpl_pline.filter[u].flags & H5Z_FLAG_OPTIONAL) H5E_clear_stack(NULL); else HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") @@ -540,7 +540,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty switch(prelude_type) { case H5Z_PRELUDE_CAN_APPLY: /* Check if filter is configured to be able to encode */ - if(! fclass->encoder_present) + if(!fclass->encoder_present) HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); @@ -589,7 +589,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty } /* end for */ /* Close dataspace */ - if(H5I_dec_ref(space_id, FALSE)<0) + if(H5I_dec_ref(space_id, FALSE) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") } /* end if */ } /* end if */ @@ -617,22 +617,20 @@ done: * of passing in the dataset's dataspace, since the chunk * dimensions are what the I/O filter will actually see * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Z_can_apply (hid_t dcpl_id, hid_t type_id) +H5Z_can_apply(hid_t dcpl_id, hid_t type_id) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_can_apply,FAIL) + FUNC_ENTER_NOAPI(H5Z_can_apply, FAIL) - assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id)); - assert (H5I_DATATYPE==H5I_get_type(type_id)); + HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Make "can apply" callbacks for filters in pipeline */ - if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY)<0) + if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: @@ -657,22 +655,20 @@ done: * of passing in the dataset's dataspace, since the chunk * dimensions are what the I/O filter will actually see * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Z_set_local (hid_t dcpl_id, hid_t type_id) +H5Z_set_local(hid_t dcpl_id, hid_t type_id) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5Z_set_local,FAIL) + FUNC_ENTER_NOAPI(H5Z_set_local, FAIL) - assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id)); - assert (H5I_DATATYPE==H5I_get_type(type_id)); + HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Make "set local" callbacks for filters in pipeline */ - if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL)<0) + if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: |