diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Sall.c | 2 | ||||
-rw-r--r-- | src/H5Shyper.c | 52 | ||||
-rw-r--r-- | src/H5Spoint.c | 2 | ||||
-rw-r--r-- | src/H5Sprivate.h | 8 | ||||
-rw-r--r-- | src/H5Sselect.c | 2 | ||||
-rw-r--r-- | src/H5TB.c | 8 |
6 files changed, 38 insertions, 36 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c index f35b23b..0f9e768 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -494,7 +494,7 @@ H5S_all_release (H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ hsize_t -H5S_all_npoints (H5S_t *space) +H5S_all_npoints (const H5S_t *space) { intn i; /* Counters */ hsize_t ret_value; diff --git a/src/H5Shyper.c b/src/H5Shyper.c index e1d3109..14a4bb6 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -30,8 +30,8 @@ typedef struct { H5S_sel_iter_t *iter; size_t nelmts; H5D_transfer_t xfer_mode; - void *_buf; - void *tconv_buf; + const void *src; + void *dst; H5S_hyper_bound_t **lo_bounds; H5S_hyper_bound_t **hi_bounds; } H5S_hyper_fhyper_info_t; @@ -153,7 +153,7 @@ printf("%s: check 1.1, bound_count=%d\n",FUNC,bound_count); /* Check if we've allocated the array yet */ if(num_reg==0) { /* Allocate array */ - ret_value=H5MM_malloc(sizeof(H5S_hyper_node_t)); + ret_value=H5MM_malloc(sizeof(H5S_hyper_region_t)); /* Initialize with first region */ ret_value[0].start=lo_bounds[0][i].bound; @@ -167,7 +167,7 @@ printf("%s: check 1.1, bound_count=%d\n",FUNC,bound_count); ret_value[curr_reg].end=MAX(hi_bounds[0][i].bound,ret_value[curr_reg].end); else { /* no overlap with previous region, add new region */ /* Enlarge array */ - ret_value=H5MM_realloc(ret_value,sizeof(H5S_hyper_node_t)*(num_reg+1)); + ret_value=H5MM_realloc(ret_value,sizeof(H5S_hyper_region_t)*(num_reg+1)); /* Initialize with new region */ ret_value[num_reg].start=lo_bounds[0][i].bound; @@ -318,7 +318,7 @@ printf("%s: check 2.1, i=%d\n",FUNC,(int)i); if (H5F_arr_read (fhyper_info->f, fhyper_info->layout, fhyper_info->comp, fhyper_info->efl, hsize, hsize, zero, file_offset, fhyper_info->xfer_mode, - fhyper_info->_buf/*out*/)<0) { + fhyper_info->dst/*out*/)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "read error"); } #ifdef QAK @@ -326,7 +326,7 @@ printf("%s: check 2.2\n",FUNC); #endif /* QAK */ /* Advance the pointer in the buffer */ - fhyper_info->_buf=((uint8 *)fhyper_info->_buf)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; + fhyper_info->dst=((uint8 *)fhyper_info->dst)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; /* Increment the number of elements read */ num_read+=(regions[i].end-regions[i].start)+1; @@ -439,7 +439,8 @@ printf("%s: check 1.0\n", FUNC); fhyper_info.iter=file_iter; fhyper_info.nelmts=nelmts; fhyper_info.xfer_mode=xfer_mode; - fhyper_info._buf=_buf; + fhyper_info.src=NULL; + fhyper_info.dst=_buf; fhyper_info.lo_bounds=lo_bounds; fhyper_info.hi_bounds=hi_bounds; @@ -530,12 +531,12 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) if (H5F_arr_write (fhyper_info->f, fhyper_info->layout, fhyper_info->comp, fhyper_info->efl, hsize, hsize, zero, file_offset, fhyper_info->xfer_mode, - fhyper_info->_buf)<0) { + fhyper_info->src)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, 0, "write error"); } /* Advance the pointer in the buffer */ - fhyper_info->_buf=((uint8 *)fhyper_info->_buf)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; + fhyper_info->src=((uint8 *)fhyper_info->src)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; /* Increment the number of elements read */ num_written+=(regions[i].end-regions[i].start)+1; @@ -639,7 +640,8 @@ printf("%s: check 1.0\n", FUNC); fhyper_info.iter=file_iter; fhyper_info.nelmts=nelmts; fhyper_info.xfer_mode=xfer_mode; - fhyper_info._buf=_buf; + fhyper_info.src=_buf; + fhyper_info.dst=NULL; fhyper_info.lo_bounds=lo_bounds; fhyper_info.hi_bounds=hi_bounds; @@ -674,7 +676,7 @@ printf("%s: check 1.0\n", FUNC); static size_t H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) { - hssize_t mem_size[H5O_LAYOUT_NDIMS]; /*size of memory buffer*/ + hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*size of memory buffer*/ hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in memory*/ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */ @@ -713,7 +715,7 @@ for(i=0; i<num_regions; i++) /* Set up hyperslab I/O parameters which apply to all regions */ /* Set up the size of the memory space */ - HDmemcpy(mem_size,fhyper_info->space->extent.u.simple.size,fhyper_info->space->extent.u.simple.rank*sizeof(hssize_t)); + HDmemcpy(mem_size,fhyper_info->space->extent.u.simple.size,fhyper_info->space->extent.u.simple.rank*sizeof(hsize_t)); mem_size[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; /* Copy the location of the region in the file */ @@ -740,13 +742,13 @@ printf("%s: check 2.1, i=%d\n",FUNC,(int)i); * Gather from memory. */ if (H5V_hyper_copy (fhyper_info->space->extent.u.simple.rank+1, - hsize, hsize, zero, fhyper_info->tconv_buf, - mem_size, mem_offset, fhyper_info->_buf)<0) { + hsize, hsize, zero, fhyper_info->dst, + mem_size, mem_offset, fhyper_info->src)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "unable to gather data from memory"); } /* Advance the pointer in the buffer */ - fhyper_info->tconv_buf=((uint8 *)fhyper_info->tconv_buf)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; + fhyper_info->dst=((uint8 *)fhyper_info->dst)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; /* Increment the number of elements read */ num_read+=(regions[i].end-regions[i].start)+1; @@ -863,8 +865,8 @@ printf("%s: check 3.2, lo[%d][%d]=%d, hi[%d][%d]=%d\n",FUNC,i,j,(int)lo_bounds[i fhyper_info.space=mem_space; fhyper_info.iter=mem_iter; fhyper_info.nelmts=nelmts; - fhyper_info._buf=_buf; - fhyper_info.tconv_buf=_tconv_buf; + fhyper_info.src=_buf; + fhyper_info.dst=_tconv_buf; fhyper_info.lo_bounds=lo_bounds; fhyper_info.hi_bounds=hi_bounds; @@ -905,7 +907,7 @@ printf("%s: check 5.0\n",FUNC); static size_t H5S_hyper_mwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) { - hssize_t mem_size[H5O_LAYOUT_NDIMS]; /*size of memory buffer*/ + hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*size of memory buffer*/ hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */ @@ -942,7 +944,7 @@ for(i=0; i<num_regions; i++) /* Set up hyperslab I/O parameters which apply to all regions */ /* Set up the size of the memory space */ - HDmemcpy(mem_size,fhyper_info->space->extent.u.simple.size,fhyper_info->space->extent.u.simple.rank*sizeof(hssize_t)); + HDmemcpy(mem_size,fhyper_info->space->extent.u.simple.size,fhyper_info->space->extent.u.simple.rank*sizeof(hsize_t)); mem_size[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; /* Copy the location of the region in the file */ @@ -969,13 +971,13 @@ printf("%s: check 3.0\n",FUNC); * Gather from memory. */ if (H5V_hyper_copy (fhyper_info->space->extent.u.simple.rank+1, - hsize, mem_size, mem_offset, fhyper_info->_buf, - hsize, zero, fhyper_info->tconv_buf)<0) { + hsize, mem_size, mem_offset, fhyper_info->dst, + hsize, zero, fhyper_info->src)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "unable to gather data from memory"); } /* Advance the pointer in the buffer */ - fhyper_info->tconv_buf=((uint8 *)fhyper_info->tconv_buf)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; + fhyper_info->src=((uint8 *)fhyper_info->src)+((regions[i].end-regions[i].start)+1)*fhyper_info->elmt_size; /* Increment the number of elements read */ num_read+=(regions[i].end-regions[i].start)+1; @@ -1066,8 +1068,8 @@ H5S_hyper_mscat (const void *_tconv_buf, size_t elmt_size, fhyper_info.space=mem_space; fhyper_info.iter=mem_iter; fhyper_info.nelmts=nelmts; - fhyper_info._buf=_buf; - fhyper_info.tconv_buf=_tconv_buf; + fhyper_info.src=_tconv_buf; + fhyper_info.dst=_buf; fhyper_info.lo_bounds=lo_bounds; fhyper_info.hi_bounds=hi_bounds; @@ -1384,7 +1386,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ hsize_t -H5S_point_npoints (H5S_t *space) +H5S_point_npoints (const H5S_t *space) { FUNC_ENTER (H5S_point_npoints, 0); diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 86b1bc9..58e5a60 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -444,7 +444,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ hsize_t -H5S_hyper_npoints (H5S_t *space) +H5S_hyper_npoints (const H5S_t *space) { FUNC_ENTER (H5S_hyper_npoints, 0); diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index a523405..74a6187 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -221,7 +221,7 @@ herr_t H5S_release_simple(H5S_simple_t *simple); herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); herr_t H5S_select_copy (H5S_t *dst, const H5S_t *src); herr_t H5S_select_release (H5S_t *space); -hsize_t H5S_select_npoints (H5S_t *space); +hsize_t H5S_select_npoints (const H5S_t *space); intn H5S_extend (H5S_t *space, const hsize_t *size); /* Conversion functions for simple data spaces */ @@ -279,7 +279,7 @@ herr_t H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_buf/*out*/); herr_t H5S_point_release (H5S_t *space); -hsize_t H5S_point_npoints (H5S_t *space); +hsize_t H5S_point_npoints (const H5S_t *space); /* "All" select functions */ herr_t H5S_all_init (const struct H5O_layout_t *layout, @@ -303,7 +303,7 @@ herr_t H5S_all_mscat (const void *_tconv_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_buf/*out*/); herr_t H5S_all_release (H5S_t *space); -hsize_t H5S_all_npoints (H5S_t *space); +hsize_t H5S_all_npoints (const H5S_t *space); /* Hyperslab selection functions */ herr_t H5S_hyper_init (const struct H5O_layout_t *layout, @@ -328,6 +328,6 @@ herr_t H5S_hyper_mscat (const void *_tconv_buf, size_t elmt_size, size_t nelmts, void *_buf/*out*/); herr_t H5S_hyper_add (H5S_t *space, hssize_t *start, hssize_t *size); herr_t H5S_hyper_release (H5S_t *space); -hsize_t H5S_hyper_npoints (H5S_t *space); +hsize_t H5S_hyper_npoints (const H5S_t *space); #endif diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e07b60b..cfed797 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -356,7 +356,7 @@ hsize_t H5Sselect_npoints (hid_t spaceid) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hsize_t H5S_select_npoints (H5S_t *space) +hsize_t H5S_select_npoints (const H5S_t *space) { herr_t ret_value=FAIL; /* return value */ @@ -200,7 +200,7 @@ hid_t H5TBget_buf(hsize_t size, hbool_t resize) if(curr!=NULL) { void * old_ptr=curr->buf; - if((curr->buf = H5MM_xrealloc(curr->buf, size))==NULL) { + if((curr->buf = H5MM_realloc(curr->buf, size))==NULL) { curr->buf=old_ptr; /* restore pointer if no memory available */ HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for temporary buffer"); @@ -213,12 +213,12 @@ hid_t H5TBget_buf(hsize_t size, hbool_t resize) /* No blocks in the list are acceptable */ /* (either too small or not able to be resized) */ if(curr==NULL) { - if((new=H5MM_xcalloc(1,sizeof(H5TB_t)))==NULL) + if((new=H5MM_calloc(sizeof(H5TB_t)))==NULL) HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for temporary buffer struct"); new->inuse=TRUE; new->size=size; - if((new->buf=H5MM_xmalloc(size))==NULL) { + if((new->buf=H5MM_malloc(size))==NULL) { H5MM_xfree(new); /* free structure */ HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for temporary buffer"); @@ -349,7 +349,7 @@ herr_t H5TBresize_ptr(hid_t tbid, hsize_t size) old_ptr=tbuf->buf; /* Try to resize buffer to new size */ - if((tbuf->buf = H5MM_xrealloc(tbuf->buf, size))==NULL) { + if((tbuf->buf = H5MM_realloc(tbuf->buf, size))==NULL) { tbuf->buf=old_ptr; /* restore pointer if no memory available */ HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for temporary buffer"); |