diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-21 16:53:39 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-21 16:53:39 (GMT) |
commit | 4402923400e705eac6d28f97518bf18c536f6c80 (patch) | |
tree | d6e4254a561072885795c0f7881ccddbbfd79895 /src | |
parent | 8263f168f703f8a680a49419a0053c384abec4c3 (diff) | |
download | hdf5-4402923400e705eac6d28f97518bf18c536f6c80.zip hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.gz hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.bz2 |
[svn-r4038] Purpose:
Code clean/bug fix
Description:
H5FL (free-list manager) code currently is taking an hsize_t as the size
of a memory block to allocate. On many machines, the size of an hsize_t
is greater than the size of a size_t, potentially leading to incorrect
memory allocations in rare circumstances.
Solution:
Changed hsize_t parameters and variables to size_t.
Platforms tested:
FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 6 | ||||
-rw-r--r-- | src/H5B.c | 10 | ||||
-rw-r--r-- | src/H5D.c | 8 | ||||
-rw-r--r-- | src/H5Distore.c | 6 | ||||
-rw-r--r-- | src/H5FL.c | 44 | ||||
-rw-r--r-- | src/H5FLprivate.h | 22 | ||||
-rw-r--r-- | src/H5Fistore.c | 6 | ||||
-rw-r--r-- | src/H5Gnode.c | 6 | ||||
-rw-r--r-- | src/H5HG.c | 10 | ||||
-rw-r--r-- | src/H5HL.c | 4 | ||||
-rw-r--r-- | src/H5O.c | 14 | ||||
-rw-r--r-- | src/H5Osdspace.c | 8 | ||||
-rw-r--r-- | src/H5S.c | 14 | ||||
-rw-r--r-- | src/H5Shyper.c | 46 | ||||
-rw-r--r-- | src/H5Sselect.c | 2 |
15 files changed, 100 insertions, 106 deletions
@@ -100,13 +100,13 @@ H5AC_create(H5F_t *f, intn size_hint) "memory allocation failed"); } cache->nslots = size_hint; - cache->slot = H5FL_ARR_ALLOC(H5AC_info_ptr_t,(hsize_t)cache->nslots,1); + cache->slot = H5FL_ARR_ALLOC(H5AC_info_ptr_t,cache->nslots,1); if (NULL==cache->slot) { f->shared->cache = H5FL_FREE (H5AC_t,f->shared->cache); HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } #ifdef H5AC_DEBUG - if ((cache->prot = H5FL_ARR_ALLOC(H5AC_prot_t,(hsize_t)cache->nslots,1))==NULL) { + if ((cache->prot = H5FL_ARR_ALLOC(H5AC_prot_t,cache->nslots,1))==NULL) { cache->slot = H5FL_ARR_FREE (H5AC_info_ptr_t,cache->slot); f->shared->cache = H5FL_FREE (H5AC_t,f->shared->cache); HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -414,7 +414,7 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) * Sort the cache entries by address since flushing them in * ascending order by address may be much more efficient. */ - if (NULL==(map=H5FL_ARR_ALLOC(intn,(hsize_t)cache->nslots,0))) { + if (NULL==(map=H5FL_ARR_ALLOC(intn,cache->nslots,0))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -229,8 +229,8 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, bt->nchildren = 0; if (NULL==(bt->page=H5FL_BLK_ALLOC(page,size,1)) || NULL==(bt->native=H5FL_BLK_ALLOC(native_block,total_native_keysize,0)) || - NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)(2*H5B_K(f,type)),0)) || - NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(hsize_t)(2*H5B_K(f,type)+1),0))) { + NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(2*H5B_K(f,type)),0)) || + NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(2*H5B_K(f,type)+1),0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node"); } @@ -333,8 +333,8 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata) bt->ndirty = 0; if (NULL==(bt->page=H5FL_BLK_ALLOC(page,size,0)) || NULL==(bt->native=H5FL_BLK_ALLOC(native_block,total_nkey_size,0)) || - NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(hsize_t)(2*H5B_K(f,type)+1),0)) || - NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)(2*H5B_K(f,type)),0))) { + NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(2*H5B_K(f,type)+1),0)) || + NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(2*H5B_K(f,type)),0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -1563,7 +1563,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * We've reached the left-most leaf. Now follow the right-sibling * pointer from leaf to leaf until we've processed all leaves. */ - if (NULL==(child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)(2*H5B_K(f,type)),0)) || + if (NULL==(child=H5FL_ARR_ALLOC(haddr_t,(2*H5B_K(f,type)),0)) || NULL==(key=H5MM_malloc((2*H5B_K(f, type)+1)*type->sizeof_nkey))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -2995,7 +2995,7 @@ void *H5D_vlen_get_buf_size_alloc(size_t size, void *info) FUNC_ENTER(H5D_vlen_get_buf_size_alloc, NULL); /* Get a temporary pointer to space for the VL data */ - if ((vlen_bufsize->vl_tbuf=H5FL_BLK_REALLOC(vlen_vl_buf,vlen_bufsize->vl_tbuf,(hsize_t)size))!=NULL) + if ((vlen_bufsize->vl_tbuf=H5FL_BLK_REALLOC(vlen_vl_buf,vlen_bufsize->vl_tbuf,size))!=NULL) vlen_bufsize->size+=size; FUNC_LEAVE(vlen_bufsize->vl_tbuf); @@ -3046,7 +3046,7 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, hsize_t UNUSED ndim, hss HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Make certain there is enough fixed-length buffer available */ - if ((vlen_bufsize->fl_tbuf=H5FL_BLK_REALLOC(vlen_fl_buf,vlen_bufsize->fl_tbuf,(hsize_t)H5T_get_size(dt)))==NULL) + if ((vlen_bufsize->fl_tbuf=H5FL_BLK_REALLOC(vlen_fl_buf,vlen_bufsize->fl_tbuf,H5T_get_size(dt)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf"); /* Select point to read in */ @@ -3122,9 +3122,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't create dataspace"); /* Grab the temporary buffers required */ - if((vlen_bufsize.fl_tbuf=H5FL_BLK_ALLOC(vlen_fl_buf,(hsize_t)1,0))==NULL) + if((vlen_bufsize.fl_tbuf=H5FL_BLK_ALLOC(vlen_fl_buf,1,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available"); - if((vlen_bufsize.vl_tbuf=H5FL_BLK_ALLOC(vlen_vl_buf,(hsize_t)1,0))==NULL) + if((vlen_bufsize.vl_tbuf=H5FL_BLK_ALLOC(vlen_vl_buf,1,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available"); /* Change to the custom memory allocation routines for reading VL data */ diff --git a/src/H5Distore.c b/src/H5Distore.c index 4ba52f4..95e4f46 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -220,7 +220,7 @@ H5F_istore_chunk_alloc(size_t chunk_size) FUNC_ENTER(H5F_istore_chunk_alloc, NULL); - ret_value=H5FL_BLK_ALLOC(istore_chunk,(hsize_t)chunk_size,0); + ret_value=H5FL_BLK_ALLOC(istore_chunk,chunk_size,0); FUNC_LEAVE(ret_value); } /* end H5F_istore_chunk_alloc() */ @@ -280,7 +280,7 @@ H5F_istore_chunk_realloc(void *chunk, size_t new_size) FUNC_ENTER(H5F_istore_chunk_realloc, NULL); - ret_value=H5FL_BLK_REALLOC(istore_chunk,chunk,(hsize_t)new_size); + ret_value=H5FL_BLK_REALLOC(istore_chunk,chunk,new_size); FUNC_LEAVE(ret_value); } /* end H5F_istore_chunk_realloc() */ @@ -907,7 +907,7 @@ H5F_istore_init (H5F_t *f) if (f->shared->rdcc_nbytes>0 && f->shared->rdcc_nelmts>0) { rdcc->nslots = f->shared->rdcc_nelmts; assert(rdcc->nslots>=0); - rdcc->slot = H5FL_ARR_ALLOC (H5F_rdcc_ent_ptr_t,(hsize_t)rdcc->nslots,1); + rdcc->slot = H5FL_ARR_ALLOC (H5F_rdcc_ent_ptr_t,rdcc->nslots,1); if (NULL==rdcc->slot) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -123,20 +123,19 @@ H5FL_DEFINE(H5FL_blk_node_t); *------------------------------------------------------------------------- */ static void * -H5FL_malloc(hsize_t mem_size) +H5FL_malloc(size_t mem_size) { void *ret_value=NULL; /* return value*/ FUNC_ENTER (H5FL_malloc, NULL); /* Attempt to allocate the memory requested */ - assert(mem_size==(hsize_t)((size_t)mem_size)); /*check for overflow*/ - if(NULL==(ret_value=H5MM_malloc((size_t)mem_size))) { + if(NULL==(ret_value=H5MM_malloc(mem_size))) { /* If we can't allocate the memory now, try garbage collecting first */ H5FL_garbage_coll(); /* Now try allocating the memory again */ - if(NULL==(ret_value=H5MM_malloc((size_t)mem_size))) + if(NULL==(ret_value=H5MM_malloc(mem_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); } /* end if */ @@ -333,8 +332,7 @@ H5FL_reg_alloc(H5FL_reg_head_t *head, uintn clear) /* Clear to zeros, if asked */ if(clear) { - assert(head->size==(hsize_t)((size_t)head->size)); /*check for overflow*/ - HDmemset(ret_value,0,(size_t)head->size); + HDmemset(ret_value,0,head->size); } /* end if */ #endif /* NO_REG_FREE_LISTS */ @@ -534,7 +532,7 @@ H5FL_reg_term(void) *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_find_list(H5FL_blk_node_t **head, hsize_t size) +H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) { H5FL_blk_node_t *temp; /* Temp. pointer to node in the native list */ H5FL_blk_node_t *ret_value=NULL; @@ -588,7 +586,7 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, hsize_t size) *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_create_list(H5FL_blk_node_t **head, hsize_t size) +H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) { H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ H5FL_blk_node_t *ret_value=NULL; @@ -683,7 +681,7 @@ H5FL_blk_init(H5FL_blk_head_t *head) *------------------------------------------------------------------------- */ void * -H5FL_blk_alloc(H5FL_blk_head_t *head, hsize_t size, uintn clear) +H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear) { H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */ @@ -722,8 +720,8 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, hsize_t size, uintn clear) /* 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)+size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); + if(NULL==(temp=H5FL_malloc(sizeof(H5FL_blk_list_t)+size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); /* Increment the number of blocks allocated */ head->allocated++; @@ -738,8 +736,7 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, hsize_t size, uintn clear) /* Clear the block to zeros, if requested */ if(clear) { - assert(size==(hsize_t)((size_t)size)); /*check for overflow*/ - HDmemset(ret_value,0,(size_t)size); + HDmemset(ret_value,0,size); } /* end if */ #endif /* NO_BLK_FREE_LISTS */ @@ -844,9 +841,9 @@ printf("%s: head->name=%s, garbage collecting all block lists\n",FUNC,head->name *------------------------------------------------------------------------- */ void * -H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, hsize_t new_size) +H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) { - hsize_t blk_size; /* Temporary block size */ + size_t blk_size; /* Temporary block size */ H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */ void *ret_value=NULL; /* Return value */ @@ -868,8 +865,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, hsize_t new_size) if((ret_value=H5FL_blk_alloc(head,new_size,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block"); blk_size=MIN(new_size,temp->size); - assert(blk_size==(hsize_t)((size_t)blk_size)); /*check for overflow*/ - HDmemcpy(ret_value,block,(size_t)blk_size); + HDmemcpy(ret_value,block,blk_size); H5FL_blk_free(head,block); } /* end if */ else @@ -1201,11 +1197,11 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) *------------------------------------------------------------------------- */ void * -H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear) +H5FL_arr_alloc(H5FL_arr_head_t *head, size_t elem, uintn clear) { H5FL_arr_node_t *new_obj; /* Pointer to the new free list node allocated */ void *ret_value; /* Pointer to object to return */ - hsize_t mem_size; /* Size of memory block being recycled */ + size_t mem_size; /* Size of memory block being recycled */ FUNC_ENTER (H5FL_arr_alloc, NULL); @@ -1261,8 +1257,7 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear) /* Clear to zeros, if asked */ if(clear) { - assert(mem_size==(hsize_t)((size_t)mem_size)); /*check for overflow*/ - HDmemset(ret_value,0,(size_t)mem_size); + HDmemset(ret_value,0,mem_size); } /* end if */ } /* end if */ /* No fixed number of elements, use PQ routine */ @@ -1291,9 +1286,9 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear) *------------------------------------------------------------------------- */ void * -H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, hsize_t new_elem) +H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem) { - hsize_t blk_size; /* Size of block */ + size_t blk_size; /* Size of block */ H5FL_arr_node_t *temp; /* Temp. ptr to the new free list node allocated */ void *ret_value; /* Pointer to object to return */ @@ -1322,8 +1317,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, hsize_t new_elem) /* Copy the appropriate amount of elements */ blk_size=head->size*MIN(temp->nelem,new_elem); - assert(blk_size==(hsize_t)((size_t)blk_size)); /*check for overflow*/ - HDmemcpy(ret_value,obj,(size_t)blk_size); + HDmemcpy(ret_value,obj,blk_size); /* Free the old block */ H5FL_arr_free(head,obj); diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index b8835db..4457682 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -47,7 +47,7 @@ typedef struct H5FL_reg_head_t { uintn onlist; /* Number of blocks on free list */ size_t list_mem; /* Amount of memory on free list */ const char *name; /* Name of the type */ - hsize_t size; /* Size of the blocks in the list */ + size_t size; /* Size of the blocks in the list */ H5FL_reg_node_t *list; /* List of free blocks */ } H5FL_reg_head_t; @@ -75,7 +75,7 @@ typedef struct H5FL_reg_head_t { /* Data structure to store each block in free list */ typedef struct H5FL_blk_list_t { - hsize_t size; /* Size of the page */ + size_t size; /* Size of the page */ struct H5FL_blk_list_t *next; /* Pointer to next block in free list */ union { double unused1; /* Unused normally, just here for aligment */ @@ -85,7 +85,7 @@ typedef struct H5FL_blk_list_t { /* Data structure for priority queue node of block free lists */ typedef struct H5FL_blk_node_t { - hsize_t size; /* Size of the blocks in the list */ + size_t size; /* Size of the blocks in the list */ H5FL_blk_list_t *list; /* List of free blocks */ struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */ struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */ @@ -96,7 +96,7 @@ typedef struct H5FL_blk_head_t { uintn init; /* Whether the free list has been initialized */ uintn allocated; /* Number of blocks allocated */ uintn onlist; /* Number of blocks on free list */ - hsize_t list_mem; /* Amount of memory in block on free list */ + size_t list_mem; /* Amount of memory in block on free list */ const char *name; /* Name of the type */ H5FL_blk_node_t *head; /* Pointer to first free list in queue */ } H5FL_blk_head_t; @@ -125,7 +125,7 @@ typedef struct H5FL_blk_head_t { /* Data structure to store each array in free list */ typedef struct H5FL_arr_node_t { struct H5FL_arr_node_t *next; /* Pointer to next block in free list */ - hsize_t nelem; /* Number of elements in this array */ + size_t nelem; /* Number of elements in this array */ union { double unused1; /* Unused normally, just here for aligment */ haddr_t unused2; /* Unused normally, just here for aligment */ @@ -137,10 +137,10 @@ typedef struct H5FL_arr_head_t { uintn init; /* Whether the free list has been initialized */ uintn allocated; /* Number of blocks allocated */ uintn *onlist; /* Number of blocks on free list */ - hsize_t list_mem; /* Amount of memory in block on free list */ + size_t list_mem; /* Amount of memory in block on free list */ const char *name; /* Name of the type */ intn maxelem; /* Maximum number of elements in an array */ - hsize_t size; /* Size of the array elements in the list */ + size_t size; /* Size of the array elements in the list */ union { H5FL_arr_node_t **list_arr; /* Array of lists of free blocks */ H5FL_blk_head_t queue; /* Priority queue of array blocks */ @@ -171,14 +171,14 @@ typedef struct H5FL_arr_head_t { /* * Library prototypes. */ -__DLL__ void * H5FL_blk_alloc(H5FL_blk_head_t *head, hsize_t size, uintn clear); +__DLL__ void * H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear); __DLL__ void * H5FL_blk_free(H5FL_blk_head_t *head, void *block); -__DLL__ void * H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, hsize_t new_size); +__DLL__ void * H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size); __DLL__ void * H5FL_reg_alloc(H5FL_reg_head_t *head, uintn clear); __DLL__ void * H5FL_reg_free(H5FL_reg_head_t *head, void *obj); -__DLL__ void * H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear); +__DLL__ void * H5FL_arr_alloc(H5FL_arr_head_t *head, size_t elem, uintn clear); __DLL__ void * H5FL_arr_free(H5FL_arr_head_t *head, void *obj); -__DLL__ void * H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, hsize_t new_elem); +__DLL__ void * H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem); __DLL__ herr_t H5FL_garbage_coll(void); __DLL__ herr_t H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim); diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 4ba52f4..95e4f46 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -220,7 +220,7 @@ H5F_istore_chunk_alloc(size_t chunk_size) FUNC_ENTER(H5F_istore_chunk_alloc, NULL); - ret_value=H5FL_BLK_ALLOC(istore_chunk,(hsize_t)chunk_size,0); + ret_value=H5FL_BLK_ALLOC(istore_chunk,chunk_size,0); FUNC_LEAVE(ret_value); } /* end H5F_istore_chunk_alloc() */ @@ -280,7 +280,7 @@ H5F_istore_chunk_realloc(void *chunk, size_t new_size) FUNC_ENTER(H5F_istore_chunk_realloc, NULL); - ret_value=H5FL_BLK_REALLOC(istore_chunk,chunk,(hsize_t)new_size); + ret_value=H5FL_BLK_REALLOC(istore_chunk,chunk,new_size); FUNC_LEAVE(ret_value); } /* end H5F_istore_chunk_realloc() */ @@ -907,7 +907,7 @@ H5F_istore_init (H5F_t *f) if (f->shared->rdcc_nbytes>0 && f->shared->rdcc_nelmts>0) { rdcc->nslots = f->shared->rdcc_nelmts; assert(rdcc->nslots>=0); - rdcc->slot = H5FL_ARR_ALLOC (H5F_rdcc_ent_ptr_t,(hsize_t)rdcc->nslots,1); + rdcc->slot = H5FL_ARR_ALLOC (H5F_rdcc_ent_ptr_t,rdcc->nslots,1); if (NULL==rdcc->slot) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 90a7c79..3847a46 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -272,7 +272,7 @@ H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key, "unable to allocate file space"); } sym->dirty = TRUE; - sym->entry = H5FL_ARR_ALLOC(H5G_entry_t,(hsize_t)(2*H5G_NODE_K(f)),1); + sym->entry = H5FL_ARR_ALLOC(H5G_entry_t,(2*H5G_NODE_K(f)),1); if (NULL==sym->entry) { H5FL_FREE(H5G_node_t,sym); HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, @@ -347,7 +347,7 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym) size = H5G_node_size(f); /* Allocate temporary buffer */ - if ((buf=H5FL_BLK_ALLOC(symbol_node,(hsize_t)size, 0))==NULL) + if ((buf=H5FL_BLK_ALLOC(symbol_node,size, 0))==NULL) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); p=buf; @@ -439,7 +439,7 @@ H5G_node_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, "memory allocation failed for symbol table node"); p=buf; if (NULL==(sym = H5FL_ALLOC(H5G_node_t,1)) || - NULL==(sym->entry=H5FL_ARR_ALLOC(H5G_entry_t,(hsize_t)(2*H5G_NODE_K(f)),1))) { + NULL==(sym->entry=H5FL_ARR_ALLOC(H5G_entry_t,(2*H5G_NODE_K(f)),1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -137,12 +137,12 @@ printf("%s: size=%d\n",FUNC,(int)size); heap->addr = addr; heap->size = size; heap->dirty = TRUE; - if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,(hsize_t)size,0))) { + if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,size,0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } heap->nalloc = H5HG_NOBJS (f, size); - if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,(hsize_t)heap->nalloc,1))) { + if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,heap->nalloc,1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -253,7 +253,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, "memory allocation failed"); } heap->addr = addr; - if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,(hsize_t)H5HG_MINSIZE,0))) { + if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,H5HG_MINSIZE,0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -289,7 +289,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, */ if (heap->size > H5HG_MINSIZE) { haddr_t next_addr = addr + (hsize_t)H5HG_MINSIZE; - if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, (hsize_t)heap->size))) { + if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, heap->size))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -303,7 +303,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, /* Decode each object */ p = heap->chunk + H5HG_SIZEOF_HDR (f); nalloc = H5HG_NOBJS (f, heap->size); - if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,(hsize_t)nalloc,1))) { + if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,nalloc,1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -141,7 +141,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) heap->addr = *addr_p + (hsize_t)H5HL_SIZEOF_HDR(f); heap->disk_alloc = size_hint; heap->mem_alloc = size_hint; - if (NULL==(heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(hsize_t)(H5HL_SIZEOF_HDR(f) + size_hint),1))) { + if (NULL==(heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(H5HL_SIZEOF_HDR(f) + size_hint),1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -253,7 +253,7 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, /* data */ H5F_addr_decode(f, &p, &(heap->addr)); - heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(hsize_t)(H5HL_SIZEOF_HDR(f) + heap->mem_alloc),1); + heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(H5HL_SIZEOF_HDR(f) + heap->mem_alloc),1); if (NULL==heap->chunk) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); @@ -189,7 +189,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/) /* create the chunk list and initialize the first chunk */ oh->nchunks = 1; oh->alloc_nchunks = H5O_NCHUNKS; - if (NULL==(oh->chunk=H5FL_ARR_ALLOC(H5O_chunk_t,(hsize_t)oh->alloc_nchunks,0))) { + if (NULL==(oh->chunk=H5FL_ARR_ALLOC(H5O_chunk_t,oh->alloc_nchunks,0))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -197,7 +197,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/) oh->chunk[0].dirty = TRUE; oh->chunk[0].addr = tmp_addr; oh->chunk[0].size = size_hint; - if (NULL==(oh->chunk[0].image = H5FL_BLK_ALLOC(chunk_image,(hsize_t)size_hint,1))) { + if (NULL==(oh->chunk[0].image = H5FL_BLK_ALLOC(chunk_image,size_hint,1))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -205,7 +205,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/) /* create the message list and initialize the first message */ oh->nmesgs = 1; oh->alloc_nmesgs = H5O_NMESGS; - if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,(hsize_t)oh->alloc_nmesgs,1))) { + if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,oh->alloc_nmesgs,1))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -405,7 +405,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, /* build the message array */ oh->alloc_nmesgs = MAX(H5O_NMESGS, nmesgs); - if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,(hsize_t)oh->alloc_nmesgs,1))) { + if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,oh->alloc_nmesgs,1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -430,7 +430,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, oh->chunk[chunkno].dirty = FALSE; oh->chunk[chunkno].addr = chunk_addr; oh->chunk[chunkno].size = chunk_size; - if (NULL==(oh->chunk[chunkno].image = H5FL_BLK_ALLOC(chunk_image,(hsize_t)chunk_size,0))) { + if (NULL==(oh->chunk[chunkno].image = H5FL_BLK_ALLOC(chunk_image,chunk_size,0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -659,7 +659,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh) assert(H5F_addr_defined(oh->chunk[i].addr)); if(i==0 && combine) { /* Allocate space for the combined prefix and first chunk */ - if((p=H5FL_BLK_ALLOC(chunk_image,(hsize_t)(H5O_SIZEOF_HDR(f)+oh->chunk[i].size),0))==NULL) + if((p=H5FL_BLK_ALLOC(chunk_image,(H5O_SIZEOF_HDR(f)+oh->chunk[i].size),0))==NULL) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy in the prefix */ @@ -1856,7 +1856,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) oh->chunk[chunkno].dirty = TRUE; oh->chunk[chunkno].addr = HADDR_UNDEF; oh->chunk[chunkno].size = size; - if (NULL==(oh->chunk[chunkno].image = p = H5FL_BLK_ALLOC(chunk_image,(hsize_t)size,1))) { + if (NULL==(oh->chunk[chunkno].image = p = H5FL_BLK_ALLOC(chunk_image,size,1))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 8cb81f2..8d84b2c 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -119,7 +119,7 @@ H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) p += 5; /*reserved*/ if (sdim->rank > 0) { - if (NULL==(sdim->size=H5FL_ARR_ALLOC(hsize_t,(hsize_t)sdim->rank,0))) { + if (NULL==(sdim->size=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -127,7 +127,7 @@ H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh) H5F_DECODE_LENGTH (f, p, sdim->size[u]); } if (flags & H5S_VALID_MAX) { - if (NULL==(sdim->max=H5FL_ARR_ALLOC(hsize_t,(hsize_t)sdim->rank,0))) { + if (NULL==(sdim->max=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -262,14 +262,14 @@ H5O_sdspace_copy(const void *mesg, void *dest) HDmemcpy(dst, src, sizeof(H5S_simple_t)); if (src->size) { - if (NULL==(dst->size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->rank,0))) { + if (NULL==(dst->size = H5FL_ARR_ALLOC(hsize_t,src->rank,0))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } HDmemcpy (dst->size, src->size, src->rank*sizeof(src->size[0])); } if (src->max) { - if (NULL==(dst->max=H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->rank,0))) { + if (NULL==(dst->max=H5FL_ARR_ALLOC(hsize_t,src->rank,0))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -664,13 +664,13 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) case H5S_SIMPLE: if (src->u.simple.size) { - dst->u.simple.size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->u.simple.rank,0); + dst->u.simple.size = H5FL_ARR_ALLOC(hsize_t,src->u.simple.rank,0); for (u = 0; u < src->u.simple.rank; u++) { dst->u.simple.size[u] = src->u.simple.size[u]; } } if (src->u.simple.max) { - dst->u.simple.max = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->u.simple.rank,0); + dst->u.simple.max = H5FL_ARR_ALLOC(hsize_t,src->u.simple.rank,0); for (u = 0; u < src->u.simple.rank; u++) { dst->u.simple.max[u] = src->u.simple.max[u]; } @@ -1160,7 +1160,7 @@ H5S_read(H5G_entry_t *ent) ds->select.type=H5S_SEL_ALL; /* Allocate space for the offset and set it to zeros */ - if (NULL==(ds->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)ds->extent.u.simple.rank,1))) { + if (NULL==(ds->select.offset = H5FL_ARR_ALLOC(hssize_t,ds->extent.u.simple.rank,1))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -1411,7 +1411,7 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, space->select.offset=H5FL_ARR_FREE(hssize_t,space->select.offset); /* Allocate space for the offset and set it to zeros */ - if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)rank,1))) { + if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,rank,1))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -1446,12 +1446,12 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, /* Set the rank and copy the dims */ space->extent.u.simple.rank = rank; - space->extent.u.simple.size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0); + space->extent.u.simple.size = H5FL_ARR_ALLOC(hsize_t,rank,0); HDmemcpy(space->extent.u.simple.size, dims, sizeof(hsize_t) * rank); /* Copy the maximum dimensions if specified */ if(max!=NULL) { - space->extent.u.simple.max = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0); + space->extent.u.simple.max = H5FL_ARR_ALLOC(hsize_t,rank,0); HDmemcpy(space->extent.u.simple.max, max, sizeof(hsize_t) * rank); } /* end if */ } @@ -1883,7 +1883,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) /* Allocate space for new offset */ if(space->select.offset==NULL) { - if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)space->extent.u.simple.rank,0))) { + if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,space->extent.u.simple.rank,0))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 8e0fd0d..9ffbdb0 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -185,7 +185,7 @@ H5S_hyper_init (const struct H5O_layout_t UNUSED *layout, sel_iter->hyp.elmt_left=space->select.num_elem; /* Allocate the position & initialize to invalid location */ - sel_iter->hyp.pos = H5FL_ARR_ALLOC(hsize_t,(hsize_t)space->extent.u.simple.rank,0); + sel_iter->hyp.pos = H5FL_ARR_ALLOC(hsize_t,space->extent.u.simple.rank,0); sel_iter->hyp.pos[0]=(-1); H5V_array_fill(sel_iter->hyp.pos, sel_iter->hyp.pos, sizeof(hssize_t), space->extent.u.simple.rank); @@ -338,7 +338,7 @@ H5S_hyper_get_regions (size_t *num_regions, uintn rank, uintn dim, /* Check if we've allocated the array yet */ if(num_reg==0) { /* Allocate temporary buffer, big enough for worst case size */ - reg=H5FL_ARR_ALLOC(H5S_hyper_region_t,(hsize_t)bound_count,0); + reg=H5FL_ARR_ALLOC(H5S_hyper_region_t,bound_count,0); /* Initialize with first region */ reg[num_reg].start=MAX(node->start[dim],pos[dim])+offset[dim]; @@ -422,7 +422,7 @@ H5S_hyper_block_cache (H5S_hyper_node_t *node, assert(io_info); /* Allocate temporary buffer of proper size */ - if((node->cinfo.block=H5FL_BLK_ALLOC(hyper_block,(hsize_t)(node->cinfo.size*io_info->elmt_size),0))==NULL) + if((node->cinfo.block=H5FL_BLK_ALLOC(hyper_block,(node->cinfo.size*io_info->elmt_size),0))==NULL) HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab cache block"); @@ -3055,9 +3055,9 @@ H5S_hyper_node_add (H5S_hyper_node_t **head, intn endflag, uintn rank, const hss /* Create new hyperslab node to insert */ if((slab = H5FL_ALLOC(H5S_hyper_node_t,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab node"); - if((slab->start = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0))==NULL) + if((slab->start = H5FL_ARR_ALLOC(hsize_t,rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab start boundary"); - if((slab->end = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0))==NULL) + if((slab->end = H5FL_ARR_ALLOC(hsize_t,rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab end boundary"); #ifdef QAK @@ -3206,7 +3206,7 @@ H5S_hyper_add (H5S_t *space, H5S_hyper_node_t *piece_lst) #ifdef QAK printf("%s: check 1.1, u=%u, space->sel_info.count=%d, tmp=%p\n",FUNC,(unsigned)u, space->select.sel_info.hslab.hyper_lst->count,tmp); #endif /* QAK */ - if((space->select.sel_info.hslab.hyper_lst->lo_bounds[u]=H5FL_ARR_REALLOC(H5S_hyper_bound_t,tmp,(hsize_t)(space->select.sel_info.hslab.hyper_lst->count+piece_count)))==NULL) { + if((space->select.sel_info.hslab.hyper_lst->lo_bounds[u]=H5FL_ARR_REALLOC(H5S_hyper_bound_t,tmp,(space->select.sel_info.hslab.hyper_lst->count+piece_count)))==NULL) { space->select.sel_info.hslab.hyper_lst->lo_bounds[u]=tmp; HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab lo boundary array"); @@ -3407,9 +3407,9 @@ H5S_hyper_clip (H5S_t *space, H5S_hyper_node_t *nodes, H5S_hyper_node_t **uniq, assert (uniq || overlap); /* Allocate space for the temporary starts & sizes */ - if((start = H5FL_ARR_ALLOC(hsize_t,(hsize_t)space->extent.u.simple.rank,0))==NULL) + if((start = H5FL_ARR_ALLOC(hsize_t,space->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab start array"); - if((end = H5FL_ARR_ALLOC(hsize_t,(hsize_t)space->extent.u.simple.rank,0))==NULL) + if((end = H5FL_ARR_ALLOC(hsize_t,space->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab size array"); /* Set up local variables */ @@ -3963,7 +3963,7 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src) /* Check if there is regular hyperslab information to copy */ if(src->select.sel_info.hslab.diminfo!=NULL) { /* Create the per-dimension selection info */ - if((new_diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,(hsize_t)src->extent.u.simple.rank,0))==NULL) + if((new_diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate per-dimension array"); /* Copy the per-dimension selection info */ @@ -3976,7 +3976,7 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src) dst->select.sel_info.hslab.diminfo = new_diminfo; /* Create the per-dimension selection info */ - if((new_diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,(hsize_t)src->extent.u.simple.rank,0))==NULL) + if((new_diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate per-dimension array"); /* Copy the per-dimension selection info */ @@ -4007,11 +4007,11 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src) printf("%s: check 4.0\n", FUNC); #endif /* QAK */ /* Allocate space for the low & high bound arrays */ - if((new_hyper->lo_bounds = H5FL_ARR_ALLOC(H5S_hyper_bound_ptr_t,(hsize_t)src->extent.u.simple.rank,0))==NULL) + if((new_hyper->lo_bounds = H5FL_ARR_ALLOC(H5S_hyper_bound_ptr_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate boundary node"); for(u=0; u<src->extent.u.simple.rank; u++) { - if((new_hyper->lo_bounds[u] = H5FL_ARR_ALLOC(H5S_hyper_bound_t,(hsize_t)src->select.sel_info.hslab.hyper_lst->count,0))==NULL) + if((new_hyper->lo_bounds[u] = H5FL_ARR_ALLOC(H5S_hyper_bound_t,src->select.sel_info.hslab.hyper_lst->count,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate boundary list"); } /* end for */ @@ -4032,10 +4032,10 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); HDmemcpy(new,curr,sizeof(H5S_hyper_node_t)); /* copy caching information */ - if((new->start = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->extent.u.simple.rank,0))==NULL) + if((new->start = H5FL_ARR_ALLOC(hsize_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - if((new->end = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->extent.u.simple.rank,0))==NULL) + if((new->end = H5FL_ARR_ALLOC(hsize_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); HDmemcpy(new->start,curr->start,(src->extent.u.simple.rank*sizeof(hssize_t))); @@ -4452,13 +4452,13 @@ H5S_hyper_select_deserialize (H5S_t *space, const uint8_t *buf) UINT32DECODE(buf,num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ - if((start = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0))==NULL) + if((start = H5FL_ARR_ALLOC(hsize_t,rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab information"); - if((end = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0))==NULL) + if((end = H5FL_ARR_ALLOC(hsize_t,rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab information"); - if((block = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0))==NULL) + if((block = H5FL_ARR_ALLOC(hsize_t,rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab information"); - if((count = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0))==NULL) + if((count = H5FL_ARR_ALLOC(hsize_t,rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab information"); /* Set the count for all blocks */ @@ -4710,7 +4710,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, /* Set the fields for the hyperslab list */ space->select.sel_info.hslab.hyper_lst->count=0; space->select.sel_info.hslab.hyper_lst->head=NULL; - if((space->select.sel_info.hslab.hyper_lst->lo_bounds = H5FL_ARR_ALLOC(H5S_hyper_bound_ptr_t,(hsize_t)space->extent.u.simple.rank,1))==NULL) + if((space->select.sel_info.hslab.hyper_lst->lo_bounds = H5FL_ARR_ALLOC(H5S_hyper_bound_ptr_t,space->extent.u.simple.rank,1))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab lo bound information"); } /* end if */ @@ -4865,7 +4865,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, hssize_t fill=1; /* Allocate temporary buffer */ - if ((_stride=H5FL_ARR_ALLOC(hsize_t,(hsize_t)space->extent.u.simple.rank,0))==NULL) + if ((_stride=H5FL_ARR_ALLOC(hsize_t,space->extent.u.simple.rank,0))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for stride buffer"); H5V_array_fill(_stride,&fill,sizeof(hssize_t),space->extent.u.simple.rank); @@ -4877,7 +4877,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, hssize_t fill=1; /* Allocate temporary buffer */ - if ((_block=H5FL_ARR_ALLOC(hsize_t,(hsize_t)space->extent.u.simple.rank,0))==NULL) + if ((_block=H5FL_ARR_ALLOC(hsize_t,space->extent.u.simple.rank,0))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for stride buffer"); H5V_array_fill(_block,&fill,sizeof(hssize_t),space->extent.u.simple.rank); @@ -4910,7 +4910,7 @@ for(u=0; u<space->extent.u.simple.rank; u++) } /* end if */ /* Copy all the application per-dimension selection info into the space descriptor */ - if((diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,(hsize_t)space->extent.u.simple.rank,0))==NULL) { + if((diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,space->extent.u.simple.rank,0))==NULL) { HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate per-dimension vector"); } /* end if */ for(u=0; u<space->extent.u.simple.rank; u++) { @@ -4922,7 +4922,7 @@ for(u=0; u<space->extent.u.simple.rank; u++) space->select.sel_info.hslab.app_diminfo = diminfo; /* Allocate room for the optimized per-dimension selection info */ - if((diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,(hsize_t)space->extent.u.simple.rank,0))==NULL) { + if((diminfo = H5FL_ARR_ALLOC(H5S_hyper_dim_t,space->extent.u.simple.rank,0))==NULL) { HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate per-dimension vector"); } /* end if */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 18c10e1..e7548dc 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -69,7 +69,7 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src) /* Need to copy order information still */ /* Copy offset information */ - if (NULL==(dst->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)src->extent.u.simple.rank,1))) { + if (NULL==(dst->select.offset = H5FL_ARR_ALLOC(hssize_t,src->extent.u.simple.rank,1))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } |