diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-10-07 03:18:59 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-10-07 03:18:59 (GMT) |
commit | 190e10b63d143d4c57cba60f6b70cbcc2f0e1af9 (patch) | |
tree | 5cc70ce68f1ca5587de127c812b7961484fb2c4e /src | |
parent | 98658b074e4c729d04e5678ab6d67b894703d005 (diff) | |
download | hdf5-190e10b63d143d4c57cba60f6b70cbcc2f0e1af9.zip hdf5-190e10b63d143d4c57cba60f6b70cbcc2f0e1af9.tar.gz hdf5-190e10b63d143d4c57cba60f6b70cbcc2f0e1af9.tar.bz2 |
[svn-r17605] Description:
Bring r17604 from trunk to 1.8 branch:
Correctly invoke generic property list class callbacks all the way to
the root of the class hierarchy.
Tested on:
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
(h5committested on trunk)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Pdcpl.c | 10 | ||||
-rw-r--r-- | src/H5Pint.c | 67 |
2 files changed, 52 insertions, 25 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 9f8650c..2f7e280 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1723,7 +1723,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags /* Get filter information */ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1791,7 +1791,7 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/ /* Get filter info */ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") done: FUNC_LEAVE_API(ret_value) @@ -1873,13 +1873,13 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) /* Get pipeline info */ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if there are any filters */ if (pline.filter) { /* Delete filter */ if(H5Z_delete(&pline, filter) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't delete filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter") /* Put the I/O pipeline information back into the property list */ if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) @@ -2959,7 +2959,7 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/ /* Get filter info */ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Pint.c b/src/H5Pint.c index 364cab2..4da7f09 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -782,14 +782,22 @@ H5P_copy_plist(H5P_genplist_t *old_plist, hbool_t app_ref) /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ new_plist->plist_id=new_plist_id; - /* Call the class callback (if it exists) now that we have the property list ID */ - if(new_plist->pclass->copy_func!=NULL) { - if((new_plist->pclass->copy_func)(new_plist_id,old_plist->plist_id,old_plist->pclass->copy_data) < 0) { - /* Delete ID, ignore return value */ - H5I_remove(new_plist_id); - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property"); + /* Call the class callback (if it exists) now that we have the property list ID + * (up through chain of parent classes also) + */ + tclass = new_plist->pclass; + while(NULL != tclass) { + if(NULL != tclass->copy_func) { + if((tclass->copy_func)(new_plist_id, old_plist->plist_id, old_plist->pclass->copy_data) < 0) { + /* Delete ID, ignore return value */ + H5I_remove(new_plist_id); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") + } /* end if */ } /* end if */ - } /* end if */ + + /* Go up to parent class */ + tclass = tclass->parent; + } /* end while */ /* Set the class initialization flag */ new_plist->class_init=1; @@ -1658,8 +1666,9 @@ done: hid_t H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) { - H5P_genplist_t *plist=NULL; /* Property list created */ - hid_t plist_id=FAIL; /* Property list ID */ + H5P_genclass_t *tclass; /* Temporary class pointer */ + H5P_genplist_t *plist = NULL; /* Property list created */ + hid_t plist_id = FAIL; /* Property list ID */ hid_t ret_value; /* return value */ FUNC_ENTER_NOAPI(H5P_create_id, FAIL); @@ -1677,14 +1686,22 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ plist->plist_id=plist_id; - /* Call the class callback (if it exists) now that we have the property list ID */ - if(plist->pclass->create_func!=NULL) { - if((plist->pclass->create_func)(plist_id,plist->pclass->create_data) < 0) { - /* Delete ID, ignore return value */ - H5I_remove(plist_id); - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property"); + /* Call the class callback (if it exists) now that we have the property list ID + * (up through chain of parent classes also) + */ + tclass = plist->pclass; + while(NULL != tclass) { + if(NULL != tclass->create_func) { + if((tclass->create_func)(plist_id, tclass->create_data) < 0) { + /* Delete ID, ignore return value */ + H5I_remove(plist_id); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") + } /* end if */ } /* end if */ - } /* end if */ + + /* Go up to parent class */ + tclass = tclass->parent; + } /* end while */ /* Set the class initialization flag */ plist->class_init=1; @@ -4058,10 +4075,20 @@ H5P_close(void *_plist) assert(plist); - /* Make call to property list class close callback, if needed */ - if(plist->class_init!=0 && plist->pclass->close_func!=NULL) { - /* Call user's "close" callback function, ignoring return value */ - (plist->pclass->close_func)(plist->plist_id,plist->pclass->close_data); + /* Make call to property list class close callback, if needed + * (up through chain of parent classes also) + */ + if(plist->class_init !=0) { + tclass = plist->pclass; + while(NULL != tclass) { + if(NULL != tclass->close_func) { + /* Call user's "close" callback function, ignoring return value */ + (tclass->close_func)(plist->plist_id, tclass->close_data); + } /* end if */ + + /* Go up to parent class */ + tclass = tclass->parent; + } /* end while */ } /* end if */ /* Create the skip list to hold names of properties already seen |