diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
commit | ec8ad09125032c9c232878d02e90aa86df162841 (patch) | |
tree | 5d63105d3a0db7d5bbee41c5b74b097649a2115e /src/H5Stest.c | |
parent | 453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff) | |
download | hdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2 |
Source formatted
Diffstat (limited to 'src/H5Stest.c')
-rw-r--r-- | src/H5Stest.c | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/src/H5Stest.c b/src/H5Stest.c index 1bc5b9f..f7f63fd 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -21,49 +21,41 @@ /* Module Setup */ /****************/ -#include "H5Smodule.h" /* This source code file is part of the H5S module */ -#define H5S_TESTING /*suppress warning about H5S testing funcs*/ - +#include "H5Smodule.h" /* This source code file is part of the H5S module */ +#define H5S_TESTING /*suppress warning about H5S testing funcs*/ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Spkg.h" /* Dataspaces */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Local Prototypes */ /********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*********************/ /* Package Variables */ /*********************/ - /*******************/ /* Local Variables */ /*******************/ - - /*-------------------------------------------------------------------------- NAME H5S__get_rebuild_status_test @@ -89,8 +81,7 @@ REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1, - H5S_diminfo_valid_t *status2) +H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1, H5S_diminfo_valid_t *status2) { H5S_t *space; /* Pointer to 1st dataspace */ herr_t ret_value = SUCCEED; /* Return value */ @@ -100,14 +91,14 @@ H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1, HDassert(status1); HDassert(status2); - /* Get dataspace structures */ - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + /* Get dataspace structures */ + if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") *status1 = space->select.sel_info.hslab->diminfo_valid; /* Fully rebuild diminfo, if necessary */ - if(*status1 == H5S_DIMINFO_VALID_NO) + if (*status1 == H5S_DIMINFO_VALID_NO) H5S__hyper_rebuild(space); *status2 = space->select.sel_info.hslab->diminfo_valid; @@ -116,7 +107,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__get_rebuild_status_test() */ - /*-------------------------------------------------------------------------- NAME H5S__get_diminfo_status_test @@ -147,8 +137,8 @@ H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *status) HDassert(status); - /* Get dataspace structures */ - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + /* Get dataspace structures */ + if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") *status = space->select.sel_info.hslab->diminfo_valid; @@ -181,24 +171,25 @@ H5S__check_spans_tail_ptr(const H5S_hyper_span_info_t *span_lst) { H5S_hyper_span_t *cur_elem; H5S_hyper_span_t *actual_tail = NULL; - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_STATIC HDassert(span_lst); cur_elem = span_lst->head; - while(cur_elem) { + while (cur_elem) { actual_tail = cur_elem; /* check the next dimension of lower order */ - if(NULL != cur_elem->down) - if((ret_value = H5S__check_spans_tail_ptr(cur_elem->down)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers") + if (NULL != cur_elem->down) + if ((ret_value = H5S__check_spans_tail_ptr(cur_elem->down)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the seletion has inconsistent tail pointers") cur_elem = cur_elem->next; } /* end while */ - if(actual_tail != span_lst->tail) + if (actual_tail != span_lst->tail) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers") done: @@ -228,25 +219,24 @@ H5S__check_points_tail_ptr(const H5S_pnt_list_t *pnt_lst) { H5S_pnt_node_t *cur_elem; H5S_pnt_node_t *actual_tail = NULL; - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_STATIC HDassert(pnt_lst); cur_elem = pnt_lst->head; - while(cur_elem) { + while (cur_elem) { actual_tail = cur_elem; - cur_elem = cur_elem->next; + cur_elem = cur_elem->next; } /* end while */ - if(actual_tail != pnt_lst->tail) + if (actual_tail != pnt_lst->tail) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__check_points_tail_ptr */ - /*-------------------------------------------------------------------------- NAME H5S__check_internal_consistency @@ -269,60 +259,70 @@ done: static herr_t H5S__check_internal_consistency(const H5S_t *space) { - hsize_t low_bounds[H5S_MAX_RANK]; - hsize_t high_bounds[H5S_MAX_RANK]; + hsize_t low_bounds[H5S_MAX_RANK]; + hsize_t high_bounds[H5S_MAX_RANK]; unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check args */ HDassert(space); - if(space->select.type->type == H5S_SEL_NONE) + if (space->select.type->type == H5S_SEL_NONE) HGOTO_DONE(ret_value); /* Initialize the inputs */ - for(u = 0; u < space->extent.rank; u++) { - low_bounds[u] = HSIZET_MAX; + for (u = 0; u < space->extent.rank; u++) { + low_bounds[u] = HSIZET_MAX; high_bounds[u] = 0; } /* end for */ /* Check the bound box */ - if(H5S_get_select_bounds(space, low_bounds, high_bounds) < 0) + if (H5S_get_select_bounds(space, low_bounds, high_bounds) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the bound box could not be retrieved") - if(space->select.type->type == H5S_SEL_HYPERSLABS) { + if (space->select.type->type == H5S_SEL_HYPERSLABS) { H5S_hyper_sel_t *hslab = space->select.sel_info.hslab; - if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { - for(u = 0; u < space->extent.rank; u++) { - if((hsize_t)((hssize_t)hslab->diminfo.low_bounds[u] + space->select.offset[u]) != low_bounds[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent") - if((hsize_t)((hssize_t)hslab->diminfo.high_bounds[u] + space->select.offset[u]) != high_bounds[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent") + if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { + for (u = 0; u < space->extent.rank; u++) { + if ((hsize_t)((hssize_t)hslab->diminfo.low_bounds[u] + space->select.offset[u]) != + low_bounds[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the lower bound box of the selection is inconsistent") + if ((hsize_t)((hssize_t)hslab->diminfo.high_bounds[u] + space->select.offset[u]) != + high_bounds[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the higher bound box of the selection is inconsistent") } /* end for */ - } /* end if */ + } /* end if */ else { - for(u = 0; u < space->extent.rank; u++) { - if((hsize_t)((hssize_t)hslab->span_lst->low_bounds[u] + space->select.offset[u]) != low_bounds[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent") - if((hsize_t)((hssize_t)hslab->span_lst->high_bounds[u] + space->select.offset[u]) != high_bounds[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent") + for (u = 0; u < space->extent.rank; u++) { + if ((hsize_t)((hssize_t)hslab->span_lst->low_bounds[u] + space->select.offset[u]) != + low_bounds[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the lower bound box of the selection is inconsistent") + if ((hsize_t)((hssize_t)hslab->span_lst->high_bounds[u] + space->select.offset[u]) != + high_bounds[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the higher bound box of the selection is inconsistent") } /* end for */ - } /* end else */ + } /* end else */ /* check the tail pointer */ - if((NULL != hslab) && (NULL != hslab->span_lst)) - if(H5S__check_spans_tail_ptr(hslab->span_lst) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers") + if ((NULL != hslab) && (NULL != hslab->span_lst)) + if (H5S__check_spans_tail_ptr(hslab->span_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the seletion has inconsistent tail pointers") } /* end if */ - else if(space->select.type->type == H5S_SEL_POINTS) { + else if (space->select.type->type == H5S_SEL_POINTS) { H5S_pnt_list_t *pnt_lst = space->select.sel_info.pnt_lst; - if(NULL != pnt_lst) - if(H5S__check_points_tail_ptr(pnt_lst) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers") + if (NULL != pnt_lst) + if (H5S__check_points_tail_ptr(pnt_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "the seletion has inconsistent tail pointers") } /* end else-if */ done: @@ -351,20 +351,20 @@ done: htri_t H5S__internal_consistency_test(hid_t space_id) { - H5S_t *space; /* Pointer to 1st dataspace */ - htri_t ret_value = TRUE; /* Return value */ + H5S_t *space; /* Pointer to 1st dataspace */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE - /* Get dataspace structures */ - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + /* Get dataspace structures */ + if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check if the dataspace selections are the same shape */ - if(FAIL == H5S__check_internal_consistency(space)) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "The dataspace has inconsistent internal state") + if (FAIL == H5S__check_internal_consistency(space)) + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, + "The dataspace has inconsistent internal state") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__internal_consistency_test() */ - |