summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-09-30 16:20:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-09-30 16:20:46 (GMT)
commitc58d85f10eb0f7da7ac920b0655937f7521e9d8c (patch)
tree5920e9682efd3a548fa78ed67735efa153dfcef0 /test
parentc48165cb11b0cb9a06239a0268c1c97336ffe6fd (diff)
downloadhdf5-c58d85f10eb0f7da7ac920b0655937f7521e9d8c.zip
hdf5-c58d85f10eb0f7da7ac920b0655937f7521e9d8c.tar.gz
hdf5-c58d85f10eb0f7da7ac920b0655937f7521e9d8c.tar.bz2
[svn-r7527] Purpose:
Code cleanup Description: Clean up a few loose ends and warnings for the 1.6 compatibility changes to the error API. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to require h5committest
Diffstat (limited to 'test')
-rw-r--r--test/err_compat.c60
-rw-r--r--test/h5test.c9
-rw-r--r--test/lheap.c2
-rw-r--r--test/tmisc.c4
-rw-r--r--test/ttsafe_error.c10
5 files changed, 35 insertions, 50 deletions
diff --git a/test/err_compat.c b/test/err_compat.c
index fd84824..f06ca10 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -41,7 +41,7 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
#define DSET_NAME "a_dataset"
#define FAKE_ID -1
-herr_t custom_print_cb(unsigned n, const H5E_error_t *err_desc, void* client_data);
+herr_t custom_print_cb(int n, H5E_error_t *err_desc, void* client_data);
/*-------------------------------------------------------------------------
@@ -61,12 +61,10 @@ herr_t custom_print_cb(unsigned n, const H5E_error_t *err_desc, void* client_dat
*
*-------------------------------------------------------------------------
*/
-#ifndef TMP
static herr_t
test_error(hid_t file)
{
hid_t dataset, space;
- hid_t estack_id;
hsize_t dims[2];
const char *FUNC_test_error="test_error";
H5E_auto_t old_func;
@@ -94,7 +92,6 @@ test_error(hid_t file)
}
/* Test enabling and disabling default printing */
-#ifndef TMP
if (H5Eget_auto(&old_func, &old_data)<0)
TEST_ERROR;
if (old_data != NULL)
@@ -106,7 +103,6 @@ test_error(hid_t file)
if(H5Eset_auto(NULL, NULL)<0)
TEST_ERROR;
-#endif
/* Make H5Dwrite fail, verify default print is disabled */
if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) {
@@ -126,31 +122,6 @@ test_error(hid_t file)
error:
return -1;
}
-#endif
-
-
-/*-------------------------------------------------------------------------
- * Function: error_stack
- *
- * Purpose: Dummy function. Simply make it fail.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 14, 2003
- *
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-error_stack(void)
-{
- return -1;
-}
/*-------------------------------------------------------------------------
@@ -207,11 +178,11 @@ dump_error(void)
*-------------------------------------------------------------------------
*/
herr_t
-custom_print_cb(unsigned n, const H5E_error_t *err_desc, void* client_data)
+custom_print_cb(int n, H5E_error_t *err_desc, void* client_data)
{
FILE *stream = (FILE *)client_data;
- char *maj;
- char *min;
+ const char *maj;
+ const char *min;
const int indent = 4;
if((min = H5Eget_minor(err_desc->min_num))==NULL)
@@ -224,7 +195,9 @@ custom_print_cb(unsigned n, const H5E_error_t *err_desc, void* client_data)
indent, "", n, err_desc->file_name,
err_desc->func_name, err_desc->line);
fprintf (stream, "%*smajor: %s\n", indent*2, "", maj);
+ HDfree(maj);
fprintf (stream, "%*sminor: %s\n", indent*2, "", min);
+ HDfree(min);
return 0;
@@ -251,8 +224,6 @@ main(void)
hid_t file, fapl;
char filename[1024];
const char *FUNC_main="main";
- H5E_auto_t old_func;
- void *old_data;
fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n");
/*h5_reset();*/
@@ -263,17 +234,16 @@ main(void)
TEST_ERROR ;
/* Test error stack */
- if(error_stack()<0) {
- /* Push an error onto error stack */
- H5Epush(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE,
- "Error test failed");
-
- /* Print out the errors on stack */
- dump_error();
- /* Empty error stack */
- H5Eclear();
- }
+ /* Push an error onto error stack */
+ H5Epush(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE,
+ "Error test failed");
+
+ /* Print out the errors on stack */
+ dump_error();
+
+ /* Empty error stack */
+ H5Eclear();
/* Test error API */
if(test_error(file)<0) {
diff --git a/test/h5test.c b/test/h5test.c
index a3d4abf..1da5883 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -89,7 +89,11 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
*/
static const char *multi_letters = "msbrglo";
+#ifdef H5_WANT_H5_V1_6_COMPAT
+static herr_t h5_errors(void *client_data);
+#else /* H5_WANT_H5_V1_6_COMPAT */
static herr_t h5_errors(hid_t err_stack, void *client_data);
+#endif /* H5_WANT_H5_V1_6_COMPAT */
/*-------------------------------------------------------------------------
@@ -108,8 +112,13 @@ static herr_t h5_errors(hid_t err_stack, void *client_data);
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_6_COMPAT
+static herr_t
+h5_errors(void UNUSED *client_data)
+#else
static herr_t
h5_errors(hid_t err_stack, void UNUSED *client_data)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
H5_FAILED();
#ifdef H5_WANT_H5_V1_6_COMPAT
diff --git a/test/lheap.c b/test/lheap.c
index 9e70848..e1694ba 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -126,7 +126,7 @@ main(void)
goto error;
}
for (i=0; i<NOBJS; i++) {
- H5HL_t *heap = NULL;
+ const H5HL_t *heap = NULL;
sprintf(buf, "%03d-", i);
for (j=4; j<i; j++) buf[j] = '0' + j%10;
diff --git a/test/tmisc.c b/test/tmisc.c
index 19150d3..c1c3a50 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -2648,7 +2648,7 @@ test_misc16(void)
hid_t file; /* File ID */
herr_t ret; /* Generic return value */
const char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE] =
- {"1234567", "1234567\0", "12345678", NULL};
+ {"1234567", "1234567\0", "12345678", {NULL}};
char rdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; /* Information read in */
hid_t dataset; /* Dataset ID */
hid_t sid; /* Dataspace ID */
@@ -2729,7 +2729,7 @@ test_misc17(void)
hid_t file; /* File ID */
herr_t ret; /* Generic return value */
const char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2] =
- {"1234567", "1234567\0", "12345678", NULL};
+ {"1234567", "1234567\0", "12345678", {NULL}};
char rdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; /* Information read in */
hid_t dataset; /* Dataset ID */
hid_t sid; /* Dataspace ID */
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index ac54a50..2cf5a92 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -57,10 +57,11 @@
#ifdef H5_WANT_H5_V1_6_COMPAT
static herr_t error_callback(void *);
+static herr_t walk_error_callback(int, H5E_error_t *, void *);
#else /*H5_WANT_H5_V1_6_COMPAT*/
static herr_t error_callback(hid_t, void *);
+static herr_t walk_error_callback(unsigned, const H5E_error_t *, void *);
#endif /* H5_WANT_H5_V1_6_COMPAT */
-static herr_t walk_error_callback(unsigned, H5E_error_t *, void *);
static void *tts_error_thread(void *);
/* Global variables */
@@ -228,8 +229,13 @@ herr_t error_callback(hid_t estack, void *client_data)
}
#endif /* H5_WANT_H5_V1_6_COMPAT */
+#ifdef H5_WANT_H5_V1_6_COMPAT
+static
+herr_t walk_error_callback(int n, H5E_error_t *err_desc, void UNUSED *client_data)
+#else /* H5_WANT_H5_V1_6_COMPAT */
static
-herr_t walk_error_callback(unsigned n, H5E_error_t *err_desc, void UNUSED *client_data)
+herr_t walk_error_callback(unsigned n, const H5E_error_t *err_desc, void UNUSED *client_data)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
hid_t maj_num, min_num;