summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-06-07 20:37:38 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-06-07 20:37:38 (GMT)
commitc7626f79fdee4eee13925e240ef41e61f3367eab (patch)
tree025a87173aa7eceef2bbf9967c292e15579d9a13
parentde9491e3651350969b2a75c602984a3786656dcb (diff)
parentaa338c3a87a4544ccb164832422e3e2462a57b88 (diff)
downloadhdf5-c7626f79fdee4eee13925e240ef41e61f3367eab.zip
hdf5-c7626f79fdee4eee13925e240ef41e61f3367eab.tar.gz
hdf5-c7626f79fdee4eee13925e240ef41e61f3367eab.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'aa338c3a87a4544ccb164832422e3e2462a57b88': Detect when there's the same-shaped selection of a single block of elements on both selections, but with different selection types (i.e. one selection defined as an 'all' type and the other as a hyperslab or point type), without falling into the generic selection iteration case. Normalization of H5T.c with 1.10. Normalization of H5D.c with 1.10.
-rw-r--r--src/H5D.c21
-rw-r--r--src/H5Sselect.c9
-rw-r--r--src/H5T.c48
-rw-r--r--test/tselect.c14
4 files changed, 50 insertions, 42 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 37b3b39..3428d77 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -150,9 +150,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
- /* Get an atom for the dataset */
+ /* Get an ID for the dataset */
if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if(H5I_INVALID_HID == ret_value)
@@ -315,7 +315,7 @@ done:
* it. It is illegal to subsequently use that same dataset
* ID in calls to other dataset functions.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -382,7 +382,7 @@ done:
*
* Purpose: Returns the status of dataspace allocation.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -719,8 +719,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
- hsize_t *size)
+H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size)
{
H5VL_object_t *vol_obj; /* Dataset for this operation */
hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */
@@ -765,7 +764,7 @@ done:
* Purpose: Modifies the dimensions of a dataset.
* Can change to a smaller dimension.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -802,7 +801,7 @@ done:
*
* Purpose: Flushes all buffers associated with a dataset.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -840,7 +839,7 @@ done:
*
* Purpose: Refreshes all buffers associated with a dataset.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -880,7 +879,7 @@ done:
* For virtual:
* No conversion
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Vailin Choi
* Feb 2015
@@ -957,7 +956,7 @@ done:
* Intended for use with the H5D(O)read_chunk API call so
* the caller can construct an appropriate buffer.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Matthew Strong (GE Healthcare)
* 20 October 2016
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 56f14ba..1072d7d 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -1885,6 +1885,15 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_a_dim--;
} /* end while */
+
+ /* Check for a single block in each selection */
+ if(H5S_SELECT_IS_SINGLE(space_a) && H5S_SELECT_IS_SINGLE(space_b)) {
+ /* If both selections are a single block and their bounds are
+ * the same, then the selections are the same, even if the
+ * selection types are different.
+ */
+ HGOTO_DONE(TRUE)
+ } /* end if */
} /* end if */
/* If the dataspaces have the same selection type, use the selection's
diff --git a/src/H5T.c b/src/H5T.c
index 5d3c4a1..47c4e4e 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1755,15 +1755,16 @@ H5Tcopy(hid_t obj_id)
switch(H5I_get_type(obj_id)) {
case H5I_DATATYPE:
+ /* The argument is a datatype handle */
if(NULL == (dt = (H5T_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a datatype ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj_id is not a datatype ID")
break;
case H5I_DATASET:
{
H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- /* Check args */
+ /* The argument is a dataset handle */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID")
@@ -1776,9 +1777,8 @@ H5Tcopy(hid_t obj_id)
/* Unwrap the type ID */
if(NULL == (dt = (H5T_t *)H5I_object(dset_tid)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "received invalid datatype from the dataset")
-
- break;
}
+ break;
case H5I_UNINIT:
case H5I_BADID:
@@ -1802,7 +1802,7 @@ H5Tcopy(hid_t obj_id)
/* Copy datatype */
if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy");
/* Get an ID for the copied datatype */
if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0)
@@ -2345,9 +2345,9 @@ H5T_get_super(const H5T_t *dt)
HDassert(dt);
if(!dt->shared->parent)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type");
if(NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3222,7 +3222,7 @@ H5T__create(H5T_class_t type, size_t size)
/* Copy the default string datatype */
if(NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
/* Modify the datatype */
if(H5T__set_size(dt, size) < 0)
@@ -4000,7 +4000,7 @@ H5T_close_real(H5T_t *dt)
/* Clean up resources, depending on shared state */
if(dt->shared->state != H5T_STATE_OPEN) {
if(H5T__free(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype");
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
} /* end if */
@@ -4094,7 +4094,7 @@ H5T_close(H5T_t *dt)
/* Clean up resources */
if(H5T_close_real(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4143,7 +4143,7 @@ H5T__set_size(H5T_t *dt, size_t size)
if(dt->shared->parent) {
if(H5T__set_size(dt->shared->parent, size) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type");
/* Adjust size of datatype appropriately */
if(dt->shared->type==H5T_ARRAY)
@@ -4185,7 +4185,7 @@ H5T__set_size(H5T_t *dt, size_t size)
size_t max_size;
if((num_membs = H5T_get_nmembers(dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members");
if(num_membs) {
for(i = 0; i < (unsigned)num_membs; i++) {
@@ -4199,7 +4199,7 @@ H5T__set_size(H5T_t *dt, size_t size)
max_size = H5T__get_member_size(dt, max_index);
if(size < (max_offset + max_size))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ");
} /* end if */
/* Compound must not have been packed previously */
@@ -4219,7 +4219,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Get a copy of unsigned char type as the base/parent type */
if(NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype");
dt->shared->parent=H5T_copy(base,H5T_COPY_ALL);
/* change this datatype into a VL string */
@@ -4245,7 +4245,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Set up VL information */
if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location");
} /* end if */
else {
prec = 8 * size;
@@ -4261,7 +4261,7 @@ H5T__set_size(H5T_t *dt, size_t size)
if(dt->shared->u.atomic.u.f.sign >= prec+offset ||
dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset ||
dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first");
}
break;
@@ -4401,7 +4401,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
for(u = 0; u < dt1->shared->u.compnd.nmembs; u++)
idx1[u] = idx2[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -4487,7 +4487,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
for(u=0; u<dt1->shared->u.enumer.nmembs; u++)
idx1[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -5661,7 +5661,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Range check against compound member's offset */
if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
/* Apply the accumulated size change to the offset of the field */
dt->shared->u.compnd.memb[i].offset += (size_t) accum_change;
@@ -5677,7 +5677,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Mark the VL, compound, enum or array type */
if((changed = H5T_set_loc(memb_type, file, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
if(changed > 0)
ret_value = changed;
@@ -5686,7 +5686,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Fail if the old_size is zero */
if (0 == old_size)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero");
/* Adjust the size of the member */
dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size;
@@ -5699,7 +5699,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Range check against datatype size */
if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
/* Apply the accumulated size change to the datatype */
dt->shared->size += (size_t) accum_change;
@@ -5711,14 +5711,14 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */
if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
if((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
if(changed > 0)
ret_value = changed;
} /* end if */
/* Mark this VL sequence */
if((changed = H5T__vlen_set_loc(dt, file, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
if(changed > 0)
ret_value = changed;
break;
diff --git a/test/tselect.c b/test/tselect.c
index 45806ae..aa0ab11 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -9388,15 +9388,15 @@ test_shape_same_dr__smoke_check_1(void)
** a "checker board" hyperslab as follows:
**
** * * - - * * - - * *
-** * * - - * * - - * *
-** - - * * - - * * - -
-** - - * * - - * * - -
** * * - - * * - - * *
-** * * - - * * - - * *
-** - - * * - - * * - -
-** - - * * - - * * - -
+** - - * * - - * * - -
+** - - * * - - * * - -
+** * * - - * * - - * *
+** * * - - * * - - * *
+** - - * * - - * * - -
+** - - * * - - * * - -
+** * * - - * * - - * *
** * * - - * * - - * *
-** * * - - * * - - * *
**
** where asterisks indicate selected elements, and dashes
** indicate unselected elements.