diff options
-rw-r--r-- | release_docs/RELEASE.txt | 3 | ||||
-rw-r--r-- | src/H5.c | 9 | ||||
-rw-r--r-- | src/H5E.c | 25 | ||||
-rw-r--r-- | src/H5Edeprec.c | 9 | ||||
-rw-r--r-- | src/H5Eint.c | 8 | ||||
-rw-r--r-- | src/H5Epkg.h | 11 | ||||
-rw-r--r-- | test/dtransform.c | 18 | ||||
-rw-r--r-- | test/enum.c | 6 | ||||
-rw-r--r-- | test/err_compat.c | 175 | ||||
-rw-r--r-- | test/error_test.c | 7 | ||||
-rw-r--r-- | test/flush2.c | 35 | ||||
-rw-r--r-- | test/h5test.c | 6 | ||||
-rw-r--r-- | test/testerror.sh.in | 2 | ||||
-rw-r--r-- | test/testfiles/err_compat_1 | 14 | ||||
-rw-r--r-- | test/testframe.c | 6 | ||||
-rw-r--r-- | test/ttsafe_error.c | 20 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 18 | ||||
-rw-r--r-- | tools/h5jam/h5jam.c | 11 | ||||
-rw-r--r-- | tools/h5jam/h5unjam.c | 11 | ||||
-rw-r--r-- | tools/h5jam/tellub.c | 11 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 6 | ||||
-rw-r--r-- | tools/h5stat/h5stat.c | 6 | ||||
-rw-r--r-- | tools/misc/h5mkgrp.c | 7 |
23 files changed, 335 insertions, 89 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 991ba77..2a05771 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -248,6 +248,9 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - 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) @@ -214,7 +214,7 @@ H5_term_library(void) int pending, ntries = 0, n; size_t at = 0; char loop[1024]; - H5E_auto2_t func; + H5E_auto_t func; #ifdef H5_HAVE_THREADSAFE /* explicit locking of the API */ @@ -227,8 +227,11 @@ H5_term_library(void) goto done; /* Check if we should display error output */ - (void)H5Eget_auto2(H5E_DEFAULT, &func, NULL); - +#ifdef H5_USE_16_API_DEFAULT + (void)H5Eget_auto(&func, NULL); +#else + (void)H5Eget_auto(H5E_DEFAULT, &func, NULL); +#endif /* * Terminate each interface. The termination functions return a positive * value if they do something that might affect some other interface in a @@ -170,13 +170,19 @@ H5E_set_default_auto(H5E_t *stk) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_default_auto) -#ifdef H5_USE_16_API +#ifdef H5_USE_16_API_DEFAULT stk->auto_op.vers = 1; - stk->auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; -#else /* H5_USE_16_API */ +#else /* H5_USE_16_API_DEFAULT */ stk->auto_op.vers = 2; - stk->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_USE_16_API */ +#endif /* H5_USE_16_API_DEFAULT */ +#ifdef H5_NO_DEPRECATED_SYMBOLS + stk->auto_op.vers = 2; + stk->auto_op.func1 = NULL; +#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_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1578,8 +1584,12 @@ 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.u.func2; + *func = op.func2; done: FUNC_LEAVE_API(ret_value) @@ -1629,7 +1639,8 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) /* Set the automatic error reporting information */ op.vers = 2; - op.u.func2 = func; + op.user_set = TRUE; + op.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 30f3ae9..9f6d869 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -389,8 +389,12 @@ 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.u.func1; + *func = auto_op.func1; done: FUNC_LEAVE_API(ret_value) @@ -436,7 +440,8 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) /* Set the automatic error reporting information */ auto_op.vers = 1; - auto_op.u.func1 = func; + auto_op.user_set = 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") diff --git a/src/H5Eint.c b/src/H5Eint.c index 584ba40..75aadda 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.u.func1) - (void)((estack->auto_op.u.func1)(estack->auto_data)); + 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.u.func2) - (void)((estack->auto_op.u.func2)(H5E_DEFAULT, estack->auto_data)); + if(estack->auto_op.func2) + (void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data)); } /* end else */ } /* end if */ diff --git a/src/H5Epkg.h b/src/H5Epkg.h index a85ddc9..fc82502 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -69,13 +69,10 @@ /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ typedef struct { - 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; + unsigned vers; /* Which version callback to use */ + hbool_t user_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; /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ diff --git a/test/dtransform.c b/test/dtransform.c index 5d5cefe..15c5934 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -641,7 +641,7 @@ static int test_set(void) { hid_t dxpl_id = -1; - H5E_auto2_t func; + H5E_auto_t func; const char *str = "(9/5.0)*x + 32"; char *ptrgetTest = NULL; @@ -654,9 +654,15 @@ test_set(void) TEST_ERROR /* Test get before set */ - H5Eget_auto2(H5E_DEFAULT, &func, NULL); +#ifdef H5_USE_16_API_DEFAULT + H5Eget_auto(&func, NULL); - H5Eset_auto2(H5E_DEFAULT, NULL, 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 */ if(H5Pget_data_transform(dxpl_id, ptrgetTest, HDstrlen(str) + 1) < 0) PASSED() @@ -693,7 +699,11 @@ test_set(void) TESTING("H5Pset_data_transform (set with invalid transform 8)") INVALID_SET_TEST("(9/5)*x + x^2"); - H5Eset_auto2(H5E_DEFAULT, func, NULL); +#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 */ if(H5Pclose(dxpl_id) < 0) TEST_ERROR diff --git a/test/enum.c b/test/enum.c index c627af1..0033c44 100644 --- a/test/enum.c +++ b/test/enum.c @@ -383,7 +383,11 @@ test_value_dsnt_exist(void) TESTING("for non-existing name and value"); /* Turn off error reporting since we expect failure in this test */ - if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) goto error; +#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 ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error; diff --git a/test/err_compat.c b/test/err_compat.c index be86a2d..4c0df06 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -44,9 +44,144 @@ 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_error + * 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 * * Purpose: Test error API functions * @@ -63,7 +198,7 @@ herr_t custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data); *------------------------------------------------------------------------- */ static herr_t -test_error(hid_t file) +test_error3(hid_t file) { hid_t dataset, space; hsize_t dims[2]; @@ -92,35 +227,21 @@ test_error(hid_t file) goto error; } - /* 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) + /* 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_ERROR; - /* Make H5Dwrite fail, verify default print is disabled */ + /* Make H5Dwrite fail, verify default printing 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; @@ -258,7 +379,13 @@ main(void) H5Eclear1(); /* Test error API */ - if(test_error(file) < 0) { +#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) { 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 52dcc0c..6a37b80 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -21,7 +21,7 @@ */ #include "h5test.h" -#ifdef H5_USE_16_API +#ifdef H5_USE_16_API_DEFAULT int main(void) { printf("Test skipped because backward compatbility with v1.6 is configured in\n"); @@ -127,13 +127,8 @@ 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 5675856..c674426 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -158,7 +158,7 @@ int main(void) { hid_t fapl; - H5E_auto2_t func; + H5E_auto_t func; char name[1024]; h5_reset(); @@ -178,8 +178,14 @@ 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)"); - H5Eget_auto2(H5E_DEFAULT,&func,NULL); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + +#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 */ h5_fixname(FILENAME[1], fapl, name, sizeof name); if(check_file(name, fapl, FALSE)) @@ -196,13 +202,23 @@ main(void) goto error; #endif } - H5Eset_auto2(H5E_DEFAULT, func, NULL); +#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 */ /* 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)"); - H5Eget_auto2(H5E_DEFAULT,&func,NULL); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + +#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 */ h5_fixname(FILENAME[2], fapl, name, sizeof name); if(check_file(name, fapl, TRUE)) @@ -220,7 +236,12 @@ main(void) #endif } - H5Eset_auto2(H5E_DEFAULT, func, NULL); +#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 */ + h5_cleanup(FILENAME, fapl); diff --git a/test/h5test.c b/test/h5test.c index 229efec..d02fea9 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -212,7 +212,11 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); - H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); +#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 */ /* * 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 7f9657a..440be4f 100644 --- a/test/testerror.sh.in +++ b/test/testerror.sh.in @@ -71,6 +71,8 @@ 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 032e7bc..f3d11a3 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 based on data I/O All error API tests passed. +Testing error API H5Eset/get_auto 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,6 +15,18 @@ 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 082a27f..f933d8b 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -135,7 +135,11 @@ 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. */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ /* * Record the program name and private routines if provided. diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index f55afdc..edc5c07 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -158,16 +158,24 @@ void *tts_error_thread(void UNUSED *arg) { hid_t dataspace, datatype, dataset; hsize_t dimsf[1]; /* dataset dimensions */ - H5E_auto2_t old_error_cb; + H5E_auto_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_auto2(H5E_DEFAULT, &old_error_cb, &old_error_client_data); + H5Eget_auto(&old_error_cb, &old_error_client_data); /* set each thread's error stack handler */ - H5Eset_auto2(H5E_DEFAULT, error_callback, NULL); + 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 */ /* define dataspace for dataset */ dimsf[0] = 1; @@ -193,7 +201,11 @@ void *tts_error_thread(void UNUSED *arg) assert(ret >= 0); /* turn our error stack handler off */ - H5Eset_auto2(H5E_DEFAULT, old_error_cb, old_error_client_data); +#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 */ return NULL; } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 261fe15..e304a41 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_auto2_t func; + H5E_auto_t func; H5O_info_t oi; struct handler_t *hand; int i; @@ -4324,8 +4324,13 @@ main(int argc, const char *argv[]) dump_function_table = &ddl_function_table; /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ /* Initialize h5tools lib */ h5tools_init(); @@ -4533,8 +4538,11 @@ done: HDfree(fname); /* To Do: clean up XML table */ - - H5Eset_auto2(H5E_DEFAULT, func, edata); +#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 */ leave(h5tools_getstatus()); } diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 17b1384..14d3f6a 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_auto2_t func; + H5E_auto_t func; hid_t ifile; hid_t plist; herr_t status; @@ -185,8 +185,13 @@ main (int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ parse_command_line (argc, argv); diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 8e31ce1..c5a337d 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_auto2_t func; + H5E_auto_t func; hid_t ifile; off_t fsize; hsize_t usize; @@ -183,8 +183,13 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ parse_command_line(argc, argv); diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index f1b6756..ba71712 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_auto2_t func; + H5E_auto_t func; hid_t ifile; hsize_t usize; htri_t testval; @@ -140,8 +140,13 @@ main (int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ parse_command_line (argc, argv); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index b1d9ee9..115a86c 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -2417,7 +2417,11 @@ main(int argc, const char *argv[]) /* Turn off HDF5's automatic error printing unless you're debugging h5ls */ if(!show_errors_g) - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ /* 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 fd21266..7cc098d 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -1544,7 +1544,11 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ /* Initialize h5tools lib */ h5tools_init(); diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 09f23ef..6d8a869 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -216,7 +216,12 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_SUCCESS); /* Disable the HDF5 library's error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +#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 */ + /* Initialize h5tools lib */ h5tools_init(); |