summaryrefslogtreecommitdiffstats
path: root/src/H5Edeprec.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2010-10-12 16:45:36 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2010-10-12 16:45:36 (GMT)
commit98c90bd9cd572616b3335746d4aaf5045f55dfe4 (patch)
treeacb82bccac043aab98bf429e76052c79ef0b2900 /src/H5Edeprec.c
parent09d549d0e9b20f592b5fb3708380aa74ca0084cc (diff)
downloadhdf5-98c90bd9cd572616b3335746d4aaf5045f55dfe4.zip
hdf5-98c90bd9cd572616b3335746d4aaf5045f55dfe4.tar.gz
hdf5-98c90bd9cd572616b3335746d4aaf5045f55dfe4.tar.bz2
[svn-r19583] Bug fix for 1707 - H5Eset_auto causes a seg fault when an application uses -DH5_USE_16_API
with the 1.8 library to compile. The cause is from the mismatch of H5Eprint1 and H5Eprint2 set through H5Eset_auto. I changed the structure H5E_auto_t. I added a IS_DEDAULT flag in it. Both H5Eprint1/2 are the default now. If the user sets his/her own printing function. Then a call to H5Eget_auto1/2 will have to match H5Eset_auto1/2. Tested on heiwa, jam, and amani. The property change in configure.in, config, tools/misc, tools/lib, c++/test, fortran, and Makefile.am came from the merge of the trunk library change. --This line, and th se below, will be ignored-- _M . M test/testerror.sh.in M test/err_compat.c M test/testfiles/err_compat_1 _M configure.in M src/H5Epkg.h M src/H5E.c M src/H5Eint.c M src/H5Edeprec.c _M tools/misc _M tools/lib _M config _M c++/test _M Makefile.am _M fortran
Diffstat (limited to 'src/H5Edeprec.c')
-rw-r--r--src/H5Edeprec.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 30f3ae9..0a028d9 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -370,6 +370,11 @@ done:
* Programmer: Raymond Lu
* Sep 16, 2003
*
+ * Modification:Raymond Lu
+ * 4 October 2010
+ * If the printing function isn't the default H5Eprint1 or 2,
+ * and H5Eset_auto2 has been called to set the new style
+ * printing function, a call to H5Eget_auto1 should fail.
*-------------------------------------------------------------------------
*/
herr_t
@@ -389,8 +394,13 @@ H5Eget_auto1(H5E_auto1_t *func, void **client_data)
/* Get the automatic error reporting information */
if(H5E_get_auto(estack, &auto_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
+
+ /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto2 */
+ if(!auto_op.is_default && auto_op.vers == 2)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto2 has been called")
+
if(func)
- *func = auto_op.u.func1;
+ *func = auto_op.func1;
done:
FUNC_LEAVE_API(ret_value)
@@ -418,6 +428,9 @@ done:
* Programmer: Raymond Lu
* Sep 16, 2003
*
+ * Modification:Raymond Lu
+ * 4 October 2010
+ * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on.
*-------------------------------------------------------------------------
*/
herr_t
@@ -434,9 +447,18 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data)
if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
+ /* Get the automatic error reporting information */
+ if(H5E_get_auto(estack, &auto_op, NULL) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
+
/* Set the automatic error reporting information */
auto_op.vers = 1;
- auto_op.u.func1 = func;
+ if(func != auto_op.func1_default)
+ auto_op.is_default = FALSE;
+ else
+ auto_op.is_default = TRUE;
+ auto_op.func1 = func;
+
if(H5E_set_auto(estack, &auto_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info")