diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-07-10 21:19:18 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-07-10 21:19:18 (GMT) |
commit | 990fadfbe55353383639f0151990ec375fbe18cb (patch) | |
tree | a07f3b3215057bad7d46cbb9e26a4699b1fc8040 /src/H5Distore.c | |
parent | 0c1c23245d103927c5d59c67b84526974e6217af (diff) | |
download | hdf5-990fadfbe55353383639f0151990ec375fbe18cb.zip hdf5-990fadfbe55353383639f0151990ec375fbe18cb.tar.gz hdf5-990fadfbe55353383639f0151990ec375fbe18cb.tar.bz2 |
[svn-r4181] Purpose:
Bug Fix, Code Cleanup, Code Optimization, etc.
Description:
Fold in the hyperslab speedups, clean up compile warnings and change a
few things from using 'unsigned' or 'hsize_t' to use 'size_t' instead.
Platforms tested:
FreeBSD 4.3 (hawkwind), Solaris 2.7 (arabica), Irix64 6.5 (modi4)
Diffstat (limited to 'src/H5Distore.c')
-rw-r--r-- | src/H5Distore.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c index 95e4f46..d37c474 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -96,7 +96,7 @@ typedef struct H5F_rdcc_ent_t { size_t chunk_size; /*size of a chunk */ size_t alloc_size; /*amount allocated for the chunk */ uint8_t *chunk; /*the unfiltered chunk data */ - intn idx; /*index in hash table */ + uintn idx; /*index in hash table */ struct H5F_rdcc_ent_t *next;/*next item in doubly-linked list */ struct H5F_rdcc_ent_t *prev;/*previous item in doubly-linked list */ } H5F_rdcc_ent_t; @@ -906,7 +906,6 @@ H5F_istore_init (H5F_t *f) HDmemset (rdcc, 0, sizeof(H5F_rdcc_t)); 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,rdcc->nslots,1); if (NULL==rdcc->slot) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, @@ -1002,7 +1001,7 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); } - if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, (hsize_t)udata.key.nbytes, H5P_DEFAULT, + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DEFAULT, buf)<0) { HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); @@ -1070,7 +1069,7 @@ H5F_istore_preempt (H5F_t *f, H5F_rdcc_ent_t *ent) assert(f); assert(ent); assert(!ent->locked); - assert(ent->idx>=0 && ent->idx<rdcc->nslots); + assert(ent->idx<rdcc->nslots); /* Flush */ if (H5F_istore_flush_entry(f, ent, TRUE)<0) { @@ -1093,7 +1092,7 @@ H5F_istore_preempt (H5F_t *f, H5F_rdcc_ent_t *ent) /* Remove from cache */ rdcc->slot[ent->idx] = NULL; - ent->idx = -1; + ent->idx = UINT_MAX; rdcc->nbytes -= ent->chunk_size; --rdcc->nused; @@ -1335,7 +1334,7 @@ static void * H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5O_pline_t *pline, const H5O_fill_t *fill, const hssize_t offset[], hbool_t relax, - intn *idx_hint/*in,out*/) + uintn *idx_hint/*in,out*/) { intn idx=0; /*hash index number */ uintn temp_idx=0; /* temporary index number */ @@ -1422,7 +1421,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* * The chunk exists on disk. */ - if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, (hsize_t)udata.key.nbytes, H5P_DEFAULT, + if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5P_DEFAULT, chunk)<0) { HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); @@ -1535,7 +1534,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * unlock function. */ ent = NULL; - idx = INT_MIN; + idx = UINT_MAX; } else if (found) { /* @@ -1608,7 +1607,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, static herr_t H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5O_pline_t *pline, hbool_t dirty, - const hssize_t offset[], intn *idx_hint, + const hssize_t offset[], uintn *idx_hint, uint8_t *chunk, size_t naccessed) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); @@ -1618,10 +1617,10 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, FUNC_ENTER (H5F_istore_unlock, FAIL); - if (INT_MIN==*idx_hint) { + if (UINT_MAX==*idx_hint) { /*not in cache*/ } else { - assert(*idx_hint>=0 && *idx_hint<rdcc->nslots); + assert(*idx_hint<rdcc->nslots); assert(rdcc->slot[*idx_hint]); assert(rdcc->slot[*idx_hint]->chunk==chunk); found = *idx_hint; @@ -1714,7 +1713,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, uintn u; size_t naccessed; /*bytes accessed in chnk*/ uint8_t *chunk=NULL; /*ptr to a chunk buffer */ - intn idx_hint=0; /*cache index hint */ + uintn idx_hint=0; /*cache index hint */ FUNC_ENTER(H5F_istore_read, FAIL); @@ -1886,7 +1885,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hssize_t offset_wrt_chunk[H5O_LAYOUT_NDIMS]; hssize_t sub_offset_m[H5O_LAYOUT_NDIMS]; uint8_t *chunk=NULL; - intn idx_hint=0; + uintn idx_hint=0; size_t chunk_size, naccessed; FUNC_ENTER(H5F_istore_write, FAIL); @@ -2333,7 +2332,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, uintn u; hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; uint8_t *chunk=NULL; - intn idx_hint=0; + uintn idx_hint=0; size_t chunk_size; #ifdef AKC H5F_istore_ud1_t udata; |