diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dchunk.c | 1 | ||||
-rw-r--r-- | src/H5Eprivate.h | 2 | ||||
-rw-r--r-- | src/H5FDfamily.c | 1 | ||||
-rw-r--r-- | src/H5HFdblock.c | 10 | ||||
-rw-r--r-- | src/H5HFhdr.c | 4 | ||||
-rw-r--r-- | src/H5HFsection.c | 18 | ||||
-rw-r--r-- | src/H5HG.c | 91 | ||||
-rw-r--r-- | src/H5Oainfo.c | 8 | ||||
-rw-r--r-- | src/H5Oattr.c | 2 | ||||
-rw-r--r-- | src/H5Olayout.c | 2 | ||||
-rw-r--r-- | src/H5Olink.c | 10 | ||||
-rw-r--r-- | src/H5Omessage.c | 9 | ||||
-rw-r--r-- | src/H5Shyper.c | 1 | ||||
-rw-r--r-- | src/H5Spoint.c | 194 | ||||
-rw-r--r-- | src/H5Znbit.c | 79 |
15 files changed, 206 insertions, 226 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 67c6b2f..6616ce7 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2431,7 +2431,6 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * done: /* Free the temp buffer only if it's different than the entry chunk */ if(buf != ent->chunk) - /* coverity["double_free"] */ H5MM_xfree(buf); /* diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 4c226d0..1e5ada1 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -156,7 +156,7 @@ extern int H5E_mpi_error_str_len; /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. */ -#define CATCH past_catch = TRUE; catch_except:; +#define CATCH catch_except:; past_catch = TRUE; /* Library-private functions defined in H5E package */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 87e5e84..3c25426 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -821,7 +821,6 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, H5FD_t **x; HDassert(n > 0); - /* coverity["freed_arg"] */ if(NULL == (x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members") file->amembs = n; diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index dd2fd3b..027146c 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -298,10 +298,12 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock, #endif /* 0 */ /* Detach from parent indirect block */ - if(H5HF_man_iblock_detach(dblock->parent, dxpl_id, dblock->par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") - dblock->parent = NULL; - dblock->par_entry = 0; + if(dblock->parent) { + if(H5HF_man_iblock_detach(dblock->parent, dxpl_id, dblock->par_entry) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block"); + dblock->parent = NULL; + dblock->par_entry = 0; + } /* end if */ } /* end else */ /* Indicate that the indirect block should be deleted & file space freed */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index db0093e..0b4936d 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -132,10 +132,6 @@ H5HF_hdr_alloc(H5F_t *f) ret_value = hdr; done: - if(!ret_value && hdr) - if(H5HF_hdr_free(hdr) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_hdr_alloc() */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 152f15a..102dc7c 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -490,7 +490,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry) { H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */ - hbool_t par_incr = FALSE; /* Indicate that parent iblock has been incremented */ H5HF_free_section_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_new) @@ -509,7 +508,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, if(sect->u.single.parent) { if(H5HF_iblock_incr(sect->u.single.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") - par_incr = TRUE; } /* end if */ sect->u.single.par_entry = par_entry; @@ -518,13 +516,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, done: if(!ret_value && sect) { - /* Check if we should decrement parent ref. count */ - if(par_incr) { - HDassert(sect->u.single.parent); - if(H5HF_iblock_decr(sect->u.single.parent) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on parent indirect block") - } /* end if */ - /* Release the section */ (void)H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ @@ -2291,7 +2282,6 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ - hbool_t iblock_incr = FALSE; /* Indicate that parent iblock has been incremented */ H5HF_free_section_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_new) @@ -2314,7 +2304,6 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, sect->u.indirect.u.iblock->max_rows; if(H5HF_iblock_incr(sect->u.indirect.u.iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") - iblock_incr = TRUE; } /* end if */ else { sect->u.indirect.u.iblock_off = iblock_off; @@ -2338,13 +2327,8 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, done: if(!ret_value && sect) { - /* Check if we should decrement parent ref. count */ - if(iblock_incr) - if(H5HF_iblock_decr(sect->u.indirect.u.iblock) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on shared indirect block") - /* Release the section */ - (void)H5FL_FREE(H5HF_free_section_t, sect); + sect = H5FL_FREE(H5HF_free_section_t, sect); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -140,31 +140,28 @@ H5FL_BLK_DEFINE(gheap_chunk); *------------------------------------------------------------------------- */ static haddr_t -H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) +H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) { H5HG_heap_t *heap = NULL; uint8_t *p = NULL; haddr_t addr; size_t n; - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HG_create) /* Check args */ - assert (f); - if (size<H5HG_MINSIZE) + HDassert(f); + if(size < H5HG_MINSIZE) size = H5HG_MINSIZE; size = H5HG_ALIGN(size); /* Create it */ - H5_CHECK_OVERFLOW(size,size_t,hsize_t); - if ( HADDR_UNDEF== - (addr=H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) - HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, \ - "unable to allocate file space for global heap"); - if (NULL==(heap = H5FL_MALLOC (H5HG_heap_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \ - "memory allocation failed"); + H5_CHECK_OVERFLOW(size, size_t, hsize_t); + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") + if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") heap->addr = addr; heap->size = size; @@ -185,14 +182,14 @@ HDmemset(heap->chunk, 0, size); *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ - H5F_ENCODE_LENGTH (f, p, size); + H5F_ENCODE_LENGTH(f, p, size); /* * Padding so free space object is aligned. If malloc returned memory * which was always at least H5HG_ALIGNMENT aligned then we could just * align the pointer, but this might not be the case. */ - n = H5HG_ALIGN(p-heap->chunk) - (p-heap->chunk); + n = H5HG_ALIGN(p - heap->chunk) - (p - heap->chunk); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset(p, 0, n); @@ -207,7 +204,7 @@ HDmemset(heap->chunk, 0, size); UINT16ENCODE(p, 0); /*object ID*/ UINT16ENCODE(p, 0); /*reference count*/ UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p)); @@ -226,7 +223,7 @@ HDmemset(heap->chunk, 0, size); 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); - } + } /* end else */ /* Add the heap to the cache */ if(H5AC_set(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) @@ -235,9 +232,20 @@ HDmemset(heap->chunk, 0, size); ret_value = addr; done: - if(!(H5F_addr_defined(addr)) && heap) - if(H5HG_dest(f, heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") + /* Cleanup on error */ + if(!H5F_addr_defined(ret_value)) { + if(H5F_addr_defined(addr)) { + /* Release the space on disk */ + if(H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, addr, (hsize_t)size) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free global heap") + + /* Check if the heap object was allocated */ + if(heap) + /* Destroy the heap object */ + if(H5HG_dest(f, heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") + } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value); } /* H5HG_create() */ @@ -704,54 +712,47 @@ done: * Programmer: Robb Matzke * Monday, March 30, 1998 * - * Modifications: - * - * John Mainzer - 6/8/05 - * Modified function to use the dirtied parameter of - * H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ int -H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) +H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) { H5HG_heap_t *heap = NULL; unsigned heap_flags = H5AC__NO_FLAGS_SET; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_link, FAIL); + FUNC_ENTER_NOAPI(H5HG_link, FAIL) /* Check args */ - assert (f); - assert (hobj); - if (0==(f->intent & H5F_ACC_RDWR)) + HDassert(f); + HDassert(hobj); + if(0 == (f->intent & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") - if(adjust!=0) { - /* Load the heap */ - 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); - assert (heap->obj[hobj->idx].begin); - if (heap->obj[hobj->idx].nrefs+adjust<0) - HGOTO_ERROR (H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range") - if (heap->obj[hobj->idx].nrefs+adjust>H5HG_MAXLINK) - HGOTO_ERROR (H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range") + /* Load the heap */ + 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") + + if(adjust != 0) { + HDassert(hobj->idx < heap->nused); + HDassert(heap->obj[hobj->idx].begin); + if((heap->obj[hobj->idx].nrefs + adjust) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range") + if((heap->obj[hobj->idx].nrefs + adjust) > H5HG_MAXLINK) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range") heap->obj[hobj->idx].nrefs += adjust; heap_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Set return value */ - ret_value=heap->obj[hobj->idx].nrefs; + ret_value = heap->obj[hobj->idx].nrefs; done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HG_link() */ /*------------------------------------------------------------------------- diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index e61d899..0984cd4 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -431,17 +431,17 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") - if ( (H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) <0) + if((H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") - } + } /* end if */ /* Set return value */ ret_value = ainfo_dst; done: /* Release destination attribute information on failure */ - if(ret_value == NULL && ainfo_dst != NULL) - (void)H5FL_FREE(H5O_ainfo_t, ainfo_dst); + if(!ret_value && ainfo_dst) + ainfo_dst = H5FL_FREE(H5O_ainfo_t, ainfo_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_ainfo_copy_file() */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index ad068ad..4d8b17a 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -668,7 +668,7 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") - if ( NULL == (ret_value=H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id))) + if(NULL == (ret_value = H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute") done: diff --git a/src/H5Olayout.c b/src/H5Olayout.c index ebae1fb..6d20ca9 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -646,7 +646,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, done: if(!ret_value) if(layout_dst) - (void)H5FL_FREE(H5O_layout_t, layout_dst); + layout_dst = H5FL_FREE(H5O_layout_t, layout_dst); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_copy_file() */ diff --git a/src/H5Olink.c b/src/H5Olink.c index ffe80e7..4ddfbf6 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -705,7 +705,6 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_ hid_t UNUSED dxpl_id) { H5O_link_t *link_src = (H5O_link_t *)native_src; - H5O_link_t *link_dst = NULL; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy_file) @@ -721,17 +720,10 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_ /* Allocate "blank" link for destination */ /* (values will be filled in during 'post copy' operation) */ - if(NULL == (link_dst = H5FL_CALLOC(H5O_link_t))) + if(NULL == (ret_value = H5FL_CALLOC(H5O_link_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Set return value */ - ret_value = link_dst; - done: - if(!ret_value) - if(link_dst) - H5O_link_free(link_dst); - FUNC_LEAVE_NOAPI(ret_value) } /* H5O_link_copy_file() */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 4baa262..28be283 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1859,7 +1859,6 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id) { - void *native_mesg = NULL; void *ret_value; FUNC_ENTER_NOAPI_NOINIT(H5O_msg_copy_file) @@ -1876,16 +1875,10 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, /* The copy_file callback will return an H5O_shared_t only if the message * to be copied is a committed datatype. */ - if(NULL == (native_mesg = (type->copy_file)(file_src, native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id))) + if(NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file") - /* Set return value */ - ret_value = native_mesg; - done: - if(NULL == ret_value && native_mesg) - H5O_msg_free(type->id, native_mesg); - FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_copy_file() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index f55135f..f86a743 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -7546,6 +7546,7 @@ partial_done: /* Yes, goto's are evil, so sue me... :-) */ /* Check if we are done */ if(io_bytes_left==0 || curr_seq>=maxseq) { + HDassert(curr_span); abs_arr[fast_dim]=curr_span->low+(span_size/elem_size); /* Check if we are still within the span */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 84b427e..5f4c74d 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -119,11 +119,11 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t); herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { - FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init); + FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init) /* Check args */ - assert (space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space)); - assert (iter); + HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space)); + HDassert(iter); /* Initialize the number of points to iterate over */ iter->elmt_left=space->select.num_elem; @@ -134,7 +134,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Initialize type of selection iterator */ iter->type=H5S_sel_iter_point; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_init() */ @@ -156,16 +156,16 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) static herr_t H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords) /* Check args */ - assert (iter); - assert (coords); + HDassert(iter); + HDassert(coords); /* Copy the offset of the current point */ HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_coords() */ @@ -187,18 +187,18 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) static herr_t H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block) /* Check args */ - assert (iter); - assert (start); - assert (end); + HDassert(iter); + HDassert(start); + HDassert(end); /* Copy the current point as a block */ HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_block() */ @@ -219,12 +219,12 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) static hsize_t H5S_point_iter_nelmts (const H5S_sel_iter_t *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_nelmts); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_nelmts) /* Check args */ - assert (iter); + HDassert(iter); - FUNC_LEAVE_NOAPI(iter->elmt_left); + FUNC_LEAVE_NOAPI(iter->elmt_left) } /* H5S_point_iter_nelmts() */ @@ -250,17 +250,17 @@ H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter) { htri_t ret_value=TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_has_next_block); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_has_next_block) /* Check args */ - assert (iter); + HDassert(iter); /* Check if there is another point in the list */ if(iter->u.pnt.curr->next==NULL) HGOTO_DONE(FALSE); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_iter_has_next_block() */ @@ -285,11 +285,11 @@ done: static herr_t H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next) /* Check args */ - assert (iter); - assert (nelem>0); + HDassert(iter); + HDassert(nelem>0); /* Increment the iterator */ while(nelem>0) { @@ -297,7 +297,7 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) nelem--; } /* end while */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_next() */ @@ -321,15 +321,15 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next_block); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next_block) /* Check args */ - assert (iter); + HDassert(iter); /* Increment the iterator */ iter->u.pnt.curr=iter->u.pnt.curr->next; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_next_block() */ @@ -353,12 +353,12 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter) static herr_t H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_release); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_release) /* Check args */ - assert (iter); + HDassert(iter); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_release() */ @@ -471,10 +471,10 @@ H5S_point_release (H5S_t *space) { H5S_pnt_node_t *curr, *next; /* Point selection nodes */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release) /* Check args */ - assert (space); + HDassert(space); /* Delete all the nodes from the list */ curr=space->select.sel_info.pnt_lst->head; @@ -492,7 +492,7 @@ H5S_point_release (H5S_t *space) /* Reset the number of elements in the selection */ space->select.num_elem=0; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_release() */ @@ -584,42 +584,60 @@ done: static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection) { - H5S_pnt_node_t *curr, *new_node, *new_head; /* Point information nodes */ - herr_t ret_value=SUCCEED; /* return value */ + H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy) - assert(src); - assert(dst); + HDassert(src); + HDassert(dst); /* Allocate room for the head of the point list */ - if((dst->select.sel_info.pnt_lst=H5FL_MALLOC(H5S_pnt_list_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); + if(NULL == (dst->select.sel_info.pnt_lst = H5FL_MALLOC(H5S_pnt_list_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") - curr=src->select.sel_info.pnt_lst->head; - new_head=NULL; - while(curr!=NULL) { - /* Create each point */ + curr = src->select.sel_info.pnt_lst->head; + new_tail = NULL; + while(curr) { + /* Create new point */ 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 = (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))); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") new_node->next = NULL; + if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank*sizeof(hsize_t)))) { + new_node = H5FL_FREE(H5S_pnt_node_t, new_node); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") + } /* end if */ + + /* Copy over the point's coordinates */ + HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t))); /* Keep the order the same when copying */ - if(new_head==NULL) - new_head=dst->select.sel_info.pnt_lst->head=new_node; + if(NULL == new_tail) + new_tail = dst->select.sel_info.pnt_lst->head = new_node; else { - new_head->next=new_node; - new_head=new_node; + new_tail->next = new_node; + new_tail = new_node; } /* end else */ - curr=curr->next; + curr = curr->next; } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value); + if(ret_value < 0) { + /* Traverse the (incomplete?) dst list, freeing all memory */ + curr = dst->select.sel_info.pnt_lst->head; + while(curr) { + H5S_pnt_node_t *tmp_node = curr; + + curr->pnt = H5MM_xfree(curr->pnt); + curr = curr->next; + tmp_node = H5FL_FREE(H5S_pnt_node_t, tmp_node); + } /* end while */ + + dst->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, dst->select.sel_info.pnt_lst); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_copy() */ @@ -650,9 +668,9 @@ H5S_point_is_valid (const H5S_t *space) unsigned u; /* Counter */ htri_t ret_value=TRUE; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid) - assert(space); + HDassert(space); /* Check each point to determine whether selection+offset is within extent */ curr = space->select.sel_info.pnt_lst->head; @@ -670,7 +688,7 @@ H5S_point_is_valid (const H5S_t *space) } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_is_valid() */ @@ -738,9 +756,9 @@ H5S_point_serial_size (const H5S_t *space) H5S_pnt_node_t *curr; /* Point information nodes */ hssize_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size) - assert(space); + HDassert(space); /* Basic number of bytes required to serialize point selection: * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> + @@ -756,7 +774,7 @@ H5S_point_serial_size (const H5S_t *space) curr=curr->next; } /* end while */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_serial_size() */ @@ -787,9 +805,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize) - assert(space); + HDassert(space); /* Store the preamble information */ UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ @@ -822,7 +840,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_serialize() */ @@ -1168,9 +1186,9 @@ H5S_point_is_contiguous(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous) - assert(space); + HDassert(space); /* One point is definitely contiguous */ if(space->select.num_elem==1) @@ -1178,7 +1196,7 @@ H5S_point_is_contiguous(const H5S_t *space) else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */ ret_value=FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_is_contiguous() */ @@ -1205,9 +1223,9 @@ H5S_point_is_single(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single) - assert(space); + HDassert(space); /* One point is definitely 'single' :-) */ if(space->select.num_elem==1) @@ -1215,7 +1233,7 @@ H5S_point_is_single(const H5S_t *space) else ret_value=FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_is_single() */ @@ -1245,10 +1263,10 @@ H5S_point_is_regular(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular) /* Check args */ - assert(space); + HDassert(space); /* Only simple check for regular points for now... */ if(space->select.num_elem==1) @@ -1256,7 +1274,7 @@ H5S_point_is_regular(const H5S_t *space) else ret_value=FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_is_regular() */ @@ -1420,31 +1438,31 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, int i; /* Local index variable */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list) /* Check args */ - assert(space); - assert(iter); - assert(maxseq>0); - assert(maxelem>0); - assert(nseq); - assert(nelem); - assert(off); - assert(len); + HDassert(space); + HDassert(iter); + HDassert(maxseq > 0); + HDassert(maxelem > 0); + HDassert(nseq); + HDassert(nelem); + HDassert(off); + HDassert(len); /* Choose the minimum number of bytes to sequence through */ - H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t); - start_io_left=io_left=(size_t)MIN(iter->elmt_left,maxelem); + H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t); + start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem); /* Get the dataspace dimensions */ - if ((ndims=H5S_get_simple_extent_dims (space, dims, NULL))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions"); + if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions") /* Walk through the points in the selection, starting at the current */ /* location in the iterator */ - node=iter->u.pnt.curr; - curr_seq=0; - while(node!=NULL) { + node = iter->u.pnt.curr; + curr_seq = 0; + while(NULL != node) { /* Compute the offset of each selected point in the buffer */ for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) { loc += (node->pnt[i] + space->select.offset[i]) * acc; @@ -1507,6 +1525,6 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, *nelem=start_io_left-io_left; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_get_seq_list() */ diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 6f090c3..8f785a2 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -138,7 +138,7 @@ H5Z_can_apply_nbit(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id) FUNC_ENTER_NOAPI(H5Z_can_apply_nbit, FAIL) /* Get datatype */ - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get datatype's class, for checking the "datatype class" */ @@ -742,7 +742,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) FUNC_ENTER_NOAPI(H5Z_set_local_nbit, FAIL) /* Get datatype */ - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get datatype's class */ @@ -781,7 +781,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype needs too many nbit parameters") /* Allocate memory space for cd_values[] */ - if(NULL == (cd_values = H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned)))) + if(NULL == (cd_values = (unsigned *)H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for cd_values[]") /* Get the plist structure */ @@ -862,81 +862,70 @@ done: * Programmer: Xiaowen Wu * Friday, January 21, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { - size_t ret_value = 0; /* return value */ - size_t size_out = 0; /* size of output buffer */ - unsigned d_nelmts = 0; /* number of elements in the chunk */ - unsigned char *outbuf = NULL; /* pointer to new output buffer */ + unsigned char *outbuf; /* pointer to new output buffer */ + size_t size_out = 0; /* size of output buffer */ + unsigned d_nelmts = 0; /* number of elements in the chunk */ + size_t ret_value = 0; /* return value */ FUNC_ENTER_NOAPI(H5Z_filter_nbit, 0) /* check arguments * cd_values[0] stores actual number of parameters in cd_values[] */ - if (cd_nelmts!=cd_values[0]) + if(cd_nelmts != cd_values[0]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid nbit aggression level") /* check if need to do nbit compress or decompress * cd_values[1] stores the flag if true indicating no need to compress */ - if (cd_values[1]) { - ret_value = *buf_size; - goto done; - } + if(cd_values[1]) + HGOTO_DONE(*buf_size) /* copy a filter parameter to d_nelmts */ d_nelmts = cd_values[2]; /* input; decompress */ - if (flags & H5Z_FLAG_REVERSE) { + if(flags & H5Z_FLAG_REVERSE) { size_out = d_nelmts * cd_values[4]; /* cd_values[4] stores datatype size */ /* allocate memory space for decompressed buffer */ - if(NULL==(outbuf = H5MM_malloc(size_out))) + if(NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression") /* decompress the buffer */ - H5Z_nbit_decompress(outbuf, d_nelmts, *buf, cd_values); - - *buf_size = size_out; - ret_value = size_out; - } + H5Z_nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values); + } /* end if */ /* output; compress */ else { - assert(nbytes == d_nelmts * cd_values[4]); + HDassert(nbytes == d_nelmts * cd_values[4]); size_out = nbytes; /* allocate memory space for compressed buffer */ - if(NULL==(outbuf = H5MM_malloc(size_out))) + if(NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit compression") /* compress the buffer, size_out will be changed */ - H5Z_nbit_compress(*buf, d_nelmts, outbuf, &size_out, cd_values); - - *buf_size = nbytes; - ret_value = size_out; - } + H5Z_nbit_compress((unsigned char *)*buf, d_nelmts, outbuf, &size_out, cd_values); + } /* end else */ /* free the input buffer */ H5MM_xfree(*buf); /* set return values */ *buf = outbuf; - outbuf = NULL; + *buf_size = size_out; + ret_value = size_out; done: - if(outbuf) - H5MM_xfree(outbuf); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5Z_filter_nbit() */ /* ======== Nbit Algorithm =============================================== * assume one byte has 8 bit @@ -946,14 +935,17 @@ done: * atomic datatype is treated on byte basis */ -static void H5Z_nbit_next_byte(size_t *j, int *buf_len) +static void +H5Z_nbit_next_byte(size_t *j, int *buf_len) { ++(*j); *buf_len = 8 * sizeof(unsigned char); } -static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i, -int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int datatype_len) +static void +H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, + int begin_i, int end_i, unsigned char *buffer, size_t *j, int *buf_len, + parms_atomic p, int datatype_len) { int dat_len; /* dat_len is the number of bits to be copied in each data byte */ int uchar_offset; @@ -995,7 +987,8 @@ int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int d } } -static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, unsigned size) { unsigned i; /* index */ @@ -1018,7 +1011,8 @@ static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_of } } -static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p) { /* begin_i: the index of byte having first significant bit @@ -1054,7 +1048,8 @@ static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offs } } -static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) { unsigned i, total_size, base_class, base_size, n, begin_index; @@ -1101,7 +1096,8 @@ static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offse } /* end switch */ } -static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, +static void +H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) { unsigned i, nmembers, member_offset, member_class, size; @@ -1139,7 +1135,8 @@ static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_of } } -static void H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +static void +H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, const unsigned parms[]) { /* i: index of data, j: index of buffer, @@ -1410,7 +1407,5 @@ static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned c } break; } /* end switch */ - - *buffer_size = j + 1; /* sometimes is catually j, but to be safe */ } #endif /* H5_HAVE_FILTER_NBIT */ |