From 011db9e56cb2c2ba4d872eb8208ce604363e9fad Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Thu, 7 Oct 2010 11:00:43 -0500 Subject: [svn-r19533] Bug 1707 - an update according to Neil's suggestion. I took out the VERS, IS_DEFAULT from H5E_auto_t structure in H5Epkg.h when the macro H5_NO_DEPRECATED_SYMBOLS is defined. Tested on jam, heiwa, amani. --- src/H5E.c | 23 ++++++++++++++++++----- src/H5Eint.c | 10 ++++++---- src/H5Epkg.h | 3 --- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/H5E.c b/src/H5E.c index 4b581f6..5e042c5 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -170,18 +170,20 @@ H5E_set_default_auto(H5E_t *stk) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_default_auto) +#ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT stk->auto_op.vers = 1; #else /* H5_USE_16_API_DEFAULT */ stk->auto_op.vers = 2; #endif /* H5_USE_16_API_DEFAULT */ -#ifdef H5_NO_DEPRECATED_SYMBOLS - stk->auto_op.vers = 2; -#else + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; -#endif stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; stk->auto_op.is_default = TRUE; +#else + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; +#endif + stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1589,9 +1591,11 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) if(H5E_get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto1 */ if(!op.is_default && op.vers == 1) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called") +#endif if(func) *func = op.func2; @@ -1645,16 +1649,21 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Get the automatic error reporting information */ if(H5E_get_auto(estack, &op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ - op.vers = 2; if(func != op.func2_default) op.is_default = FALSE; else op.is_default = TRUE; + + op.vers = 2; +#endif + + /* Set the automatic error reporting function */ op.func2 = func; if(H5E_set_auto(estack, &op, client_data) < 0) @@ -1699,7 +1708,11 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) /* Check if the error stack reporting function is the "newer" stack type */ if(is_stack) +#ifndef H5_NO_DEPRECATED_SYMBOLS *is_stack = estack->auto_op.vers > 1; +#else + *is_stack = 1; +#endif done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Eint.c b/src/H5Eint.c index 75aadda..eff9049 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -1011,18 +1011,20 @@ H5E_dump_api_stack(hbool_t is_api) H5E_t *estack = H5E_get_my_stack(); HDassert(estack); + +#ifdef H5_NO_DEPRECATED_SYMBOLS + if(estack->auto_op.func2) + (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); +#else if(estack->auto_op.vers == 1) { -#ifndef H5_NO_DEPRECATED_SYMBOLS if(estack->auto_op.func1) (void)((estack->auto_op.func1)(estack->auto_data)); -#else /* H5_NO_DEPRECATED_SYMBOLS */ - HDassert(0 && "version 1 error stack dump without deprecated symbols!"); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ else { if(estack->auto_op.func2) (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); } /* end else */ +#endif } /* end if */ done: diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 93e0d82..2e9f592 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -79,10 +79,7 @@ typedef struct { } H5E_auto_op_t; #else typedef struct { - unsigned vers; /* Which version callback to use */ - hbool_t is_default; /* If the printing function is the library's own. */ H5E_auto_t func2; /* Only the new style callback function is available. */ - H5E_auto2_t func2_default; /* The saved library's default function - new style. */ } H5E_auto_op_t; #endif -- cgit v0.12