diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-11-27 20:20:36 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-11-27 20:20:36 (GMT) |
commit | 14ced87d62a3591126067ac00175504ef55bfaaa (patch) | |
tree | ee8630b97c4fe583c6caf5e03caccc8149e827bd /src/H5PLint.c | |
parent | 96784c9873433b57de813c5afadd5d9771103686 (diff) | |
parent | f116545ce465181928ca97214b9cfa87092a3ee9 (diff) | |
download | hdf5-14ced87d62a3591126067ac00175504ef55bfaaa.zip hdf5-14ced87d62a3591126067ac00175504ef55bfaaa.tar.gz hdf5-14ced87d62a3591126067ac00175504ef55bfaaa.tar.bz2 |
Merge branch 'develop' into bugfix/version_bounds
Merge from develop to keeep the branch up-to-date.
Diffstat (limited to 'src/H5PLint.c')
-rw-r--r-- | src/H5PLint.c | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/src/H5PLint.c b/src/H5PLint.c index c887f86..b190746 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -235,11 +235,11 @@ done: *------------------------------------------------------------------------- */ const void * -H5PL_load(H5PL_type_t type, int id) +H5PL_load(H5PL_type_t type, H5PL_key_t key) { - H5PL_search_params_t search_params; + H5PL_search_params_t search_params; /* Plugin search parameters */ hbool_t found = FALSE; /* Whether the plugin was found */ - const void *plugin_info = NULL; + const void *plugin_info = NULL; /* Information from the plugin */ const void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -248,18 +248,17 @@ H5PL_load(H5PL_type_t type, int id) switch (type) { case H5PL_TYPE_FILTER: if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled") break; - case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Invalid plugin type specified") } /* Set up the search parameters */ search_params.type = type; - search_params.id = id; + search_params.key.id = key.id; /* Search in the table of already loaded plugin libraries */ if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0) @@ -304,11 +303,11 @@ done: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" herr_t -H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const void **plugin_info) +H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info) { H5PL_HANDLE handle = NULL; H5PL_get_plugin_info_t get_plugin_info = NULL; - htri_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -326,35 +325,46 @@ H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const v */ if (NULL == (handle = H5PL_OPEN_DLIB(path))) { H5PL_CLR_ERROR; /* clear error */ - HGOTO_DONE(SUCCEED); + HGOTO_DONE(SUCCEED) } /* Return a handle for the function H5PLget_plugin_info in the dynamic library. * The plugin library is suppose to define this function. */ - if (NULL != (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info"))) { - - const H5Z_class2_t *info; + if (NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info"))) + HGOTO_DONE(SUCCEED) - /* Get the plugin info */ - if (NULL == (info = (const H5Z_class2_t *)(*get_plugin_info)())) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") + /* Get the plugin information */ + switch (type) { + case H5PL_TYPE_FILTER: + { + const H5Z_class2_t *filter_info; - /* Check if the filter IDs match */ - if (info->id == id) { + /* Get the plugin info */ + if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info)())) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin") - /* Store the plugin in the cache */ - if (H5PL__add_plugin(type, id, handle)) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache") + /* If the filter IDs match, we're done. Set the output parameters. */ + if (filter_info->id == key.id) { + *plugin_info = (const void *)filter_info; + *success = TRUE; + } - /* Set output parameters */ - *success = TRUE; - *plugin_info = (const void *)info; + break; } - } + case H5PL_TYPE_ERROR: + case H5PL_TYPE_NONE: + default: + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified") + } /* end switch */ + + /* If we found the correct plugin, store it in the cache */ + if (*success) + if (H5PL__add_plugin(type, key, handle)) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache") done: - if (!success && handle) + if (!(*success) && handle) if (H5PL__close(handle) < 0) HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") |