summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-11-01 18:39:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-11-01 18:39:20 (GMT)
commitba751a6a4c23bd0c53625e53f67562f5b4af00b4 (patch)
tree2afd6751bcb6e7eca02611463e16b05e3626287b
parent23457df13df32e1db53b3ce36abd2ef7ad6d0494 (diff)
downloadhdf5-ba751a6a4c23bd0c53625e53f67562f5b4af00b4.zip
hdf5-ba751a6a4c23bd0c53625e53f67562f5b4af00b4.tar.gz
hdf5-ba751a6a4c23bd0c53625e53f67562f5b4af00b4.tar.bz2
[svn-r6047] Purpose:
Bug fix & code cleanup Description: Hyperslab code for collapsing dimensions was incorrectly collapsing selections inappropriately when the fastest changing dimension couldn't be collapsed. Also add some more assertions which will make similar bugs easier to find. Solution: Break out of loop earlier. Platforms tested: modi4 (parallel), too small to triple check.
-rw-r--r--src/H5Dseq.c2
-rw-r--r--src/H5FL.c6
-rw-r--r--src/H5Fseq.c2
-rw-r--r--src/H5Shyper.c2
-rw-r--r--src/H5Smpio.c2
-rw-r--r--src/H5Sselect.c11
6 files changed, 24 insertions, 1 deletions
diff --git a/src/H5Dseq.c b/src/H5Dseq.c
index 105d5da..6176003 100644
--- a/src/H5Dseq.c
+++ b/src/H5Dseq.c
@@ -71,6 +71,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
assert(f);
assert(layout);
assert(buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
if (H5F_seq_readv(f, dxpl_id, layout, dc_plist, file_space, elmt_size, 1, &seq_len, &dset_offset, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read failed");
@@ -115,6 +116,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout,
assert(f);
assert(layout);
assert(buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
if (H5F_seq_writev(f, dxpl_id, layout, dc_plist, file_space, elmt_size, 1, &seq_len, &dset_offset, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed");
diff --git a/src/H5FL.c b/src/H5FL.c
index 7e002ad..917821c 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -1176,6 +1176,9 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, size_t elem, unsigned clear)
/* Check if there is a maximum number of elements in array */
if(head->maxelem>0) {
+ /* Sanity check that the number of elements is supported */
+ assert((int)elem<=head->maxelem);
+
/* Check for nodes available on the free list first */
if(head->u.list_arr[elem]!=NULL) {
/* Get a pointer to the block on the free list */
@@ -1260,6 +1263,9 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem)
else {
/* Check if there is a maximum number of elements in array */
if(head->maxelem>0) {
+ /* Sanity check that the number of elements is supported */
+ assert((int)new_elem<=head->maxelem);
+
/* Get the pointer to the info header in front of the block to free */
temp=(H5FL_arr_node_t *)((unsigned char *)obj-sizeof(H5FL_arr_node_t));
diff --git a/src/H5Fseq.c b/src/H5Fseq.c
index 105d5da..6176003 100644
--- a/src/H5Fseq.c
+++ b/src/H5Fseq.c
@@ -71,6 +71,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
assert(f);
assert(layout);
assert(buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
if (H5F_seq_readv(f, dxpl_id, layout, dc_plist, file_space, elmt_size, 1, &seq_len, &dset_offset, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read failed");
@@ -115,6 +116,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout,
assert(f);
assert(layout);
assert(buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
if (H5F_seq_writev(f, dxpl_id, layout, dc_plist, file_space, elmt_size, 1, &seq_len, &dset_offset, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed");
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index ad5c53a..3eec64e 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -146,6 +146,8 @@ H5S_hyper_iter_init (const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *sel_i
for(u=space->extent.u.simple.rank-1; u>0; u--) {
if(tdiminfo[u].count==1 && tdiminfo[u].block==mem_size[u])
cont_dim=u;
+ else
+ break;
} /* end for */
/* Check if the regular selection can be "flattened" */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index e72a953..c4996a4 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -1033,7 +1033,7 @@ H5S_mpio_opt_possible( const H5S_t *mem_space, const H5S_t *file_space, const un
htri_t c1,c2; /* Flags whether a selection is optimizable */
htri_t ret_value=TRUE;
- FUNC_ENTER_NOAPI(H5S_all_opt_possible, FAIL);
+ FUNC_ENTER_NOAPI(H5S_mpio_opt_possible, FAIL);
/* Check args */
assert(mem_space);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index fca9132..0fb429e 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -803,6 +803,7 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout,
assert (iter);
assert (nelmts>0);
assert (_buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
/* Get the hyperslab vector size */
if(NULL == (dx_plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
@@ -1165,6 +1166,11 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, H5P_genplist_t *dc_plist,
FUNC_ENTER_NOAPI(H5S_select_read, FAIL);
+ /* Check args */
+ assert(f);
+ assert(_buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+
/* Get the hyperslab vector size */
if(NULL == (dx_plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
@@ -1395,6 +1401,11 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, H5P_genplist_t *dc_plist,
FUNC_ENTER_NOAPI(H5S_select_write, FAIL);
+ /* Check args */
+ assert(f);
+ assert(_buf);
+ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+
/* Get the hyperslab vector size */
if(NULL == (dx_plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");