[svn-r19668] Description:

Do some extra range-checking on H5Pset_elink_acc_flags() calls.

    Clean up some minor compiler warnings also.

Tested on:
    Mac OS X/32 10.6.4 (amazon) w/debug & production
    (too minor to require h5committest)
This commit is contained in:
Quincey Koziol 2010-10-26 13:07:18 -05:00
parent 2efc06789a
commit 1fd8a32c91
2 changed files with 28 additions and 7 deletions

View File

@ -177,7 +177,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
int i, ncell, cmp;
int ncell, cmp;
static int ncalls = 0;
herr_t status;
herr_t ret_value = SUCCEED; /* Return value */
@ -210,7 +210,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
HDassert(bt);
shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
cur = H5MM_calloc(sizeof(struct child_t));
cur = (struct child_t *)H5MM_calloc(sizeof(struct child_t));
HDassert(cur);
cur->addr = addr;
cur->level = bt->level;
@ -242,24 +242,26 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
HDassert(!H5F_addr_defined(bt->left));
if(cur->level > 0) {
for(i = 0; i < bt->nchildren; i++) {
unsigned u;
for(u = 0; u < bt->nchildren; u++) {
/*
* Check that child nodes haven't already been seen. If they
* have then the tree has a cycle.
*/
for(tmp = head; tmp; tmp = tmp->next)
HDassert(H5F_addr_ne(tmp->addr, bt->child[i]));
HDassert(H5F_addr_ne(tmp->addr, bt->child[u]));
/* Add the child node to the end of the queue */
tmp = H5MM_calloc(sizeof(struct child_t));
tmp = (struct child_t *)H5MM_calloc(sizeof(struct child_t));
HDassert(tmp);
tmp->addr = bt->child[i];
tmp->addr = bt->child[u];
tmp->level = bt->level - 1;
tail->next = tmp;
tail = tmp;
/* Check that the keys are monotonically increasing */
cmp = (type->cmp2)(H5B_NKEY(bt, shared, i), udata, H5B_NKEY(bt, shared, i + 1));
cmp = (type->cmp2)(H5B_NKEY(bt, shared, u), udata, H5B_NKEY(bt, shared, u + 1));
HDassert(cmp < 0);
} /* end for */
} /* end if */

View File

@ -4033,6 +4033,7 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format)
hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1;
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE];
herr_t ret;
unsigned flags;
if(new_format)
@ -4083,6 +4084,24 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
if(subgroup != FAIL) TEST_ERROR
/* Attempt to set invalid flags on gapl */
H5E_BEGIN_TRY {
ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC);
} H5E_END_TRY;
if(ret != FAIL) TEST_ERROR
H5E_BEGIN_TRY {
ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL);
} H5E_END_TRY;
if(ret != FAIL) TEST_ERROR
H5E_BEGIN_TRY {
ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_DEBUG);
} H5E_END_TRY;
if(ret != FAIL) TEST_ERROR
H5E_BEGIN_TRY {
ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT);
} H5E_END_TRY;
if(ret != FAIL) TEST_ERROR
/* Close file1 and group */
if(H5Gclose(group) < 0) TEST_ERROR
if(H5Fclose(file1) < 0) TEST_ERROR