diff options
-rw-r--r-- | src/H5Gdense.c | 8 | ||||
-rw-r--r-- | src/H5Gent.c | 6 | ||||
-rw-r--r-- | src/H5Gloc.c | 10 | ||||
-rw-r--r-- | src/H5Gnode.c | 2 | ||||
-rw-r--r-- | src/H5Gpkg.h | 1 | ||||
-rw-r--r-- | src/H5Gprivate.h | 1 | ||||
-rw-r--r-- | src/H5Gstab.c | 10 | ||||
-rw-r--r-- | src/H5Gtraverse.c | 10 |
8 files changed, 25 insertions, 23 deletions
diff --git a/src/H5Gdense.c b/src/H5Gdense.c index ab0547b..e8fa237 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -322,8 +322,9 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5G_BT2_NAME; bt2_cparam.node_size = (size_t)H5G_NAME_BT2_NODE_SIZE; + H5_CHECK_OVERFLOW(fheap_id_len, /* From: */ hsize_t, /* To: */ uint32_t); bt2_cparam.rrec_size = 4 + /* Name's hash value */ - fheap_id_len; /* Fractal heap ID */ + (uint32_t)fheap_id_len; /* Fractal heap ID */ bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC; if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) @@ -342,8 +343,9 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr) HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5G_BT2_CORDER; bt2_cparam.node_size = (size_t)H5G_CORDER_BT2_NODE_SIZE; - bt2_cparam.rrec_size = 8 + /* Creation order value */ - fheap_id_len; /* Fractal heap ID */ + H5_CHECK_OVERFLOW(fheap_id_len, /* From: */ hsize_t, /* To: */ uint32_t); + bt2_cparam.rrec_size = 8 + /* Creation order value */ + (uint32_t)fheap_id_len; /* Fractal heap ID */ bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC; if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) diff --git a/src/H5Gent.c b/src/H5Gent.c index 8df8414..6020028 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -411,8 +411,8 @@ H5G__ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, * Add the new name to the heap. */ name_offset = H5HL_insert(f, dxpl_id, heap, HDstrlen(name) + 1, name); - if(0 == name_offset || (size_t)(-1) == name_offset) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") + if(0 == name_offset || UFAIL == name_offset) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") ent->name_off = name_offset; /* Build correct information for symbol table entry based on link type */ @@ -505,7 +505,7 @@ H5G__ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, size_t lnk_offset; /* Offset to sym-link value */ /* Insert link value into local heap */ - if((size_t)(-1) == (lnk_offset = H5HL_insert(f, dxpl_id, heap, + if(UFAIL == (lnk_offset = H5HL_insert(f, dxpl_id, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap") diff --git a/src/H5Gloc.c b/src/H5Gloc.c index eb8cd78..3fcbd09 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -259,7 +259,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__loc_copy + * Function: H5G_loc_copy * * Purpose: Copy over information for a location * @@ -271,11 +271,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) +H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Check args. */ HDassert(dst); @@ -289,7 +289,7 @@ H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__loc_copy() */ +} /* end H5G_loc_copy() */ /*------------------------------------------------------------------------- @@ -388,7 +388,7 @@ H5G_loc_find_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, /* (Group traversal callbacks are responsible for either taking ownership * of the group location for the object, or freeing it. - QAK) */ - H5G__loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW); + H5G_loc_copy(udata->loc, obj_loc, H5_COPY_SHALLOW); *own_loc = H5G_OWN_OBJ_LOC; done: diff --git a/src/H5Gnode.c b/src/H5Gnode.c index e25a17e..4d299dc 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -119,7 +119,7 @@ H5B_class_t H5B_SNODE[1] = {{ H5G_node_remove, /*remove */ H5G_node_decode_key, /*decode */ H5G_node_encode_key, /*encode */ - H5G_node_debug_key, /*debug */ + H5G_node_debug_key /*debug */ }}; /* Declare a free list to manage the H5G_node_t struct */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 1457e62..4cb6f9b 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -516,7 +516,6 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path); /* * These functions operate on group "locations" */ -H5_DLL herr_t H5G__loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id); diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index baf4209..1ab5522 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -280,6 +280,7 @@ H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char * These functions operate on group "locations" */ H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc); +H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc/*out*/, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5G_loc_find_by_idx(H5G_loc_t *loc, const char *group_name, diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 7f4b8df..3a7cd9e 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -156,16 +156,16 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree") /* Create symbol table private heap */ - if(H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") + if(FAIL == H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(f, dxpl_id, stab->heap_addr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Insert name into the heap */ - if((size_t)(-1) == (name_offset = H5HL_insert(f, dxpl_id, heap, (size_t)1, ""))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap") + if(UFAIL == (name_offset = H5HL_insert(f, dxpl_id, heap, (size_t)1, ""))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap") /* * B-tree's won't work if the first name isn't at the beginning @@ -175,7 +175,7 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t done: /* Release resources */ - if(heap && H5HL_unprotect(heap) < 0) + if(heap && FAIL == H5HL_unprotect(heap)) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 5121f45..4d84e9f 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -201,7 +201,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, grp_loc_copy.path = &grp_path_copy; grp_loc_copy.oloc = &grp_oloc_copy; H5G_loc_reset(&grp_loc_copy); - if(H5G__loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) + if(H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object location") /* Create a group ID to pass to the user-defined callback */ @@ -263,7 +263,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, H5G_loc_free(obj_loc); /* Copy new object's location information */ - H5G__loc_copy(obj_loc, &new_loc, H5_COPY_DEEP); + H5G_loc_copy(obj_loc, &new_loc, H5_COPY_DEEP); /* Hold the file open until we free this object header (otherwise the * object location will be invalidated when the file closes). @@ -344,7 +344,7 @@ H5G_traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, /* ("tracking the names properly" means to ignore the effects of the * link traversal on the object's & group's paths - QAK) */ - H5G__loc_copy(&tmp_grp_loc, grp_loc, H5_COPY_DEEP); + H5G_loc_copy(&tmp_grp_loc, grp_loc, H5_COPY_DEEP); tmp_grp_loc_set = TRUE; /* Hold the object's group hier. path to restore later */ @@ -544,7 +544,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, #endif /* H5_USING_MEMCHECKER */ /* Deep copy of the starting location to group location */ - if(H5G__loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) + if(H5G_loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy location") group_copy = TRUE; @@ -761,7 +761,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Transfer "ownership" of the object's information to the group object */ H5G_loc_free(&grp_loc); - H5G__loc_copy(&grp_loc, &obj_loc, H5_COPY_SHALLOW); + H5G_loc_copy(&grp_loc, &obj_loc, H5_COPY_SHALLOW); H5G_loc_reset(&obj_loc); obj_loc_valid = FALSE; |