summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5B2int.c90
-rw-r--r--src/H5O.c69
-rw-r--r--src/H5Oattribute.c13
-rw-r--r--src/H5Ochunk.c9
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Shyper.c360
-rw-r--r--src/H5Sprivate.h1
7 files changed, 244 insertions, 300 deletions
diff --git a/src/H5B2int.c b/src/H5B2int.c
index a0c5366..f6602737f 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -80,10 +80,10 @@ static herr_t H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc);
#ifdef H5B2_DEBUG
-static herr_t H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf);
-static herr_t H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2);
-static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal);
-static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal, H5B2_internal_t *internal2);
+static herr_t H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf);
+static herr_t H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t *leaf2);
+static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal);
+static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2);
#endif /* H5B2_DEBUG */
/*********************/
@@ -178,7 +178,7 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child, *right_child; /* Pointers to child nodes */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native;/* Pointers to childs' native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
@@ -324,12 +324,12 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -509,12 +509,12 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -629,12 +629,12 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -672,8 +672,8 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- void *left_child, *right_child; /* Pointers to child nodes */
- void *middle_child; /* Pointers to middle child node */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ void *middle_child = NULL; /* Pointers to middle child node */
uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint16_t *middle_nrec; /* Pointers to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
@@ -1011,15 +1011,15 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, left_child, middle_child);
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, middle_child, left_child);
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, middle_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)middle_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, middle_child);
- H5B2_assert_leaf2(hdr, middle_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)middle_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -1058,7 +1058,7 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child, *right_child; /* Pointers to left & right child nodes */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
@@ -1171,9 +1171,9 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1)
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, left_child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child);
else
- H5B2_assert_leaf(hdr, left_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)left_child);
#endif /* H5B2_DEBUG */
done:
@@ -1212,8 +1212,8 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- void *left_child, *right_child; /* Pointers to left & right child nodes */
- void *middle_child; /* Pointer to middle child node */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
+ void *middle_child = NULL; /* Pointer to middle child node */
uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint16_t *middle_nrec; /* Pointer to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
@@ -1393,12 +1393,12 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, left_child, middle_child);
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, middle_child);
- H5B2_assert_leaf(hdr, middle_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)middle_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -1439,7 +1439,7 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t child_addr; /* Address of child node */
- void *child; /* Pointer to child node */
+ void *child = NULL; /* Pointer to child node */
uint8_t *child_native; /* Pointer to child's native records */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1494,9 +1494,9 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1)
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)child);
else
- H5B2_assert_leaf(hdr, child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)child);
#endif /* H5B2_DEBUG */
done:
@@ -3082,7 +3082,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf)
+H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
@@ -3105,13 +3105,13 @@ H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
+H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t UNUSED *leaf2)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
return(0);
-} /* end H5B2_assert_leaf() */
+} /* end H5B2_assert_leaf2() */
/*-------------------------------------------------------------------------
@@ -3128,10 +3128,10 @@ H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal)
+H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
- unsigned u, v; /* Local index variables */
+ uint16_t u, v; /* Local index variables */
/* General sanity checking on node */
HDassert(internal->nrec <= hdr->node_info->split_nrec);
@@ -3169,10 +3169,10 @@ H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal, H5B2_internal_t *internal2)
+H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
- unsigned u, v; /* Local index variables */
+ uint16_t u, v; /* Local index variables */
/* General sanity checking on node */
HDassert(internal->nrec <= hdr->node_info->split_nrec);
diff --git a/src/H5O.c b/src/H5O.c
index 473dc23..3b4d70a 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1052,17 +1052,29 @@ H5Oclose(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* Get the type of the object and close it in the correct way */
- switch(H5I_get_type(object_id))
- {
- case(H5I_GROUP):
- case(H5I_DATATYPE):
- case(H5I_DATASET):
+ switch(H5I_get_type(object_id)) {
+ case H5I_GROUP:
+ case H5I_DATATYPE:
+ case H5I_DATASET:
if(H5I_object(object_id) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
if(H5I_dec_ref(object_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
break;
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
break;
@@ -1228,7 +1240,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
oh->mesg[0].dirty = TRUE;
oh->mesg[0].native = NULL;
oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[0].raw_size = size_hint - H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].chunkno = 0;
/* Set metadata tag in dxpl_id */
@@ -1485,7 +1497,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
/* Adjust the link count for the object header */
- oh->nlink += adjust;
+ oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
@@ -1517,7 +1529,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
} /* end if */
/* Adjust the link count for the object header */
- oh->nlink += adjust;
+ oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
@@ -1674,6 +1686,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
* when the object header is actually loaded from the file.
*/
HDassert(udata.made_attempt == TRUE);
+ HDassert(cont_msg_info.msgs);
/* Construct the user data for protecting chunks */
chk_udata.decoding = TRUE;
@@ -1715,8 +1728,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
} /* end while */
/* Release any continuation messages built up */
- if(cont_msg_info.msgs)
- cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
+ cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
/* Pass back out some of the chunk's user data */
udata.common.merged_null_msgs = chk_udata.common.merged_null_msgs;
@@ -1990,7 +2002,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
break;
/* Create a new message, if necessary */
- if(idx == oh->nmesgs) {
+ if(idx == (int)oh->nmesgs) {
unsigned mesg_flags = 0; /* Flags for message in object header */
/* If we would have to create a new message, but we aren't 'forcing' it, get out now */
@@ -2426,23 +2438,35 @@ H5O_get_loc(hid_t object_id)
FUNC_ENTER_NOAPI_NOINIT(H5O_get_loc)
- switch(H5I_get_type(object_id))
- {
- case(H5I_GROUP):
+ switch(H5I_get_type(object_id)) {
+ case H5I_GROUP:
if(NULL == (ret_value = H5O_OBJ_GROUP->get_oloc(object_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID")
break;
- case(H5I_DATASET):
+ case H5I_DATASET:
if(NULL == (ret_value = H5O_OBJ_DATASET->get_oloc(object_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID")
break;
- case(H5I_DATATYPE):
+ case H5I_DATATYPE:
if(NULL == (ret_value = H5O_OBJ_DATATYPE->get_oloc(object_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID")
break;
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type")
} /* end switch */
@@ -2504,7 +2528,7 @@ H5O_loc_reset(H5O_loc_t *loc)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
+H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_loc_copy)
@@ -2524,8 +2548,7 @@ H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
if(src->holding_file)
dst->file->nopen_objs++;
} else if(depth == H5_COPY_SHALLOW) {
- /* Discarding 'const' qualifier OK - QAK */
- H5O_loc_reset((H5O_loc_t *)src);
+ H5O_loc_reset(src);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -2686,7 +2709,7 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
hdr->flags = oh->flags;
/* Iterate over all the messages, accumulating message size & type information */
- hdr->space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ hdr->space.meta = (hsize_t)H5O_SIZEOF_HDR(oh) + (hsize_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
hdr->space.mesg = 0;
hdr->space.free = 0;
hdr->mesg.present = 0;
@@ -2696,11 +2719,11 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
/* Accumulate space usage information, based on the type of message */
if(H5O_NULL_ID == curr_msg->type->id)
- hdr->space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ hdr->space.free += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
else if(H5O_CONT_ID == curr_msg->type->id)
- hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ hdr->space.meta += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
else {
- hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh);
+ hdr->space.meta += (hsize_t)H5O_SIZEOF_MSGHDR_OH(oh);
hdr->space.mesg += curr_msg->raw_size;
} /* end else */
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index dcb129d..f155c94 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -851,12 +851,17 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Because the attribute structure is shared now. The only situation that requires
* copying the data is when the metadata cache evicts and reloads this attribute.
- * The attribute structure will be different in that situation. SLU-2010/7/29 */
- if(((H5A_t *)mesg->native)->shared != udata->attr->shared)
+ * The shared attribute structure will be different in that situation. SLU-2010/7/29 */
+ if(((H5A_t *)mesg->native)->shared != udata->attr->shared) {
+ /* Sanity check */
+ HDassert(((H5A_t *)mesg->native)->shared->data);
+ HDassert(udata->attr->shared->data);
+ HDassert(((H5A_t *)mesg->native)->shared->data != udata->attr->shared->data);
+
/* (Needs to occur before updating the shared message, or the hash
* value on the old & new messages will be the same) */
- HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data,
- udata->attr->shared->data_size);
+ HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
+ } /* end if */
/* Mark the message as modified */
mesg->dirty = TRUE;
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index f867d04..42b391d 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -148,8 +148,8 @@ done:
H5O_chunk_proxy_t *
H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
{
- H5O_chunk_proxy_t *chk_proxy; /* Proxy for protected chunk */
- H5O_chunk_proxy_t *ret_value; /* Return value */
+ H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for protected chunk */
+ H5O_chunk_proxy_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5O_chunk_protect, dxpl_id, oh->cache_info.addr, NULL)
@@ -196,6 +196,11 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
ret_value = chk_proxy;
done:
+ /* Cleanup on error */
+ if(!ret_value)
+ if(0 == idx && chk_proxy)
+ chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
+
FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
} /* end H5O_chunk_protect() */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index c38ddea..cc06671 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -713,7 +713,7 @@ H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, in
/* These functions operate on object locations */
H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
-H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5O_loc_hold_file(H5O_loc_t *loc);
H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc);
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 937fc26..a4fe5a3 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -2711,43 +2711,43 @@ done:
herr_t
H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
- int rank; /* Dataspace rank */
- int i; /* index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned rank; /* Dataspace rank */
+ unsigned i; /* index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_hyper_bounds,FAIL)
+ FUNC_ENTER_NOAPI(H5S_hyper_bounds, FAIL)
- assert(space);
- assert(start);
- assert(end);
+ HDassert(space);
+ HDassert(start);
+ HDassert(end);
/* Set the start and end arrays up */
- rank=space->extent.rank;
- for(i=0; i<rank; i++) {
- start[i]=HSIZET_MAX;
- end[i]=0;
+ rank = space->extent.rank;
+ for(i = 0; i < rank; i++) {
+ start[i] = HSIZET_MAX;
+ end[i] = 0;
} /* end for */
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
+ const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
/* Check each dimension */
- for(i=0; i<rank; i++) {
+ for(i = 0; i < rank; i++) {
/* Check for offset moving selection negative */
- if((space->select.offset[i]+(hssize_t)diminfo[i].start)<0)
+ if((space->select.offset[i] + (hssize_t)diminfo[i].start) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Compute the smallest location in this dimension */
- start[i]=diminfo[i].start+space->select.offset[i];
+ start[i] = diminfo[i].start + space->select.offset[i];
/* Compute the largest location in this dimension */
- end[i]=diminfo[i].start+diminfo[i].stride*(diminfo[i].count-1)+(diminfo[i].block-1)+space->select.offset[i];
+ end[i] = diminfo[i].start + diminfo[i].stride * (diminfo[i].count - 1) + (diminfo[i].block - 1) + space->select.offset[i];
} /* end for */
} /* end if */
else {
/* Call the recursive routine to get the bounds for the span tree */
- ret_value=H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst,space->select.offset,(hsize_t)0,start,end);
+ ret_value = H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst, space->select.offset, (hsize_t)0, start, end);
} /* end if */
done:
@@ -2781,7 +2781,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
const hssize_t *sel_offset; /* Pointer to the selection's offset */
const hsize_t *dim_size; /* Pointer to a dataspace's extent */
hsize_t accum; /* Accumulator for dimension sizes */
- int rank; /* Dataspace rank */
+ unsigned rank; /* Dataspace rank */
int i; /* index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2804,7 +2804,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
/* Loop through starting coordinates, calculating the linear offset */
accum = 1;
- for(i = (rank - 1); i >= 0; i--) {
+ for(i = (int)(rank - 1); i >= 0; i--) {
hssize_t hyp_offset = (hssize_t)diminfo[i].start + sel_offset[i]; /* Hyperslab's offset in this dimension */
/* Check for offset moving selection out of the dataspace */
@@ -2824,7 +2824,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
/* Calculate the accumulator for each dimension */
accum = 1;
- for(i = (rank - 1); i >= 0; i--) {
+ for(i = (int)(rank - 1); i >= 0; i--) {
/* Set the accumulator for this dimension */
dim_accum[i] = accum;
@@ -4505,115 +4505,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_move_helper
- PURPOSE
- Helper routine to move offset in span trees
- USAGE
- herr_t H5S_hyper_move_helper(spans, offset)
- H5S_hyper_span_info_t *spans; IN: Span tree to operate with
- const hssize_t *offset; IN: Offset to move to
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Adjust the location of the spans in a span tree by moving selection to an
- offset.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_move_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
-{
- H5S_hyper_span_t *span; /* Pointer to current span in span tree */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_move_helper);
-
- /* Sanity check */
- assert(spans);
- assert(offset);
-
- /* Check if we've already set this down span tree */
- if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
- /* Set the tree's scratch pointer */
- spans->scratch=(H5S_hyper_span_info_t *)~((size_t)NULL);
-
- /* Get the span lists for each span in this tree */
- span=spans->head;
-
- /* Iterate over the spans in tree */
- while(span!=NULL) {
- /* Adjust span location */
- assert(*offset>=0);
- span->high=*offset+(span->high-span->low);
- span->low=*offset;
-
- /* Recursively move spans in next dimension down */
- if(span->down!=NULL)
- H5S_hyper_move_helper(span->down,offset+1);
-
- /* Advance to next span in this dimension */
- span=span->next;
- } /* end while */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5S_hyper_move_helper() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_move
- PURPOSE
- Move a hyperslab selection by to an offset
- USAGE
- herr_t H5S_hyper_move(space,offset)
- H5S_t *space; IN/OUT: Pointer to dataspace to move
- const hssize_t *offset; IN: Offset to move to
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Moves a hyperslab selection to a new offset.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_hyper_move(H5S_t *space, const hssize_t *offset)
-{
- unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_move);
-
- assert(space);
- assert(offset);
-
- /* Move to the offset with the "regular" coordinates, if they exist */
- if(space->select.sel_info.hslab->diminfo_valid) {
- for(u=0; u<space->extent.rank; u++) {
- assert(offset[u]>=0);
- space->select.sel_info.hslab->opt_diminfo[u].start=offset[u];
- } /* end for */
- } /* end if */
-
- /* Subtract the offset from the span tree coordinates, if they exist */
- if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_move_helper(space->select.sel_info.hslab->span_lst,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset movement");
-
- /* Reset the scratch pointers for the next routine which needs them */
- H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_hyper_move() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5S_hyper_normalize_offset
PURPOSE
"Normalize" a hyperslab selection by adjusting it's coordinates by the
@@ -5774,10 +5665,9 @@ static H5S_hyper_span_info_t *
H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
const hsize_t *count, const hsize_t *block)
{
- H5S_hyper_span_info_t *down; /* Pointer to spans in next dimension down */
- H5S_hyper_span_t *span; /* New hyperslab span */
+ H5S_hyper_span_info_t *down = NULL; /* Pointer to spans in next dimension down */
H5S_hyper_span_t *last_span; /* Current position in hyperslab span list */
- H5S_hyper_span_t *head; /* Head of new hyperslab span list */
+ H5S_hyper_span_t *head = NULL; /* Head of new hyperslab span list */
hsize_t stride_iter; /* Iterator over the stride values */
int i; /* Counters */
unsigned u; /* Counters */
@@ -5793,8 +5683,7 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
HDassert(block);
/* Start creating spans in fastest changing dimension */
- down = NULL;
- for(i = (rank - 1); i >= 0; i--) {
+ for(i = (int)(rank - 1); i >= 0; i--) {
/* Sanity check */
if(0 == count[i])
@@ -5806,6 +5695,8 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
/* Generate all the span segments for this dimension */
for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) {
+ H5S_hyper_span_t *span; /* New hyperslab span */
+
/* Allocate a span node */
if(NULL == (span = H5FL_MALLOC(H5S_hyper_span_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
@@ -5918,7 +5809,7 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
hsize_t curr_block, next_block;
hsize_t curr_start;
hsize_t curr_low;
- int outcount;
+ size_t outcount;
unsigned u;
H5S_hyper_dim_t canon_down_span_slab_info[H5S_MAX_RANK];
hbool_t ret_value = TRUE;
@@ -6318,6 +6209,11 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
} /* end if */
break;
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6444,6 +6340,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
HGOTO_DONE(SUCCEED); /* Selection stays same */
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6503,6 +6403,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
HGOTO_DONE(SUCCEED); /* Selection stays "none" */
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6551,6 +6455,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
HGOTO_DONE(SUCCEED);
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6565,6 +6473,8 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
break;
/* Else fall through to error */
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -7653,52 +7563,53 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
size_t io_used; /* Number of elements processed */
size_t curr_seq=0; /* Number of sequence/offsets stored in the arrays */
size_t elem_size; /* Size of each element iterating over */
- int ndims; /* Number of dimensions of dataset */
- int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int curr_dim; /* Current dimension being operated on */
+ unsigned u; /* Index variable */
int i; /* Index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_gen);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_gen)
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Set the rank of the fastest changing dimension */
- ndims=space->extent.rank;
- fast_dim=(ndims-1);
+ ndims = space->extent.rank;
+ fast_dim = (ndims - 1);
/* Get the pointers to the current span info and span nodes */
- curr_span=iter->u.hyp.span[fast_dim];
- abs_arr=iter->u.hyp.off;
- off_arr=space->select.offset;
- ispan=iter->u.hyp.span;
- elem_size=iter->elmt_size;
+ curr_span = iter->u.hyp.span[fast_dim];
+ abs_arr = iter->u.hyp.off;
+ off_arr = space->select.offset;
+ ispan = iter->u.hyp.span;
+ elem_size = iter->elmt_size;
/* Set the amount of elements to perform I/O on, etc. */
- H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t);
- io_left=MIN(maxelem,(size_t)iter->elmt_left);
- io_bytes_left=io_left*elem_size;
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN(maxelem, (size_t)iter->elmt_left);
+ io_bytes_left = io_left * elem_size;
/* Compute the cumulative size of dataspace dimensions */
- for(i=fast_dim, acc=elem_size; i>=0; i--) {
- slab[i]=acc;
- acc*=space->extent.size[i];
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= space->extent.size[i];
} /* end for */
/* Set the offset of the first element iterated on */
- for(i=0, loc_off=0; i<ndims; i++)
+ for(u = 0, loc_off = 0; u < ndims; u++)
/* Compute the sequential element offset */
- loc_off+=(abs_arr[i]+off_arr[i])*slab[i];
+ loc_off += (abs_arr[u] + off_arr[u]) * slab[u];
/* Range check against number of elements left in selection */
- assert(io_bytes_left<=(iter->elmt_left*elem_size));
+ HDassert(io_bytes_left <= (iter->elmt_left * elem_size));
/* Take care of any partial spans leftover from previous I/Os */
if(abs_arr[fast_dim]!=curr_span->low) {
@@ -7765,7 +7676,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
if(NULL == curr_span) {
/* Same as code in main loop */
/* Start at the next fastest dim */
- curr_dim = fast_dim - 1;
+ curr_dim = (int)(fast_dim - 1);
/* Work back up through the dimensions */
while(curr_dim >= 0) {
@@ -7804,7 +7715,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Check if we have more spans in the tree */
if(curr_dim >= 0) {
/* Walk back down the iterator positions, reseting them */
- while(curr_dim < fast_dim) {
+ while((unsigned)curr_dim < fast_dim) {
HDassert(curr_span);
HDassert(curr_span->down);
HDassert(curr_span->down->head);
@@ -7826,8 +7737,8 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
HDassert(curr_span == iter->u.hyp.span[fast_dim]);
/* Reset the buffer offset */
- for(i = 0, loc_off = 0; i < ndims; i++)
- loc_off += (abs_arr[i] + off_arr[i]) * slab[i];
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += (abs_arr[u] + off_arr[u]) * slab[u];
} /* end else */
else
/* We had better be done with I/O or bad things are going to happen... */
@@ -7946,10 +7857,10 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Adjust iterator pointers */
/* Start at the next fastest dim */
- curr_dim=fast_dim-1;
+ curr_dim = (int)(fast_dim - 1);
/* Work back up through the dimensions */
- while(curr_dim>=0) {
+ while(curr_dim >= 0) {
/* Reset the current span */
curr_span=iter->u.hyp.span[curr_dim];
@@ -7983,51 +7894,51 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
} /* end while */
/* Check if we are finished with the spans in the tree */
- if(curr_dim<0) {
+ if(curr_dim < 0) {
/* We had better be done with I/O or bad things are going to happen... */
- assert(io_bytes_left==0);
+ HDassert(io_bytes_left == 0);
break;
} /* end if */
else {
/* Walk back down the iterator positions, reseting them */
- while(curr_dim<fast_dim) {
- assert(curr_span);
- assert(curr_span->down);
- assert(curr_span->down->head);
+ while((unsigned)curr_dim < fast_dim) {
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
/* Increment current dimension to the next dimension down */
curr_dim++;
/* Set the new span for the next dimension down */
- iter->u.hyp.span[curr_dim]=curr_span->down->head;
+ iter->u.hyp.span[curr_dim] = curr_span->down->head;
/* Advance span down the tree */
- curr_span=curr_span->down->head;
+ curr_span = curr_span->down->head;
/* Reset the absolute offset for the dim */
- abs_arr[curr_dim]=curr_span->low;
+ abs_arr[curr_dim] = curr_span->low;
} /* end while */
/* Verify that the curr_span points to the fastest dim */
- assert(curr_span==iter->u.hyp.span[fast_dim]);
+ HDassert(curr_span == iter->u.hyp.span[fast_dim]);
} /* end else */
/* Reset the buffer offset */
- for(i=0, loc_off=0; i<ndims; i++)
- loc_off+=(abs_arr[i]+off_arr[i])*slab[i];
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += (abs_arr[u] + off_arr[u]) * slab[u];
} /* end while */
/* Decrement number of elements left in iterator */
- io_used=(io_left-(io_bytes_left/elem_size));
- iter->elmt_left-=io_used;
+ io_used = (io_left - (io_bytes_left / elem_size));
+ iter->elmt_left -= io_used;
/* Set the number of sequences generated */
- *nseq=curr_seq;
+ *nseq = curr_seq;
/* Set the number of elements used */
- *nelem=io_used;
+ *nelem = io_used;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S_hyper_get_seq_list_gen() */
@@ -8085,11 +7996,12 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
size_t act_blk_count; /* Actual number of blocks to output */
size_t total_rows; /* Total number of entire rows to output */
size_t curr_rows; /* Current number of entire rows to output */
- int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Number of dimensions of dataset */
int temp_dim; /* Temporary rank holder */
- int ndims; /* Number of dimensions of dataset */
hsize_t acc; /* Accumulator */
hsize_t loc; /* Coordinate offset */
+ unsigned u; /* Local index variable */
int i; /* Local index variable */
size_t curr_seq=0; /* Current sequence being operated on */
size_t actual_elem; /* The actual number of elements to count */
@@ -8115,34 +8027,34 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
tdiminfo=iter->u.hyp.diminfo;
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank!=0 && iter->u.hyp.iter_rank<space->extent.rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
/* Set the aliases for a few important dimension ranks */
- ndims=iter->u.hyp.iter_rank;
- fast_dim=ndims-1;
+ ndims = iter->u.hyp.iter_rank;
+ fast_dim = ndims - 1;
/* Set the local copy of the selection offset */
- sel_off=iter->u.hyp.sel_off;
+ sel_off = iter->u.hyp.sel_off;
/* Set up the pointer to the size of the memory space */
- mem_size=iter->u.hyp.size;
+ mem_size = iter->u.hyp.size;
} /* end if */
else {
/* Set the aliases for a few important dimension ranks */
- ndims=space->extent.rank;
- fast_dim=ndims-1;
+ ndims = space->extent.rank;
+ fast_dim = ndims - 1;
/* Set the local copy of the selection offset */
- sel_off=space->select.offset;
+ sel_off = space->select.offset;
/* Set up the pointer to the size of the memory space */
- mem_size=space->extent.size;
+ mem_size = space->extent.size;
} /* end else */
/* initialize row sizes for each dimension */
- elem_size=iter->elmt_size;
- for(i=(ndims-1),acc=elem_size; i>=0; i--) {
- slab[i]=acc;
- acc*=mem_size[i];
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
} /* end for */
/* Calculate the number of elements to sequence through */
@@ -8166,8 +8078,8 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
actual_elem=MIN(leftover,io_left);
/* Compute the initial buffer offset */
- for(i=0,loc=0; i<ndims; i++)
- loc+=(iter->u.hyp.off[i]+sel_off[i])*slab[i];
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += (iter->u.hyp.off[u] + sel_off[u]) * slab[u];
/* Add a new sequence */
off[curr_seq]=loc;
@@ -8199,24 +8111,24 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Copy the location of the point to get */
/* (Add in the selection offset) */
- for(i=0; i<ndims; i++)
- offset[i] = iter->u.hyp.off[i] + sel_off[i];
+ for(u = 0; u < ndims; u++)
+ offset[u] = iter->u.hyp.off[u] + sel_off[u];
/* Compute the current "counts" for this location */
- for(i=0; i<ndims; i++) {
- if(tdiminfo[i].count==1) {
- tmp_count[i] = 0;
- tmp_block[i] = iter->u.hyp.off[i]-tdiminfo[i].start;
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ tmp_count[u] = 0;
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
} /* end if */
else {
- tmp_count[i] = (iter->u.hyp.off[i]-tdiminfo[i].start)/tdiminfo[i].stride;
- tmp_block[i] = (iter->u.hyp.off[i]-tdiminfo[i].start)%tdiminfo[i].stride;
+ tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
+ tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
} /* end else */
} /* end for */
/* Compute the initial buffer offset */
- for(i=0,loc=0; i<ndims; i++)
- loc+=offset[i]*slab[i];
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
/* Set the number of elements to write each time */
H5_ASSIGN_OVERFLOW(actual_elem,tdiminfo[fast_dim].block,hsize_t,size_t);
@@ -8239,12 +8151,12 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
tot_blk_count=MIN(tot_blk_count,(maxseq-curr_seq));
/* Compute the amount to wrap at the end of each row */
- for(i=0; i<ndims; i++)
- wrap[i]=(mem_size[i]-(tdiminfo[i].stride*tdiminfo[i].count))*slab[i];
+ for(u = 0; u < ndims; u++)
+ wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
/* Compute the amount to skip between blocks */
- for(i=0; i<ndims; i++)
- skip[i]=(tdiminfo[i].stride-tdiminfo[i].block)*slab[i];
+ for(u = 0; u < ndims; u++)
+ skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
/* Check if there is a partial row left (with full blocks) */
if(tmp_count[fast_dim]>0) {
@@ -8292,7 +8204,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
tmp_count[fast_dim]=0;
/* Increment the offset and count for the other dimensions */
- temp_dim=fast_dim-1;
+ temp_dim = (int)fast_dim - 1;
while(temp_dim>=0) {
/* Move to the next row in the curent dimension */
offset[temp_dim]++;
@@ -8392,7 +8304,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
loc += wrap[fast_dim];
/* Increment the offset and count for the other dimensions */
- temp_dim=fast_dim-1;
+ temp_dim = (int)fast_dim - 1;
while(temp_dim>=0) {
/* Move to the next row in the curent dimension */
offset[temp_dim]++;
@@ -8491,20 +8403,20 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Update the iterator with the location we stopped */
/* (Subtract out the selection offset) */
- for(i=0; i<ndims; i++)
- iter->u.hyp.off[i] = offset[i] - sel_off[i];
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = offset[u] - sel_off[u];
/* Decrement the number of elements left in selection */
- iter->elmt_left-=(nelmts-io_left);
+ iter->elmt_left -= (nelmts - io_left);
} /* end if */
/* Set the number of sequences generated */
- *nseq=curr_seq;
+ *nseq = curr_seq;
/* Set the number of bytes used */
- *nelem=start_io_left-io_left;
+ *nelem = start_io_left - io_left;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S_hyper_get_seq_list_opt() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index d7faa89..0e67af1 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -257,7 +257,6 @@ H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
#endif /* LATER */
H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
-H5_DLL herr_t H5S_hyper_move(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset);