From 2599c231642879dad505291f7950d5bd796d80e1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Apr 2017 15:50:05 -0500 Subject: Change signature of H5PLget_size --- java/src/jni/h5plImp.c | 10 ++++------ src/H5PL.c | 18 ++++++++++-------- src/H5PLpublic.h | 12 ++++++------ test/plugin.c | 23 +++++++++++++++-------- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index 5a2d3ba..7ee1940 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -211,13 +211,11 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLsize (JNIEnv *env, jclass clss) { - int retVal = -1; - - retVal = H5PLsize(); - if (retVal < 0) + unsigned int listsize = 0; + if (H5PLget_loading_state(&listsize) < 0) { h5libraryError(env); - - return (jint)retVal; + } + return (jint)listsize; } /* end Java_hdf_hdf5lib_H5_H5PLsize */ #ifdef __cplusplus diff --git a/src/H5PL.c b/src/H5PL.c index 02c8f00..bc69a25 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -607,7 +607,7 @@ ssize_t H5PLget(unsigned int index, char *pathname/*out*/, size_t size) { ssize_t ret_value = 0; /* Return value */ - ssize_t len = 0; /* Length of pathname */ + size_t len = 0; /* Length of pathname */ char *dl_path = NULL; FUNC_ENTER_API(FAIL) @@ -626,7 +626,7 @@ H5PLget(unsigned int index, char *pathname/*out*/, size_t size) } /* end if */ /* Set return value */ - ret_value = len; + ret_value = (ssize_t)len; done: FUNC_LEAVE_API(ret_value) @@ -638,17 +638,19 @@ done: * * Purpose: Query the size of the current list of plugin paths. * - * Return: Plugin path size (can't indicate failure due to unsigned type) + * Return: Plugin path size * *------------------------------------------------------------------------- */ -unsigned int -H5PLsize(void) +herr_t +H5PLsize(unsigned int *listsize) { - unsigned int ret_value = (unsigned int)H5PL_num_paths_g; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "*Iu", listsize); - FUNC_ENTER_API(0) - H5TRACE0("Iu",""); + *listsize = (unsigned int)H5PL_num_paths_g; done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index fc638a0..9ce1fca 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -41,14 +41,14 @@ extern "C" { /* plugin state */ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_type); -H5_DLL herr_t H5PLget_loading_state(unsigned int* plugin_type/*out*/); -H5_DLL herr_t H5PLappend(const char* plugin_path); -H5_DLL herr_t H5PLprepend(const char* plugin_path); -H5_DLL herr_t H5PLreplace(const char* plugin_path, unsigned int index); -H5_DLL herr_t H5PLinsert(const char* plugin_path, unsigned int index); +H5_DLL herr_t H5PLget_loading_state(unsigned int *plugin_type/*out*/); +H5_DLL herr_t H5PLappend(const char *plugin_path); +H5_DLL herr_t H5PLprepend(const char *plugin_path); +H5_DLL herr_t H5PLreplace(const char *plugin_path, unsigned int index); +H5_DLL herr_t H5PLinsert(const char *plugin_path, unsigned int index); H5_DLL herr_t H5PLremove(unsigned int index); H5_DLL ssize_t H5PLget(unsigned int index, char *pathname/*out*/, size_t size); -H5_DLL unsigned int H5PLsize(void); +H5_DLL herr_t H5PLsize(unsigned int *listsize/*out*/); #ifdef __cplusplus } diff --git a/test/plugin.c b/test/plugin.c index ea22c68..8b4324d 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -731,7 +731,7 @@ test_filter_path_apis(void) if(H5Zfilter_avail(H5Z_FILTER_DYNLIB1) != TRUE) TEST_ERROR - ndx = H5PLsize(); + H5PLsize(&ndx); TESTING(" remove"); /* Remove all existing paths*/ @@ -741,7 +741,8 @@ test_filter_path_apis(void) TEST_ERROR } /* end if */ /* Verify the table is empty */ - if(H5PLsize() > 0) TEST_ERROR + H5PLsize(&ndx); + if(ndx > 0) TEST_ERROR PASSED(); TESTING(" remove (exceed min)"); @@ -762,7 +763,8 @@ test_filter_path_apis(void) } } /* Verify the table is full */ - if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR + H5PLsize(&ndx); + if(ndx != H5PL_MAX_PATH_NUM) TEST_ERROR PASSED(); TESTING(" append (exceed)"); @@ -833,7 +835,8 @@ test_filter_path_apis(void) PASSED(); /* Verify the table is not full */ - if (H5PLsize() != H5PL_MAX_PATH_NUM - 1) TEST_ERROR + H5PLsize(&ndx); + if (ndx != H5PL_MAX_PATH_NUM - 1) TEST_ERROR TESTING(" prepend"); /* Prepend one path*/ @@ -844,7 +847,8 @@ test_filter_path_apis(void) } /* Verify the table is full */ - if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR + H5PLsize(&ndx); + if(ndx != H5PL_MAX_PATH_NUM) TEST_ERROR /* Verify that the entries were moved */ if(H5PLget(8, pathname, 256) <= 0) TEST_ERROR @@ -878,7 +882,8 @@ test_filter_path_apis(void) } /* Verify the table is full */ - if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR + H5PLsize(&ndx); + if(ndx != H5PL_MAX_PATH_NUM) TEST_ERROR /* Verify that the entries were not moved */ if(H5PLget(0, pathname, 256) <= 0) TEST_ERROR @@ -907,7 +912,8 @@ test_filter_path_apis(void) PASSED(); /* Verify the table is not full */ - if(H5PLsize() != 15) TEST_ERROR + H5PLsize(&ndx); + if(ndx != 15) TEST_ERROR TESTING(" insert"); /* Insert one path*/ @@ -926,7 +932,8 @@ test_filter_path_apis(void) PASSED(); /* Verify the table is full */ - if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR + H5PLsize(&ndx); + if(ndx != H5PL_MAX_PATH_NUM) TEST_ERROR TESTING(" insert (exceed)"); /* Exceed the max path insert */ -- cgit v0.12