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 /src | |
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.
Diffstat (limited to 'src')
-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 |
15 files changed, 77 insertions, 47 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); |