From 1c61b6fe13f6fd9c84c0407f02865568e0a7f638 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Mon, 27 Sep 2010 14:02:48 -0500 Subject: [svn-r19481] I'm backing out my fix for bug 1707 because there're some unresolved issues - r19441 and 19467. Bug 1707 is that H5Eset_auto causes a seg fault when an application uses -DH5_USE_16_API with the 1.8 library to compile. I created a branch off the trunk called set_auto to continue working on the problem. Tested on jam - backing out, simple. --- release_docs/RELEASE.txt | 3 - src/H5.c | 9 +-- src/H5E.c | 24 ++---- src/H5Edeprec.c | 9 +-- src/H5Eint.c | 8 +- src/H5Epkg.h | 19 ++--- test/dtransform.c | 18 +---- test/enum.c | 6 +- test/err_compat.c | 175 ++++++-------------------------------------- test/error_test.c | 7 +- test/flush2.c | 35 ++------- test/h5test.c | 6 +- test/testerror.sh.in | 2 - test/testfiles/err_compat_1 | 14 +--- test/testframe.c | 6 +- test/ttsafe_error.c | 20 +---- tools/h5dump/h5dump.c | 18 ++--- tools/h5jam/h5jam.c | 11 +-- tools/h5jam/h5unjam.c | 11 +-- tools/h5jam/tellub.c | 11 +-- tools/h5ls/h5ls.c | 6 +- tools/h5stat/h5stat.c | 6 +- tools/misc/h5mkgrp.c | 7 +- 23 files changed, 89 insertions(+), 342 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 32dcf1f..21334fd 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -251,9 +251,6 @@ Bug Fixes since HDF5-1.8.0 release - Modified library to always cache symbol table information. Libraries version 1.6.3 have a bug which causes them to require this information for some operations. (NAF - 2010/09/21 - 1864) - - H5Eset_auto causes a seg fault when an application uses -DH5_USE_16_API - to compile with the library. The problem is fixed and the behavior - of H5Eget_auto is modified (Bug #1707). (SLU - 2010/9/21) - Fixed a bug that could occur when getting information for a new-style group that was previously opened through a file handle that was later closed. (NAF - 2010/09/15) diff --git a/src/H5.c b/src/H5.c index 97c4036..0a14c6e 100644 --- a/src/H5.c +++ b/src/H5.c @@ -214,7 +214,7 @@ H5_term_library(void) int pending, ntries = 0, n; size_t at = 0; char loop[1024]; - H5E_auto_t func; + H5E_auto2_t func; #ifdef H5_HAVE_THREADSAFE /* explicit locking of the API */ @@ -227,11 +227,8 @@ H5_term_library(void) goto done; /* Check if we should display error output */ -#ifdef H5_USE_16_API_DEFAULT - (void)H5Eget_auto(&func, NULL); -#else - (void)H5Eget_auto(H5E_DEFAULT, &func, NULL); -#endif + (void)H5Eget_auto2(H5E_DEFAULT, &func, NULL); + /* * Terminate each interface. The termination functions return a positive * value if they do something that might affect some other interface in a diff --git a/src/H5E.c b/src/H5E.c index 704253f..01dd35b 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -170,18 +170,13 @@ H5E_set_default_auto(H5E_t *stk) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_default_auto) -#ifdef H5_USE_16_API_DEFAULT +#ifdef H5_USE_16_API stk->auto_op.vers = 1; -#else /* H5_USE_16_API_DEFAULT */ + stk->auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; +#else /* H5_USE_16_API */ 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 = (H5E_auto1_t)H5Eprint1; -#endif - stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; - stk->auto_op.user_set = FALSE; + stk->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_USE_16_API */ stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1583,12 +1578,8 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) /* Get the automatic error reporting information */ if(H5E_get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") - - if(op.user_set && op.vers == 1) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called") - if(func) - *func = op.func2; + *func = op.u.func2; done: FUNC_LEAVE_API(ret_value) @@ -1638,8 +1629,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) /* Set the automatic error reporting information */ op.vers = 2; - op.user_set = TRUE; - op.func2 = func; + op.u.func2 = func; if(H5E_set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 9f6d869..30f3ae9 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -389,12 +389,8 @@ 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") - - if(auto_op.user_set && auto_op.vers == 2) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto2 has been called") - if(func) - *func = auto_op.func1; + *func = auto_op.u.func1; done: FUNC_LEAVE_API(ret_value) @@ -440,8 +436,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) /* Set the automatic error reporting information */ auto_op.vers = 1; - auto_op.user_set = TRUE; - auto_op.func1 = func; + auto_op.u.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") diff --git a/src/H5Eint.c b/src/H5Eint.c index 75aadda..584ba40 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -1013,15 +1013,15 @@ H5E_dump_api_stack(hbool_t is_api) HDassert(estack); if(estack->auto_op.vers == 1) { #ifndef H5_NO_DEPRECATED_SYMBOLS - if(estack->auto_op.func1) - (void)((estack->auto_op.func1)(estack->auto_data)); + if(estack->auto_op.u.func1) + (void)((estack->auto_op.u.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)); + if(estack->auto_op.u.func2) + (void)((estack->auto_op.u.func2)(H5E_DEFAULT, estack->auto_data)); } /* end else */ } /* end if */ diff --git a/src/H5Epkg.h b/src/H5Epkg.h index b9688d2..a85ddc9 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -68,20 +68,15 @@ /****************************/ /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ -#ifndef H5_NO_DEPRECATED_SYMBOLS -typedef struct { - unsigned vers; /* Which version callback to use */ - hbool_t user_set; /* If the printing function has been set. */ - H5E_auto1_t func1; /* Old-style callback, NO error stack param. */ - H5E_auto2_t func2; /* New-style callback, with error stack param. */ -} H5E_auto_op_t; -#else typedef struct { - unsigned vers; /* Which version callback to use */ - hbool_t user_set; /* If the printing function has been set. */ - H5E_auto_t func2; /* Only the new style callback function is available. */ + unsigned vers; /* Which version callback to use */ + union { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5E_auto1_t func1; /* Old-style callback, NO error stack param. */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5E_auto2_t func2; /* New-style callback, with error stack param. */ + }u; } H5E_auto_op_t; -#endif /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ typedef struct { diff --git a/test/dtransform.c b/test/dtransform.c index 15c5934..5d5cefe 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -641,7 +641,7 @@ static int test_set(void) { hid_t dxpl_id = -1; - H5E_auto_t func; + H5E_auto2_t func; const char *str = "(9/5.0)*x + 32"; char *ptrgetTest = NULL; @@ -654,15 +654,9 @@ test_set(void) TEST_ERROR /* Test get before set */ -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func, NULL); + H5Eget_auto2(H5E_DEFAULT, &func, NULL); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT, &func, NULL); - - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); if(H5Pget_data_transform(dxpl_id, ptrgetTest, HDstrlen(str) + 1) < 0) PASSED() @@ -699,11 +693,7 @@ test_set(void) TESTING("H5Pset_data_transform (set with invalid transform 8)") INVALID_SET_TEST("(9/5)*x + x^2"); -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(func, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, func, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, func, NULL); if(H5Pclose(dxpl_id) < 0) TEST_ERROR diff --git a/test/enum.c b/test/enum.c index 0033c44..c627af1 100644 --- a/test/enum.c +++ b/test/enum.c @@ -383,11 +383,7 @@ test_value_dsnt_exist(void) TESTING("for non-existing name and value"); /* Turn off error reporting since we expect failure in this test */ -#ifdef H5_USE_16_API_DEFAULT - if (H5Eset_auto(NULL, NULL) < 0) goto error; -#else /* H5_USE_16_API_DEFAULT */ - if (H5Eset_auto(H5E_DEFAULT, NULL, NULL) < 0) goto error; -#endif /* H5_USE_16_API_DEFAULT */ + if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) goto error; if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error; diff --git a/test/err_compat.c b/test/err_compat.c index 4c0df06..be86a2d 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -44,144 +44,9 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; herr_t custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data); -#ifdef H5_USE_16_API_DEFAULT /*------------------------------------------------------------------------- - * Function: test_error1 - * - * Purpose: Test the backward compatibility of H5Eset/get_auto. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Raymond Lu - * 17 September 2010 - * - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -test_error1(void) -{ - hid_t dataset, space; - hsize_t dims[2]; - H5E_auto1_t old_func1; - H5E_auto2_t old_func2; - void *old_data; - herr_t ret; - - TESTING("error API H5Eset/get_auto"); - fprintf(stderr, "\n"); - - /* Create the data space */ - dims[0] = DIM0; - dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; - - /* Test whether the printing function is mismatched. The library should indicate - * H5Eprint1 as the default. */ - if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)<0) - TEST_ERROR; - if (old_data != NULL) - TEST_ERROR; - if (!old_func2) - TEST_ERROR; - - /* This function changes the default printing function to be H5Eprint2. */ - if(H5Eset_auto2(H5E_DEFAULT, old_func2, old_data)<0) - TEST_ERROR; - - /* Dataset creation should fail because the file doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) - TEST_ERROR; - - /* This call should fail because the test mixes H5Eget_auto1 with H5Eset_auto2. - * Once the H5Eset_auto2 is called, a call to H5Eget_auto1 will fail. */ - if((ret = H5Eget_auto1(&old_func1, &old_data)) >= 0) - TEST_ERROR; - - return 0; - - error: - return -1; -} - -#else /*H5_USE_16_API_DEFAULT*/ - -/*------------------------------------------------------------------------- - * Function: test_error2 - * - * Purpose: Test the backward compatibility of H5Eset/get_auto. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Raymond Lu - * 17 September 2010 - * - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -test_error2(void) -{ - hid_t dataset, space; - hsize_t dims[2]; - H5E_auto1_t old_func1; - H5E_auto2_t old_func2; - void *old_data; - herr_t ret; - - TESTING("error API H5Eset/get_auto"); - fprintf(stderr, "\n"); - - /* Create the data space */ - dims[0] = DIM0; - dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; - - /* Test whether the printing function is mismatched. The library should indicate - * H5Eprint2 as the default. */ - if (H5Eget_auto1(&old_func1, &old_data)<0) - TEST_ERROR; - if (old_data != NULL) - TEST_ERROR; - if (!old_func1) - TEST_ERROR; - - /* This function changes the default printing function to be H5Eprint1. */ - if(H5Eset_auto1(old_func1, old_data)<0) - TEST_ERROR; - - /* Dataset creation should fail because the file doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) - TEST_ERROR; - - /* This call should fail because it mixed H5Eget_auto2 with H5Eset_auto1. - * Once the H5Eset_auto1 is called, a call to H5Eget_auto2 will fail. */ - if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)) >= 0) - TEST_ERROR; - - return 0; - - error: - return -1; -} -#endif /*H5_USE_16_API_DEFAULT*/ - - -/*------------------------------------------------------------------------- - * Function: test_error3 + * Function: test_error * * Purpose: Test error API functions * @@ -198,7 +63,7 @@ test_error2(void) *------------------------------------------------------------------------- */ static herr_t -test_error3(hid_t file) +test_error(hid_t file) { hid_t dataset, space; hsize_t dims[2]; @@ -227,21 +92,35 @@ test_error3(hid_t file) goto error; } - /* Disable the library's default printing function */ -#ifdef H5_USE_16_API_DEFAULT - if(H5Eset_auto(NULL, NULL)<0) -#else - if(H5Eset_auto(H5E_DEFAULT, NULL, NULL)<0) -#endif + /* Test enabling and disabling default printing */ + if (H5Eget_auto1(&old_func, &old_data)<0) + TEST_ERROR; + if (old_data != NULL) + TEST_ERROR; + if (!old_func) + TEST_ERROR; +#ifdef H5_USE_16_API + if (old_func != (H5E_auto1_t)H5Eprint1) + TEST_ERROR; +#else /* H5_USE_16_API */ + if (old_func != (H5E_auto1_t)H5Eprint2) + TEST_ERROR; +#endif /* H5_USE_16_API */ + + if(H5Eset_auto1(NULL, NULL)<0) TEST_ERROR; - /* Make H5Dwrite fail, verify default printing is disabled */ + /* Make H5Dwrite fail, verify default print is disabled */ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) { H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR, "H5Dwrite shouldn't succeed"); goto error; } + if(H5Eset_auto1(old_func, old_data)<0) + TEST_ERROR; + + /* In case program comes to this point, close dataset */ if(H5Dclose(dataset)<0) TEST_ERROR; TEST_ERROR; @@ -379,13 +258,7 @@ main(void) H5Eclear1(); /* Test error API */ -#ifdef H5_USE_16_API_DEFAULT - if(test_error1() < 0) TEST_ERROR ; -#else /*H5_USE_16_API_DEFAULT*/ - if(test_error2() < 0) TEST_ERROR ; -#endif /*H5_USE_16_API_DEFAULT*/ - - if(test_error3(file) < 0) { + if(test_error(file) < 0) { H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, "Error test failed"); H5Eprint1(stderr); diff --git a/test/error_test.c b/test/error_test.c index 6a37b80..52dcc0c 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -21,7 +21,7 @@ */ #include "h5test.h" -#ifdef H5_USE_16_API_DEFAULT +#ifdef H5_USE_16_API int main(void) { printf("Test skipped because backward compatbility with v1.6 is configured in\n"); @@ -127,8 +127,13 @@ test_error(hid_t file) TEST_ERROR; if(old_data != NULL) TEST_ERROR; +#ifdef H5_USE_16_API + if (old_func != (H5E_auto_t)H5Eprint) + TEST_ERROR; +#else /* H5_USE_16_API */ if (old_func != (H5E_auto2_t)H5Eprint2) TEST_ERROR; +#endif /* H5_USE_16_API */ if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) TEST_ERROR; diff --git a/test/flush2.c b/test/flush2.c index c674426..5675856 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -158,7 +158,7 @@ int main(void) { hid_t fapl; - H5E_auto_t func; + H5E_auto2_t func; char name[1024]; h5_reset(); @@ -178,14 +178,8 @@ main(void) /* Check the case where the file was not flushed. This should give an error * so we turn off the error stack temporarily */ TESTING("H5Fflush (part2 without flush)"); - -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func,NULL); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT,&func,NULL); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eget_auto2(H5E_DEFAULT,&func,NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); h5_fixname(FILENAME[1], fapl, name, sizeof name); if(check_file(name, fapl, FALSE)) @@ -202,23 +196,13 @@ main(void) goto error; #endif } -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(func, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, func, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, func, NULL); /* Check the case where the file was flushed, but more data was added afterward. This should give an error * so we turn off the error stack temporarily */ TESTING("H5Fflush (part2 with flush and later addition)"); - -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func,NULL); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT,&func,NULL); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eget_auto2(H5E_DEFAULT,&func,NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); h5_fixname(FILENAME[2], fapl, name, sizeof name); if(check_file(name, fapl, TRUE)) @@ -236,12 +220,7 @@ main(void) #endif } -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(func, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, func, NULL); -#endif /* H5_USE_16_API_DEFAULT */ - + H5Eset_auto2(H5E_DEFAULT, func, NULL); h5_cleanup(FILENAME, fapl); diff --git a/test/h5test.c b/test/h5test.c index d02fea9..229efec 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -212,11 +212,7 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(h5_errors, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, h5_errors, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); /* * I commented this chunk of code out because it's not clear what diagnostics diff --git a/test/testerror.sh.in b/test/testerror.sh.in index 440be4f..7f9657a 100644 --- a/test/testerror.sh.in +++ b/test/testerror.sh.in @@ -71,8 +71,6 @@ TEST() { -e 's/line [0-9]*/line (number)/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ - -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext cat $actual_ext >> $actual diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index f3d11a3..032e7bc 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,7 +1,7 @@ ############################# Expected output for err_compat ############################# -Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed. +Testing error API based on data I/O All error API tests passed. This program tests the Error API compatible with HDF5 version (number). There're supposed to be some error messages ********* Print error stack in HDF5 default way ********* HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): @@ -15,18 +15,6 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): not a location ID - major: Invalid arguments to routine - minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID - major: Invalid arguments to routine - minor: Bad value -HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Eget_auto(1 or 2)(): wrong API function, H5Eset_auto(1 or 2) has been called - major: Error API - minor: Can't get value - -HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed major: Error API minor: Unrecognized message diff --git a/test/testframe.c b/test/testframe.c index f933d8b..082a27f 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -135,11 +135,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index edc5c07..f55afdc 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -158,24 +158,16 @@ void *tts_error_thread(void UNUSED *arg) { hid_t dataspace, datatype, dataset; hsize_t dimsf[1]; /* dataset dimensions */ - H5E_auto_t old_error_cb; + H5E_auto2_t old_error_cb; void *old_error_client_data; int value; int ret; -#ifdef H5_USE_16_API_DEFAULT /* preserve previous error stack handler */ - H5Eget_auto(&old_error_cb, &old_error_client_data); + H5Eget_auto2(H5E_DEFAULT, &old_error_cb, &old_error_client_data); /* set each thread's error stack handler */ - H5Eset_auto(error_callback, NULL); -#else /* H5_USE_16_API_DEFAULT */ - /* preserve previous error stack handler */ - H5Eget_auto(H5E_DEFAULT, &old_error_cb, &old_error_client_data); - - /* set each thread's error stack handler */ - H5Eset_auto(H5E_DEFAULT, error_callback, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, error_callback, NULL); /* define dataspace for dataset */ dimsf[0] = 1; @@ -201,11 +193,7 @@ void *tts_error_thread(void UNUSED *arg) assert(ret >= 0); /* turn our error stack handler off */ -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(old_error_cb, old_error_client_data); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, old_error_cb, old_error_client_data); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, old_error_cb, old_error_client_data); return NULL; } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index e304a41..261fe15 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -4312,7 +4312,7 @@ main(int argc, const char *argv[]) hid_t fid, gid; char *fname = NULL; void *edata; - H5E_auto_t func; + H5E_auto2_t func; H5O_info_t oi; struct handler_t *hand; int i; @@ -4324,13 +4324,8 @@ main(int argc, const char *argv[]) dump_function_table = &ddl_function_table; /* Disable error reporting */ -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT, &func, &edata); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* Initialize h5tools lib */ h5tools_init(); @@ -4538,11 +4533,8 @@ done: HDfree(fname); /* To Do: clean up XML table */ -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(func, edata); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, func, edata); -#endif /* H5_USE_16_API_DEFAULT */ + + H5Eset_auto2(H5E_DEFAULT, func, edata); leave(h5tools_getstatus()); } diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 14d3f6a..17b1384 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -166,7 +166,7 @@ main (int argc, const char *argv[]) int h5fid; int ofid; void *edata; - H5E_auto_t func; + H5E_auto2_t func; hid_t ifile; hid_t plist; herr_t status; @@ -185,13 +185,8 @@ main (int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT, &func, &edata); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); parse_command_line (argc, argv); diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index c5a337d..8e31ce1 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -169,7 +169,7 @@ main(int argc, const char *argv[]) int ufid; int h5fid; void *edata; - H5E_auto_t func; + H5E_auto2_t func; hid_t ifile; off_t fsize; hsize_t usize; @@ -183,13 +183,8 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT, &func, &edata); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); parse_command_line(argc, argv); diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index ba71712..f1b6756 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -129,7 +129,7 @@ main (int argc, const char *argv[]) { char *ifname; void *edata; - H5E_auto_t func; + H5E_auto2_t func; hid_t ifile; hsize_t usize; htri_t testval; @@ -140,13 +140,8 @@ main (int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ -#ifdef H5_USE_16_API_DEFAULT - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eget_auto(H5E_DEFAULT, &func, &edata); - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); parse_command_line (argc, argv); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 115a86c..b1d9ee9 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -2417,11 +2417,7 @@ main(int argc, const char *argv[]) /* Turn off HDF5's automatic error printing unless you're debugging h5ls */ if(!show_errors_g) -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* Each remaining argument is an hdf5 file followed by an optional slash diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 7cc098d..fd21266 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -1544,11 +1544,7 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* Initialize h5tools lib */ h5tools_init(); diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 6d8a869..09f23ef 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -216,12 +216,7 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable the HDF5 library's error reporting */ -#ifdef H5_USE_16_API_DEFAULT - H5Eset_auto(NULL, NULL); -#else /* H5_USE_16_API_DEFAULT */ - H5Eset_auto(H5E_DEFAULT, NULL, NULL); -#endif /* H5_USE_16_API_DEFAULT */ - + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* Initialize h5tools lib */ h5tools_init(); -- cgit v0.12