diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-12-05 23:26:00 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-12-05 23:26:00 (GMT) |
commit | eb52c2ea6ff2e78c0c1025d6a5db85f9d2cc8c92 (patch) | |
tree | 812f9bcc69fb821dfed3db039fb58ff681306d8c | |
parent | e8ad5f6d1ad5eecf79168026f10899d1798451a0 (diff) | |
parent | 107bcbd3dfff51895c99ea3ff71afa0ce693a956 (diff) | |
download | hdf5-eb52c2ea6ff2e78c0c1025d6a5db85f9d2cc8c92.zip hdf5-eb52c2ea6ff2e78c0c1025d6a5db85f9d2cc8c92.tar.gz hdf5-eb52c2ea6ff2e78c0c1025d6a5db85f9d2cc8c92.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '107bcbd3dfff51895c99ea3ff71afa0ce693a956':
Implement support for using H5Dvlen_get_buf_size with non-native VOL connectors.
Two fixes: (1) Set the version for reference datatype messge to H5O_DTYPE_VERSION_4. (2) Verify the decoded version for hyperslab selection.
Add H5VL_MAP_OPTIONAL operation id (unused currently).
Fix H5VL_token_t type and fix H5VL_loc_by_token to use H5VL_token_t *
Change hdset_reg_ref_t and H5R_ref_t from arrays of unsigned char to structs containing those arrays. Encapsulating the arrays in this way makes it easier to write and think about pointers to these types, casts to/from these types, etc.
-rw-r--r-- | src/H5D.c | 31 | ||||
-rw-r--r-- | src/H5Dint.c | 2 | ||||
-rw-r--r-- | src/H5Dpkg.h | 1 | ||||
-rw-r--r-- | src/H5Mpublic.h | 3 | ||||
-rw-r--r-- | src/H5O.c | 4 | ||||
-rw-r--r-- | src/H5Ocopy_ref.c | 8 | ||||
-rw-r--r-- | src/H5R.c | 16 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 12 | ||||
-rw-r--r-- | src/H5Rint.c | 20 | ||||
-rw-r--r-- | src/H5Rpublic.h | 8 | ||||
-rw-r--r-- | src/H5Shyper.c | 3 | ||||
-rw-r--r-- | src/H5Spkg.h | 7 | ||||
-rw-r--r-- | src/H5T.c | 1 | ||||
-rw-r--r-- | src/H5VLconnector.h | 6 | ||||
-rw-r--r-- | src/H5VLnative_object.c | 2 | ||||
-rw-r--r-- | test/objcopy_ref.c | 8 | ||||
-rw-r--r-- | test/trefer.c | 273 | ||||
-rw-r--r-- | test/trefer_deprec.c | 2 |
18 files changed, 217 insertions, 190 deletions
@@ -736,7 +736,7 @@ herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { - H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0}; + H5D_vlen_bufsize_t vlen_bufsize = {NULL, H5I_INVALID_HID, H5I_INVALID_HID, NULL, NULL, 0, H5P_DATASET_XFER_DEFAULT}; H5VL_object_t *vol_obj; /* Dataset for this operation */ H5S_t *mspace = NULL; /* Memory dataspace */ char bogus; /* bogus value to pass to H5Diterate() */ @@ -763,8 +763,6 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, /* Save the dataset */ vlen_bufsize.dset_vol_obj = vol_obj; - vlen_bufsize.fspace_id = H5I_INVALID_HID; - vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) @@ -786,6 +784,22 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") + /* If we are not using the native VOL connector we must also set this + * property on the DXPL since the context is not visible to the connector + * and will be ignored if the connector re-enters the library */ + if(vol_obj->connector->cls->value != H5VL_NATIVE_VALUE) { + H5P_genplist_t *dxpl; + + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") + if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") + if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + } /* end if */ + /* Set the initial number of bytes required */ vlen_bufsize.size = 0; @@ -805,14 +819,17 @@ done: if(mspace && H5S_close(mspace) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") - if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") + if(vlen_bufsize.fspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") + if(vlen_bufsize.mspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); + if(vlen_bufsize.dxpl_id != H5P_DATASET_XFER_DEFAULT) + if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") FUNC_LEAVE_API(ret_value) } /* end H5Dvlen_get_buf_size() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 0acb030..c3d4398 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2639,7 +2639,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index ff43880..02121e6 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -524,6 +524,7 @@ typedef struct { void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ hsize_t size; /* Accumulated number of bytes for the selection */ + hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */ } H5D_vlen_bufsize_t; diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index 9cbdb32..524ab0f 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -40,7 +40,8 @@ #define H5VL_MAP_PUT 5 #define H5VL_MAP_GET 6 #define H5VL_MAP_SPECIFIC 7 -#define H5VL_MAP_CLOSE 8 +#define H5VL_MAP_OPTIONAL 8 +#define H5VL_MAP_CLOSE 9 /*******************/ @@ -290,11 +290,11 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") /* This is a native specific routine that requires serialization of the token */ - p = obj_token; + p = (uint8_t *)&obj_token; H5F_addr_encode(f, &p, addr); loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Open the object */ diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index 20b8454..b835f8e 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -185,7 +185,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, /* Set up for the object copy for the reference */ if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") @@ -196,7 +196,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set the object reference info for the destination file */ - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); if(H5R__encode_token_obj_compat((const H5VL_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") @@ -371,7 +371,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, /* Get src object address */ if(H5R__get_obj_token(ref, &tmp_token, &token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token") - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); /* Attempt to copy object from source to destination file */ @@ -379,7 +379,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set dst object address */ - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); if(H5R__set_obj_token(ref, (const H5VL_token_t *)&tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token") @@ -130,7 +130,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p loc_params.obj_type = obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Create the reference (do not pass filename, since file_id is attached) */ @@ -223,7 +223,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, loc_params.obj_type = obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Create the reference (do not pass filename, since file_id is attached) */ @@ -312,7 +312,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, loc_params.obj_type = obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Create the reference (do not pass filename, since file_id is attached) */ @@ -511,7 +511,7 @@ H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Open object by token */ @@ -583,7 +583,7 @@ H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Open object by token */ @@ -675,7 +675,7 @@ H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Open object by token */ @@ -765,7 +765,7 @@ H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve object's type */ @@ -873,7 +873,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve object's name */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 63be3f8..ad3c219 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -128,7 +128,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Retrieve object's type */ @@ -188,7 +188,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Dereference */ @@ -262,7 +262,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, loc_params.obj_type = vol_obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Get the file for the object */ @@ -357,7 +357,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Retrieve object's type */ @@ -421,7 +421,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Open object by token */ @@ -554,7 +554,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Retrieve object's name */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 558c095..9879865 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -258,7 +258,7 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(ref->ref.obj.token, obj_token, token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); ref->ref.obj.filename = NULL; ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_OBJECT2; @@ -300,7 +300,7 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(ref->ref.obj.token, obj_token, token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); ref->ref.obj.filename = NULL; if(NULL == (ref->ref.reg.space = H5S_copy(space, FALSE, TRUE))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") @@ -355,7 +355,7 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN) /* Create new reference */ - H5MM_memcpy(ref->ref.obj.token, obj_token, token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); ref->ref.obj.filename = NULL; if(NULL == (ref->ref.attr.name = HDstrdup(attr_name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") @@ -602,7 +602,7 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) /* Compare object addresses */ if(ref1->token_size != ref2->token_size) HGOTO_DONE(FALSE); - if(0 != HDmemcmp(ref1->ref.obj.token, ref2->ref.obj.token, ref1->token_size)) + if(0 != HDmemcmp(&ref1->ref.obj.token, &ref2->ref.obj.token, ref1->token_size)) HGOTO_DONE(FALSE); /* Compare filenames */ @@ -659,7 +659,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) HDassert((src_ref != NULL) && (dst_ref != NULL)); - H5MM_memcpy(dst_ref->ref.obj.token, src_ref->ref.obj.token, src_ref->token_size); + H5MM_memcpy(&dst_ref->ref.obj.token, &src_ref->ref.obj.token, src_ref->token_size); dst_ref->encode_size = src_ref->encode_size; dst_ref->type = src_ref->type; dst_ref->token_size = src_ref->token_size; @@ -729,7 +729,7 @@ H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, if(obj_token) { if(0 == ref->token_size) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size") - H5MM_memcpy(obj_token, ref->ref.obj.token, ref->token_size); + H5MM_memcpy(obj_token, &ref->ref.obj.token, ref->token_size); } if(token_size) *token_size = ref->token_size; @@ -761,7 +761,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, HDassert(token_size); HDassert(token_size <= H5VL_MAX_TOKEN_SIZE); - H5MM_memcpy(ref->ref.obj.token, obj_token, ref->token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, ref->token_size); ref->token_size = token_size; FUNC_LEAVE_NOAPI(ret_value) @@ -1702,13 +1702,13 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, /* Get object address */ p = (const uint8_t *)data; - H5MM_memcpy(token, p, token_size); + H5MM_memcpy(&token, p, token_size); p += token_size; if(space_ptr) { H5O_loc_t oloc; /* Object location */ H5S_t *space = NULL; - const uint8_t *q = token; + const uint8_t *q = (const uint8_t *)&token; /* Initialize the object location */ H5O_loc_reset(&oloc); @@ -1726,7 +1726,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, *space_ptr = space; } if(obj_token) - H5MM_memcpy(obj_token, token, token_size); + H5MM_memcpy(obj_token, &token, token_size); done: H5MM_free(data); diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 585cb85..a13d54b 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -70,14 +70,18 @@ typedef haddr_t hobj_ref_t; * machine (8 bytes currently) plus an int. * Note! This type can only be used with the "native" HDF5 VOL connector. */ -typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE]; +typedef struct { + char __data[H5R_DSET_REG_REF_BUF_SIZE]; +} hdset_reg_ref_t; /** * Opaque reference type. The same reference type is used for object, * dataset region and attribute references. This is the type that * should always be used with the current reference API. */ -typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE]; +typedef struct { + char __data[H5R_REF_BUF_SIZE]; +} H5R_ref_t; /********************/ /* Public Variables */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index acb8b87..1e1538e 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -4265,6 +4265,9 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_HYPER_VERSION_1 || version > H5S_HYPER_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection") + if(version >= (uint32_t)H5S_HYPER_VERSION_2) { /* Decode flags */ flags = *(pp)++; diff --git a/src/H5Spkg.h b/src/H5Spkg.h index ba60cbf..e139bce 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -41,9 +41,10 @@ #define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR) /* Versions for H5S_SEL_HYPER selection info */ -#define H5S_HYPER_VERSION_1 1 -#define H5S_HYPER_VERSION_2 2 -#define H5S_HYPER_VERSION_3 3 +#define H5S_HYPER_VERSION_1 1 +#define H5S_HYPER_VERSION_2 2 +#define H5S_HYPER_VERSION_3 3 +#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3 /* Versions for H5S_SEL_POINTS selection info */ #define H5S_POINT_VERSION_1 1 @@ -254,6 +254,7 @@ dt->shared->u.atomic.u.r.rtype = H5R_OBJECT2; \ dt->shared->u.atomic.u.r.opaque = TRUE; \ dt->shared->u.atomic.u.r.version = H5R_ENCODE_VERSION; \ + dt->shared->version = H5O_DTYPE_VERSION_4; \ } /* Define the code templates for the "SIZE_TMPL" in the H5T_INIT_TYPE macro */ diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index f0925bf..373eb44 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -52,7 +52,9 @@ /* type for tokens. Token are unique and permanent identifiers that are * used to reference HDF5 objects. */ -typedef unsigned char H5VL_token_t[H5VL_MAX_TOKEN_SIZE]; +typedef struct { + char __data[H5VL_MAX_TOKEN_SIZE]; +} H5VL_token_t; /* types for attribute GET callback */ typedef enum H5VL_attr_get_t { @@ -213,7 +215,7 @@ typedef struct H5VL_loc_by_idx { } H5VL_loc_by_idx_t; typedef struct H5VL_loc_by_token { - void *token; + H5VL_token_t *token; } H5VL_loc_by_token_t; /* Structure to hold parameters for object locations. diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index dfa4eab..6a22b05 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -287,7 +287,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Lookup object */ case H5VL_OBJECT_LOOKUP: { - void *token = va_arg(arguments, void *); + H5VL_token_t *token = va_arg(arguments, H5VL_token_t *); HDassert(token); diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index a73e569..b539b8a 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -1587,7 +1587,6 @@ main(void) unsigned max_compact, min_dense; int configuration; /* Configuration of tests. */ int ExpressMode; - hbool_t same_file; /* Whether to run tests that only use one file */ /* Setup */ h5_reset(); @@ -1620,11 +1619,6 @@ main(void) hid_t fcpl_src; hid_t fcpl_dst; - /* Start with same_file == TRUE. Use source file settings for these - * tests. Don't run with a non-default destination file setting, as - * destination settings have no effect. */ - same_file = TRUE; - /* No need to test dense attributes with old format */ if(!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE)) continue; @@ -1646,7 +1640,6 @@ main(void) if(configuration & CONFIG_SHARE_DST) { HDputs("Testing with shared dst messages:"); fcpl_dst = fcpl_shared; - same_file = FALSE; } else { HDputs("Testing without shared dst messages:"); @@ -1678,7 +1671,6 @@ main(void) if(configuration & CONFIG_DST_NEW_FORMAT) { HDputs("Testing with latest format for destination file:"); dst_fapl = fapl2; - same_file = FALSE; } /* end if */ else { HDputs("Testing with oldest file format for destination file:"); diff --git a/test/trefer.c b/test/trefer.c index 7791ca1..cd09c8e 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -89,9 +89,9 @@ test_reference_params(void) H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temp. buffer read from disk */ + unsigned *obuf; H5R_type_t type; /* Reference type */ - unsigned *tu32; /* Temporary pointer to uint32 data */ - int i; /* Counters */ + unsigned int i; /* Counters */ const char *write_comment = "Foo!"; /* Comments for group */ hid_t ret_id; /* Generic hid_t return value */ ssize_t name_size; /* Size of reference name */ @@ -101,12 +101,13 @@ test_reference_params(void) MESSAGE(5, ("Testing Reference Parameters\n")); /* Allocate write & read buffers */ - wbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - rbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - tbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); + wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)i * 3; + for(i = 0; i < SPACE1_DIM1; i++) + obuf[i] = i * 3; /* Create file */ fid1 = H5Fcreate(FILE_REF_PARAM, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -137,7 +138,7 @@ test_reference_params(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Write selection to disk */ - ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -153,7 +154,7 @@ test_reference_params(void) CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); /* Write attribute to disk */ - ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); + ret = H5Awrite(attr, H5T_NATIVE_UINT, obuf); CHECK(ret, FAIL, "H5Awrite"); /* Close attribute */ @@ -233,19 +234,19 @@ test_reference_params(void) VERIFY(type, H5R_BADTYPE, "H5Rget_type ref"); /* Test parameters to H5Requal */ - ret = H5Requal(NULL, (const H5R_ref_t *)&rbuf[0]); + ret = H5Requal(NULL, &rbuf[0]); VERIFY(ret, FAIL, "H5Requal ref1"); - ret = H5Requal((const H5R_ref_t *)&rbuf[0], NULL); + ret = H5Requal(&rbuf[0], NULL); VERIFY(ret, FAIL, "H5Requal ref2"); /* Test parameters to H5Rcopy */ ret = H5Rcopy(NULL, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcopy src_ref"); - ret = H5Rcopy((const H5R_ref_t *)&rbuf[0], NULL); + ret = H5Rcopy(&rbuf[0], NULL); VERIFY(ret, FAIL, "H5Rcopy dest_ref"); /* Test parameters to H5Ropen_object */ - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); + dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); VERIFY(dset2, FAIL, "H5Ropen_object oapl_id"); dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id); VERIFY(dset2, FAIL, "H5Ropen_object ref"); @@ -298,6 +299,7 @@ test_reference_params(void) HDfree(wbuf); HDfree(rbuf); HDfree(tbuf); + HDfree(obuf); } /* test_reference_params() */ /**************************************************************** @@ -318,10 +320,9 @@ test_reference_obj(void) hsize_t dims1[] = {SPACE1_DIM1}; hid_t dapl_id; /* Dataset access property list */ H5R_ref_t *wbuf, /* buffer to write to disk */ - *rbuf, /* buffer read from disk */ - *tbuf; /* temp. buffer read from disk */ - unsigned *tu32; /* Temporary pointer to uint32 data */ - int i, j; /* Counters */ + *rbuf; /* buffer read from disk */ + unsigned *ibuf, *obuf; + unsigned i, j; /* Counters */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ @@ -329,12 +330,13 @@ test_reference_obj(void) MESSAGE(5, ("Testing Object Reference Functions\n")); /* Allocate write & read buffers */ - wbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - rbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - tbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); + wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)i * 3; + for (i = 0; i < SPACE1_DIM1; i++) + obuf[i] = i * 3; /* Create file */ fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -357,7 +359,7 @@ test_reference_obj(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Write selection to disk */ - ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -405,28 +407,28 @@ test_reference_obj(void) /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group */ ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype */ ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); @@ -459,7 +461,7 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Dread"); /* Open dataset object */ - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); + dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Check information in referenced dataset */ @@ -470,18 +472,18 @@ test_reference_obj(void) VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints"); /* Read from disk */ - ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf); + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); CHECK(ret, FAIL, "H5Dread"); - for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)(i*3), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(ibuf[i], i * 3, "Data"); /* Close dereferenced Dataset */ ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); /* Open group object. GAPL isn't supported yet. But it's harmless to pass in */ - group = H5Ropen_object((const H5R_ref_t *)&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + group = H5Ropen_object(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(group, H5I_INVALID_HID, "H5Ropen_object"); /* Close group */ @@ -489,7 +491,7 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Gclose"); /* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */ - tid1 = H5Ropen_object((const H5R_ref_t *)&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + tid1 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object"); /* Verify correct datatype */ @@ -530,7 +532,8 @@ test_reference_obj(void) /* Free memory buffers */ HDfree(wbuf); HDfree(rbuf); - HDfree(tbuf); + HDfree(ibuf); + HDfree(obuf); } /* test_reference_obj() */ /**************************************************************** @@ -565,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - H5R_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ + H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -583,8 +586,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); /* Allocate write & read buffers */ - wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); - rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); @@ -647,7 +650,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Store first dataset region */ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -691,7 +694,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_region"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -764,7 +767,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) * Dereference an undefined reference (should fail) */ H5E_BEGIN_TRY { - dset2 = H5Ropen_object((const H5R_ref_t *)&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object"); @@ -798,11 +801,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Dread"); /* Try to open objects */ - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); + dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Check what H5Rget_obj_type3 function returns */ - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -821,7 +824,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(*tu8, (uint8_t)(i * 3), "Data"); /* Get the hyperslab selection */ - sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct hyperslab selected */ @@ -849,7 +852,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Sclose"); /* Get the element selection */ - sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct elements selected */ @@ -893,7 +896,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Sclose"); /* Get the unlimited selection */ - sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Ropen_region(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct hyperslab selected */ @@ -928,7 +931,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Attempting to retrieve type of object using non-valid refs */ for(j = 0; j < 3; j++) { H5E_BEGIN_TRY { - ret = H5Rget_obj_type3((const H5R_ref_t *)&nvrbuf[j], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Rget_obj_type3"); } /* end for */ @@ -1006,8 +1009,8 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n")); /* Allocate write & read buffers */ - wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1); - rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1); + wbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1); + rbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1); dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); @@ -1070,7 +1073,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Store first dataset region */ ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -1128,11 +1131,11 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Dread"); /* Try to open objects */ - dset3 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); + dset3 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset3, H5I_INVALID_HID, "H5Ropen_object"); /* Check what H5Rget_obj_type3 function returns */ - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -1151,7 +1154,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(*tu8, (uint8_t)(i * 3), "Data"); /* Get the hyperslab selection */ - sid3 = H5Ropen_region((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + sid3 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct hyperslab selected */ @@ -1203,7 +1206,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Sclose"); /* Get the element selection */ - sid3 = H5Ropen_region((const H5R_ref_t *)&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); + sid3 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct elements selected */ @@ -1313,7 +1316,7 @@ test_reference_obj_deleted(void) /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Dataset1", H5P_DEFAULT, &oref); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&oref, H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&oref, H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -1354,7 +1357,7 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dread"); /* Open deleted dataset object */ - dset2 = H5Ropen_object((const H5R_ref_t *)&oref, H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object(&oref, H5P_DEFAULT, H5P_DEFAULT); VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Close Dataset */ @@ -1501,7 +1504,7 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Dread"); /* Dereference to get the group */ - gid = H5Ropen_object((const H5R_ref_t *)&rref, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Ropen_object(&rref, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid, H5I_INVALID_HID, "H5Ropen_object"); /* Iterate through objects in dereferenced group */ @@ -1562,8 +1565,7 @@ test_reference_attr(void) H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */ ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */ unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1]; - unsigned *tu32; /* Temporary pointer to uint32 data */ - int i; /* Local index variables */ + unsigned i; /* Local index variables */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ @@ -1590,8 +1592,8 @@ test_reference_attr(void) attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)((i * 3) + 1); + for(i = 0; i < SPACE1_DIM1; i++) + wbuf[i] = (i * 3) + 1; /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1609,8 +1611,8 @@ test_reference_attr(void) attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)(i * 3); + for(i = 0; i < SPACE1_DIM1; i++) + wbuf[i] = i * 3; /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1654,8 +1656,8 @@ test_reference_attr(void) attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)((i * 3) + 2); + for(i = 0; i < SPACE1_DIM1; i++) + wbuf[i] = (i * 3) + 2; /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1680,28 +1682,28 @@ test_reference_attr(void) /* Create reference to dataset1 attribute */ ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset2 attribute */ ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group attribute */ ret = H5Rcreate_attr(fid, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype attribute */ ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); @@ -1734,7 +1736,7 @@ test_reference_attr(void) CHECK(ret, FAIL, "H5Dread"); /* Open attribute on dataset object */ - attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Check information in referenced dataset */ @@ -1748,38 +1750,38 @@ test_reference_attr(void) ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)(i * 3), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(rbuf[i], i * 3, "Data"); /* Close dereferenced Dataset */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on group object */ - attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Read from disk */ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)((i * 3) + 1), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(rbuf[i], (i * 3) + 1, "Data"); /* Close attribute */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on named datatype object */ - attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Read from disk */ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)((i * 3) + 2), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(rbuf[i], (i * 3) + 2, "Data"); /* Close attribute */ ret = H5Aclose(attr); @@ -1826,8 +1828,7 @@ test_reference_external(void) H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */ ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */ unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1]; - unsigned *tu32; /* Temporary pointer to uint32 data */ - int i; /* Local index variables */ + unsigned i; /* Local index variables */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ @@ -1854,8 +1855,8 @@ test_reference_external(void) attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)((i * 3) + 1); + for(i = 0; i < SPACE1_DIM1; i++) + wbuf[i] = (i * 3) + 1; /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1873,8 +1874,8 @@ test_reference_external(void) attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)(i * 3); + for(i = 0; i < SPACE1_DIM1; i++) + wbuf[i] = i * 3; /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1918,8 +1919,8 @@ test_reference_external(void) attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)((i * 3) + 2); + for(i = 0; i < SPACE1_DIM1; i++) + wbuf[i] = (i * 3) + 2; /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1940,28 +1941,28 @@ test_reference_external(void) /* Create reference to dataset1 attribute */ ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset2 attribute */ ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group attribute */ ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype attribute */ ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); @@ -2014,7 +2015,7 @@ test_reference_external(void) CHECK(ret, FAIL, "H5Dread"); /* Open attribute on dataset object */ - attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Check information in referenced dataset */ @@ -2028,38 +2029,38 @@ test_reference_external(void) ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)(i * 3), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(rbuf[i], i * 3, "Data"); /* Close dereferenced Dataset */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on group object */ - attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Read from disk */ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)((i * 3) + 1), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(rbuf[i], (i * 3) + 1, "Data"); /* Close attribute */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on named datatype object */ - attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Read from disk */ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - VERIFY(*tu32, (uint32_t)((i * 3) + 2), "Data"); + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(rbuf[i], (i * 3) + 2, "Data"); /* Close attribute */ ret = H5Aclose(attr); @@ -2121,9 +2122,9 @@ test_reference_compat_conv(void) /* Allocate write & read buffers */ wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1); - rbuf_obj = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf_obj = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf_reg = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2286,43 +2287,43 @@ test_reference_compat_conv(void) CHECK(ret, FAIL, "H5Dread"); /* Verify type of objects pointed at */ - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf_obj[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf_obj[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf_obj[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_obj[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf_obj[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); /* Make sure the referenced objects can be opened */ - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object(&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object(&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); - group2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT); + group2 = H5Ropen_object(&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(group2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Gclose(group2); CHECK(ret, FAIL, "H5Gclose"); - tid2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT); + tid2 = H5Ropen_object(&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT); CHECK(tid2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Tclose(tid2); @@ -2342,22 +2343,22 @@ test_reference_compat_conv(void) CHECK(ret, FAIL, "H5Dread"); /* Verify type of objects pointed at */ - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_reg[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf_reg[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf_reg[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&rbuf_reg[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Make sure the referenced objects can be opened */ - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object(&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object(&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); @@ -2414,8 +2415,8 @@ test_reference_perf(void) *rbuf_deprec;/* deprecated references */ hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/ *rbuf_reg_deprec; /* deprecated references*/ - unsigned *tu32; /* Temporary pointer to uint32 data */ - int i, j; /* Counters */ + unsigned *ibuf, *obuf; + unsigned i, j; /* Counters */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ double t1, t2, t; /* Timers */ @@ -2424,18 +2425,20 @@ test_reference_perf(void) MESSAGE(5, ("Testing Object Reference Performance\n")); /* Allocate write & read buffers */ - wbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - wbuf_deprec = (hobj_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)), SPACE1_DIM1); - rbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - rbuf_deprec = (hobj_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)), SPACE1_DIM1); - tbuf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - wbuf_reg = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - rbuf_reg = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), SPACE1_DIM1); - wbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hdset_reg_ref_t)), SPACE1_DIM1); - rbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(hdset_reg_ref_t)), SPACE1_DIM1); - - for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++ = (unsigned)i * 3; + wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + wbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1); + rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1); + tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + wbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + wbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + + for(i = 0; i < SPACE1_DIM1; i++) + obuf[i] = i * 3; /* Create file */ fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2458,7 +2461,7 @@ test_reference_perf(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Write selection to disk */ - ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -2518,7 +2521,7 @@ test_reference_perf(void) /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -2670,7 +2673,7 @@ test_reference_perf(void) CHECK(ret, FAIL, "H5Dread"); /* Open dataset object */ - dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); + dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Check information in referenced dataset */ @@ -2681,11 +2684,11 @@ test_reference_perf(void) VERIFY(ret, dims1[0], "H5Sget_simple_extent_npoints"); /* Read from disk */ - ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf); + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); CHECK(ret, FAIL, "H5Dread"); - for(tu32 = (unsigned *)tbuf, i = 0; i < (int)dims1[0]; i++, tu32++) - VERIFY(*tu32, (uint32_t)(i*3), "Data"); + for(i = 0; i < dims1[0]; i++) + VERIFY(ibuf[i], i * 3, "Data"); /* Close dereferenced Dataset */ ret = H5Dclose(dset2); @@ -2767,7 +2770,7 @@ test_reference_perf(void) CHECK(ret, FAIL, "H5Fclose"); /* Destroy references */ - for(j = 0; j < (int)dims1[0]; j++) { + for(j = 0; j < dims1[0]; j++) { ret = H5Rdestroy(&wbuf[j]); CHECK(ret, FAIL, "H5Rdestroy"); ret = H5Rdestroy(&wbuf_reg[j]); @@ -2788,6 +2791,8 @@ test_reference_perf(void) HDfree(wbuf_reg_deprec); HDfree(rbuf_reg_deprec); HDfree(tbuf); + HDfree(ibuf); + HDfree(obuf); } /* test_reference_perf() */ /**************************************************************** @@ -2811,7 +2816,7 @@ test_reference(void) for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Invalid combinations, just continue */ - if(high == H5F_LIBVER_EARLIEST || high < low) + if(high <= H5F_LIBVER_V112 || high < low) continue; test_reference_region(low, high); /* Test basic H5R dataset region reference code */ diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 194f27e..272b866 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -517,7 +517,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ + hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ |