From fd1970572f83c92903f1f83cc0dd3bf3a7fc2928 Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Mon, 18 Nov 2019 14:07:03 -0600 Subject: Community-proposed fix --- src/H5Dint.c | 28 +++++++++++++++++++++------- src/H5Dpkg.h | 1 + 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 772a150..bda4662 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -49,7 +49,7 @@ /********************/ /* General stuff */ -static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); +static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl, hbool_t creating, hbool_t vl_type); static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); @@ -465,7 +465,7 @@ done: *------------------------------------------------------------------------- */ static H5D_shared_t * -H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) +H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) { H5D_shared_t *new_dset = NULL; /* New dataset object */ H5P_genplist_t *plist; /* Property list created */ @@ -496,6 +496,19 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) new_dset->dcpl_id = H5P_copy_plist(plist, FALSE); } /* end else */ + if(!vl_type && creating && dapl_id == H5P_DATASET_ACCESS_DEFAULT) { + if(H5I_inc_ref(dapl_id, FALSE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DAPL ID") + new_dset->dapl_id = dapl_id; + } /* end if */ + else { + /* Get the property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + + new_dset->dapl_id = H5P_copy_plist(plist, FALSE); + } /* end else */ + /* Set return value */ ret_value = new_dset; @@ -504,6 +517,8 @@ done: if(new_dset != NULL) { if(new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID") + if(new_dset->dapl_id != 0 && H5I_dec_ref(new_dset->dapl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID") new_dset = H5FL_FREE(H5D_shared_t, new_dset); } /* end if */ @@ -1225,9 +1240,8 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, H5G_loc_reset(&dset_loc); /* Initialize the shared dataset space */ - if(NULL == (new_dset->shared = H5D__new(dcpl_id, TRUE, has_vl_type))) + if(NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Copy & initialize datatype for dataset */ if(H5D__init_type(file, new_dset, type_id, type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype") @@ -1686,7 +1700,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) HDassert(dataset); /* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */ - if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, FALSE, FALSE))) + if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, dapl_id, FALSE, FALSE))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Open the dataset object */ @@ -3436,8 +3450,8 @@ H5D_get_access_plist(const H5D_t *dset) FUNC_ENTER_NOAPI_NOINIT /* Make a copy of the default dataset access property list */ - if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id))) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 723acf9..ff43880 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -443,6 +443,7 @@ struct H5D_shared_t { H5T_t *type; /* Datatype for this dataset */ H5S_t *space; /* Dataspace of this dataset */ hid_t dcpl_id; /* Dataset creation property id */ + hid_t dapl_id; /* Dataset access property id */ H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */ H5O_layout_t layout; /* Data layout */ hbool_t checked_filters;/* TRUE if dataset passes can_apply check */ -- cgit v0.12 From 0de8401d34675b927d22d1a642842f8eaaf5a10a Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Thu, 21 Nov 2019 16:21:06 -0600 Subject: Add two missing calls to H5I_dec_ref for new dapl_id --- src/H5Dint.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index bda4662..0dec9ac 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1334,14 +1334,14 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information") /* Update the dataset's object header info. */ - if(H5D__update_oh_info(file, new_dset, dapl_id) < 0) + if(H5D__update_oh_info(file, new_dset, new_dset->shared->dapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache") /* Indicate that the layout information was initialized */ layout_init = TRUE; /* Set up append flush parameters for the dataset */ - if(H5D__append_flush_setup(new_dset, dapl_id) < 0) + if(H5D__append_flush_setup(new_dset, new_dset->shared->dapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ @@ -1396,6 +1396,8 @@ done: } /* end if */ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + if(new_dset->shared->dapl_id != 0 && H5I_dec_ref(new_dset->shared->dapl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); @@ -1982,12 +1984,13 @@ H5D_close(H5D_t *dataset) if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") - /* Release datatype, dataspace and creation property list -- there isn't + /* Release datatype, dataspace and creation and access property lists -- there isn't * much we can do if one of these fails, so we just continue. */ free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || (H5S_close(dataset->shared->space) < 0) || - (H5I_dec_ref(dataset->shared->dcpl_id) < 0); + (H5I_dec_ref(dataset->shared->dcpl_id) < 0) || + (H5I_dec_ref(dataset->shared->dapl_id) < 0); /* Remove the dataset from the list of opened objects in the file */ if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0) -- cgit v0.12 From 3664cea5d6f87a7e8e708191f9cea36077424a80 Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Mon, 25 Nov 2019 16:28:51 -0600 Subject: Fix failing test and retain semantics for chunk cache properties in non-chunked datasets --- src/H5Dint.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 0dec9ac..21447c0 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3445,14 +3445,17 @@ done: hid_t H5D_get_access_plist(const H5D_t *dset) { - H5P_genplist_t *old_plist; /* Default DAPL */ + H5P_genplist_t *old_plist; /* Stored DAPL from dset */ H5P_genplist_t *new_plist; /* New DAPL */ + H5P_genplist_t *def_fapl; /* Default FAPL */ + H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */ + H5D_rdcc_t def_chunk_info; /* Default chunk cache property */ hid_t new_dapl_id = FAIL; hid_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT - /* Make a copy of the default dataset access property list */ + /* Make a copy of the dataset's dataset access property list */ if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) @@ -3460,7 +3463,8 @@ H5D_get_access_plist(const H5D_t *dset) if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - /* If the dataset is chunked then copy the rdcc & append flush parameters */ + /* If the dataset is chunked then copy the rdcc & append flush parameters. + * Otherwise, use the default values. */ if(dset->shared->layout.type == H5D_CHUNKED) { if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") @@ -3470,7 +3474,33 @@ H5D_get_access_plist(const H5D_t *dset) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &dset->shared->append_flush) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush property") - } /* end if */ + } else { + /* Get the default FAPL */ + if(NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list") + + /* Set the data cache number of slots to the value of the default FAPL */ + if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data number of slots"); + if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots") + + /* Set the data cache byte size to the value of the default FAPL */ + if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data cache byte size"); + if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size") + + /* Set the preempt read chunks property to the value of the default FAPL */ + if (H5P_get(def_fapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get preempt read chunks"); + if(H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks") + + /* Set the append flush property to its default value */ + if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &def_append_flush_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property") + }/* end if-else */ /* Set the VDS view & printf gap options */ if(H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0) -- cgit v0.12 From 6b68cc352ffabb5fe997db1eb52216b3ee80e669 Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Tue, 26 Nov 2019 15:50:08 -0600 Subject: H5R: fix H5Tconv to check for null references Valid for both deprecated and non-deprecated references Update test --- src/H5Rint.c | 3 +- src/H5Tconv.c | 71 +++++++++------- src/H5Tpkg.h | 4 + src/H5Tref.c | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- test/trefer.c | 8 +- 5 files changed, 304 insertions(+), 46 deletions(-) diff --git a/src/H5Rint.c b/src/H5Rint.c index 504ae06..0879f31 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -413,6 +413,7 @@ H5R__destroy(H5R_ref_priv_t *ref) break; case H5R_OBJECT1: case H5R_DATASET_REGION1: + break; case H5R_BADTYPE: case H5R_MAXTYPE: HDassert("invalid reference type" && 0); @@ -423,7 +424,7 @@ H5R__destroy(H5R_ref_priv_t *ref) } /* end switch */ /* Decrement refcount of attached loc_id */ - if((ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) + if(ref->type && (ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") done: diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 6aea00e..4cc5f3c 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3609,39 +3609,52 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, for(elmtno = 0; elmtno < safe; elmtno++) { size_t buf_size; hbool_t dst_copy = FALSE; + hbool_t is_nil; /* Whether sequence is "nil" */ - /* Get size of references */ - if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, &dst_copy))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") - - /* Check if conversion buffer is large enough, resize if necessary. */ - if(conv_buf_size < buf_size) { - conv_buf_size = buf_size; - if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") - HDmemset(conv_buf, 0, conv_buf_size); - } /* end if */ + /* Check for "nil" source sequence */ + if((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") - if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { - H5MM_memcpy(conv_buf, s, buf_size); - } else { - /* Read reference */ - if(src->shared->u.atomic.u.r.cls->read( + if(is_nil) { + + /* Write "nil" sequence to destination location */ + if((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'") + } /* end else-if */ + else { + /* Get size of references */ + if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") - } + dst->shared->u.atomic.u.r.file, &dst_copy))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") + + /* Check if conversion buffer is large enough, resize if necessary. */ + if(conv_buf_size < buf_size) { + conv_buf_size = buf_size; + if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") + HDmemset(conv_buf, 0, conv_buf_size); + } /* end if */ - if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { - H5MM_memcpy(d, conv_buf, buf_size); - } else { - /* Write reference to destination location */ - if(dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, - dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") + if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + H5MM_memcpy(conv_buf, s, buf_size); + } else { + /* Read reference */ + if(src->shared->u.atomic.u.r.cls->read( + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") + } + + if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + H5MM_memcpy(d, conv_buf, buf_size); + } else { + /* Write reference to destination location */ + if(dst->shared->u.atomic.u.r.cls->write( + src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, + dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") + } } /* Advance pointers */ diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 1dbc229..39bff15 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -182,11 +182,15 @@ struct H5T_path_t { }; /* Reference function pointers */ +typedef herr_t (*H5T_ref_isnullfunc_t)(const H5VL_object_t *file, const void *src_buf, hbool_t *isnull); +typedef herr_t (*H5T_ref_setnullfunc_t)(H5VL_object_t *file, void *dst_buf, void *bg_buf); typedef size_t (*H5T_ref_getsizefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); typedef herr_t (*H5T_ref_readfunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); typedef herr_t (*H5T_ref_writefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); typedef struct H5T_ref_class_t { + H5T_ref_isnullfunc_t isnull; /* check if reference value is NIL */ + H5T_ref_setnullfunc_t setnull; /* set a reference value to NIL */ H5T_ref_getsizefunc_t getsize; /* get reference size (bytes) */ H5T_ref_readfunc_t read; /* read reference into buffer */ H5T_ref_writefunc_t write; /* write reference from buffer */ diff --git a/src/H5Tref.c b/src/H5Tref.c index 2e52954..57263a9 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -54,18 +54,24 @@ struct H5Tref_dsetreg { /* Local Prototypes */ /********************/ +static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); +static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); /* For compatibility */ +static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); @@ -75,24 +81,32 @@ static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *sr /* Class for reference in memory */ static const H5T_ref_class_t H5T_ref_mem_g = { + H5T__ref_mem_isnull, /* 'isnull' */ + H5T__ref_mem_setnull, /* 'setnull' */ H5T__ref_mem_getsize, /* 'getsize' */ H5T__ref_mem_read, /* 'read' */ H5T__ref_mem_write /* 'write' */ }; static const H5T_ref_class_t H5T_ref_disk_g = { + H5T__ref_disk_isnull, /* 'isnull' */ + H5T__ref_disk_setnull, /* 'setnull' */ H5T__ref_disk_getsize, /* 'getsize' */ H5T__ref_disk_read, /* 'read' */ H5T__ref_disk_write /* 'write' */ }; static const H5T_ref_class_t H5T_ref_obj_disk_g = { + H5T__ref_obj_disk_isnull, /* 'isnull' */ + NULL, /* 'setnull' */ H5T__ref_obj_disk_getsize, /* 'getsize' */ H5T__ref_obj_disk_read, /* 'read' */ NULL /* 'write' */ }; static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = { + H5T__ref_dsetreg_disk_isnull, /* 'isnull' */ + NULL, /* 'setnull' */ H5T__ref_dsetreg_disk_getsize, /* 'getsize' */ H5T__ref_dsetreg_disk_read, /* 'read' */ NULL /* 'write' */ @@ -268,6 +282,57 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_mem_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, + const void *src_buf, hbool_t *isnull) +{ + const unsigned char zeros[H5T_REF_MEM_SIZE] = { 0 }; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC_NOERR + + /* Check parameters */ + HDassert(src_buf); + HDassert(isnull); + + *isnull = (0 == HDmemcmp(src_buf, zeros, H5T_REF_MEM_SIZE)) ? TRUE : FALSE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_mem_isnull() */ + + +/*------------------------------------------------------------------------- + * Function: H5T__ref_mem_setnull + * + * Purpose: Set a reference as NULL / uninitialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, + H5_ATTR_UNUSED void *bg_buf) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC_NOERR + + HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_mem_setnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_mem_getsize * * Purpose: Retrieves the size of a memory based reference. @@ -484,6 +549,96 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_disk_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, + hbool_t *isnull) +{ + const uint8_t *p = (const uint8_t *)src_buf; + H5R_type_t ref_type; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check parameters */ + HDassert(src_file); + HDassert(src_buf); + HDassert(isnull); + + /* Try to check encoded reference type */ + ref_type = (H5R_type_t)*p++; + if(ref_type) { + /* This is a valid reference */ + *isnull = FALSE; + } else { + /* Skip the size / header */ + p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T; + + /* Check if blob ID is "nil" */ + if(H5VL_blob_specific(src_file, (void *)p, H5VL_BLOB_ISNULL, isnull) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_disk_isnull() */ + + +/*------------------------------------------------------------------------- + * Function: H5T__ref_disk_setnull + * + * Purpose: Set a reference as NULL / uninitialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) +{ + uint8_t *q = (uint8_t *)dst_buf; + uint8_t *p_bg = (uint8_t *)bg_buf; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(dst_file); + HDassert(dst_buf); + + /* TODO Should get rid of bg stuff */ + if(p_bg) { + /* Skip the size / header */ + p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE); + + /* Remove blob for old data */ + if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") + } /* end if */ + + /* Copy header manually so that it does not get encoded into the blob */ + HDmemset(q, 0, H5R_ENCODE_HEADER_SIZE); + q += H5R_ENCODE_HEADER_SIZE; + + /* Set the size */ + UINT32ENCODE(q, 0); + + /* Set blob ID to "nil" */ + if(H5VL_blob_specific(dst_file, q, H5VL_BLOB_SETNULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_disk_setnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_disk_getsize * * Purpose: Retrieves the length of a disk based reference. @@ -562,7 +717,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size q += H5R_ENCODE_HEADER_SIZE; blob_size -= H5R_ENCODE_HEADER_SIZE; - /* Skip the length of the sequence */ + /* Skip the size */ p += H5_SIZEOF_UINT32_T; HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T)); @@ -606,10 +761,10 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, if(p_bg) { size_t p_buf_size_left = dst_size; - /* Skip the length of the reference */ - p_bg += H5_SIZEOF_UINT32_T; - HDassert(p_buf_size_left > H5_SIZEOF_UINT32_T); - p_buf_size_left -= H5_SIZEOF_UINT32_T; + /* Skip the size / header */ + p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE); + HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE)); + p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE); /* Remove blob for old data */ if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0) @@ -638,6 +793,48 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_obj_disk_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, + const void *src_buf, hbool_t *isnull) +{ + H5F_t *src_f; + const uint8_t *p = (const uint8_t *)src_buf; + haddr_t addr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check parameters */ + HDassert(src_file); + HDassert(src_buf); + HDassert(isnull); + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + /* Get the object address */ + H5F_addr_decode(src_f, &p, &addr); + + /* Check if heap address is 'nil' */ + *isnull = (addr == 0) ? TRUE : FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_obj_disk_isnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_obj_disk_getsize * * Purpose: Retrieves the length of a disk based reference. @@ -709,7 +906,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ /* Get object address */ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, - (unsigned char *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) + (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -718,6 +915,49 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_dsetreg_disk_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, + hbool_t *isnull) +{ + H5F_t *src_f; + const uint8_t *p = (const uint8_t *)src_buf; + haddr_t addr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check parameters */ + HDassert(src_file); + HDassert(src_buf); + HDassert(isnull); + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + /* Get the heap address */ + H5F_addr_decode(src_f, &p, &addr); + + /* Check if heap address is 'nil' */ + *isnull = (addr == 0) ? TRUE : FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_dsetreg_disk_isnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_dsetreg_disk_getsize * * Purpose: Retrieves the length of a disk based reference. @@ -727,28 +967,28 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *file, - const void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size, +H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, + const void H5_ATTR_UNUSED *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy) { size_t ret_value = sizeof(struct H5Tref_dsetreg); FUNC_ENTER_STATIC - HDassert(buf); + HDassert(src_buf); #ifndef NDEBUG { - H5F_t *f; + H5F_t *src_f; /* We should assert here that the terminal connector is H5VL_NATIVE once * there is a facility to do so -NAF 2019/10/30 */ /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(file))) + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") - HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f)); + HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); } /* end block */ #endif /* NDEBUG */ diff --git a/test/trefer.c b/test/trefer.c index 7d87ea9..0f9e4f9 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -793,7 +793,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) } H5E_END_TRY; if(libver_high < H5F_LIBVER_V110) - VERIFY(ret, FAIL, "H5Dread"); + CHECK(ret, FAIL, "H5Dread"); else { CHECK(ret, FAIL, "H5Dread"); @@ -2102,7 +2102,7 @@ test_reference_compat_conv(void) hid_t tid1, tid2; /* Datatype ID */ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}, - dims3[] = {2}; + dims3[] = {SPACE1_DIM1}; /* Purposedly set dimension larger to test NULL references */ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK];/* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ @@ -2122,8 +2122,8 @@ 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); - wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), 2); - rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), 2); + 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); /* Create file */ fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -- cgit v0.12 From 8fb9fb5d4dab0b7e9a9884611d0511e2a03228a2 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 27 Nov 2019 11:16:52 -0600 Subject: Revert "Oops, remove more C99 designated initializers for VS 2010 compatibility." This reverts commit f907b511d06612dafc7814a7c30f2f3d2b76d52b. --- hl/src/H5DS.c | 6 +----- src/H5Fsuper_cache.c | 3 +-- src/H5HGcache.c | 2 +- test/fillval.c | 8 ++------ 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index ce61028..44e0ecf9 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1433,11 +1433,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) union { /* union is needed to eliminate compiler warnings about */ char ** buf; /* discarding the 'const' qualifier in the free */ char const ** const_buf; /* buf calls */ - } u; - - u.buf = NULL; - u.const_buf = NULL; - + } u = {.buf = NULL, .const_buf = NULL}; /*------------------------------------------------------------------------- * parameter checking *------------------------------------------------------------------------- diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index ce216a2..b7c1dad 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -881,7 +881,7 @@ H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, { const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ - H5O_drvinfo_t drvrinfo; /* Driver info */ + H5O_drvinfo_t drvrinfo = {.len = 0}; /* Driver info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -893,7 +893,6 @@ H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, HDassert(*actual_len == image_len); HDassert(image_len == H5F_DRVINFOBLOCK_HDR_SIZE); - drvrinfo.len = 0; /* Deserialize the file driver info's prefix */ if(H5F__drvrinfo_prefix_decode(&drvrinfo, NULL, &image, udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file driver info prefix") diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 9f6e73f..e3d0f4c 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -205,7 +205,7 @@ static herr_t H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len, void *udata, size_t *actual_len) { - H5HG_heap_t heap; /* Global heap */ + H5HG_heap_t heap = {.size = 0}; /* Global heap */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/test/fillval.c b/test/fillval.c index dd0ca7f..5c20e14 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -758,15 +758,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, int fillval=(-1), val_rd, should_be; int i, j, *buf=NULL, odd; unsigned u; - comp_datatype rd_c, fill_c, should_be_c; + comp_datatype rd_c, fill_c = {.a = 0, .x = 0, .y = 0, .z = 0}, + should_be_c; comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - fill_c.a = 0; - fill_c.x = 0; - fill_c.y = 0; - fill_c.z = 0; - if(datatype == H5T_INTEGER) { fillval = *(int*)_fillval; } -- cgit v0.12 From 0108072f7a746b809952d5cc560577f931b64f71 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 27 Nov 2019 11:26:02 -0600 Subject: Revert "Make a squash commit of 'Quiet some warnings by adjusting warnings level and fixing some code.' (commit 5c911d8baf3)" --- config/commence.am | 2 +- config/gnu-flags | 98 ++---------- configure.ac | 4 - hl/src/H5DS.c | 2 +- hl/test/H5srcdir_str.h.in | 2 +- src/H5Cdbg.c | 5 +- src/H5Cpkg.h | 2 +- src/H5Dchunk.c | 35 +++-- src/H5FDhdfs.c | 1 + src/H5FDlog.c | 4 +- src/H5FSsection.c | 10 +- src/H5Fsuper_cache.c | 27 ++-- src/H5HFcache.c | 8 +- src/H5HFtiny.c | 2 +- src/H5HGcache.c | 8 +- src/H5Oint.c | 1 - src/H5Pmapl.c | 3 +- src/H5Rint.c | 2 +- src/H5Rpublic.h | 8 +- src/H5SL.c | 4 +- src/H5SM.c | 4 +- src/H5T.c | 2 +- src/H5Tprivate.h | 2 +- src/H5Tref.c | 2 +- src/libhdf5.settings.in | 2 +- test/CMakeLists.txt | 2 - test/H5srcdir.c | 61 -------- test/H5srcdir.h | 39 ++++- test/H5srcdir_str.h.in | 2 +- test/Makefile.am | 8 +- test/cache.c | 2 +- test/cache_common.c | 2 +- test/cache_tagging.c | 2 +- test/del_many_dense_attrs.c | 2 +- test/dsets.c | 9 +- test/dt_arith.c | 34 ++--- test/fillval.c | 3 +- test/null_vol_connector.c | 6 - test/objcopy_ref.c | 8 + test/swmr_sparse_reader.c | 4 +- test/tid.c | 25 ++-- test/trefer.c | 271 +++++++++++++++++----------------- test/trefer_deprec.c | 2 +- test/tvlstr.c | 4 +- test/vds_swmr.h | 24 ++- test/vds_swmr_common.c | 36 ----- tools/lib/h5diff.c | 3 - tools/lib/h5diff_array.c | 4 - tools/lib/h5tools_utils.c | 2 +- tools/src/h5import/h5import.c | 2 +- tools/src/h5repack/h5repack_main.c | 14 +- tools/test/h5repack/h5repackgentest.c | 1 + 52 files changed, 314 insertions(+), 498 deletions(-) delete mode 100644 test/H5srcdir.c delete mode 100644 test/vds_swmr_common.c diff --git a/config/commence.am b/config/commence.am index 830c494..a16eee5 100644 --- a/config/commence.am +++ b/config/commence.am @@ -70,7 +70,7 @@ H5CPP=${DESTDIR}$(bindir)/h5c++ # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ +AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@ AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@ diff --git a/config/gnu-flags b/config/gnu-flags index bc120a8..6355ccf 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -168,44 +168,12 @@ if test "X-gcc" = "X-$cc_vendor"; then # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add # it to the developer flags. # - H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra" - H5_ECFLAGS="$H5_ECFLAGS -Werror=bad-function-cast" - H5_ECFLAGS="$H5_ECFLAGS -Werror=cast-align" - H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion" - H5_ECFLAGS="$H5_ECFLAGS -Werror=declaration-after-statement" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wdisabled-optimization" - H5_CFLAGS="$H5_CFLAGS -Wfloat-equal" - H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch" - H5_ECFLAGS="$H5_ECFLAGS -Werror=missing-declarations" - H5_CFLAGS="$H5_CFLAGS -Wmissing-include-dirs" - H5_ECFLAGS="$H5_ECFLAGS -Werror=missing-prototypes" - H5_ECFLAGS="$H5_ECFLAGS -Werror=nested-externs" - H5_ECFLAGS="$H5_ECFLAGS -Werror=old-style-definition" - H5_ECFLAGS="$H5_ECFLAGS -Werror=packed" - H5_ECFLAGS="$H5_ECFLAGS -Werror=redundant-decls" - H5_ECFLAGS="$H5_ECFLAGS -Werror=shadow" - H5_ECFLAGS="$H5_ECFLAGS -Werror=strict-prototypes" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wswitch-default" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wswitch-enum" - H5_CFLAGS="$H5_CFLAGS -Wundef" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunused-macros" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsafe-loop-optimizations" - H5_CFLAGS="$H5_CFLAGS -Wwrite-strings" - - # - # HDF5 code should not trigger the following warnings under any - # circumstances, so ask the compiler to treat them as errors: - # -# H5_ECFLAGS="$H5_ECFLAGS -Werror=discarded-qualifiers" - H5_ECFLAGS="$H5_ECFLAGS -Werror=implicit-function-declaration" - H5_CFLAGS="$H5_CFLAGS -Wmaybe-uninitialized" - H5_ECFLAGS="$H5_ECFLAGS -Werror=pointer-sign" - H5_ECFLAGS="$H5_ECFLAGS -Werror=pointer-to-int-cast" - H5_ECFLAGS="$H5_ECFLAGS -Werror=switch" - H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-but-set-variable" - H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-function" - H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-parameter" - H5_ECFLAGS="$H5_ECFLAGS -Werror=unused-variable" + H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" + H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" + H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" + H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" + H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" + H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" ###################### # Developer warnings # @@ -254,34 +222,17 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 4.3 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then - H5_CFLAGS="$H5_CFLAGS -Wlogical-op" - # - # Lots of noise, questionable benefit: - # - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wlarger-than=2560" - # + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" fi # gcc 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wpacked-bitfield-compat" - # - # Lots of noise, questionable benefit: - # - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wframe-larger-than=16384" - # + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" fi # gcc 4.5 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wunsuffixed-float-constants" - # - # -Wjump-misses-init makes lots of noise for a questionable benefit. - # Can jumping over an initialization in C cause any harm, if - # the variable is never *used* before it has been initialized? - # - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wjump-misses-init" - # + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" fi # gcc 4.6 @@ -293,17 +244,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 4.7 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then - # - # It's not clear that -Wvector-operation-performance warnings are - # actionable. - # - # -Wstack-usage=8192 warnings need better justification; - # if justifiable, should be enabled on a branch and swept up there - # before burdening the whole development team. - # - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstack-usage=8192" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wvector-operation-performance" - + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" fi @@ -322,21 +263,11 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 5 if test $cc_vers_major -ge 5; then H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - H5_ECFLAGS="$H5_ECFLAGS -Werror=incompatible-pointer-types" fi # gcc 6 if test $cc_vers_major -ge 6; then - H5_CFLAGS="$H5_CFLAGS -Wunused-const-variable -Whsa -Wnormalized" - # - # Unacceptably noisy on HDF5 right now. - # - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wnull-dereference" - # - # Careful! -Wduplicated-cond, combined with HDF5's heavy use of - # macros, can make a lot of noise. - # - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wduplicated-cond" + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" fi # gcc 7 @@ -347,13 +278,6 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 8 if test $cc_vers_major -ge 8; then - # For GCC 8, promote maybe-initialized warnings to an error. GCC 8 - # reports 0 maybe-uninitialized warnings where earlier versions - # make many false reports. GCC 8 seems to analyze calls to static - # in order to detect initializations that occur there. It's possible - # that GCC 8 only performs that analysis at -O3, though. - H5_ECFLAGS="$H5_ECFLAGS -Werror=maybe-uninitialized" - H5_ECFLAGS="$H5_ECFLAGS -Werror=cast-function-type" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" diff --git a/configure.ac b/configure.ac index 5851b32..0eada60 100644 --- a/configure.ac +++ b/configure.ac @@ -103,11 +103,7 @@ AC_SUBST([AR_FLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) -## -## H5_ECFLAGS is for warnings that should be treated as errors. -## AC_SUBST([H5_CFLAGS]) -AC_SUBST([H5_ECFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 44e0ecf9..b24f887 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1433,7 +1433,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) union { /* union is needed to eliminate compiler warnings about */ char ** buf; /* discarding the 'const' qualifier in the free */ char const ** const_buf; /* buf calls */ - } u = {.buf = NULL, .const_buf = NULL}; + } u; /*------------------------------------------------------------------------- * parameter checking *------------------------------------------------------------------------- diff --git a/hl/test/H5srcdir_str.h.in b/hl/test/H5srcdir_str.h.in index ba30a88..bab1df3 100644 --- a/hl/test/H5srcdir_str.h.in +++ b/hl/test/H5srcdir_str.h.in @@ -16,5 +16,5 @@ */ /* Set the 'srcdir' path from configure time */ -#define config_srcdir "@srcdir@" +static const char *config_srcdir = "@srcdir@"; diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index cb1d0e2..1f55e86 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -319,8 +319,9 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) (int)(entry_ptr->is_dirty), entry_ptr->type->name); - HDfprintf(stdout, " node_ptr = %p, item = %p\n", - node_ptr, H5SL_item(node_ptr)); + HDfprintf(stdout, " node_ptr = 0x%llx, item = %p\n", + (unsigned long long)node_ptr, + H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ node_ptr = H5SL_next(node_ptr); diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index b8648f0..9156c0d 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4694,7 +4694,7 @@ struct H5C_t { uint32_t num_last_entries; #if H5C_DO_SANITY_CHECKS int32_t slist_len_increase; - int64_t slist_size_increase; + ssize_t slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ /* Fields for maintaining list of tagged entries */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4d139c7..381ca4a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -284,8 +284,7 @@ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void * static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims); static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); -static void *H5D__chunk_mem_xfree(void *chk, void *pline); -static void H5D__chunk_mem_xfree_wrapper(void *chk, void *pline); +static void *H5D__chunk_mem_xfree(void *chk, const void *pline); static void *H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); @@ -1101,10 +1100,14 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf H5D_chunk_map_t *fm) { const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ + H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */ hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ + H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ unsigned f_ndims; /* The number of dimensions of the file's dataspace */ int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ + char bogus; /* "bogus" buffer to pass to selection iterator */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1428,7 +1431,7 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) *------------------------------------------------------------------------- */ static void * -H5D__chunk_mem_xfree(void *chk, void *_pline) +H5D__chunk_mem_xfree(void *chk, const void *_pline) { const H5O_pline_t *pline = (const H5O_pline_t *)_pline; @@ -1444,17 +1447,6 @@ H5D__chunk_mem_xfree(void *chk, void *_pline) FUNC_LEAVE_NOAPI(NULL) } /* H5D__chunk_mem_xfree() */ -/* H5D__chunk_mem_xfree_wrapper() safely adapts the type of - * H5D__chunk_mem_xfree() to an H5MM_free_t callback, without making - * compilers warn. It is used with H5D__chunk_mem_xfree_wrapper(), for - * example. - */ -static void -H5D__chunk_mem_xfree_wrapper(void *chk, void *_pline) -{ - (void)H5D__chunk_mem_xfree(chk, _pline); -} - /*------------------------------------------------------------------------- * Function: H5D__chunk_mem_realloc @@ -2147,6 +2139,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) { H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ H5SL_node_t *curr_node; /* Current node in skip list */ + hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ + hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ + hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ + hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ + hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2171,18 +2169,17 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) chunk_info->mspace_shared = TRUE; } /* end if */ else { + HDassert(fm->m_ndims == 1); hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ - HDassert(fm->m_ndims == 1); - if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") /* Iterate over each chunk in the chunk list */ curr_node = H5SL_first(fm->sel_chunks); while(curr_node) { - hsize_t schunk_points; /* Number of elements in chunk selection */ + hssize_t schunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -4453,7 +4450,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* (delay allocating fill buffer for VL datatypes until refilling) */ /* (casting away const OK - QAK) */ if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, - (void *)pline, H5D__chunk_mem_xfree_wrapper, (void *)pline, + (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") @@ -7155,6 +7152,7 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ hsize_t num_chunks = 0; /* Number of written chunks */ H5D_rdcc_ent_t *ent; /* Cache entry */ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ + const H5O_layout_t *layout; /* Dataset layout */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -7164,6 +7162,7 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ HDassert(space); HDassert(nchunks); + layout = &(dset->shared->layout); /* Dataset layout */ rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */ HDassert(rdcc); diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 0b954cf..819d200 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -581,6 +581,7 @@ hid_t H5FD_hdfs_init(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ + unsigned int bin_i; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 1c7d549..ac5667f 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -489,8 +489,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #endif #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start; - struct timeval open_timeval_diff = {0, 0}; - struct timeval stat_timeval_diff = {0, 0}; + struct timeval open_timeval_diff; + struct timeval stat_timeval_diff; #endif /* H5_HAVE_GETTIMEOFDAY */ h5_stat_t sb; H5FD_t *ret_value = NULL; /* Return value */ diff --git a/src/H5FSsection.c b/src/H5FSsection.c index cf4a587..df67bd9 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -371,10 +371,10 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Check if section info lock count dropped to zero */ if(fspace->sinfo_lock_count == 0) { hbool_t release_sinfo_space = FALSE; /* Flag to indicate section info space in file should be released */ - hbool_t closing_or_flushing = f->shared->closing; /* Is closing or flushing in progress */ + hbool_t flush_in_progress = FALSE; /* Is flushing in progress */ - /* Check whether cache-flush is in progress if closing is not. */ - if(!closing_or_flushing && H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0) + /* Check whether cache is flush_in_progress */ + if(H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress") /* Check if we actually protected the section info */ @@ -390,7 +390,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" cache_flags |= H5AC__DIRTIED_FLAG; /* On file close or flushing, does not allow section info to shrink in size */ - if(closing_or_flushing) { + if(f->shared->closing || flush_in_progress) { if(fspace->sect_size > fspace->alloc_sect_size) cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; else @@ -441,7 +441,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* Set flag to release section info space in file */ /* On file close or flushing, only need to release section info with size bigger than previous section */ - if(closing_or_flushing) { + if(f->shared->closing || flush_in_progress) { if(fspace->sect_size > fspace->alloc_sect_size) release_sinfo_space = TRUE; else diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index b7c1dad..125d6cf 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -347,9 +347,9 @@ static herr_t H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - const uint8_t *image = _image; /* Pointer into raw data buffer */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ - H5F_super_t sblock; /* Temporary file superblock */ + H5F_super_t sblock; /* Temporary file superblock */ htri_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -361,15 +361,6 @@ H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, HDassert(*actual_len == image_len); HDassert(image_len >= H5F_SUPERBLOCK_FIXED_SIZE + 6); - /* Initialize because GCC 5.5 does not realize that - * H5F__superblock_prefix_decode() initializes it. - * - * TBD condition on compiler version. - */ - sblock.super_vers = 0; - sblock.sizeof_addr = 0; - sblock.sizeof_size = 0; - /* Deserialize the file superblock's prefix */ if(H5F__superblock_prefix_decode(&sblock, &image, udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file superblock prefix") @@ -402,7 +393,7 @@ done: static htri_t H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata) { - const uint8_t *image = _image; /* Pointer into raw data buffer */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -448,7 +439,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, { H5F_super_t *sblock = NULL; /* File's superblock */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = _image; /* Pointer into raw data buffer */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5F_super_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -673,7 +664,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU void *_thing) { H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */ - uint8_t *image = _image; /* Pointer into raw data buffer */ + uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ haddr_t rel_eof; /* Relative EOF for file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -879,9 +870,9 @@ static herr_t H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - const uint8_t *image = _image; /* Pointer into raw data buffer */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ - H5O_drvinfo_t drvrinfo = {.len = 0}; /* Driver info */ + H5O_drvinfo_t drvrinfo; /* Driver info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -925,7 +916,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, { H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = _image; /* Pointer into raw data buffer */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ char drv_name[9]; /* Name of driver */ H5O_drvinfo_t *ret_value = NULL; /* Return value */ @@ -1019,7 +1010,7 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */ - uint8_t *image = _image; /* Pointer into raw data buffer */ + uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint8_t *dbuf; /* Pointer to beginning of driver info */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index ab448ef..2d1c1f2 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -406,7 +406,7 @@ static herr_t H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - H5HF_hdr_t hdr; /* Temporary fractal heap header */ + H5HF_hdr_t hdr; /* Temporary fractal heap header */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into into supplied image */ H5HF_hdr_cache_ud_t *udata = (H5HF_hdr_cache_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -419,12 +419,6 @@ H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len, HDassert(actual_len); HDassert(*actual_len == image_len); - /* Initialize because GCC 5.5 does not realize that the - * H5HF__hdr_prefix_decode() call is sufficient to initialize. - * GCC 8 is clever enough to see that the variable is initialized. - * TBD condition on compiler version. - */ - hdr.filter_len = 0; /* Deserialize the fractal heap header's prefix */ if(H5HF__hdr_prefix_decode(&hdr, &image) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode fractal heap header prefix") diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 79d790b..0c27180 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -377,7 +377,7 @@ done: herr_t H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) { - size_t enc_obj_size = 0; /* Encoded object size */ + size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HGcache.c b/src/H5HGcache.c index e3d0f4c..29e88df 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -205,7 +205,7 @@ static herr_t H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len, void *udata, size_t *actual_len) { - H5HG_heap_t heap = {.size = 0}; /* Global heap */ + H5HG_heap_t heap; /* Global heap */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -217,12 +217,6 @@ H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len, HDassert(*actual_len == image_len); HDassert(image_len == H5HG_MINSIZE); - /* Initialize because GCC 5.5 cannot see that - * H5HG__hdr_deserialize() initializes. - * - * TBD condition on compiler version. - */ - heap.size = 0; /* Deserialize the heap's header */ if(H5HG__hdr_deserialize(&heap, (const uint8_t *)image, (const H5F_t *)udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode global heap prefix") diff --git a/src/H5Oint.c b/src/H5Oint.c index 0029976..b97ff30 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -31,7 +31,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c index 59da91a..fe5be0f 100644 --- a/src/H5Pmapl.c +++ b/src/H5Pmapl.c @@ -138,7 +138,6 @@ done: } /* end H5P__macc_reg_prop() */ -#ifdef H5_HAVE_MAP_API /*------------------------------------------------------------------------- * Function: H5Pset_map_iterate_hints * @@ -215,4 +214,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_map_iterate_hints() */ -#endif /* H5_HAVE_MAP_API */ + diff --git a/src/H5Rint.c b/src/H5Rint.c index 9fbc7ef..504ae06 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1169,8 +1169,8 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc) /* Don't encode if buffer size isn't big enough or buffer is empty */ if(buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) { - int rank; p = (uint8_t *)buf; + int rank; /* Encode the size for safety check */ UINT32ENCODE(p, (uint32_t)buf_size); diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 045e04a..ce54ac4 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -70,18 +70,14 @@ 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 struct { - unsigned char content[H5R_DSET_REG_REF_BUF_SIZE]; -} hdset_reg_ref_t; +typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE]; /** * 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 struct { - unsigned char content[H5R_REF_BUF_SIZE]; -} H5R_ref_t; +typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE]; /********************/ /* Public Variables */ diff --git a/src/H5SL.c b/src/H5SL.c index ec06395..5f00fb8 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -1394,7 +1394,7 @@ H5SL_search(H5SL_t *slist, const void *key) { H5SL_node_t *x; /* Current node to examine */ uint32_t hashval = 0; /* Hash value for key */ - void *ret_value = NULL; /* Return value */ + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1695,7 +1695,7 @@ H5SL_find(H5SL_t *slist, const void *key) { H5SL_node_t *x; /* Current node to examine */ uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value = NULL; /* Return value */ + H5SL_node_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5SM.c b/src/H5SM.c index 91ef98b..290e575 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -313,7 +313,7 @@ ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id) { size_t x; - unsigned type_flag = 0; + unsigned type_flag; ssize_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT @@ -353,7 +353,7 @@ htri_t H5SM_type_shared(H5F_t *f, unsigned type_id) { H5SM_master_table_t *table = NULL; /* Shared object master table */ - unsigned type_flag = 0; /* Flag corresponding to message type */ + unsigned type_flag; /* Flag corresponding to message type */ size_t u; /* Local index variable */ htri_t ret_value = FALSE; /* Return value */ diff --git a/src/H5T.c b/src/H5T.c index 3fc59d0..9263158 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -3320,7 +3320,7 @@ done: *------------------------------------------------------------------------- */ H5T_t * -H5T_copy(const H5T_t *old_dt, H5T_copy_t method) +H5T_copy(H5T_t *old_dt, H5T_copy_t method) { H5T_t *new_dt = NULL, *tmp = NULL; H5T_shared_t *reopened_fo = NULL; diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 86bc174..d8e98af 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -109,7 +109,7 @@ H5_DLLVAR H5T_order_t H5T_native_order_g; /* Private functions */ H5_DLL herr_t H5T_init(void); -H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method); +H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); H5_DLL herr_t H5T_close_real(H5T_t *dt); diff --git a/src/H5Tref.c b/src/H5Tref.c index b1bc9e8..2e52954 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -709,7 +709,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ /* Get object address */ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, - (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) + (unsigned char *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 0c2be75..1591bed 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -39,7 +39,7 @@ Languages: H5_CPPFLAGS: @H5_CPPFLAGS@ AM_CPPFLAGS: @AM_CPPFLAGS@ C Flags: @CFLAGS@ - H5 C Flags: @H5_CFLAGS@ @H5_ECFLAGS@ + H5 C Flags: @H5_CFLAGS@ AM C Flags: @AM_CFLAGS@ Shared C Library: @enable_shared@ Static C Library: @enable_static@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d3f8ed8..c7a945e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,11 +16,9 @@ set (TEST_LIB_SOURCES ${HDF5_TEST_SOURCE_DIR}/cache_common.c ${HDF5_TEST_SOURCE_DIR}/external_common.c ${HDF5_TEST_SOURCE_DIR}/swmr_common.c - ${HDF5_TEST_SOURCE_DIR}/vds_swmr_common.c ) set (TEST_LIB_HEADERS - ${HDF5_TEST_SOURCE_DIR}/H5srcdir.h ${HDF5_TEST_SOURCE_DIR}/h5test.h ${HDF5_TEST_SOURCE_DIR}/cache_common.h ${HDF5_TEST_SOURCE_DIR}/external_common.h diff --git a/test/H5srcdir.c b/test/H5srcdir.c deleted file mode 100644 index 8268d2c..0000000 --- a/test/H5srcdir.c +++ /dev/null @@ -1,61 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "H5private.h" -#include "H5srcdir.h" - -/* Buffer to construct path in and return pointer to */ -char srcdir_path[1024] = ""; - -/* Buffer to construct file in and return pointer to */ -char srcdir_testpath[1024] = ""; - -/* Just return the srcdir path */ -const char * -H5_get_srcdir(void) -{ - const char *srcdir = HDgetenv("srcdir"); - - /* Check for using the srcdir from configure time */ - if(NULL == srcdir) - srcdir = config_srcdir; - - /* Build path to all test files */ - if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) { - HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); - return(srcdir_path); - } /* end if */ - else - return(NULL); -} /* end H5_get_srcdir() */ - -/* Append the test file name to the srcdir path and return the whole string */ -const char * -H5_get_srcdir_filename(const char *filename) -{ - const char *srcdir = H5_get_srcdir(); - - /* Check for error */ - if(NULL == srcdir) - return(NULL); - else { - /* Build path to test file */ - if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) { - HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename); - return(srcdir_testpath); - } /* end if */ - else - return(NULL); - } /* end else */ -} /* end H5_get_srcdir_filename() */ - diff --git a/test/H5srcdir.h b/test/H5srcdir.h index d0a4bf7..32fe8c9 100644 --- a/test/H5srcdir.h +++ b/test/H5srcdir.h @@ -24,16 +24,47 @@ #include "H5srcdir_str.h" /* Buffer to construct path in and return pointer to */ -extern char srcdir_path[1024]; +static char srcdir_path[1024] = ""; /* Buffer to construct file in and return pointer to */ -extern char srcdir_testpath[1024]; +static char srcdir_testpath[1024] = ""; /* Just return the srcdir path */ -const char *H5_get_srcdir(void); +static const char * +H5_get_srcdir(void) +{ + const char *srcdir = HDgetenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if(NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) { + HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); + return(srcdir_path); + } /* end if */ + else + return(NULL); +} /* end H5_get_srcdir() */ /* Append the test file name to the srcdir path and return the whole string */ -const char *H5_get_srcdir_filename(const char *); +static const char *H5_get_srcdir_filename(const char *filename) +{ + const char *srcdir = H5_get_srcdir(); + /* Check for error */ + if(NULL == srcdir) + return(NULL); + else { + /* Build path to test file */ + if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) { + HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename); + return(srcdir_testpath); + } /* end if */ + else + return(NULL); + } /* end else */ +} /* end H5_get_srcdir_filename() */ #endif /* _H5SRCDIR_H */ diff --git a/test/H5srcdir_str.h.in b/test/H5srcdir_str.h.in index ba30a88..bab1df3 100644 --- a/test/H5srcdir_str.h.in +++ b/test/H5srcdir_str.h.in @@ -16,5 +16,5 @@ */ /* Set the 'srcdir' path from configure time */ -#define config_srcdir "@srcdir@" +static const char *config_srcdir = "@srcdir@"; diff --git a/test/Makefile.am b/test/Makefile.am index d66200d..57080aa 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -135,7 +135,7 @@ else noinst_LTLIBRARIES=libh5test.la endif -libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c H5srcdir.c +libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c # Use libhd5test.la to compile all of the tests LDADD=libh5test.la $(LIBHDF5) @@ -145,12 +145,6 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c cache_image_SOURCES=cache_image.c genall5.c -#filter_plugin_SOURCES=filter_plugin.c H5srcdir.c - -vds_swmr_gen_SOURCES=vds_swmr_gen.c vds_swmr_common.c -vds_swmr_writer_SOURCES=vds_swmr_writer.c vds_swmr_common.c -vds_swmr_reader_SOURCES=vds_swmr_reader.c vds_swmr_common.c - VFD_LIST = sec2 stdio core core_paged split multi family if DIRECT_VFD_CONDITIONAL VFD_LIST += direct diff --git a/test/cache.c b/test/cache.c index e59dc3e..1a726fa 100644 --- a/test/cache.c +++ b/test/cache.c @@ -16926,7 +16926,7 @@ check_move_entry_errs(unsigned paged) { herr_t result; H5F_t * file_ptr = NULL; - H5C_t * cache_ptr; + H5C_t * cache_ptr = NULL; test_entry_t * entry_ptr = NULL; test_entry_t * entry_0_0_ptr; test_entry_t * entry_0_1_ptr; diff --git a/test/cache_common.c b/test/cache_common.c index 740523e..24962bc 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -5522,7 +5522,7 @@ col_major_scan_backward(H5F_t * file_ptr, int mile_stone = 1; int32_t type; int32_t idx; - int32_t local_max_index[NUMBER_OF_ENTRY_TYPES] = {0}; + int32_t local_max_index[NUMBER_OF_ENTRY_TYPES]; if ( verbose ) HDfprintf(stdout, "%s: entering.\n", FUNC); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index c3921ea..7ce4e88 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -528,7 +528,7 @@ check_file_open_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ int verbose = FALSE; /* verbose file outout */ hid_t fapl = -1; /* File access prop list */ - haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ + haddr_t root_tag; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ /* Testing Macro */ diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c index ce85d1b..ada7a6f 100644 --- a/test/del_many_dense_attrs.c +++ b/test/del_many_dense_attrs.c @@ -70,7 +70,7 @@ main(void) hid_t fapl = -1; /* File access property lists */ hid_t gcpl = -1; /* Group creation property list */ char aname[50]; /* Name of attribute */ - const char *basename="attr";/* Name prefix for attribute */ + char *basename="attr"; /* Name prefix for attribute */ char filename[100]; /* File name */ int i; /* Local index variable */ diff --git a/test/dsets.c b/test/dsets.c index aa84833..eaa469f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -7065,15 +7065,16 @@ static void make_random_offset_and_increment(long nelts, long *offsetp, long *incp) { long inc; - /* `maxinc` is chosen so that for any `x` in [0, nelts - 1], - * `x + maxinc` does not overflow a long. - */ - const long maxinc = MIN(nelts - 1, LONG_MAX - nelts); HDassert(0 < nelts); *offsetp = HDrandom() % nelts; + /* `maxinc` is chosen so that for any `x` in [0, nelts - 1], + * `x + maxinc` does not overflow a long. + */ + const long maxinc = MIN(nelts - 1, LONG_MAX - nelts); + /* Choose a random number in [1, nelts - 1]. If its greatest divisor * in common with `nelts` is 1, then it will "generate" the additive ring * [0, nelts - 1], so let it be our increment. Otherwise, choose a new diff --git a/test/dt_arith.c b/test/dt_arith.c index 8d04770..7e1adf5 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -770,7 +770,7 @@ static int test_particular_fp_integer(void) /* Print errors */ if(dst_c != SCHAR_MAX) { - double x = 0.; + double x; signed char y; if(0 == fails_this_test++) @@ -814,7 +814,7 @@ static int test_particular_fp_integer(void) /* Print errors */ if(dst_i != fill_value) { - float x = 0.; + float x; int y; if(0 == fails_this_test++) @@ -2723,16 +2723,16 @@ my_isnan(dtype_t type, void *val) char s[256]; if (FLT_FLOAT==type) { - float x = 0.; + float x; HDmemcpy(&x, val, sizeof(float)); retval = (x!=x); } else if (FLT_DOUBLE==type) { - double x = 0.; + double x; HDmemcpy(&x, val, sizeof(double)); retval = (x!=x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (FLT_LDOUBLE==type) { - long double x = 0.; + long double x; HDmemcpy(&x, val, sizeof(long double)); retval = (x!=x); #endif @@ -2746,18 +2746,18 @@ my_isnan(dtype_t type, void *val) */ if (!retval) { if (FLT_FLOAT==type) { - float x = 0.; + float x; HDmemcpy(&x, val, sizeof(float)); HDsnprintf(s, sizeof(s), "%g", (double)x); } else if (FLT_DOUBLE==type) { - double x = 0.; + double x; HDmemcpy(&x, val, sizeof(double)); HDsnprintf(s, sizeof(s), "%g", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (FLT_LDOUBLE==type) { - long double x = 0.; + long double x; HDmemcpy(&x, val, sizeof(long double)); HDsnprintf(s, sizeof(s), "%Lg", x); @@ -3197,7 +3197,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) int check_expo[2]; if (FLT_FLOAT==dst_type) { - float x = 0.; + float x; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) @@ -3208,7 +3208,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[1] = HDfrexpf(hw_f, check_expo+1); } else if (FLT_DOUBLE==dst_type) { - double x = 0.; + double x; HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) @@ -3220,7 +3220,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) check_mant[1] = HDfrexp(hw_d, check_expo+1); #if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE) } else { - long double x = 0.; + long double x; HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ check_mant[0] = (double)HDfrexpl(x, check_expo+0); @@ -3265,16 +3265,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]); HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), ""); if (FLT_FLOAT==src_type) { - float x = 0.; + float x; HDmemcpy(&x, &saved[j*src_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE==src_type) { - double x = 0.; + double x; HDmemcpy(&x, &saved[j*src_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x; HDmemcpy(&x, &saved[j*src_size], sizeof(long double)); HDfprintf(stdout," %29.20Le\n", x); #endif @@ -3285,16 +3285,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]); HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); if (FLT_FLOAT==dst_type) { - float x = 0.; + float x; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE==dst_type) { - double x = 0.; + double x; HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x; HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); HDfprintf(stdout," %29.20Le\n", x); #endif diff --git a/test/fillval.c b/test/fillval.c index 5c20e14..47cd53a 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -758,8 +758,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, int fillval=(-1), val_rd, should_be; int i, j, *buf=NULL, odd; unsigned u; - comp_datatype rd_c, fill_c = {.a = 0, .x = 0, .y = 0, .z = 0}, - should_be_c; + comp_datatype rd_c, fill_c, should_be_c; comp_datatype *buf_c=NULL; H5D_space_status_t allocation; diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 64f62c4..5ed8545 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -116,12 +116,6 @@ static const H5VL_class_t null_vol_g = { NULL, /* optional */ NULL /* free */ }, - { /* blob_cls */ - NULL, /* put */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ - }, NULL /* optional */ }; diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index fdb3179..721a7c6 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -1587,6 +1587,7 @@ 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(); @@ -1619,6 +1620,11 @@ 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; @@ -1640,6 +1646,7 @@ 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:"); @@ -1671,6 +1678,7 @@ 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/swmr_sparse_reader.c b/test/swmr_sparse_reader.c index a969b16..6adc6c5 100644 --- a/test/swmr_sparse_reader.c +++ b/test/swmr_sparse_reader.c @@ -115,7 +115,7 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t /* Emit informational message */ if(verbose) - HDfprintf(stderr, "Symbol = '%s', location = %ju,%ju\n", symbol->name, (uintmax_t)start[0], (uintmax_t)start[1]); + HDfprintf(stderr, "Symbol = '%s', location = %lld\n", symbol->name, (long long)start); /* Read record from dataset */ record->rec_id = (uint64_t)ULLONG_MAX; @@ -126,7 +126,7 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t if(record->rec_id != start[1]) { HDfprintf(stderr, "*** ERROR ***\n"); HDfprintf(stderr, "Incorrect record value!\n"); - HDfprintf(stderr, "Symbol = '%s', location = %ju,%ju, record->rec_id = %" PRIu64 "\n", symbol->name, (uintmax_t)start[0], (uintmax_t)start[1], record->rec_id); + HDfprintf(stderr, "Symbol = '%s', location = %lld, record->rec_id = %llu\n", symbol->name, (long long)start, (unsigned long long)record->rec_id); return -1; } /* end if */ diff --git a/test/tid.c b/test/tid.c index 7a839d2..d0ae3e4 100644 --- a/test/tid.c +++ b/test/tid.c @@ -19,13 +19,6 @@ #define H5I_FRIEND /*suppress error about including H5Ipkg */ #include "H5Ipkg.h" -static herr_t -free_wrapper(void *p) -{ - HDfree(p); - return SUCCEED; -} - /* Test basic functionality of registering and deleting types and IDs */ static int basic_id_test(void) { @@ -76,7 +69,7 @@ static int basic_id_test(void) goto out; /* Register a type */ - myType = H5Iregister_type((size_t)64, 0, free_wrapper); + myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); CHECK(myType, H5I_BADID, "H5Iregister_type"); if(myType == H5I_BADID) @@ -170,7 +163,7 @@ static int basic_id_test(void) H5E_END_TRY /* Register another type and another object in that type */ - myType = H5Iregister_type((size_t)64, 0, free_wrapper); + myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); CHECK(myType, H5I_BADID, "H5Iregister_type"); if(myType == H5I_BADID) @@ -245,7 +238,7 @@ out: /* A dummy search function for the next test */ -static int test_search_func(void H5_ATTR_UNUSED * ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED * ptr2) { return 0; } +static int test_search_func(void H5_ATTR_UNUSED * ptr1, void H5_ATTR_UNUSED * ptr2) { return 0; } /* Ensure that public functions cannot access "predefined" ID types */ static int id_predefined_test(void ) @@ -271,7 +264,7 @@ static int id_predefined_test(void ) goto out; H5E_BEGIN_TRY - testPtr = H5Isearch(H5I_GENPROP_LST, test_search_func, testObj); + testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj); H5E_END_TRY CHECK_PTR_NULL(testPtr, "H5Isearch"); @@ -499,7 +492,7 @@ static int test_id_type_list(void) H5I_type_t testType; int i; /* Just a counter variable */ - startType = H5Iregister_type((size_t)8, 0, free_wrapper); + startType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); CHECK(startType, H5I_BADID, "H5Iregister_type"); if(startType == H5I_BADID) goto out; @@ -514,7 +507,7 @@ static int test_id_type_list(void) /* Create types up to H5I_MAX_NUM_TYPES */ for(i = startType + 1; i < H5I_MAX_NUM_TYPES; i++) { - currentType = H5Iregister_type((size_t)8, 0, free_wrapper); + currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); CHECK(currentType, H5I_BADID, "H5Iregister_type"); if(currentType == H5I_BADID) goto out; @@ -523,7 +516,7 @@ static int test_id_type_list(void) /* Wrap around to low type ID numbers */ for(i = H5I_NTYPES; i < startType; i++) { - currentType = H5Iregister_type((size_t)8, 0, free_wrapper); + currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); CHECK(currentType, H5I_BADID, "H5Iregister_type"); if(currentType == H5I_BADID) goto out; @@ -531,7 +524,7 @@ static int test_id_type_list(void) /* There should be no room at the inn for a new ID type*/ H5E_BEGIN_TRY - testType = H5Iregister_type((size_t)8, 0, free_wrapper); + testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); H5E_END_TRY VERIFY(testType, H5I_BADID, "H5Iregister_type"); @@ -540,7 +533,7 @@ static int test_id_type_list(void) /* Now delete a type and try to insert again */ H5Idestroy_type(H5I_NTYPES); - testType = H5Iregister_type((size_t)8, 0, free_wrapper); + testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); VERIFY(testType, H5I_NTYPES, "H5Iregister_type"); if(testType != H5I_NTYPES) diff --git a/test/trefer.c b/test/trefer.c index 4ffc2dc..7d87ea9 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 int i; /* Counters */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + 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,13 +101,12 @@ test_reference_params(void) MESSAGE(5, ("Testing Reference Parameters\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); - tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); - obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + 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); - for(i = 0; i < SPACE1_DIM1; i++) - obuf[i] = i * 3; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)i * 3; /* Create file */ fid1 = H5Fcreate(FILE_REF_PARAM, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -138,7 +137,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, obuf); + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -154,7 +153,7 @@ test_reference_params(void) CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); /* Write attribute to disk */ - ret = H5Awrite(attr, H5T_NATIVE_UINT, obuf); + ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); CHECK(ret, FAIL, "H5Awrite"); /* Close attribute */ @@ -234,19 +233,19 @@ test_reference_params(void) VERIFY(type, H5R_BADTYPE, "H5Rget_type ref"); /* Test parameters to H5Requal */ - ret = H5Requal(NULL, &rbuf[0]); + ret = H5Requal(NULL, (const H5R_ref_t *)&rbuf[0]); VERIFY(ret, FAIL, "H5Requal ref1"); - ret = H5Requal(&rbuf[0], NULL); + ret = H5Requal((const H5R_ref_t *)&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(&rbuf[0], NULL); + ret = H5Rcopy((const H5R_ref_t *)&rbuf[0], NULL); VERIFY(ret, FAIL, "H5Rcopy dest_ref"); /* Test parameters to H5Ropen_object */ - dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); + dset2 = H5Ropen_object((const H5R_ref_t *)&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"); @@ -299,7 +298,6 @@ test_reference_params(void) HDfree(wbuf); HDfree(rbuf); HDfree(tbuf); - HDfree(obuf); } /* test_reference_params() */ /**************************************************************** @@ -320,9 +318,10 @@ 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 */ - unsigned *ibuf, *obuf; - unsigned i, j; /* Counters */ + *rbuf, /* buffer read from disk */ + *tbuf; /* temp. buffer read from disk */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + int i, j; /* Counters */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ @@ -330,13 +329,12 @@ test_reference_obj(void) MESSAGE(5, ("Testing Object Reference Functions\n")); /* Allocate write & read buffers */ - 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); + 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); - for (i = 0; i < SPACE1_DIM1; i++) - obuf[i] = i * 3; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)i * 3; /* Create file */ fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -359,7 +357,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, obuf); + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -407,28 +405,28 @@ test_reference_obj(void) /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); @@ -461,7 +459,7 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Dread"); /* Open dataset object */ - dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Check information in referenced dataset */ @@ -472,18 +470,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, ibuf); + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf); CHECK(ret, FAIL, "H5Dread"); - for(i = 0; i < SPACE1_DIM1; i++) - VERIFY(ibuf[i], i * 3, "Data"); + for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)(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(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + group = H5Ropen_object((const H5R_ref_t *)&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(group, H5I_INVALID_HID, "H5Ropen_object"); /* Close group */ @@ -491,7 +489,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(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + tid1 = H5Ropen_object((const H5R_ref_t *)&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object"); /* Verify correct datatype */ @@ -532,8 +530,7 @@ test_reference_obj(void) /* Free memory buffers */ HDfree(wbuf); HDfree(rbuf); - HDfree(ibuf); - HDfree(obuf); + HDfree(tbuf); } /* test_reference_obj() */ /**************************************************************** @@ -568,7 +565,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 */ @@ -586,8 +583,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 = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); - rbuf = HDcalloc(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); 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)); @@ -650,7 +647,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Store first dataset region */ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); - ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -694,7 +691,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_region"); - ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -767,7 +764,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(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object((const H5R_ref_t *)&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object"); @@ -801,11 +798,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(&rbuf[0], H5P_DEFAULT, dapl_id); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Check what H5Rget_obj_type3 function returns */ - ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -824,7 +821,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(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct hyperslab selected */ @@ -852,7 +849,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(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct elements selected */ @@ -896,7 +893,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(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Ropen_region((const H5R_ref_t *)&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct hyperslab selected */ @@ -931,7 +928,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(&nvrbuf[j], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&nvrbuf[j], H5P_DEFAULT, &obj_type); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Rget_obj_type3"); } /* end for */ @@ -1009,8 +1006,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 = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1); - rbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1); + 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); dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); @@ -1073,7 +1070,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, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); - ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -1131,11 +1128,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(&rbuf[0], H5P_DEFAULT, dapl_id); + dset3 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset3, H5I_INVALID_HID, "H5Ropen_object"); /* Check what H5Rget_obj_type3 function returns */ - ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -1154,7 +1151,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(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + sid3 = H5Ropen_region((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct hyperslab selected */ @@ -1206,7 +1203,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(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); + sid3 = H5Ropen_region((const H5R_ref_t *)&rbuf[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region"); /* Verify correct elements selected */ @@ -1316,7 +1313,7 @@ test_reference_obj_deleted(void) /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Dataset1", &oref); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3(&oref, H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&oref, H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -1357,7 +1354,7 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dread"); /* Open deleted dataset object */ - dset2 = H5Ropen_object(&oref, H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object((const H5R_ref_t *)&oref, H5P_DEFAULT, H5P_DEFAULT); VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Close Dataset */ @@ -1504,7 +1501,7 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Dread"); /* Dereference to get the group */ - gid = H5Ropen_object(&rref, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Ropen_object((const H5R_ref_t *)&rref, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid, H5I_INVALID_HID, "H5Ropen_object"); /* Iterate through objects in dereferenced group */ @@ -1565,7 +1562,8 @@ 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 i; /* Local index variables */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + int i; /* Local index variables */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ @@ -1592,8 +1590,8 @@ test_reference_attr(void) attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(i = 0; i < SPACE1_DIM1; i++) - wbuf[i] = (i * 3) + 1; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)((i * 3) + 1); /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1611,8 +1609,8 @@ test_reference_attr(void) attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(i = 0; i < SPACE1_DIM1; i++) - wbuf[i] = i * 3; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)(i * 3); /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1656,8 +1654,8 @@ test_reference_attr(void) attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(i = 0; i < SPACE1_DIM1; i++) - wbuf[i] = (i * 3) + 2; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)((i * 3) + 2); /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1682,28 +1680,28 @@ test_reference_attr(void) /* Create reference to dataset1 attribute */ ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); @@ -1736,7 +1734,7 @@ test_reference_attr(void) CHECK(ret, FAIL, "H5Dread"); /* Open attribute on dataset object */ - attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Check information in referenced dataset */ @@ -1750,38 +1748,38 @@ test_reference_attr(void) ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(i = 0; i < SPACE1_DIM1; i++) - VERIFY(rbuf[i], i * 3, "Data"); + for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)(i * 3), "Data"); /* Close dereferenced Dataset */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on group object */ - attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr((const H5R_ref_t *)&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(i = 0; i < SPACE1_DIM1; i++) - VERIFY(rbuf[i], (i * 3) + 1, "Data"); + for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)((i * 3) + 1), "Data"); /* Close attribute */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on named datatype object */ - attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr((const H5R_ref_t *)&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(i = 0; i < SPACE1_DIM1; i++) - VERIFY(rbuf[i], (i * 3) + 2, "Data"); + for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)((i * 3) + 2), "Data"); /* Close attribute */ ret = H5Aclose(attr); @@ -1828,7 +1826,8 @@ 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 i; /* Local index variables */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + int i; /* Local index variables */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ @@ -1855,8 +1854,8 @@ test_reference_external(void) attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(i = 0; i < SPACE1_DIM1; i++) - wbuf[i] = (i * 3) + 1; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)((i * 3) + 1); /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1874,8 +1873,8 @@ test_reference_external(void) attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(i = 0; i < SPACE1_DIM1; i++) - wbuf[i] = i * 3; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)(i * 3); /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1919,8 +1918,8 @@ test_reference_external(void) attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); - for(i = 0; i < SPACE1_DIM1; i++) - wbuf[i] = (i * 3) + 2; + for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++ = (unsigned)((i * 3) + 2); /* Write attribute to disk */ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf); @@ -1941,28 +1940,28 @@ test_reference_external(void) /* Create reference to dataset1 attribute */ ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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", &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); - ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); @@ -2015,7 +2014,7 @@ test_reference_external(void) CHECK(ret, FAIL, "H5Dread"); /* Open attribute on dataset object */ - attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr((const H5R_ref_t *)&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr"); /* Check information in referenced dataset */ @@ -2029,38 +2028,38 @@ test_reference_external(void) ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf); CHECK(ret, FAIL, "H5Aread"); - for(i = 0; i < SPACE1_DIM1; i++) - VERIFY(rbuf[i], i * 3, "Data"); + for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)(i * 3), "Data"); /* Close dereferenced Dataset */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on group object */ - attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr((const H5R_ref_t *)&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(i = 0; i < SPACE1_DIM1; i++) - VERIFY(rbuf[i], (i * 3) + 1, "Data"); + for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)((i * 3) + 1), "Data"); /* Close attribute */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open attribute on named datatype object */ - attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + attr = H5Ropen_attr((const H5R_ref_t *)&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(i = 0; i < SPACE1_DIM1; i++) - VERIFY(rbuf[i], (i * 3) + 2, "Data"); + for(tu32 = (unsigned *)rbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + VERIFY(*tu32, (uint32_t)((i * 3) + 2), "Data"); /* Close attribute */ ret = H5Aclose(attr); @@ -2122,9 +2121,9 @@ test_reference_compat_conv(void) /* Allocate write & read buffers */ wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1); - rbuf_obj = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf_obj = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), 2); - rbuf_reg = HDcalloc(sizeof(H5R_ref_t), 2); + rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), 2); /* Create file */ fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2287,43 +2286,43 @@ test_reference_compat_conv(void) CHECK(ret, FAIL, "H5Dread"); /* Verify type of objects pointed at */ - ret = H5Rget_obj_type3(&rbuf_obj[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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(&rbuf_obj[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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(&rbuf_obj[2], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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(&rbuf_obj[3], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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(&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); - dset2 = H5Ropen_object(&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); - group2 = H5Ropen_object(&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT); + group2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT); CHECK(group2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Gclose(group2); CHECK(ret, FAIL, "H5Gclose"); - tid2 = H5Ropen_object(&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT); + tid2 = H5Ropen_object((const H5R_ref_t *)&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT); CHECK(tid2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Tclose(tid2); @@ -2343,22 +2342,22 @@ test_reference_compat_conv(void) CHECK(ret, FAIL, "H5Dread"); /* Verify type of objects pointed at */ - ret = H5Rget_obj_type3(&rbuf_reg[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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(&rbuf_reg[1], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&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(&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); CHECK(ret, FAIL, "H5Dclose"); - dset2 = H5Ropen_object(&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); ret = H5Dclose(dset2); @@ -2415,8 +2414,8 @@ test_reference_perf(void) *rbuf_deprec;/* deprecated references */ hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/ *rbuf_reg_deprec; /* deprecated references*/ - unsigned *ibuf, *obuf; - unsigned i, j; /* Counters */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + int i, j; /* Counters */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ double t1, t2, t; /* Timers */ @@ -2425,20 +2424,18 @@ test_reference_perf(void) MESSAGE(5, ("Testing Object Reference Performance\n")); /* Allocate write & read buffers */ - 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; + 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; /* Create file */ fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2461,7 +2458,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, obuf); + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -2521,7 +2518,7 @@ test_reference_perf(void) /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); - ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); @@ -2673,7 +2670,7 @@ test_reference_perf(void) CHECK(ret, FAIL, "H5Dread"); /* Open dataset object */ - dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); + dset2 = H5Ropen_object((const H5R_ref_t *)&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Check information in referenced dataset */ @@ -2684,11 +2681,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, ibuf); + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf); CHECK(ret, FAIL, "H5Dread"); - for(i = 0; i < dims1[0]; i++) - VERIFY(ibuf[i], i * 3, "Data"); + for(tu32 = (unsigned *)tbuf, i = 0; i < (int)dims1[0]; i++, tu32++) + VERIFY(*tu32, (uint32_t)(i*3), "Data"); /* Close dereferenced Dataset */ ret = H5Dclose(dset2); @@ -2770,7 +2767,7 @@ test_reference_perf(void) CHECK(ret, FAIL, "H5Fclose"); /* Destroy references */ - for(j = 0; j < dims1[0]; j++) { + for(j = 0; j < (int)dims1[0]; j++) { ret = H5Rdestroy(&wbuf[j]); CHECK(ret, FAIL, "H5Rdestroy"); ret = H5Rdestroy(&wbuf_reg[j]); @@ -2791,8 +2788,6 @@ test_reference_perf(void) HDfree(wbuf_reg_deprec); HDfree(rbuf_reg_deprec); HDfree(tbuf); - HDfree(ibuf); - HDfree(obuf); } /* test_reference_perf() */ /**************************************************************** diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 1b77e9c..949f41b 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 */ diff --git a/test/tvlstr.c b/test/tvlstr.c index cc01084..731270c 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -861,12 +861,12 @@ static void test_write_same_element(void) hid_t file1, dataset1; hid_t mspace, fspace, dtype; hsize_t fdim[] = {SPACE1_DIM1}; - const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; + char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; hsize_t marray[] = {NUMP}; hsize_t coord[SPACE1_RANK][NUMP]; herr_t ret; - const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; + char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); diff --git a/test/vds_swmr.h b/test/vds_swmr.h index 18d6b35..eb2dcf4 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -84,17 +84,31 @@ #define N_PLANES_TO_WRITE 25 /* Planes */ -extern hsize_t PLANES[N_SOURCES][RANK]; +static hsize_t PLANES[N_SOURCES][RANK] = { + {1, SM_HEIGHT, WIDTH}, + {1, LG_HEIGHT, WIDTH}, + {1, SM_HEIGHT, WIDTH}, + {1, LG_HEIGHT, WIDTH}, + {1, SM_HEIGHT, WIDTH}, + {1, LG_HEIGHT, WIDTH} +}; /* File names for source datasets */ -extern char FILE_NAMES[N_SOURCES][NAME_LEN]; +static char FILE_NAMES[N_SOURCES][NAME_LEN] = { + {"vds_swmr_src_a.h5"}, + {"vds_swmr_src_b.h5"}, + {"vds_swmr_src_c.h5"}, + {"vds_swmr_src_d.h5"}, + {"vds_swmr_src_e.h5"}, + {"vds_swmr_src_f.h5"} +}; /* VDS file name */ -extern char VDS_FILE_NAME[NAME_LEN]; +static char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; /* Dataset names */ -extern char SOURCE_DSET_PATH[NAME_LEN]; -extern char VDS_DSET_NAME[NAME_LEN]; +static char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; +static char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ #endif /* VDS_SWMR_H */ diff --git a/test/vds_swmr_common.c b/test/vds_swmr_common.c deleted file mode 100644 index d2b4bd6..0000000 --- a/test/vds_swmr_common.c +++ /dev/null @@ -1,36 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "vds_swmr.h" - -hsize_t PLANES[N_SOURCES][RANK] = { - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH}, - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH}, - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH} -}; - -char FILE_NAMES[N_SOURCES][NAME_LEN] = { - {"vds_swmr_src_a.h5"}, - {"vds_swmr_src_b.h5"}, - {"vds_swmr_src_c.h5"}, - {"vds_swmr_src_d.h5"}, - {"vds_swmr_src_e.h5"}, - {"vds_swmr_src_f.h5"} -}; - -char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; -char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1b4bc56..c2153e5 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -258,8 +258,6 @@ free_exclude_path_list(diff_opt_t *opts) * Parameter: * table_out [OUT] : return the list *------------------------------------------------------------------------*/ -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wunused-but-set-variable" static void build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2, trav_table_t ** table_out, diff_opt_t *opts) @@ -376,7 +374,6 @@ done: *table_out = table; h5difftrace("build_match_list finish\n"); } -#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 55ad65c..2a45913 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -2245,9 +2245,6 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, *------------------------------------------------------------------------- */ -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wunused-but-set-variable" - static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph) { @@ -2308,7 +2305,6 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, return nfound; } -#pragma GCC diagnostic pop /*------------------------------------------------------------------------- * Function: diff_float diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 6fc9de4..47ce690 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -1279,7 +1279,7 @@ done: int h5tools_set_configured_fapl(hid_t fapl_id, const char vfd_name[], - void *fapl_t_ptr H5_ATTR_UNUSED) + void *fapl_t_ptr) { int ret_value = 1; diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 65c2359..1eef5ab 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1428,7 +1428,7 @@ static int processConfigurationFile(char *infile, struct Input *in) /* Initialize machine endian */ volatile uint32_t ibyte=0x01234567; /* 0 for big endian, 1 for little endian. */ - if ((*((volatile uint8_t*)(&ibyte))) == 0x67) { + if ((*((uint8_t*)(&ibyte))) == 0x67) { if ((kindex = OutputByteOrderStrToInt("LE")) == -1) { (void) HDfprintf(stderr, "%s", err11e); return (-1); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 16899a3..c628beb 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -281,7 +281,7 @@ int read_info(const char *filename, pack_opt_t *options) char comp_info[1024]; FILE *fp = NULL; char c; - int i; + int i, rc = 1; int ret_value = EXIT_SUCCESS; if (NULL == (fp = HDfopen(filename, "r"))) { @@ -412,7 +412,7 @@ set_sort_order(const char *form) static int parse_command_line(int argc, const char **argv, pack_opt_t* options) { - int bound, opt; + int opt; int ret_value = 0; /* parse command line options */ @@ -492,21 +492,19 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'j': - bound = HDatoi(opt_arg); - if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { + options->low_bound = (H5F_libver_t)HDatoi(opt_arg); + if (options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { error_msg("in parsing low bound\n"); goto done; } - options->low_bound = bound; break; case 'k': - bound = HDatoi(opt_arg); - if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { + options->high_bound = (H5F_libver_t)HDatoi(opt_arg); + if (options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { error_msg("in parsing high bound\n"); goto done; } - options->high_bound = bound; break; case 'c': diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 87ca31c..aaac285 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -314,6 +314,7 @@ generate_f32le(hbool_t external) { int main(void) { int i = 0; + int ret_value = 0; for (i = 0; i < 2; i++) { hbool_t external = (i & 1) ? TRUE : FALSE; -- cgit v0.12 From f46494ffd8449fc610798c8af312362608029d3d Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Mon, 25 Nov 2019 19:07:44 -0600 Subject: Remove H5VL_NATIVE_FILE_GET_FILE_ID and add H5VL_OBJECT_GET_FILE Remove H5F__get_file_id() and use only private routine instead --- src/H5Fint.c | 65 ++++++++++++++----------------------------------- src/H5Fpkg.h | 1 - src/H5Fprivate.h | 2 +- src/H5I.c | 9 ++++++- src/H5O.c | 2 +- src/H5Ocopy_ref.c | 5 ++-- src/H5R.c | 6 ++--- src/H5Rdeprec.c | 14 +++++------ src/H5Rint.c | 6 ++--- src/H5Rpkg.h | 2 +- src/H5Tref.c | 2 +- src/H5VLconnector.h | 1 + src/H5VLnative.h | 37 ++++++++++++++-------------- src/H5VLnative_file.c | 14 ----------- src/H5VLnative_object.c | 22 ++++++++++++++++- src/H5trace.c | 3 +++ 16 files changed, 88 insertions(+), 103 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 435c1be..153ec2f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3654,9 +3654,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_file_id + * Function: H5F_get_file_id * - * Purpose: The package version of H5Iget_file_id(), obtains the file + * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. * * Return: Success: The file ID associated with the object @@ -3665,22 +3665,31 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F__get_file_id(H5F_t *file, hbool_t app_ref) +H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) { - hid_t file_id = H5I_INVALID_HID; /* File ID */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *vol_obj_file = NULL; /* File object pointer */ + H5VL_loc_params_t loc_params; /* Location parameters */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = obj_type; + + /* Retrieve VOL file from object */ + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") /* Check if the file's ID already exists */ - if(H5I_find_id(file, H5I_FILE, &file_id) < 0) + if(H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") /* If the ID does not exist, register it with the VOL connector */ if(H5I_INVALID_HID == file_id) { - if((file_id = H5VL_wrap_register(H5I_FILE, file, app_ref)) < 0) + if((file_id = H5VL_register(H5I_FILE, vol_obj_file, vol_obj->connector, app_ref)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") - file->id_exists = TRUE; } /* end if */ else { /* Increment ref count on existing ID */ @@ -3693,44 +3702,6 @@ H5F__get_file_id(H5F_t *file, hbool_t app_ref) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__get_file_id() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_get_file_id - * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. - * - * Return: Success: The file ID associated with the object - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -hid_t -H5F_get_file_id(hid_t obj_id, H5I_type_t type, hbool_t app_ref) -{ - H5VL_object_t *vol_obj; /* File info */ - hid_t file_id = H5I_INVALID_HID; /* File ID for object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - - /* Get the file through the VOL */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID") - if(H5I_INVALID_HID == file_id) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL") - - /* Set return value */ - ret_value = file_id; - -done: - FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7d9a090..6e2c994 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -412,7 +412,6 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); -H5_DLL hid_t H5F__get_file_id(H5F_t *file, hbool_t app_ref); H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); /* File mount related routines */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index e1a8a2f..cfb796c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -732,7 +732,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); -H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); +H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); diff --git a/src/H5I.c b/src/H5I.c index 76faab1..c3c2d46 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2270,7 +2270,14 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5F_get_file_id(obj_id, type, TRUE)) < 0) + H5VL_object_t *vol_obj = NULL; /* Object token of obj_id */ + + /* Get the VOL object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Get the file ID */ + if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else diff --git a/src/H5O.c b/src/H5O.c index b79914c..7e5694a 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -278,7 +278,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, vol_obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") /* Retrieve VOL object */ diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index d8efeb5..20b8454 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -24,7 +24,6 @@ /****************/ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #define H5R_FRIEND /* Suppress error about including H5Rpkg */ @@ -32,7 +31,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Fpkg.h" /* File */ +#include "H5Fprivate.h" /* File */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -359,7 +358,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed") /* Retrieve loc ID */ - if((dst_loc_id = H5F__get_file_id(dst_oloc->file, FALSE)) < 0) + if((dst_loc_id = H5F_get_id(dst_oloc->file)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Making equivalent references in the destination file */ diff --git a/src/H5R.c b/src/H5R.c index 11b75ca..31b2bcd 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -103,7 +103,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL file object */ @@ -186,7 +186,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL file object */ @@ -265,7 +265,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL file object */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b9bdffa..0636da9 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -123,7 +123,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5G_UNKNOWN, "unable to get object token") /* Set location parameters */ @@ -183,7 +183,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(obj_id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token") /* Set location parameters */ @@ -265,7 +265,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, vol_obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL object */ @@ -351,7 +351,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") /* Set location parameters */ @@ -415,7 +415,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(obj_id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token") /* Set location parameters */ @@ -479,7 +479,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(id, vol_obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") /* Retrieve VOL object */ @@ -548,7 +548,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, (-1), "unable to get object token") /* Set location parameters */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 504ae06..adf6e4e 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1479,18 +1479,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type, +H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token) { hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ - void *vol_obj_file = NULL; + H5VL_object_t *vol_obj_file = NULL; H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE /* Get the file for the object */ - if((file_id = H5F_get_file_id(id, type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL object */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 19f3115..7471487 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -118,7 +118,7 @@ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, c H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size); H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes); -H5_DLL herr_t H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token); +H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token); H5_DLL herr_t H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size); diff --git a/src/H5Tref.c b/src/H5Tref.c index 2e52954..20c6e41 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -468,7 +468,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size /* If no filename set, this is not an external reference */ if(NULL == H5R_REF_FILENAME(dst_ref)) { /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(src_f, FALSE)) < 0) + if((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Attach loc ID to reference and hold reference to it */ diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 46383bb..0fce7f4 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -160,6 +160,7 @@ typedef enum H5VL_link_specific_t { /* types for object GET callback */ typedef enum H5VL_object_get_t { + H5VL_OBJECT_GET_FILE, /* object file */ H5VL_OBJECT_GET_NAME, /* object name */ H5VL_OBJECT_GET_TYPE /* object type */ } H5VL_object_get_t; diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 5b51e66..73cec8d 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -57,25 +57,24 @@ typedef int H5VL_native_file_optional_t; #define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */ #define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */ #define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */ -#define H5VL_NATIVE_FILE_GET_FILE_ID 10 /* H5Fget_file_id */ -#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 11 /* H5Freset_mdc_hit_rate_stats */ -#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 12 /* H5Fset_mdc_config */ -#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 13 /* H5Fget_metadata_read_retry_info */ -#define H5VL_NATIVE_FILE_START_SWMR_WRITE 14 /* H5Fstart_swmr_write */ -#define H5VL_NATIVE_FILE_START_MDC_LOGGING 15 /* H5Fstart_mdc_logging */ -#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 16 /* H5Fstop_mdc_logging */ -#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 17 /* H5Fget_mdc_logging_status */ -#define H5VL_NATIVE_FILE_FORMAT_CONVERT 18 /* H5Fformat_convert */ -#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 19 /* H5Freset_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 20 /* H5Fget_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 21 /* H5Fget_mdc_image_info */ -#define H5VL_NATIVE_FILE_GET_EOA 22 /* H5Fget_eoa */ -#define H5VL_NATIVE_FILE_INCR_FILESIZE 23 /* H5Fincrement_filesize */ -#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 24 /* H5Fset_latest_format/libver_bounds */ -#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 25 /* H5Fget_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 26 /* H5Fset_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 27 /* H5Fget_mpi_atomicity */ -#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 28 /* H5Fset_mpi_atomicity */ +#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */ +#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */ +#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */ +#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */ +#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */ +#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */ +#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */ +#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */ +#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */ +#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */ +#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */ +#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ +#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ +#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ /* Typedef and values for native VOL connector group optional VOL operations */ typedef int H5VL_native_group_optional_t; diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 094722e..3bda0b8 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -578,20 +578,6 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR break; } - /* H5Iget_file_id */ - case H5VL_NATIVE_FILE_GET_FILE_ID: - { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - hbool_t app_ref = (hbool_t)HDva_arg(arguments, int); - hid_t *file_id = HDva_arg(arguments, hid_t *); - - if(NULL == (f = H5F__get_file(obj, type))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object") - if((*file_id = H5F__get_file_id(f, app_ref)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID") - break; - } - /* H5Fclear_elink_file_cache */ case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE: { diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 675d8cf..dfa4eab 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -16,10 +16,11 @@ */ #define H5O_FRIEND /* Suppress error about including H5Opkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ +#include "H5Fpkg.h" /* Files (pkg needed for id_exists) */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ @@ -150,6 +151,25 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(get_type) { + + /* Object file */ + case H5VL_OBJECT_GET_FILE: + { + void **ret = HDva_arg(arguments, void **); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + *ret = (void *)loc.oloc->file; + + /* TODO we currently need to set id_exists to TRUE because + * the upper layer will create an ID from the returned + * object. In theory this should not be needed and id_exists + * should be removed once the H5Fmount code gets fixed. */ + loc.oloc->file->id_exists = TRUE; + } else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters") + break; + } + /* Object name */ case H5VL_OBJECT_GET_NAME: { diff --git a/src/H5trace.c b/src/H5trace.c index 79dfbc8..65e267e 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3000,6 +3000,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5VL_object_get_t get = (H5VL_object_get_t)HDva_arg(ap, int); switch(get) { + case H5VL_OBJECT_GET_FILE: + HDfprintf(out, "H5VL_OBJECT_GET_FILE"); + break; case H5VL_OBJECT_GET_NAME: HDfprintf(out, "H5VL_OBJECT_GET_NAME"); break; -- cgit v0.12 From ad2fbb022e096233444489e69b93343a4b7e9631 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 14 Nov 2019 17:32:29 -0600 Subject: Add support for point selections to H5S_select_project_intersection. --- src/H5Sselect.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 17 deletions(-) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 65a66cb..97d2c32 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2559,7 +2559,12 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t **new_space_ptr, hbool_t share_selection) { - H5S_t *new_space = NULL; /* New dataspace constructed */ + H5S_t *new_space = NULL; /* New dataspace constructed */ + H5S_t *tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */ + H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */ + hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */ + H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */ + hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2569,6 +2574,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(dst_space); HDassert(src_intersect_space); HDassert(new_space_ptr); + HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); /* Create new space, using dst extent. Start with "all" selection. */ if(NULL == (new_space = H5S_create(H5S_SIMPLE))) @@ -2578,7 +2584,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* If the intersecting space is "all", the intersection must be equal to the * source space and the projection must be equal to the destination space */ - if(src_intersect_space->select.type->type == H5S_SEL_ALL) { + if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_ALL) { /* Copy the destination selection. */ if(H5S_select_copy(new_space, dst_space, FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection") @@ -2592,20 +2598,99 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, if(H5S_select_none(new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ - /* If any of the spaces use point selection, fall back to general algorithm */ - else if((src_intersect_space->select.type->type == H5S_SEL_POINTS) - || (src_space->select.type->type == H5S_SEL_POINTS) - || (dst_space->select.type->type == H5S_SEL_POINTS)) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported") else { - HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS); - HDassert(src_space->select.type->type != H5S_SEL_NONE); - HDassert(dst_space->select.type->type != H5S_SEL_NONE); - - /* Intersecting space is hyperslab selection. Call the hyperslab - * routine to project to another hyperslab selection. */ - if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection") + /* If the source intersect space is a point selection, convert it to a + * hyperslab (discarding ordering). We can get away with this because + * the order does not matter for the source intersect space */ + /* Maybe we should just leave it as a point selection for the point by + * point algorithm? The search through the selection in + * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */ + if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) { + H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; + + /* Create dataspace and copy extent */ + if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace") + if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent") + + /* Iterate over points */ + for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next) + /* Add point to hyperslab selection */ + if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection") + + /* Redirect local src_intersect_space pointer (will not affect + * calling function) */ + src_intersect_space = tmp_src_intersect_space; + } /* end for */ + + /* By this point, src_intersect_space must be a hyperslab selection */ + HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); + + /* If either the source space or the destination space is a point + * selection, iterate element by element */ + if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS) + || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) { + hsize_t coords[H5S_MAX_RANK]; + htri_t intersect; + + /* Start with "none" selection */ + if(H5S_select_none(new_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + + /* Initialize iterators */ + if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") + ss_iter_init = TRUE; + if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") + ds_iter_init = TRUE; + + /* Iterate over points */ + do { + HDassert(ss_iter.elmt_left > 0); + HDassert(ss_iter.elmt_left > 0); + + /* Get SS coords */ + if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") + + /* Check for intersection */ + if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") + + /* Add point if it intersects */ + if(intersect) { + /* Get DS coords */ + if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") + + /* Add point to new_space */ + if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection") + } /* end if */ + + /* Advance iterators */ + if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") + ss_iter.elmt_left--; + if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") + ds_iter.elmt_left--; + } while(ss_iter.elmt_left > 0); + HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + } /* end if */ + else { + HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); + HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); + + /* Source and destination selections are all or hyperslab, + * intersecting selection is hyperslab. Call the hyperslab routine + * to project to another hyperslab selection. */ + if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection") + } /* end else */ } /* end else */ /* load the address of the new space into *new_space_ptr */ @@ -2617,6 +2702,14 @@ done: if(new_space && H5S_close(new_space) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + /* General cleanup */ + if(tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace") + if(ss_iter_init && H5S_SELECT_ITER_RELEASE(&ss_iter) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator") + if(ds_iter_init && H5S_SELECT_ITER_RELEASE(&ds_iter) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_project_intersection() */ @@ -2628,8 +2721,7 @@ done: PURPOSE Projects the intersection of of the selections of src_space_id and src_intersect_space_id within the selection of src_space_id as a - selection within the selection of dst_space_id. Currently does not - support point selections. + selection within the selection of dst_space_id. USAGE hid_t H5Sselect_project_intersection(src_space_id,dst_space_d,src_intersect_space_id) @@ -2672,6 +2764,10 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + /* Check numbbers of points selected matches in source and destination */ + if(H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space)) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "number of points selected in source space does not match that in destination space") + /* Perform operation */ if(H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, FALSE) < 0) -- cgit v0.12 From 28294070597c8a04c10e55a843dfe6dbae6ef04c Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Wed, 27 Nov 2019 14:52:30 -0600 Subject: Fix issues with using H5Pget_fill_value() with file datatypes retrieved from H5VLget_file_type(). --- src/H5Pdcpl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 721ba89..b83e2cf 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -3324,19 +3324,19 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/) */ if(H5T_get_size(type) >= H5T_get_size(fill.type)) { buf = value; - if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(type)))) + if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") } /* end if */ else { - if(NULL == (buf = H5MM_malloc(H5T_get_size(fill.type)))) + if(NULL == (buf = H5MM_calloc(H5T_get_size(fill.type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") - if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(fill.type)))) + if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(fill.type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") } /* end else */ H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type)); /* Do the conversion */ - if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT), FALSE)) < 0) + if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype") if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed") -- cgit v0.12 From e23e67798ace036628f291c4f77831a895b67286 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Wed, 27 Nov 2019 16:50:01 -0600 Subject: Implement file comparison VOL callback. Other changes to allow references to work with non-native connectors. There is a bug somewhere. --- src/H5Tref.c | 99 +++++++++++++++++++++++++++++++++++---------------- src/H5VLcallback.c | 68 +++++++++++++++++++++++++++++++++++ src/H5VLconnector.h | 3 +- src/H5VLnative_file.c | 13 +++++++ 4 files changed, 152 insertions(+), 31 deletions(-) diff --git a/src/H5Tref.c b/src/H5Tref.c index 20c6e41..ad00761 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -280,10 +280,12 @@ static size_t H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) { - H5F_t *src_f; - H5F_t *dst_f; H5VL_object_t *vol_obj = NULL; const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; + hbool_t files_equal = FALSE; + char file_name_buf_static[256]; + char *file_name_buf_dyn = NULL; + ssize_t file_name_len; unsigned flags = 0; size_t ret_value = 0; @@ -296,27 +298,43 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ - - /* Retrieve files from VOL objects */ - if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") - if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") - /* Set external flag if referenced file is not destination file */ - flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0; + if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") + flags |= files_equal ? H5R_IS_EXTERNAL : 0; /* Force re-calculating encoding size if any flags are set */ if(flags || !src_ref->encode_size) { /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ - if(src_ref->type == (int8_t)H5R_DATASET_REGION2) - H5CX_set_libver_bounds(dst_f); + if(src_ref->type == (int8_t)H5R_DATASET_REGION2) { + /* Temporary hack to check if this is the native connector. We need to + * add a way to check if the terminal connector is native. For now this + * will break passthroughs, but it's needed for other VOL connectors to + * work. -NAF */ + if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) { + H5F_t *dst_f; + + if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + H5CX_set_libver_bounds(dst_f); + } /* end if */ + else + H5CX_set_libver_bounds(NULL); + } /* end if */ + + /* Get file name */ + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) { + if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name") + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + } /* end if */ /* Determine encoding size */ - if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, NULL, &ret_value, flags) < 0) + if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL, &ret_value, flags) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size") } else { /* Can do a direct copy and skip blob decoding */ @@ -328,6 +346,8 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf } done: + H5MM_xfree(file_name_buf_dyn); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_mem_getsize() */ @@ -346,10 +366,12 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size) { - H5F_t *src_f; - H5F_t *dst_f; H5VL_object_t *vol_obj = NULL; const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; + hbool_t files_equal = FALSE; + char file_name_buf_static[256]; + char *file_name_buf_dyn = NULL; + ssize_t file_name_len; unsigned flags = 0; herr_t ret_value = SUCCEED; @@ -365,25 +387,41 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ - - /* Retrieve files from VOL objects */ - if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") - if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") - /* Set external flag if referenced file is not destination file */ - flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0; + if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") + flags |= files_equal ? H5R_IS_EXTERNAL : 0; /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ - if(src_ref->type == (int8_t)H5R_DATASET_REGION2) - H5CX_set_libver_bounds(dst_f); + if(src_ref->type == (int8_t)H5R_DATASET_REGION2) { + /* Temporary hack to check if this is the native connector. We need to + * add a way to check if the terminal connector is native. For now this + * will break passthroughs, but it's needed for other VOL connectors to + * work. -NAF */ + if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) { + H5F_t *dst_f; + + if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + H5CX_set_libver_bounds(dst_f); + } /* end if */ + else + H5CX_set_libver_bounds(NULL); + } /* end if */ + + /* Get file name */ + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) { + if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name") + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + } /* end if */ /* Encode reference */ - if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0) + if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference") done: @@ -827,3 +865,4 @@ H5T_ref_reclaim(void *elem, const H5T_t *dt) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_ref_reclaim() */ + diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 8d7368b..b20494a 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -101,6 +101,8 @@ static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, @@ -2989,6 +2991,43 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__file_specific_wrap_va_list + * + * Purpose: Perform File specific operations through the VOL. Just + * starts a va_list and passes it to the connector's + * callback. Needed when the VOL layer needs to replace one + * of the variable arguments. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Start access to the varargs, so they are available in all situations below */ + HDva_start(arguments, req); + + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + /* End access to the va_list */ + HDva_end(arguments); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific_wrap_va_list() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__file_specific * * Purpose: Perform File specific operations through the VOL @@ -3010,6 +3049,35 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe if(NULL == cls->file_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") + /* Special handling for file is equal */ + if(specific_type == H5VL_FILE_IS_EQUAL) { + va_list tmp_args; /* Argument list passed from the API call */ + H5VL_object_t *vol_obj2; /* Second VOL object */ + hbool_t *is_equal; /* Output variable */ + int cmp_value; /* Comparison result */ + + /* Get parameters */ + HDva_copy(tmp_args, arguments); + vol_obj2 = HDva_arg(tmp_args, H5VL_object_t *); + is_equal = HDva_arg(tmp_args, hbool_t *); + HDva_end(tmp_args); + + HDassert(vol_obj2); + + /* Compare connector classes */ + if(H5VL_cmp_connector_cls(&cmp_value, cls, vol_obj2->connector->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If the classes are different the files are different */ + if(cmp_value) + *is_equal = FALSE; + else + /* Make callback (need to extract data from vol_obj2 and redo the + * va_list) */ + if(H5VL__file_specific_wrap_va_list(obj, cls, specific_type, dxpl_id, req, vol_obj2->data, is_equal) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + } /* end if */ + /* Call the corresponding VOL callback */ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 0012eeb..f0925bf 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -122,7 +122,8 @@ typedef enum H5VL_file_specific_t { H5VL_FILE_MOUNT, /* Mount a file */ H5VL_FILE_UNMOUNT, /* Unmount a file */ H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ - H5VL_FILE_DELETE /* Delete a file */ + H5VL_FILE_DELETE, /* Delete a file */ + H5VL_FILE_IS_EQUAL /* Check if two files are the same */ } H5VL_file_specific_t; /* types for group GET callback */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 3bda0b8..588d59f 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -418,6 +418,19 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, break; } + /* Check if two files are the same */ + case H5VL_FILE_IS_EQUAL: + { + H5F_t *file2 = (H5F_t *)HDva_arg(arguments, void *); + hbool_t *is_equal = HDva_arg(arguments, hbool_t *); + + if(!obj || !file2) + *is_equal = FALSE; + else + *is_equal = (((H5F_t *)obj)->shared == file2->shared); + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") } /* end switch */ -- cgit v0.12 From ece625e3b680aafb33b0ef4ec101792e20be4aac Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Wed, 27 Nov 2019 22:48:01 -0600 Subject: Fix bugs in H5VL file comparison code. Add short circuit success to H5VL_cmp_connector_cls(). --- src/H5Tref.c | 12 ++++++------ src/H5VLcallback.c | 8 ++++---- src/H5VLint.c | 6 ++++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/H5Tref.c b/src/H5Tref.c index ad00761..886891c 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -301,7 +301,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Set external flag if referenced file is not destination file */ if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") - flags |= files_equal ? H5R_IS_EXTERNAL : 0; + flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Force re-calculating encoding size if any flags are set */ if(flags || !src_ref->encode_size) { @@ -324,12 +324,12 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf } /* end if */ /* Get file name */ - if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) { if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name") - if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") } /* end if */ @@ -390,7 +390,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, /* Set external flag if referenced file is not destination file */ if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") - flags |= files_equal ? H5R_IS_EXTERNAL : 0; + flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ @@ -411,12 +411,12 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, } /* end if */ /* Get file name */ - if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) { if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name") - if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") } /* end if */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index b20494a..77df207 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -3077,10 +3077,10 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe if(H5VL__file_specific_wrap_va_list(obj, cls, specific_type, dxpl_id, req, vol_obj2->data, is_equal) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") } /* end if */ - - /* Call the corresponding VOL callback */ - if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + else + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5VLint.c b/src/H5VLint.c index 733a2b5..284b266 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1639,6 +1639,12 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas HDassert(cls1); HDassert(cls2); + /* If the pointers are the same the classes are the same */ + if(cls1 == cls2) { + *cmp_value = 0; + HGOTO_DONE(SUCCEED); + } /* end if */ + /* Compare connector "values" */ if(cls1->value < cls2->value) { *cmp_value = -1; -- cgit v0.12 From 40b2658b4b266b4dc65ec3db2897e0aaf54f8e42 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 28 Nov 2019 23:07:33 -0600 Subject: Fix missing free in H5T__ref_mem_read() --- src/H5Tref.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/H5Tref.c b/src/H5Tref.c index 886891c..5c72489 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -425,6 +425,8 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference") done: + H5MM_xfree(file_name_buf_dyn); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_mem_read() */ -- cgit v0.12 From ac1a8ab5fe7c58533e005fef94d3acb2d46f4b31 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 28 Nov 2019 23:00:23 -0600 Subject: Add support for scalar dataspaces to H5Sproject_intersection. Add checking for ank validity. --- src/H5Shyper.c | 2 +- src/H5Sselect.c | 215 +++++++++++++++++++++++++++++++++----------------------- 2 files changed, 130 insertions(+), 87 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index ab06eff..acb8b87 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -11503,7 +11503,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(src_intersect_space); HDassert(proj_space); - /* Assert that src_space and src_intersect_space have same extent and there + /* Assert that src_space and src_intersect_space have same rank and there * are no point selections */ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 664f4b5..6c8b898 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2615,6 +2615,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(src_intersect_space); HDassert(new_space_ptr); HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); + HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); /* Create new space, using dst extent. Start with "all" selection. */ if(NULL == (new_space = H5S_create(H5S_SIMPLE))) @@ -2639,97 +2640,134 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ else { - /* If the source intersect space is a point selection, convert it to a - * hyperslab (discarding ordering). We can get away with this because - * the order does not matter for the source intersect space */ - /* Maybe we should just leave it as a point selection for the point by - * point algorithm? The search through the selection in - * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */ - if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) { - H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; - - /* Create dataspace and copy extent */ - if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace") - if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent") - - /* Iterate over points */ - for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next) - /* Add point to hyperslab selection */ - if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection") - - /* Redirect local src_intersect_space pointer (will not affect - * calling function) */ - src_intersect_space = tmp_src_intersect_space; - } /* end for */ - - /* By this point, src_intersect_space must be a hyperslab selection */ - HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); - - /* If either the source space or the destination space is a point - * selection, iterate element by element */ - if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS) - || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) { - hsize_t coords[H5S_MAX_RANK]; + /* Handle scalar dataspaces. It should not be possible for the source + * intersect space or the source space to be scalar since scalar spaces + * only support all or none selections, and both of those cases are + * covered above, and the source intersect space must have the same + * rank, so it also cannot be scalar, as scalar dataspaces have a rank + * of 0. */ + HDassert(H5S_GET_EXTENT_TYPE(src_space) != H5S_SCALAR); + HDassert(H5S_GET_EXTENT_TYPE(src_intersect_space) != H5S_SCALAR); + + /* Check for scalar dst_space. In this case we simply check if the + * (single) point selected in src_space intersects src_intersect_space, + * if so select all in new_space, otherwise select none. */ + if(H5S_GET_EXTENT_TYPE(dst_space) == H5S_SCALAR) { + hsize_t coords_start[H5S_MAX_RANK]; + hsize_t coords_end[H5S_MAX_RANK]; htri_t intersect; - /* Start with "none" selection */ - if(H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Get source space bounds. Should be a single point. */ + if(H5S_SELECT_BOUNDS(src_space, coords_start, coords_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source space bounds") + HDassert(0 == HDmemcmp(coords_start, coords_end, H5S_GET_EXTENT_NDIMS(src_space) * sizeof(coords_start[0]))); - /* Initialize iterators */ - if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") - ss_iter_init = TRUE; - if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") - ds_iter_init = TRUE; - - /* Iterate over points */ - do { - HDassert(ss_iter.elmt_left > 0); - HDassert(ss_iter.elmt_left > 0); - - /* Get SS coords */ - if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") - - /* Check for intersection */ - if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") - - /* Add point if it intersects */ - if(intersect) { - /* Get DS coords */ - if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") - - /* Add point to new_space */ - if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection") - } /* end if */ + /* Check for intersection */ + if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords_start, coords_end)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") - /* Advance iterators */ - if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") - ss_iter.elmt_left--; - if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") - ds_iter.elmt_left--; - } while(ss_iter.elmt_left > 0); - HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + /* Select all or none as appropriate */ + if(intersect) { + if(H5S_select_all(new_space, TRUE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't select all") + } /* end if */ + else + if(H5S_select_none(new_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ else { - HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); - HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); - - /* Source and destination selections are all or hyperslab, - * intersecting selection is hyperslab. Call the hyperslab routine - * to project to another hyperslab selection. */ - if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection") + /* If the source intersect space is a point selection, convert it to a + * hyperslab (discarding ordering). We can get away with this because + * the order does not matter for the source intersect space */ + /* Maybe we should just leave it as a point selection for the point by + * point algorithm? The search through the selection in + * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */ + if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) { + H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; + + /* Create dataspace and copy extent */ + if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace") + if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent") + + /* Iterate over points */ + for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next) + /* Add point to hyperslab selection */ + if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection") + + /* Redirect local src_intersect_space pointer (will not affect + * calling function) */ + src_intersect_space = tmp_src_intersect_space; + } /* end for */ + + /* By this point, src_intersect_space must be a hyperslab selection */ + HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); + + /* If either the source space or the destination space is a point + * selection, iterate element by element */ + if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS) + || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) { + hsize_t coords[H5S_MAX_RANK]; + htri_t intersect; + + /* Start with "none" selection */ + if(H5S_select_none(new_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + + /* Initialize iterators */ + if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") + ss_iter_init = TRUE; + if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") + ds_iter_init = TRUE; + + /* Iterate over points */ + do { + HDassert(ss_iter.elmt_left > 0); + HDassert(ss_iter.elmt_left > 0); + + /* Get SS coords */ + if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") + + /* Check for intersection */ + if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") + + /* Add point if it intersects */ + if(intersect) { + /* Get DS coords */ + if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") + + /* Add point to new_space */ + if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection") + } /* end if */ + + /* Advance iterators */ + if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") + ss_iter.elmt_left--; + if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") + ds_iter.elmt_left--; + } while(ss_iter.elmt_left > 0); + HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + } /* end if */ + else { + HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); + HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); + + /* Source and destination selections are all or hyperslab, + * intersecting selection is hyperslab. Call the hyperslab routine + * to project to another hyperslab selection. */ + if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection") + } /* end else */ } /* end else */ } /* end else */ @@ -2804,10 +2842,15 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") - /* Check numbbers of points selected matches in source and destination */ + /* Check numbers of points selected matches in source and destination */ if(H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space)) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "number of points selected in source space does not match that in destination space") + /* Check numbers of dimensions matches in source and source intersect spaces + */ + if(H5S_GET_EXTENT_NDIMS(src_space) != H5S_GET_EXTENT_NDIMS(src_intersect_space)) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "rank of source space does not match rank of source intersect space") + /* Perform operation */ if(H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, FALSE) < 0) -- cgit v0.12 From 874900d39561f97c0a41b7efc59686daa66df95e Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 2 Dec 2019 12:43:49 -0600 Subject: Add OAPL parameter to H5Rcreate_ APIs --- examples/h5_ref_extern.c | 2 +- src/H5R.c | 42 ++++++++++++++++++++++++---- src/H5Rdeprec.c | 1 + src/H5Rpublic.h | 6 ++-- test/objcopy_ref.c | 12 ++++---- test/trefer.c | 72 ++++++++++++++++++++++++------------------------ 6 files changed, 83 insertions(+), 52 deletions(-) diff --git a/examples/h5_ref_extern.c b/examples/h5_ref_extern.c index 4327a06..17082ba 100644 --- a/examples/h5_ref_extern.c +++ b/examples/h5_ref_extern.c @@ -56,7 +56,7 @@ main(void) { /* Create reference to dataset1 in "refer_extern1.h5" */ file1 = H5Fopen(H5FILE_NAME1, H5F_ACC_RDONLY, H5P_DEFAULT); - H5Rcreate_object(file1, "dataset1", &ref_buf[0]); + H5Rcreate_object(file1, "dataset1", H5P_DEFAULT, &ref_buf[0]); H5Fclose(file1); /* Store reference in dataset in separate file "refer_extern2.h5" */ diff --git a/src/H5R.c b/src/H5R.c index 31b2bcd..70d4749 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -74,7 +74,7 @@ *------------------------------------------------------------------------- */ herr_t -H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) +H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -86,13 +86,22 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*s*Rr", loc_id, name, ref_ptr); + H5TRACE4("e", "i*si*Rr", loc_id, name, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -117,6 +126,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ @@ -152,7 +162,7 @@ done: */ herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, - H5R_ref_t *ref_ptr) + hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -165,7 +175,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*si*Rr", loc_id, name, space_id, ref_ptr); + H5TRACE5("e", "i*sii*Rr", loc_id, name, space_id, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) @@ -176,6 +186,15 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -200,6 +219,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ @@ -234,7 +254,7 @@ done: */ herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, - H5R_ref_t *ref_ptr) + hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -246,7 +266,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*s*Rr", loc_id, name, attr_name, ref_ptr); + H5TRACE5("e", "i*s*si*Rr", loc_id, name, attr_name, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) @@ -255,6 +275,15 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name given") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -279,6 +308,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 0636da9..63be3f8 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -258,6 +258,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = vol_obj_type; /* Get the object token */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index ce54ac4..585cb85 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -93,9 +93,9 @@ extern "C" { #endif /* Constructors */ -H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr); -H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, H5R_ref_t *ref_ptr); -H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr); H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); /* Info */ diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 721a7c6..a73e569 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -247,8 +247,8 @@ attach_ref_attr(hid_t file_id, hid_t loc_id) if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR /* create an attribute with two object references */ - if(H5Rcreate_object(file_id, dsetname1, &ref[0]) < 0) TEST_ERROR - if(H5Rcreate_object(file_id, dsetname2, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_object(file_id, dsetname1, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_object(file_id, dsetname2, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR @@ -315,12 +315,12 @@ attach_reg_ref_attr(hid_t file_id, hid_t loc_id) /* create reg_ref of block selection */ if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR /* create reg_ref of point selection */ if(H5Sselect_none(space_id) < 0) TEST_ERROR if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR /* create reg_ref attribute */ if((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -402,10 +402,10 @@ create_reg_ref_dataset(hid_t file_id, hid_t loc_id) count[0] = 2; count[1] = 3; if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR if(H5Sselect_none(space_id) < 0) TEST_ERROR if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR if(H5Dclose(dsetr_id) < 0) TEST_ERROR diff --git a/test/trefer.c b/test/trefer.c index 0f9e4f9..9fc6563 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -195,33 +195,33 @@ test_reference_params(void) CHECK(ret, H5I_INVALID_HID, "H5Dcreate2"); /* Test parameters to H5Rcreate_object */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", NULL); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_object ref"); - ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object loc_id"); - ret = H5Rcreate_object(fid1, NULL, &wbuf[0]); + ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object name"); - ret = H5Rcreate_object(fid1, "", &wbuf[0]); + ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object null name"); /* Test parameters to H5Rcreate_region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, NULL); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_region ref"); - ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, &wbuf[0]); + ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region loc_id"); - ret = H5Rcreate_region(fid1, NULL, sid1, &wbuf[0]); + ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region name"); - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region dataspace"); /* Test parameters to H5Rcreate_attr */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", NULL); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_attr ref"); - ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", &wbuf[0]); + ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr loc_id"); - ret = H5Rcreate_attr(fid1, NULL, "Attr", &wbuf[0]); + ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr name"); - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, &wbuf[0]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr attr_name"); /* Test parameters to H5Rdestroy */ @@ -403,28 +403,28 @@ test_reference_obj(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + 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); 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", &wbuf[1]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group */ - ret = H5Rcreate_object(fid1, "/Group1", &wbuf[2]); + 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); 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", &wbuf[3]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -645,7 +645,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, 36, "H5Sget_select_npoints"); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[0]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -669,7 +669,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints"); /* Store second dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[1]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Select unlimited hyperslab for third reference */ @@ -688,7 +688,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); /* Store third dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[2]); + 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); @@ -696,7 +696,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Store fourth dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[3]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Write selection to disk */ @@ -1068,7 +1068,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, (block[0] * count[0]), "H5Sget_select_npoints"); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[0]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1092,7 +1092,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, POINT1_NPOINTS, "H5Sget_select_npoints"); /* Store second dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[1]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Write selection to disk */ @@ -1311,7 +1311,7 @@ test_reference_obj_deleted(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Dataset1", &oref); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1469,7 +1469,7 @@ test_reference_group(void) CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to group */ - ret = H5Rcreate_object(fid, GROUPNAME, &wref); + ret = H5Rcreate_object(fid, GROUPNAME, H5P_DEFAULT, &wref); CHECK(ret, FAIL, "H5Rcreate_object"); /* Write reference to disk */ @@ -1678,28 +1678,28 @@ test_reference_attr(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset1 attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); + 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); 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", &ref_wbuf[1]); + 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); 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", &ref_wbuf[2]); + 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); 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", &ref_wbuf[3]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1938,28 +1938,28 @@ test_reference_external(void) CHECK(ret, FAIL, "H5Gclose"); /* Create reference to dataset1 attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); + 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); 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", &ref_wbuf[1]); + 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); 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", &ref_wbuf[2]); + 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); 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", &ref_wbuf[3]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -2506,7 +2506,7 @@ test_reference_perf(void) t = 0; for(i = 0; i < MAX_ITER_CREATE; i++) { t1 = H5_get_time(); - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); t2 = H5_get_time(); t += t2 - t1; @@ -2516,7 +2516,7 @@ test_reference_perf(void) HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + 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); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -2578,7 +2578,7 @@ test_reference_perf(void) for(i = 0; i < MAX_ITER_CREATE; i++) { t1 = H5_get_time(); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, &wbuf_reg[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); CHECK(ret, FAIL, "H5Rcreate_region"); t2 = H5_get_time(); t += t2 - t1; @@ -2588,7 +2588,7 @@ test_reference_perf(void) HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, &wbuf_reg[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); CHECK(ret, FAIL, "H5Rcreate_region"); t = 0; -- cgit v0.12 From 43c48fbadc994f740f63caeb5110442c79346501 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 3 Dec 2019 15:14:57 -0800 Subject: Fixed missing blob callbacks in test VOL connectors. --- test/null_vol_connector.c | 6 ++++++ test/vol.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 5ed8545..14e1a38 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -116,6 +116,12 @@ static const H5VL_class_t null_vol_g = { NULL, /* optional */ NULL /* free */ }, + { /* blob_cls */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, NULL /* optional */ }; diff --git a/test/vol.c b/test/vol.c index 5ff0af0..da42a1e 100644 --- a/test/vol.c +++ b/test/vol.c @@ -131,6 +131,12 @@ static const H5VL_class_t fake_vol_g = { NULL, /* optional */ NULL /* free */ }, + { /* blob_cls */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, NULL /* optional */ }; -- cgit v0.12 From 1ad02a445920578654d257bb66aa1e8e7e368018 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 4 Dec 2019 00:49:52 -0800 Subject: Yanked -Wc++-compat from the flags used to build the C library in both the Autotools and CMake. --- config/cmake/HDFCompilerFlags.cmake | 2 +- config/gnu-flags | 5 +++- src/H5FD.c | 4 ++-- src/H5Fsuper.c | 2 +- src/H5MF.c | 48 ++++++++++++++++++------------------- src/H5MFdbg.c | 6 ++--- src/H5Ofsinfo.c | 10 ++++---- src/H5private.h | 7 ------ src/hdf5-lin.lnt | 3 --- src/hdf5.lnt | 7 +----- test/dsets.c | 24 +++++++++---------- test/dtypes.c | 8 +++---- test/earray.c | 4 ++-- test/enc_dec_plist.c | 4 ++-- test/farray.c | 4 ++-- test/fheap.c | 12 +++++----- test/gen_filespace.c | 3 +-- test/h5test.c | 8 +++---- test/links.c | 33 ++++++++++++------------- test/mf.c | 20 ++++++++-------- test/objcopy.c | 4 ++-- test/ohdr.c | 4 ++-- test/page_buffer.c | 4 ++-- test/set_extent.c | 6 ++--- test/tattr.c | 12 +++++----- test/tfile.c | 38 ++++++++++++++--------------- test/th5o.c | 4 ++-- test/th5s.c | 6 ++--- test/trefer.c | 4 ++-- test/trefer_deprec.c | 4 ++-- test/tvltypes.c | 6 ++--- test/vds.c | 4 ++-- test/vds_env.c | 4 ++-- test/vfd.c | 4 ++-- tools/test/h5dump/h5dumpgentest.c | 2 +- tools/test/perform/sio_engine.c | 4 ++-- tools/test/perform/sio_standalone.h | 7 ------ 37 files changed, 156 insertions(+), 175 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index adace89..f49b674 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -107,7 +107,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wno-c++-compat -Wcast-align") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") diff --git a/config/gnu-flags b/config/gnu-flags index 6355ccf..16795d0 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -168,7 +168,10 @@ if test "X-gcc" = "X-$cc_vendor"; then # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add # it to the developer flags. # - H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" + # NOTE: Due to the divergence in the C and C++, we're dropping support for + # compiling the C library with a C++ compiler and dropping the -Wc++-compat + # warning. + H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wno-c++-compat -Wcast-align" H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" diff --git a/src/H5FD.c b/src/H5FD.c index 61969b6..1a4ab4d 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -241,7 +241,7 @@ H5FDregister(const H5FD_class_t *cls) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") if(!cls->read || !cls->write) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined") - for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) + for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") @@ -286,7 +286,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); HDassert(cls->read && cls->write); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); } diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index f8e8f3f..e5d4cde 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1394,7 +1394,7 @@ H5F__super_init(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") f->shared->fs_version = fsinfo.version; - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0) diff --git a/src/H5MF.c b/src/H5MF.c index 14be37a..c100637 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -163,7 +163,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) * can merge with the metadata or small 'raw' data aggregator */ all_same = TRUE; - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) /* Check for any different type mappings */ if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_DEFAULT]) { all_same = FALSE; @@ -187,7 +187,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) /* One or more allocation type don't map to the same free list type */ /* Check if all the metadata allocation types map to the same type */ all_metadata_same = TRUE; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) /* Skip checking raw data free list mapping */ /* (global heap is treated as raw data) */ if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { @@ -1686,7 +1686,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers and * get each free list's space */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; @@ -1708,7 +1708,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers and * get each free list's space */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; @@ -1807,9 +1807,9 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * * In passing, verify that all the free space managers are closed. */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) fsinfo.fs_addr[type-1] = f->shared->fs_addr[type]; fsinfo.strategy = f->shared->fs_strategy; fsinfo.persist = f->shared->fs_persist; @@ -1824,7 +1824,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") /* Close the free space managers */ - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) @@ -1877,7 +1877,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(H5F_NULL_FSM_ADDR(f) || final_eoa == f->shared->eoa_fsm_fsalloc); } /* end if */ else { /* super_vers can be 0, 1, 2 */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if(H5MF__close_delete_fstype(f, (H5F_mem_page_t)type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") } /* end else */ @@ -1958,7 +1958,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; fsinfo.version = f->shared->fs_version; - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; if(f->shared->fs_persist) { @@ -1980,7 +1980,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * file space for the self referential free space managers. Other * data was gathered above. */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype-1] = f->shared->fs_addr[ptype]; fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_fsm_fsalloc; @@ -1990,7 +1990,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Close the free space managers */ /* use H5MF__close_fstype() for this? */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) @@ -2052,7 +2052,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers * and get each free list's space */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) if(H5MF__close_delete_fstype(f, ptype) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") @@ -2125,7 +2125,7 @@ H5MF__close_shrink_eoa(H5F_t *f) if(H5F_PAGED_AGGR(f)) { /* Check the last section of each free-space manager */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) @@ -2149,7 +2149,7 @@ H5MF__close_shrink_eoa(H5F_t *f) } /* end if */ else { /* Check the last section of each free-space manager */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) @@ -2245,7 +2245,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) end_type = (H5F_mem_page_t)H5FD_MEM_NTYPES; } /* end else */ - for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, tt)) + for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; tt++) if(HADDR_UNDEF == (fs_eoa[tt] = H5F_get_eoa(f, tt))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") @@ -2260,7 +2260,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end if */ /* Iterate over all the free space types that have managers and get each free list's space */ - for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { + for(type = start_type; type < end_type; type++) { fs_started[type] = FALSE; /* Check if the free space for the file has been initialized */ @@ -2300,7 +2300,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end for */ /* Close the free-space managers if they were opened earlier in this routine */ - for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { + for(type = start_type; type < end_type; type++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; @@ -2387,7 +2387,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(H5F_PAGED_AGGR(f)) /* set to the corresponding LARGE free-space manager */ end_type = (H5F_mem_page_t)(end_type + H5FD_MEM_NTYPES); else - H5_INC_ENUM(H5F_mem_page_t, end_type); + end_type++; } /* end else */ /* Set up user data for section iteration */ @@ -2403,7 +2403,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t curr_ring = H5AC_RING_RDFSM; /* Iterate over memory types, retrieving the number of sections of each type */ - for(ty = start_type; ty < end_type; H5_INC_ENUM(H5F_mem_page_t, ty)) { + for(ty = start_type; ty < end_type; ty++) { hbool_t fs_started = FALSE; /* The free-space manager is opened or not */ size_t nums = 0; /* The number of free-space sections */ @@ -2733,7 +2733,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) else /* no need for a second pass */ break; - for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { + for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) { H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ @@ -2834,7 +2834,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * those addresses are unknown. This is OK -- we will write the correct * values to the message at free space manager shutdown. */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) fsinfo.fs_addr[fsm_type - 1] = HADDR_UNDEF; fsinfo.strategy = f->shared->fs_strategy; fsinfo.persist = f->shared->fs_persist; @@ -2867,7 +2867,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ /* Reinitialize fsm_visited */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) fsm_visited[fsm_type] = FALSE; for(pass_count = 0; pass_count <= 1; pass_count++) { @@ -2878,7 +2878,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) else /* no need for a second pass */ break; - for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { + for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) { H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ @@ -2975,7 +2975,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) } /* end for */ /* verify that all opened FSMs were closed */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) HDassert(!fsm_opened[fsm_type]); /* Indicate that the FSM was settled successfully */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index e11476b..7bb77e8 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -169,7 +169,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth HDassert(indent >= 0); HDassert(fwidth >= 0); - for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, type)) + for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; type++) if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) { if(!f->shared->fs_man[type]) if(H5MF__open_fstype(f, type) < 0) @@ -243,7 +243,7 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); if(H5F_PAGED_AGGR(f)) { /* File space paging */ H5F_mem_page_t ptype; /* Memory type for iteration -- page fs */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Print header for type */ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype); @@ -289,7 +289,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ - for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, atype)) { + for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; atype++) { /* Print header for type */ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype); diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index e5e6741..7e48b9e 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -112,7 +112,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF; /* Version of message */ @@ -141,7 +141,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, fsinfo->threshold = threshold; if(HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)) ) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size") - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1])); break; @@ -181,7 +181,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Decode addresses of free space managers, if persisting */ if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1])); } /* end if */ @@ -235,7 +235,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c /* Store addresses of free-space managers, if persisting */ if(fsinfo->persist) { /* Addresses of free-space managers */ - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]); } /* end if */ @@ -480,7 +480,7 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Free space manager address:", fsinfo->fs_addr[ptype-1]); } /* end if */ diff --git a/src/H5private.h b/src/H5private.h index 2b35bd4..c39c946 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -521,13 +521,6 @@ # define H5_POSIX_CREATE_MODE_RW 0666 #endif -/* - * A macro to portably increment enumerated types. - */ -#ifndef H5_INC_ENUM -# define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) -#endif - /* Represents an empty asynchronous request handle. * Used in the VOL code. */ diff --git a/src/hdf5-lin.lnt b/src/hdf5-lin.lnt index da20937..23ceed2 100644 --- a/src/hdf5-lin.lnt +++ b/src/hdf5-lin.lnt @@ -13,9 +13,6 @@ // Turn off warnings about not using the return value from these functions: -emacro(534,HDfflush,HDgetrusage,HDgettimeofday,HDputc) -// Turn off warnings about converting an enum to an int --emacro(641,H5_INC_ENUM,H5_DEC_ENUM) - // Suppress message about "Expression with side effects passed to repeated parameter 1 in macro 'assert'" -esym(666,assert) diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 642698a..995e3f6 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -30,11 +30,6 @@ -esym(534, H5UC_decr) -esym(534, H5VM_array_fill) - -// Turn off warnings about "Expression-like macro not parenthesized" for -// enumerated type increment & decrement macros: --esym(773, H5_INC_ENUM, H5_DEC_ENUM) - /* So far, the following files have been linted with these options: H5.c H5A.c @@ -60,7 +55,7 @@ H5FO.c H5Tcommit.c - H5Tcompound.c + H5Tcompound.c H5Tcset.c H5Tenum.c diff --git a/test/dsets.c b/test/dsets.c index eaa469f..d017ff3 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -834,8 +834,8 @@ test_compact_io(hid_t fapl) skipping invalid combinations. - Create a file, create and write a compact dataset, and verify its data - Verify the dataset's layout and fill message versions */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds */ H5E_BEGIN_TRY { @@ -8419,7 +8419,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { unsigned ndims; /* Current # of dims to test */ /* Loop over dataspace ranks to test */ @@ -8719,7 +8719,7 @@ test_reopen_chunk_fast(hid_t fapl) h5_fixname(FILENAME[10], fapl, filename, sizeof filename); /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -8850,7 +8850,7 @@ test_chunk_fast_bug1(hid_t fapl) if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9028,7 +9028,7 @@ test_chunk_expand(hid_t fapl) if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9485,7 +9485,7 @@ test_fixed_array(hid_t fapl) #endif /* H5_HAVE_FILTER_DEFLATE */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9894,7 +9894,7 @@ test_single_chunk(hid_t fapl) #endif /* H5_HAVE_FILTER_DEFLATE */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -10424,8 +10424,8 @@ test_zero_dim_dset(hid_t fapl) /* Loop through all the combinations of low/high library format bounds, skipping invalid combination, and verify support for reading a 1D chunked dataset with dimension size = 0 */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds before opening the file */ H5E_BEGIN_TRY { @@ -13053,8 +13053,8 @@ test_versionbounds(void) /* Create a source file and a dataset in it. Create a virtual file and virtual dataset. Creation of virtual dataset should only succeed in H5F_LIBVER_V110 */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds, skip for invalid low/high combination */ H5E_BEGIN_TRY { diff --git a/test/dtypes.c b/test/dtypes.c index 689336f..791e8e8 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6858,8 +6858,8 @@ test_delete_obj_named(hid_t fapl) /* Loop through all valid the combinations of low/high library format bounds, to test delete objects that use named datatypes through different file IDs */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Skip invalid low/high combination */ if ((high == H5F_LIBVER_EARLIEST) || (low > high)) @@ -6959,8 +6959,8 @@ test_delete_obj_named_fileid(hid_t fapl) h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2); /* Loop through all the combinations of low/high library format bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Skip invalid low/high combination */ if ((high == H5F_LIBVER_EARLIEST) || (low > high)) diff --git a/test/earray.c b/test/earray.c index 71dd8b5..3c0212d 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2471,7 +2471,7 @@ main(void) init_cparam(&cparam); /* Iterate over the testing parameters */ - for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; H5_INC_ENUM(earray_test_type_t, curr_test)) { + for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) { /* Initialize the testing parameters */ init_tparam(&tparam, &cparam); @@ -2503,7 +2503,7 @@ main(void) nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) { + for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) { hsize_t sblk; /* Super block index */ hsize_t dblk; /* Data block index */ hsize_t nelmts; /* # of elements to test */ diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index fa0a15e..54f3fb0 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -187,8 +187,8 @@ main(void) -1 }; /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { char msg[80]; /* Message for file version bounds */ const char *low_string; /* The low bound string */ const char *high_string; /* The high bound string */ diff --git a/test/farray.c b/test/farray.c index c9584b8..d6610f2 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1687,7 +1687,7 @@ main(void) } /* Iterate over the testing parameters */ - for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; H5_INC_ENUM(farray_test_type_t, curr_test)) { + for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) { /* Initialize the testing parameters */ HDmemset(&tparam, 0, sizeof(tparam)); @@ -1723,7 +1723,7 @@ main(void) nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; H5_INC_ENUM(farray_iter_type_t, curr_iter)) { + for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) { /* Set appropriate parameters for each type of iteration */ switch(curr_iter) { diff --git a/test/fheap.c b/test/fheap.c index ef47d94..2cd2be3 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16458,7 +16458,7 @@ main(void) } /* Iterate over the testing parameters */ - for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) { + for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) { /* Clear the testing parameters */ HDmemset(&tparam, 0, sizeof(fheap_test_param_t)); tparam.actual_id_len = HEAP_ID_LEN; @@ -16500,7 +16500,7 @@ main(void) fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */ /* Filling with different sized objects */ - for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) { + for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) { tparam.fill = fill; /* Set appropriate testing parameters for each test */ @@ -16593,9 +16593,9 @@ main(void) fheap_test_del_drain_t drain_half; /* Deletion draining */ /* More complex removal patterns */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { tparam.del_dir = del_dir; - for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) { + for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; drain_half++) { tparam.drain_half = drain_half; /* Don't need to test deletion directions when deleting entire heap */ if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL) @@ -16703,7 +16703,7 @@ main(void) } /* end switch */ /* Try several different methods of deleting objects */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { tparam.del_dir = del_dir; /* Test 'huge' object insert & delete */ @@ -16731,7 +16731,7 @@ main(void) { fheap_test_del_dir_t del_dir; /* Deletion direction */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { tparam.del_dir = del_dir; /* Controlled tests */ diff --git a/test/gen_filespace.c b/test/gen_filespace.c index 4397836..f4a4f3f 100644 --- a/test/gen_filespace.c +++ b/test/gen_filespace.c @@ -29,7 +29,6 @@ const char *FILENAMES[] = { #define NUM_ELMTS 100 #define FALSE 0 #define TRUE 1 -#define INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) /* * Compile and run this program in the trunk to generate @@ -58,7 +57,7 @@ int main(void) unsigned fs_persist; /* Persisting free-space or not */ j = 0; - for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) { + for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) { for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) { if(fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR) diff --git a/test/h5test.c b/test/h5test.c index c8f4132..67c73f1 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -237,7 +237,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl) HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); HDremove(sub_filename); } @@ -990,7 +990,7 @@ h5_get_vfd_fapl(hid_t fapl) HDmemset(memb_addr, 0, sizeof(memb_addr)); HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl[mt] = H5P_DEFAULT; sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN); HDassert(sv[mt]); @@ -1002,7 +1002,7 @@ h5_get_vfd_fapl(hid_t fapl) if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) goto error; - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) HDfree(sv[mt]); } else if(!HDstrcmp(tok, "family")) { /* Family of files, each 1MB and using the default driver */ @@ -1398,7 +1398,7 @@ h5_get_file_size(const char *filename, hid_t fapl) h5_stat_size_t tot_size = 0; HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { /* Create the filename to query */ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); diff --git a/test/links.c b/test/links.c index 916ad88..5774f97 100644 --- a/test/links.c +++ b/test/links.c @@ -3310,7 +3310,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(memb_addr, 0, sizeof memb_addr); HDmemset(sv, 0, sizeof sv); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_map[mt] = H5FD_MEM_SUPER; memb_fapl[mt] = H5P_DEFAULT; } /* end for */ @@ -10912,9 +10912,9 @@ delete_by_idx(hid_t fapl) herr_t ret; /* Generic return value */ /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -11224,7 +11224,7 @@ delete_by_idx_old(hid_t fapl) herr_t ret; /* Generic return value */ /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { /* Print test banner */ if(order == H5_ITER_INC) TESTING("deleting links by index in increasing order in old-style group") @@ -11721,9 +11721,9 @@ link_iterate(hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -12147,7 +12147,7 @@ link_iterate_old(hid_t fapl) iter_info.visited = visited; /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("iterating over links by name index in increasing order in old-style group") @@ -12368,9 +12368,9 @@ open_by_idx(hid_t fapl) if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -12576,7 +12576,7 @@ open_by_idx_old(hid_t fapl) if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("open object by name index in increasing order in old-style group") @@ -12786,9 +12786,9 @@ object_info(hid_t fapl) if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -13018,7 +13018,8 @@ object_info_old(hid_t fapl) if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) { + /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("query object info by name index in increasing order in old-style group") @@ -13165,9 +13166,9 @@ group_info(hid_t fapl) if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -13557,7 +13558,7 @@ group_info_old(hid_t fapl) unsigned u, v; /* Local index variables */ /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { if(order == H5_ITER_INC) { TESTING("query group info by name index in increasing order in old-style group") } /* end if */ diff --git a/test/mf.c b/test/mf.c index ca2defe..3c33163 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6005,7 +6005,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Populate memb_fapl_arr, patch memb_addr so member file addresses * are aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl_arr[mt] = memb_fapl; memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align; } /* end for */ @@ -6015,7 +6015,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); } /* end else */ @@ -6378,7 +6378,7 @@ error: HDmemset(memb_name, 0, sizeof memb_name); \ HDmemset(memb_addr, 0, sizeof memb_addr); \ HDmemset(sv, 0, sizeof sv); \ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \ + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { \ memb_map[mt] = H5FD_MEM_SUPER; \ memb_fapl[mt] = H5P_DEFAULT; \ } \ @@ -7128,7 +7128,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) { /* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */ - for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) { + for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) { if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE)) continue; @@ -7296,7 +7296,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format /* Test with TRUE or FALSE for persisting free-space */ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) { /* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */ - for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) { + for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) { /* Skip for multi/split driver: persisting free-space or paged aggregation strategy */ if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE)) @@ -7551,7 +7551,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; } else { /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize; } /* end else */ @@ -7560,7 +7560,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); return 0; @@ -8616,7 +8616,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Populate memb_fapl_arr */ /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl_arr[mt] = memb_fapl; memb_addr[mt] = ((memb_addr[mt] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096; } @@ -8628,7 +8628,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) } /* end else */ /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); /* Close memb_fapl */ @@ -8875,7 +8875,7 @@ main(void) nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); /* For old library format--tests for alignment */ - for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) { + for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { switch(curr_test) { case TEST_NORMAL: /* set alignment = 1024 */ diff --git a/test/objcopy.c b/test/objcopy.c index 083d9af..751fe72 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2187,8 +2187,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) /* Loop through all the combinations of low/high library format bounds, skipping invalid combinations. Create a destination file and copy the source dataset to it, then verify */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds */ H5E_BEGIN_TRY { diff --git a/test/ohdr.c b/test/ohdr.c index 13bac9e..9d2d414 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1624,8 +1624,8 @@ main(void) api_ctx_pushed = TRUE; /* Loop through all the combinations of low/high library format bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { const char *low_string; /* Message for library version low bound */ const char *high_string; /* Message for library version high bound */ char msg[80]; /* Message for file format version */ diff --git a/test/page_buffer.c b/test/page_buffer.c index e11a6d6..5313c9b 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -336,7 +336,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; } else { /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize; } /* end else */ @@ -345,7 +345,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); } /* end if */ diff --git a/test/set_extent.c b/test/set_extent.c index 78d2b0b..17d439e 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -358,7 +358,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) /* Iterate over different index types, but only if using the new format */ - for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) { + for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; index_type++) { /* Standard test */ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4") @@ -433,8 +433,8 @@ static int do_layouts( hid_t fapl ) TESTING("storage layout use - tested with all low/high library format bounds"); /* Loop through all the combinations of low/high library format bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Copy plist to use locally to avoid modifying the original */ new_fapl = H5Pcopy(fapl); diff --git a/test/tattr.c b/test/tattr.c index 7c2b5ce..b89ec3f 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -6272,9 +6272,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -7226,9 +7226,9 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -7586,9 +7586,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ diff --git a/test/tfile.c b/test/tfile.c index 4fb2bc9..7da8b85 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4083,7 +4083,7 @@ test_filespace_info(const char *env_h5_drvr) for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) { /* Test with 4 file space strategies */ - for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; H5_INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) { + for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) { if(!contig_addr_vfd && (fs_strategy == H5F_FSPACE_STRATEGY_PAGE || fs_persist)) continue; @@ -4231,7 +4231,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; } else { /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize; } /* end else */ @@ -4240,7 +4240,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); return 0; @@ -4607,7 +4607,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) if(multi_vfd) { hssize_t ntmp; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { if(type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP) continue; /* Get the # of free-space sections in the file for metadata */ @@ -5348,7 +5348,7 @@ test_libver_bounds_open(void) /* Opening VERBFNAME in these combination should succeed. For each low bound, verify that it is upgraded properly */ high = H5F_LIBVER_LATEST; - for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) + for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { H5F_libver_t new_low = H5F_LIBVER_EARLIEST; @@ -5515,8 +5515,8 @@ test_libver_bounds_low_high(void) CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { /* Set the low/high version bounds */ @@ -5919,8 +5919,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non CHECK(new_fapl, FAIL, "H5Pcreate"); /* Loop through all the combinations of low/high bounds in new_fapl */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } H5E_END_TRY; @@ -6095,8 +6095,8 @@ test_libver_bounds_obj(hid_t fapl) /* Loop through all the combinations of low/high bounds in new_fapl */ /* Open the file with the fapl; create a group and verify the object header version, then delete the group and close the file.*/ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } H5E_END_TRY; @@ -6306,8 +6306,8 @@ test_libver_bounds_dataset(hid_t fapl) /* Loop through all the combinations of low/high bounds in new_fapl */ /* Open the file with the fapl and create the chunked dataset */ /* Verify the dataset's layout, fill value and filter pipleline message versions */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } H5E_END_TRY; @@ -6519,8 +6519,8 @@ test_libver_bounds_dataspace(hid_t fapl) /* Loop through all the combinations of low/high bounds in new_fapl */ /* Open the file and create the chunked/compact/contiguous datasets */ /* Verify the dataspace message version for the three datasets */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */ H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */ @@ -6844,8 +6844,8 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Open the file and create the chunked dataset with the input tid */ /* Verify the dataset's datatype message version */ /* Also verify the committed atatype message version */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } H5E_END_TRY; @@ -7165,8 +7165,8 @@ test_libver_bounds_attributes(hid_t fapl) /* Loop through all the combinations of low/high bounds */ /* Open the file and group and attach an attribute to the group */ /* Verify the attribute version */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } H5E_END_TRY; diff --git a/test/th5o.c b/test/th5o.c index 93a12e8..354245f 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -806,8 +806,8 @@ test_h5o_link(void) CHECK(fapl_id, FAIL, "H5Pcreate"); /* Loop through all the combinations of low/high library format bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Set version bounds */ H5E_BEGIN_TRY { diff --git a/test/th5s.c b/test/th5s.c index 1a4456a..747e741 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -591,7 +591,7 @@ test_h5s_zero_dim(void) wdata_real[i][j][k] = (int)(i + j + k); /* Test with different space allocation times */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Make sure we can create the space with the dimension size 0 (starting from v1.8.7). * The dimension doesn't need to be unlimited. */ @@ -3366,8 +3366,8 @@ test_h5s(void) test_h5s_zero_dim(); /* Test dataspace with zero dimension size */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/trefer.c b/test/trefer.c index 9fc6563..7791ca1 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -2807,8 +2807,8 @@ test_reference(void) test_reference_obj(); /* Test basic H5R object reference code */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 949f41b..194f27e 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -1781,8 +1781,8 @@ test_reference_deprec(void) test_reference_obj(); /* Test basic H5R object reference code */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/tvltypes.c b/test/tvltypes.c index 656bf92..acfd0a2 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2543,7 +2543,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fcreate"); /* Create datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2659,7 +2659,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Read empty datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2860,7 +2860,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Write one element & fill values to datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ diff --git a/test/vds.c b/test/vds.c index c98bc12..f724e67 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12165,8 +12165,8 @@ main(void) if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { char msg[80]; /* Message for file version bounds */ const char *low_string; /* The low bound string */ const char *high_string; /* The high bound string */ diff --git a/test/vds_env.c b/test/vds_env.c index 19b2d96..3d5b5dd 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -312,8 +312,8 @@ main(void) if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { char msg[80]; /* Message for file version bounds */ const char *low_string; /* The low bound string */ const char *high_string; /* The high bound string */ diff --git a/test/vfd.c b/test/vfd.c index 1de7fd5..4fc61da 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1351,7 +1351,7 @@ test_multi(void) HDmemset(memb_addr, 0, sizeof(memb_addr)); HDmemset(sv, 0, sizeof(sv)); - for(mt=H5FD_MEM_DEFAULT; mt Date: Wed, 13 Nov 2019 13:29:59 -0600 Subject: 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. An interesting side-effect that we probably should *not* rely on is that the struct-encapsulation changes the alignment so that some GCC warnings about casts that increase the alignment requirement of the operand go away. Warnings like that have to be taken seriously: I will add -Werror=cast-align to the default compiler flags so that they stop the build quickly. GCC warnings led me to some surprising casts in test/trefer.c. I found that it was possible to make many simplifications after introducing the struct-encapsulation that I described, above. In test objcopy_ref `same_file` is assigned but never used. Delete it. --- src/H5Rpublic.h | 8 +- test/objcopy_ref.c | 8 -- test/trefer.c | 271 ++++++++++++++++++++++++++------------------------- test/trefer_deprec.c | 2 +- 4 files changed, 145 insertions(+), 144 deletions(-) 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/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..e5039bf 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() */ /**************************************************************** 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 */ -- cgit v0.12 From 7b03a1c03633d695b487642e54f897c715f8622e Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Thu, 5 Dec 2019 12:10:12 -0600 Subject: Fix H5VL_token_t type and fix H5VL_loc_by_token to use H5VL_token_t * --- src/H5O.c | 4 ++-- src/H5Ocopy_ref.c | 8 ++++---- src/H5R.c | 16 ++++++++-------- src/H5Rdeprec.c | 12 ++++++------ src/H5Rint.c | 20 ++++++++++---------- src/H5VLconnector.h | 6 ++++-- src/H5VLnative_object.c | 2 +- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index 7e5694a..3938413 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -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") diff --git a/src/H5R.c b/src/H5R.c index 70d4749..2c4c713 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -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/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); -- cgit v0.12 From 9cb77297301e14389e8f4e445f3b91f98d697947 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 5 Dec 2019 14:56:57 -0600 Subject: Add H5VL_MAP_OPTIONAL operation id (unused currently). --- src/H5Mpublic.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 /*******************/ -- cgit v0.12 From 1e10b3212ed5904b69d9f4c4bcb4d0122dfd7c77 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 5 Dec 2019 15:09:23 -0600 Subject: Two fixes: (1) Set the version for reference datatype messge to H5O_DTYPE_VERSION_4. (2) Verify the decoded version for hyperslab selection. --- src/H5Shyper.c | 3 +++ src/H5Spkg.h | 7 ++++--- src/H5T.c | 1 + test/trefer.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) 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 diff --git a/src/H5T.c b/src/H5T.c index 9263158..f378357 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -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/test/trefer.c b/test/trefer.c index 7791ca1..a27dbc5 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -2811,7 +2811,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 */ -- cgit v0.12 From 12ac0587e7b9b18a56907aa78f68c084dd5b51b4 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Tue, 3 Dec 2019 17:27:17 -0600 Subject: Implement support for using H5Dvlen_get_buf_size with non-native VOL connectors. --- src/H5D.c | 31 ++++++++++++++++++++++++------- src/H5Dint.c | 2 +- src/H5Dpkg.h | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index a2e6f0a..7c68127 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -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; -- cgit v0.12