diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-08-31 21:58:15 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-08-31 21:58:15 (GMT) |
commit | db8e289abe67b506d2a1096d1a39151aca0935e9 (patch) | |
tree | 2fb45f2f3c1f9f8717bc00a07a55831689aa382c /src | |
parent | 2c91cbecc6460d1a319bfb2303e228ea6f6d6e4d (diff) | |
download | hdf5-db8e289abe67b506d2a1096d1a39151aca0935e9.zip hdf5-db8e289abe67b506d2a1096d1a39151aca0935e9.tar.gz hdf5-db8e289abe67b506d2a1096d1a39151aca0935e9.tar.bz2 |
[svn-r27632] Description:
Revert changes to pass file pointer to selection serialize/deserialize
routines. Also patch back in some changes that were merged out in the
previous merge w/trunk.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial
(h5committest not required on this branch)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Fint.c | 127 | ||||
-rw-r--r-- | src/H5Fprivate.h | 6 | ||||
-rw-r--r-- | src/H5Olayout.c | 12 | ||||
-rw-r--r-- | src/H5R.c | 6 | ||||
-rw-r--r-- | src/H5S.c | 6 | ||||
-rw-r--r-- | src/H5Sall.c | 27 | ||||
-rw-r--r-- | src/H5Shyper.c | 46 | ||||
-rw-r--r-- | src/H5Snone.c | 28 | ||||
-rw-r--r-- | src/H5Spkg.h | 9 | ||||
-rw-r--r-- | src/H5Spoint.c | 22 | ||||
-rw-r--r-- | src/H5Sprivate.h | 18 | ||||
-rw-r--r-- | src/H5Sselect.c | 25 |
12 files changed, 85 insertions, 247 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index c9e1ac0..0e77349 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1653,9 +1653,6 @@ done: * then increments the pointer to the first byte after the * address. An undefined value is stored as all 1's. * - * Note this function is almost identical to H5F_size_encode. - * Changes should be made in both places. - * * Return: void * * Programmer: Robb Matzke @@ -1728,9 +1725,6 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) * If the value read is all 1's then the address is returned * with an undefined value. * - * Note this function is almost identical to H5F_size_decode. - * Changes should be made in both places. - * * Return: void * * Programmer: Robb Matzke @@ -1821,127 +1815,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o /*------------------------------------------------------------------------- - * Function: H5F_size_encode - * - * Purpose: Encodes a size into the buffer pointed to by *PP and then - * increments the pointer to the first byte after the size. - * An undefined value is stored as all 1's. If size cannot - * be HSIZE_UNDEF, then you can use H5F_ENCODE_LENGTH - * instead. - * - * Note this function is almost identical to H5F_addr_encode - * and H5F_addr_encode_len. Changes should be made in both - * places. - * - * Return: void - * - * Programmer: Neil Fortner - * Friday, April 10, 2015 - * - *------------------------------------------------------------------------- - */ -void -H5F_size_encode(const H5F_t *f, uint8_t **pp/*in,out*/, hsize_t size) -{ - unsigned u; /* Local index variable */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(f); - HDassert(pp && *pp); - - if(size != HSIZE_UNDEF) { - for(u = 0; u < H5F_SIZEOF_SIZE(f); u++) { - *(*pp)++ = (uint8_t)(size & 0xff); - size >>= 8; - } /* end for */ - HDassert("overflow" && 0 == size); - } /* end if */ - else { - for(u = 0; u < H5F_SIZEOF_SIZE(f); u++) - *(*pp)++ = 0xff; - } /* end else */ - - FUNC_LEAVE_NOAPI_VOID -} /* end H5F_size_encode() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_size_decode - * - * Purpose: Decodes a size from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * size. - * - * If the value read is all 1's then the size is returned - * with an undefined value. If size cannot be HSIZE_UNDEF, - * then you can use H5F_DECODE_LENGTH instead. - * - * Note this function is almost identical to H5F_addr_decode - * and H5F_addr_decode_len. Changes should be made in both - * places. - * - * Return: void - * - * Programmer: Neil Fortner - * Friday, April 10, 2015 - * - *------------------------------------------------------------------------- - */ -void -H5F_size_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, - hsize_t *size_p/*out*/) -{ - hbool_t all_zero = TRUE; /* True if address was all zeroes */ - unsigned u; /* Local index variable */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(f); - HDassert(pp && *pp); - HDassert(size_p); - - /* Reset value in destination */ - *size_p = 0; - - /* Decode bytes from size */ - for(u = 0; u < H5F_SIZEOF_SIZE(f); u++) { - uint8_t c; /* Local decoded byte */ - - /* Get decoded byte (and advance pointer) */ - c = *(*pp)++; - - /* Check for non-undefined size byte value */ - if(c != 0xff) - all_zero = FALSE; - - if(u < sizeof(*size_p)) { - haddr_t tmp = c; /* Local copy of size, for casting */ - - /* Shift decoded byte to correct position */ - tmp <<= (u * 8); /*use tmp to get casting right */ - - /* Merge into already decoded bytes */ - *size_p |= tmp; - } /* end if */ - else - if(!all_zero) - HDassert(0 == **pp); /*overflow */ - } /* end for */ - - /* If 'all_zero' is still TRUE, the size_p was entirely composed of '0xff' - * bytes, which is the encoded form of 'HSIZE_UNDEF', so set the destination - * to that value */ - if(all_zero) - *size_p = HSIZE_UNDEF; - - FUNC_LEAVE_NOAPI_VOID -} /* end H5F_size_decode() */ - - -/*------------------------------------------------------------------------- * Function: H5F_set_grp_btree_shared * * Purpose: Set the grp_btree_shared field with a valid ref-count pointer. diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1533d2c..36d7429 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -667,12 +667,6 @@ H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t **pp, haddr_t addr); H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp, haddr_t *addr_p); H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *addr_p); -/* Size-related functions */ -H5_DLL void H5F_size_encode(const H5F_t *f, uint8_t **pp/*in,out*/, - hsize_t size); -H5_DLL void H5F_size_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, - hsize_t *size_p/*out*/); - /* File access property list callbacks */ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index dae43f3..130bf67 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -299,11 +299,11 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * heap_block_p += tmp_size; /* Source selection */ - if(H5S_SELECT_DESERIALIZE(f, &mesg->storage.u.virt.list[i].source_select, &heap_block_p) < 0) + if(H5S_SELECT_DESERIALIZE(&mesg->storage.u.virt.list[i].source_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode source space selection") /* Virtual selection */ - if(H5S_SELECT_DESERIALIZE(f, &mesg->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) + if(H5S_SELECT_DESERIALIZE(&mesg->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode virtual space selection") /* Parse source file and dataset names for "printf" @@ -524,12 +524,12 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c block_size += str_size[(2 * i) + 1]; /* Source selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(f, mesg->storage.u.virt.list[i].source_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(mesg->storage.u.virt.list[i].source_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; /* Virtual dataset selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(f, mesg->storage.u.virt.list[i].source_dset.virtual_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(mesg->storage.u.virt.list[i].source_dset.virtual_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; } /* end for */ @@ -561,11 +561,11 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ - if(H5S_SELECT_SERIALIZE(f, mesg->storage.u.virt.list[i].source_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(mesg->storage.u.virt.list[i].source_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") /* Virtual selection */ - if(H5S_SELECT_SERIALIZE(f, mesg->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(mesg->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") } /* end for */ @@ -275,7 +275,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE); /* Get the amount of space required to serialize the selection */ - if((buf_size = H5S_SELECT_SERIAL_SIZE(loc->oloc->file, space)) < 0) + if((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") /* Increase buffer size to allow for the dataset OID */ @@ -291,7 +291,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); /* Serialize the selection into heap buffer */ - if(H5S_SELECT_SERIALIZE(loc->oloc->file, space, &p) < 0) + if(H5S_SELECT_SERIALIZE(space, &p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") /* Save the serialized buffer for later */ @@ -668,7 +668,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref) HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found") /* Unserialize the selection */ - if(H5S_SELECT_DESERIALIZE(file, &ret_value, &p) < 0) + if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection") done: @@ -1548,7 +1548,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") /* Find out the size of buffer needed for selection */ - if((sselect_size = H5S_SELECT_SERIAL_SIZE(f, obj)) < 0) + if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t); @@ -1575,7 +1575,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) *p += extent_size; /* Encode the selection part of dataspace. */ - if(H5S_SELECT_SERIALIZE(f, obj, p) < 0) + if(H5S_SELECT_SERIALIZE(obj, p) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space") } /* end else */ @@ -1694,7 +1694,7 @@ H5S_decode(const unsigned char **p) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") /* Decode the select part of dataspace. I believe this part always exists. */ - if(H5S_SELECT_DESERIALIZE(f, &ds, p) < 0) + if(H5S_SELECT_DESERIALIZE(&ds, p) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection") /* Set return value */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 7e33980..568327a 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -38,11 +38,10 @@ static herr_t H5S_all_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_all_release(H5S_t *space); static htri_t H5S_all_is_valid(const H5S_t *space); -static hssize_t H5S_all_serial_size(const H5F_t *f, const H5S_t *space); -static herr_t H5S_all_serialize(const H5F_t *f, const H5S_t *space, - uint8_t **p); -static herr_t H5S_all_deserialize(const H5F_t *f, H5S_t *space, - uint32_t version, uint8_t flags, const uint8_t **p); +static hssize_t H5S_all_serial_size(const H5S_t *space); +static herr_t H5S_all_serialize(const H5S_t *space, uint8_t **p); +static herr_t H5S_all_deserialize(H5S_t *space, uint32_t version, uint8_t flags, + const uint8_t **p); static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_all_offset(const H5S_t *space, hsize_t *off); static int H5S_all_unlim_dim(const H5S_t *space); @@ -468,9 +467,8 @@ H5S_all_is_valid (const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "all" selection information. USAGE - hssize_t H5S_all_serial_size(f, space) - H5F_t *f IN: File pointer - H5S_t *space; IN: Dataspace pointer to query + hssize_t H5S_all_serial_size(space) + H5S_t *space; IN: Dataspace pointer to query RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -482,8 +480,7 @@ H5S_all_is_valid (const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_all_serial_size(const H5F_t H5_ATTR_UNUSED *f, - const H5S_t H5_ATTR_UNUSED *space) +H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -503,8 +500,7 @@ H5S_all_serial_size(const H5F_t H5_ATTR_UNUSED *f, PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_all_serialize(f, space, p) - H5F_t *f IN: File pointer + herr_t H5S_all_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -520,8 +516,7 @@ H5S_all_serial_size(const H5F_t H5_ATTR_UNUSED *f, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, - uint8_t **p) +H5S_all_serialize (const H5S_t *space, uint8_t **p) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -546,7 +541,6 @@ H5S_all_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_all_deserialize(space, p) - H5F_t *f IN: File pointer H5S_t *space; IN/OUT: Dataspace pointer to place selection into uint32_t version IN: Selection version @@ -565,8 +559,7 @@ H5S_all_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_deserialize(const H5F_t H5_ATTR_UNUSED *f, H5S_t *space, - uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, +H5S_all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, const uint8_t H5_ATTR_UNUSED **p) { herr_t ret_value = SUCCEED; /* return value */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 88a3d21..9fa053b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -57,11 +57,10 @@ static herr_t H5S_hyper_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_hyper_release(H5S_t *space); static htri_t H5S_hyper_is_valid(const H5S_t *space); -static hssize_t H5S_hyper_serial_size(const H5F_t *f, const H5S_t *space); -static herr_t H5S_hyper_serialize(const H5F_t *f, const H5S_t *space, - uint8_t **p); -static herr_t H5S_hyper_deserialize(const H5F_t *f, H5S_t *space, - uint32_t version, uint8_t flags, const uint8_t **p); +static hssize_t H5S_hyper_serial_size(const H5S_t *space); +static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t **p); +static herr_t H5S_hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags, + const uint8_t **p); static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_hyper_offset(const H5S_t *space, hsize_t *offset); static int H5S_hyper_unlim_dim(const H5S_t *space); @@ -1954,9 +1953,8 @@ done: Determine the number of bytes needed to store the serialized hyperslab selection information. USAGE - hssize_t H5S_hyper_serial_size(f, space) - H5F_t *f IN: File pointer - H5S_t *space; IN: Dataspace pointer to query + hssize_t H5S_hyper_serial_size(space) + H5S_t *space; IN: Dataspace pointer to query RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -1968,7 +1966,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_hyper_serial_size(const H5F_t *f, const H5S_t *space) +H5S_hyper_serial_size(const H5S_t *space) { unsigned u; /* Counter */ hsize_t block_count; /* block counter for regular hyperslabs */ @@ -1985,11 +1983,11 @@ H5S_hyper_serial_size(const H5F_t *f, const H5S_t *space) /* Size required is always: * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> + * <length (4 bytes)> + <rank (4 bytes)> + - * (4 * <rank> * <start/stride/count/block (sizeof_size bytes)>) = - * 17 + (4 * sizeof_size) bytes + * (4 (start/stride/count/block) * <rank> * <value (8 bytes)>) = + * 17 + (4 * rank * 8) bytes */ ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)space->extent.rank - * (hssize_t)H5F_SIZEOF_SIZE(f)); + * (hssize_t)8); else { /* Version 1 */ /* Basic number of bytes required to serialize hyperslab selection: @@ -2104,7 +2102,6 @@ done: Serialize the current selection into a user-provided buffer. USAGE herr_t H5S_hyper_serialize(space, p) - H5F_t *f IN: File pointer const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -2120,7 +2117,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_serialize(const H5F_t *f, const H5S_t *space, uint8_t **p) +H5S_hyper_serialize (const H5S_t *space, uint8_t **p) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ @@ -2172,10 +2169,10 @@ H5S_hyper_serialize(const H5F_t *f, const H5S_t *space, uint8_t **p) /* Iterate over dimensions */ for(i = 0; i < space->extent.rank; i++) { /* Encode start/stride/block/count */ - H5F_size_encode(f, p, space->select.sel_info.hslab->opt_diminfo[i].start); - H5F_size_encode(f, p, space->select.sel_info.hslab->opt_diminfo[i].stride); - H5F_size_encode(f, p, space->select.sel_info.hslab->opt_diminfo[i].count); - H5F_size_encode(f, p, space->select.sel_info.hslab->opt_diminfo[i].block); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].start); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].stride); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].count); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].block); } /* end for */ } /* end if */ /* Check for a "regular" hyperslab selection */ @@ -2296,7 +2293,6 @@ H5S_hyper_serialize(const H5F_t *f, const H5S_t *space, uint8_t **p) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_hyper_deserialize(space, p) - H5F_t *f IN: File pointer H5S_t *space; IN/OUT: Dataspace pointer to place selection into uint32_t version IN: Selection version @@ -2315,8 +2311,8 @@ H5S_hyper_serialize(const H5F_t *f, const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_deserialize(const H5F_t *f, H5S_t *space, - uint32_t H5_ATTR_UNUSED version, uint8_t flags, const uint8_t **p) +H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags, + const uint8_t **p) { unsigned rank; /* rank of points */ size_t num_elem=0; /* number of elements in selection */ @@ -2352,10 +2348,10 @@ H5S_hyper_deserialize(const H5F_t *f, H5S_t *space, /* Iterate over dimensions */ for(i = 0; i < space->extent.rank; i++) { /* Decode start/stride/block/count */ - H5F_size_decode(f, p, &start[i]); - H5F_size_decode(f, p, &stride[i]); - H5F_size_decode(f, p, &count[i]); - H5F_size_decode(f, p, &block[i]); + UINT64DECODE(*p, start[i]); + UINT64DECODE(*p, stride[i]); + UINT64DECODE(*p, count[i]); + UINT64DECODE(*p, block[i]); } /* end for */ /* Select the hyperslab to the current selection */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 23433a1..74a9b82 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -39,11 +39,10 @@ static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_none_release(H5S_t *space); static htri_t H5S_none_is_valid(const H5S_t *space); -static hssize_t H5S_none_serial_size(const H5F_t *f, const H5S_t *space); -static herr_t H5S_none_serialize(const H5F_t *f, const H5S_t *space, - uint8_t **p); -static herr_t H5S_none_deserialize(const H5F_t *f, H5S_t *space, - uint32_t version, uint8_t flags, const uint8_t **p); +static hssize_t H5S_none_serial_size(const H5S_t *space); +static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p); +static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, + const uint8_t **p); static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off); static int H5S_none_unlim_dim(const H5S_t *space); @@ -436,9 +435,8 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "none" selection information. USAGE - hssize_t H5S_none_serial_size(f, space) - H5F_t *f IN: File pointer - H5S_t *space; IN: Dataspace pointer to query + hssize_t H5S_none_serial_size(space) + H5S_t *space; IN: Dataspace pointer to query RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -450,8 +448,7 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_none_serial_size(const H5F_t H5_ATTR_UNUSED *f, - const H5S_t H5_ATTR_UNUSED *space) +H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -471,8 +468,7 @@ H5S_none_serial_size(const H5F_t H5_ATTR_UNUSED *f, PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_none_serialize(f, space, p) - H5F_t *f IN: File pointer + herr_t H5S_none_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -488,7 +484,7 @@ H5S_none_serial_size(const H5F_t H5_ATTR_UNUSED *f, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, uint8_t **p) +H5S_none_serialize(const H5S_t *space, uint8_t **p) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -510,8 +506,7 @@ H5S_none_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, uint8_t ** PURPOSE Deserialize the current selection from a user-provided buffer. USAGE - herr_t H5S_none_deserialize(f, space, version, flags, p) - H5F_t *f IN: File pointer + herr_t H5S_none_deserialize(space, version, flags, p) H5S_t *space; IN/OUT: Dataspace pointer to place selection into uint32_t version IN: Selection version @@ -530,8 +525,7 @@ H5S_none_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, uint8_t ** REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_deserialize(const H5F_t H5_ATTR_UNUSED *f, H5S_t *space, - uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, +H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, const uint8_t H5_ATTR_UNUSED **p) { herr_t ret_value = SUCCEED; /* return value */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index f719201..b4210c2 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -141,13 +141,12 @@ typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space); /* Method to determine if current selection is valid for dataspace */ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space); /* Method to determine number of bytes required to store current selection */ -typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5F_t *f, const H5S_t *space); +typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_serialize_func_t)(const H5F_t *f, const H5S_t *space, - uint8_t **p); +typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_deserialize_func_t)(const H5F_t *f, H5S_t *space, - uint32_t version, uint8_t flags, const uint8_t **p); +typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags, + const uint8_t **p); /* Method to determine smallest n-D bounding box containing the current selection */ typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end); /* Method to determine linear offset of initial element in selection within dataspace */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index d10b600..202da85 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -40,11 +40,10 @@ static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_point_release(H5S_t *space); static htri_t H5S_point_is_valid(const H5S_t *space); -static hssize_t H5S_point_serial_size(const H5F_t *f, const H5S_t *space); -static herr_t H5S_point_serialize(const H5F_t *f, const H5S_t *space, - uint8_t **p); -static herr_t H5S_point_deserialize(const H5F_t *f, H5S_t *space, - uint32_t version, uint8_t flags, const uint8_t **p); +static hssize_t H5S_point_serial_size(const H5S_t *space); +static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p); +static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, + const uint8_t **p); static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off); static int H5S_point_unlim_dim(const H5S_t *space); @@ -764,8 +763,7 @@ done: information. USAGE hssize_t H5S_point_serial_size(space) - H5F_t *f IN: File pointer - H5S_t *space; IN: Dataspace pointer to query + H5S_t *space; IN: Dataspace pointer to query RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -777,7 +775,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_point_serial_size(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space) +H5S_point_serial_size (const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ hssize_t ret_value; /* return value */ @@ -811,7 +809,6 @@ H5S_point_serial_size(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space) Serialize the current selection into a user-provided buffer. USAGE herr_t H5S_point_serialize(space, p) - H5F_t *f IN: File pointer const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -827,8 +824,7 @@ H5S_point_serial_size(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, - uint8_t **p) +H5S_point_serialize (const H5S_t *space, uint8_t **p) { H5S_pnt_node_t *curr; /* Point information nodes */ uint8_t *lenp; /* pointer to length location for later storage */ @@ -881,7 +877,6 @@ H5S_point_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_point_deserialize(space, p) - H5F_t *f IN: File pointer H5S_t *space; IN/OUT: Dataspace pointer to place selection into uint32_t version IN: Selection version @@ -900,8 +895,7 @@ H5S_point_serialize(const H5F_t H5_ATTR_UNUSED *f, const H5S_t *space, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_deserialize(const H5F_t H5_ATTR_UNUSED *f, H5S_t *space, - uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, +H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, const uint8_t **p) { H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 8918a4f..e6816e2 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -125,8 +125,8 @@ typedef struct H5S_sel_iter_t { #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S)) #define H5S_SELECT_RELEASE(S) ((*(S)->select.type->release)(S)) -#define H5S_SELECT_SERIAL_SIZE(F,S) ((*(S)->select.type->serial_size)(F,S)) -#define H5S_SELECT_SERIALIZE(F,S,BUF) ((*(S)->select.type->serialize)(F,S,BUF)) +#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S)) +#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF)) #define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.type->bounds)(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) ((*(S)->select.type->offset)(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) ((*(S)->select.type->is_contiguous)(S)) @@ -151,8 +151,8 @@ typedef struct H5S_sel_iter_t { #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) (H5S_select_valid(S)) #define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) -#define H5S_SELECT_SERIAL_SIZE(F,S) (H5S_select_serial_size(F,S)) -#define H5S_SELECT_SERIALIZE(F,S,BUF) (H5S_select_serialize(F,S,BUF)) +#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S)) +#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF)) #define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) (H5S_get_select_offset(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) (H5S_select_is_contiguous(S)) @@ -171,7 +171,7 @@ typedef struct H5S_sel_iter_t { #endif /* H5S_PACKAGE */ /* Handle these two callbacks in a special way, since they have prologs that need to be executed */ #define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE)) -#define H5S_SELECT_DESERIALIZE(F,S,BUF) (H5S_select_deserialize(F,S,BUF)) +#define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF)) /* Operations on dataspaces */ @@ -211,8 +211,7 @@ H5_DLL htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2); H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src); /* Operations on selections */ -H5_DLL herr_t H5S_select_deserialize(const H5F_t *f, H5S_t **space, - const uint8_t **p); +H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p); H5_DLL H5S_sel_type H5S_get_select_type(const H5S_t *space); H5_DLL herr_t H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op, void *operator_data); @@ -235,9 +234,8 @@ H5_DLL herr_t H5S_select_release(H5S_t *ds); H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL hssize_t H5S_select_serial_size(const H5F_t *f, const H5S_t *space); -H5_DLL herr_t H5S_select_serialize(const H5F_t *f, const H5S_t *space, - uint8_t **p); +H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space); +H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e965dba..3a1c6c9 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -63,9 +63,7 @@ static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter); herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset) { - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(space); @@ -78,8 +76,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) /* Indicate that the offset was changed */ space->select.offset_changed = TRUE; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_select_offset() */ @@ -221,7 +218,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, *------------------------------------------------------------------------- */ hssize_t -H5S_select_serial_size(const H5F_t *f, const H5S_t *space) +H5S_select_serial_size(const H5S_t *space) { hssize_t ret_value; /* Return value */ @@ -230,7 +227,7 @@ H5S_select_serial_size(const H5F_t *f, const H5S_t *space) HDassert(space); /* Call the selection type's serial_size function */ - ret_value=(*space->select.type->serial_size)(f, space); + ret_value=(*space->select.type->serial_size)(space); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serial_size() */ @@ -261,7 +258,7 @@ H5S_select_serial_size(const H5F_t *f, const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_serialize(const H5F_t *f, const H5S_t *space, uint8_t **p) +H5S_select_serialize(const H5S_t *space, uint8_t **p) { herr_t ret_value=SUCCEED; /* Return value */ @@ -271,7 +268,7 @@ H5S_select_serialize(const H5F_t *f, const H5S_t *space, uint8_t **p) HDassert(p); /* Call the selection type's serialize function */ - ret_value = (*space->select.type->serialize)(f, space, p); + ret_value=(*space->select.type->serialize)(space,p); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serialize() */ @@ -453,7 +450,7 @@ H5S_select_valid(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_deserialize(const H5F_t *f, H5S_t **space, const uint8_t **p) +H5S_select_deserialize(H5S_t **space, const uint8_t **p) { H5S_t *tmp_space; /* Pointer to actual dataspace to use, either *space or a newly allocated one */ @@ -519,19 +516,19 @@ H5S_select_deserialize(const H5F_t *f, H5S_t **space, const uint8_t **p) /* Make routine for selection type */ switch(sel_type) { case H5S_SEL_POINTS: /* Sequence of points selected */ - ret_value = (*H5S_sel_point->deserialize)(f, tmp_space, version, flags, p); + ret_value = (*H5S_sel_point->deserialize)(tmp_space, version, flags, p); break; case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */ - ret_value = (*H5S_sel_hyper->deserialize)(f, tmp_space, version, flags, p); + ret_value = (*H5S_sel_hyper->deserialize)(tmp_space, version, flags, p); break; case H5S_SEL_ALL: /* Entire extent selected */ - ret_value = (*H5S_sel_all->deserialize)(f, tmp_space, version, flags, p); + ret_value = (*H5S_sel_all->deserialize)(tmp_space, version, flags, p); break; case H5S_SEL_NONE: /* Nothing selected */ - ret_value = (*H5S_sel_none->deserialize)(f, tmp_space, version, flags, p); + ret_value = (*H5S_sel_none->deserialize)(tmp_space, version, flags, p); break; default: |