diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B.c | 6 | ||||
-rw-r--r-- | src/H5B2.c | 8 | ||||
-rw-r--r-- | src/H5B2cache.c | 16 | ||||
-rw-r--r-- | src/H5B2hdr.c | 6 | ||||
-rw-r--r-- | src/H5B2int.c | 4 | ||||
-rw-r--r-- | src/H5B2pkg.h | 2 | ||||
-rw-r--r-- | src/H5B2test.c | 2 | ||||
-rw-r--r-- | src/H5HFdbg.c | 4 | ||||
-rw-r--r-- | src/H5HFdblock.c | 2 | ||||
-rw-r--r-- | src/H5HFhdr.c | 2 | ||||
-rw-r--r-- | src/H5HFsection.c | 30 | ||||
-rw-r--r-- | src/H5HFtest.c | 2 | ||||
-rw-r--r-- | src/H5HG.c | 70 | ||||
-rw-r--r-- | src/H5HGpkg.h | 6 | ||||
-rw-r--r-- | src/H5HLdbg.c | 2 | ||||
-rw-r--r-- | src/H5MM.c | 110 |
16 files changed, 130 insertions, 142 deletions
@@ -1939,7 +1939,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared); HDassert(shared); @@ -1949,7 +1949,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") /* Iterate over all children in tree, deleting them */ if(bt->level > 0) { @@ -1976,7 +1976,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, } /* end else */ done: - if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | (shared->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG)) < 0) + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, (unsigned)(H5AC__DELETED_FLAG | (shared->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG))) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache") FUNC_LEAVE_NOAPI(ret_value) @@ -487,7 +487,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, next_node_ptr=internal->node_ptrs[idx]; /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") /* Keep track of parent if necessary */ @@ -658,7 +658,7 @@ H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx, next_node_ptr = internal->node_ptrs[u]; /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") /* Keep track of parent if necessary */ @@ -704,7 +704,7 @@ H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx, next_node_ptr = internal->node_ptrs[u]; /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") /* Keep track of parent if necessary */ @@ -1107,7 +1107,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, next_node_ptr = internal->node_ptrs[idx]; /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") /* Keep track of parent if necessary */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index be53058..74303c0 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -177,7 +177,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate new B-tree header and reset cache info */ if(NULL == (hdr = H5B2_hdr_alloc(udata->f))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header") /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) @@ -189,24 +189,24 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Read header from disk */ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, hdr->hdr_size, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header") /* Get temporary pointer to serialized header */ p = buf; /* Magic number */ if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header signature") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5B2_HDR_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version") /* B-tree class */ id = (H5B2_subid_t)*p++; if(id >= H5B2_NUM_BTREE_ID) - HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") + HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") /* Node size (in bytes) */ UINT32DECODE(p, cparam.node_size); @@ -237,12 +237,12 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Verify checksum */ if(stored_chksum != computed_chksum) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 B-tree header") /* Initialize B-tree header info */ cparam.cls = H5B2_client_class_g[id]; - if(H5B2_hdr_init(hdr, &cparam, udata->ctx_udata, udata->parent, depth) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") + if(H5B2_hdr_init(hdr, &cparam, udata->ctx_udata, udata->parent, (unsigned)depth) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") /* Set the B-tree header's address */ hdr->addr = addr; diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 589325c..9f6be80 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -108,7 +108,7 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); */ herr_t H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, - void *parent, uint16_t depth) + void *parent, unsigned depth) { size_t sz_max_nrec; /* Temporary variable for range checking */ unsigned u_max_nrec_size; /* Temporary variable for range checking */ @@ -137,7 +137,7 @@ H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, hdr->pending_delete = FALSE; /* Assign dynamic information */ - hdr->depth = depth; + hdr->depth = (uint16_t)depth; /* Assign user's information */ hdr->split_percent = cparam->split_percent; @@ -312,7 +312,7 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header") /* Initialize shared B-tree info */ - if(H5B2_hdr_init(hdr, cparam, ctx_udata, parent, (uint16_t)0) < 0) + if(H5B2_hdr_init(hdr, cparam, ctx_udata, parent, (unsigned)0) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info") /* Allocate space for the header on disk */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 7f56352..c741d5a 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2957,7 +2957,7 @@ H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, HDmemcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec)); /* Unlock the node */ - if(H5AC_unprotect(hdr->f, dxpl_id, curr_node_class, curr_node->addr, node, hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, curr_node_class, curr_node->addr, node, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") if(hdr->swmr_write) node_pinned = TRUE; @@ -4033,7 +4033,7 @@ H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, done: /* Unlock & delete current node */ - if(node && H5AC_unprotect(hdr->f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG | (hdr->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG)) < 0) + if(node && H5AC_unprotect(hdr->f, dxpl_id, curr_node_class, curr_node->addr, node, (unsigned)(H5AC__DELETED_FLAG | (hdr->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG))) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 50cd153..f00cde6 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -294,7 +294,7 @@ H5_DLL H5B2_hdr_t *H5B2_hdr_alloc(H5F_t *f); H5_DLL haddr_t H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udata, void *parent); H5_DLL herr_t H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, - void *ctx_udata, void *parent, uint16_t depth); + void *ctx_udata, void *parent, unsigned depth); H5_DLL herr_t H5B2_hdr_incr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2_hdr_decr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr); diff --git a/src/H5B2test.c b/src/H5B2test.c index 29e378a..9694922 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -457,7 +457,7 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata, next_node_ptr = internal->node_ptrs[idx]; /* Unlock current node */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET) < 0) + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") /* Keep track of parent if necessary */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 76c7b96..8d2b6fa 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -187,7 +187,7 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi void H5HF_hdr_print(const H5HF_hdr_t *hdr, hid_t dxpl_id, hbool_t dump_internal, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* * Check arguments. @@ -569,7 +569,7 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, char temp_str[64]; /* Temporary string, for formatting */ size_t u, v; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* * Check arguments. diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index afc7f25..1f69f02 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -359,7 +359,7 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ - if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) + if(min_dblock_size < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) + request) min_dblock_size *= 2; /* Check if this is the first block in the heap */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index a3a037c..1ad5aa1 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -382,7 +382,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info") #ifndef NDEBUG - if(cparam->managed.max_index > (8 * hdr->sizeof_size)) + if(cparam->managed.max_index > (unsigned)(8 * hdr->sizeof_size)) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size too large for file") #endif /* NDEBUG */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 72ea100..7f5f233 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -14,10 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol <koziol@hdfgroup.org> * Monday, May 1, 2006 * - * Purpose: Free space section routines for fractal heaps. + * Purpose: Free space section routines for fractal heaps * */ @@ -586,15 +586,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_revive + * Function: H5HF_sect_single_revive * - * Purpose: Update the memory information for a 'single' free section + * Purpose: Update the memory information for a 'single' free section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 8 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * May 8 2006 * *------------------------------------------------------------------------- */ @@ -635,20 +635,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_dblock_info + * Function: H5HF_sect_single_dblock_info * - * Purpose: Retrieve the direct block information for a single section + * Purpose: Retrieve the direct block information for a single section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * October 24 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * October 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t dxpl_id, +H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t UNUSED dxpl_id, H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size) { FUNC_ENTER_NOAPI_NOERR diff --git a/src/H5HFtest.c b/src/H5HFtest.c index c2e9cb0..39a08c1 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -96,7 +96,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam) /* Get fractal heap creation parameters */ if(fh->hdr->id_len == (unsigned)(1 + fh->hdr->heap_off_size + fh->hdr->heap_len_size)) cparam->id_len = 0; - else if(fh->hdr->id_len == (1 + fh->hdr->sizeof_size + fh->hdr->sizeof_addr)) + else if(fh->hdr->id_len == (unsigned)(1 + fh->hdr->sizeof_size + fh->hdr->sizeof_addr)) cparam->id_len = 1; else cparam->id_len = fh->hdr->id_len; @@ -293,9 +293,9 @@ done: static size_t H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) { - size_t idx; - uint8_t *p; - size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); + size_t idx; + uint8_t *p; + size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -354,34 +354,35 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) /* Fix the free space object */ if(need == heap->obj[0].size) { - /* - * All free space has been exhausted from this collection. - */ - heap->obj[0].size = 0; - heap->obj[0].begin = NULL; + /* + * All free space has been exhausted from this collection. + */ + heap->obj[0].size = 0; + heap->obj[0].begin = NULL; } /* end if */ - else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) { - /* - * Some free space remains and it's larger than a heap object header, - * so write the new free heap object header to the heap. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - p = heap->obj[0].begin; - UINT16ENCODE(p, 0); /*id*/ - UINT16ENCODE(p, 0); /*nrefs*/ - UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); - assert(H5HG_ISALIGNED(heap->obj[0].size)); + //else if(heap->obj[0].size - need >= H5HG_SIZEOF_OBJHDR(f)) { + else if(heap->obj[0].size >= need + H5HG_SIZEOF_OBJHDR(f)) { + /* + * Some free space remains and it's larger than a heap object header, + * so write the new free heap object header to the heap. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + p = heap->obj[0].begin; + UINT16ENCODE(p, 0); /*id*/ + UINT16ENCODE(p, 0); /*nrefs*/ + UINT32ENCODE(p, 0); /*reserved*/ + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* end else-if */ else { - /* - * Some free space remains but it's smaller than a heap object header, - * so we don't write the header. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - assert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains but it's smaller than a heap object header, + * so we don't write the header. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* Mark the heap as dirty */ @@ -739,10 +740,10 @@ done: herr_t H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) { - H5HG_heap_t *heap = NULL; - uint8_t *p = NULL, *obj_start = NULL; - size_t need; - unsigned u; + H5HG_heap_t *heap = NULL; + uint8_t *p = NULL, *obj_start = NULL; + size_t need; + unsigned u; unsigned flags = H5AC__NO_FLAGS_SET;/* Whether the heap gets deleted */ herr_t ret_value = SUCCEED; /* Return value */ @@ -775,9 +776,8 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) } /* end if */ else heap->obj[0].size += need; - HDmemmove(obj_start, obj_start + need, - heap->size - ((obj_start + need) - heap->chunk)); - if(heap->obj[0].size >= H5HG_SIZEOF_OBJHDR(f)) { + HDmemmove(obj_start, obj_start + need, heap->size - ((obj_start + need) - heap->chunk)); + if(heap->obj[0].size >= (size_t)H5HG_SIZEOF_OBJHDR(f)) { p = heap->obj[0].begin; UINT16ENCODE(p, 0); /*id*/ UINT16ENCODE(p, 0); /*nrefs*/ diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 5d4234f..eea110b 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -117,9 +117,9 @@ H5FL_BLK_EXTERN(gheap_chunk); /****************************/ typedef struct H5HG_obj_t { - int nrefs; /*reference count */ - size_t size; /*total size of object */ - uint8_t *begin; /*ptr to object into heap->chunk*/ + int nrefs; /* reference count */ + size_t size; /* total size of object */ + uint8_t *begin; /* ptr to object into heap->chunk */ } H5HG_obj_t; /* Forward declarations for fields */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 13b1d79..bee9196 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -112,7 +112,7 @@ CATCH if(h && FAIL == H5HL_unprotect(h)) H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap"); - if(marker && FAIL == H5MM_xfree(marker)) + if(marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker))) H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); END_FUNC(PRIV) /* end H5HL_debug() */ @@ -15,13 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5MM.c - * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> - * - * Purpose: Memory management functions. + * Created: H5MM.c + * Jul 10 1997 + * Robb Matzke <matzke@llnl.gov> * - * Modifications: + * Purpose: Memory management functions * *------------------------------------------------------------------------- */ @@ -34,22 +32,19 @@ #ifndef NDEBUG /*------------------------------------------------------------------------- - * Function: H5MM_malloc + * Function: H5MM_malloc * - * Purpose: Just like the POSIX version of malloc(3). This routine - * specifically checks for allocations of 0 bytes and fails + * Purpose: Just like the POSIX version of malloc(3). This routine + * specifically checks for allocations of 0 bytes and fails * in that case. This routine is not called when NDEBUG is - * defined. - * - * Return: Success: Ptr to new memory - * - * Failure: NULL + * defined. * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 8 2003 + * Return: Success: Ptr to new memory + * Failure: NULL * - * Modifications: + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Nov 8 2003 * *------------------------------------------------------------------------- */ @@ -66,23 +61,20 @@ H5MM_malloc(size_t size) /*------------------------------------------------------------------------- - * Function: H5MM_calloc + * Function: H5MM_calloc * - * Purpose: Similar to the POSIX version of calloc(3), except this routine + * Purpose: Similar to the POSIX version of calloc(3), except this routine * just takes a 'size' parameter. This routine - * specifically checks for allocations of 0 bytes and fails + * specifically checks for allocations of 0 bytes and fails * in that case. This routine is not called when NDEBUG is - * defined. + * defined. * - * Return: Success: Ptr to new memory + * Return: Success: Ptr to new memory + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 8 2003 - * - * Modifications: + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Nov 8 2003 * *------------------------------------------------------------------------- */ @@ -100,24 +92,23 @@ H5MM_calloc(size_t size) /*------------------------------------------------------------------------- - * Function: H5MM_realloc + * Function: H5MM_realloc * - * Purpose: Just like the POSIX version of realloc(3). Specifically, the - * following calls are equivalent + * Purpose: Just like the POSIX version of realloc(3). Specifically, the + * following calls are equivalent * - * H5MM_realloc (NULL, size) <==> H5MM_malloc (size) - * H5MM_realloc (ptr, 0) <==> H5MM_xfree (ptr) - * H5MM_realloc (NULL, 0) <==> NULL + * H5MM_realloc (NULL, size) <==> H5MM_malloc (size) + * H5MM_realloc (ptr, 0) <==> H5MM_xfree (ptr) + * H5MM_realloc (NULL, 0) <==> NULL * - * Return: Success: Ptr to new memory or NULL if the memory - * was freed or HDrealloc couldn't allocate - * memory. + * Return: Success: Ptr to new memory or NULL if the memory + * was freed or HDrealloc couldn't allocate + * memory. + * Failure: NULL * - * Failure: NULL - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 10 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 * *------------------------------------------------------------------------- */ @@ -130,15 +121,15 @@ H5MM_realloc(void *mem, size_t size) FUNC_ENTER_NOAPI_NOINIT_NOERR if(NULL == mem) { - if(0 == size) + if(0 == size) ret_value = NULL; else ret_value = H5MM_malloc(size); } /* end if */ else if(0 == size) - ret_value = H5MM_xfree(mem); + ret_value = H5MM_xfree(mem); else - ret_value = HDrealloc(mem, size); + ret_value = HDrealloc(mem, size); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_realloc() */ @@ -151,7 +142,6 @@ H5MM_realloc(void *mem, size_t size) * NULL is an acceptable value for the input string. * * Return: Success: Pointer to a new string (NULL if s is NULL). - * * Failure: abort() * * Programmer: Robb Matzke @@ -162,7 +152,7 @@ H5MM_realloc(void *mem, size_t size) char * H5MM_xstrdup(const char *s) { - char *ret_value = NULL; + char *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -187,7 +177,6 @@ done: * an error will be raised. * * Return: Success: Pointer to a new string - * * Failure: abort() * * Programmer: Robb Matzke @@ -214,21 +203,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5MM_xfree + * Function: H5MM_xfree * - * Purpose: Just like free(3) except null pointers are allowed as - * arguments, and the return value (always NULL) can be - * assigned to the pointer whose memory was just freed: + * Purpose: Just like free(3) except null pointers are allowed as + * arguments, and the return value (always NULL) can be + * assigned to the pointer whose memory was just freed: * - * thing = H5MM_xfree (thing); + * thing = H5MM_xfree (thing); * - * Return: Success: NULL + * Return: Success: NULL + * Failure: never fails * - * Failure: never fails - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 10 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 * *------------------------------------------------------------------------- */ |