diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2013-04-04 20:57:59 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2013-04-04 20:57:59 (GMT) |
commit | 8277409a9b52049af6f18aa2a6688c85cebb7695 (patch) | |
tree | 74f743b0b6a3ccb5c7a2b97f26c8c4ff07310fd3 /src | |
parent | 70e0f8e200cec594ae5340a3210f349d5f2e63ed (diff) | |
download | hdf5-8277409a9b52049af6f18aa2a6688c85cebb7695.zip hdf5-8277409a9b52049af6f18aa2a6688c85cebb7695.tar.gz hdf5-8277409a9b52049af6f18aa2a6688c85cebb7695.tar.bz2 |
[svn-r23549] Description:
More misc. cleanups, but main change is to make an "extern" header file
for the plugin interface.
Tested on:
Mac OSX/64 10.8.3 (amazon)
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/H5PL.c | 58 | ||||
-rw-r--r-- | src/H5PLextern.h (renamed from src/H5PLpublic.h) | 24 | ||||
-rw-r--r-- | src/H5PLprivate.h | 7 | ||||
-rw-r--r-- | src/H5Pocpl.c | 5 | ||||
-rw-r--r-- | src/H5Z.c | 4 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/Makefile.in | 2 | ||||
-rw-r--r-- | src/hdf5.h | 1 |
9 files changed, 52 insertions, 53 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4b70259..7132d80 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -482,7 +482,7 @@ SET (H5PL_SRCS ) SET (H5PL_HDRS - ${HDF5_SRC_DIR}/H5PLpublic.h + ${HDF5_SRC_DIR}/H5PLextern.h ) IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SRCS}" ) @@ -61,7 +61,7 @@ /* Clear error - nothing to do */ #define H5PL_CLR_ERROR -typedef const H5Z_class2_t *(__cdecl *H5PL_get_filter_info_t)(void); +typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); /* Unix support */ #else /* H5_HAVE_WIN32_API */ @@ -84,7 +84,7 @@ typedef const H5Z_class2_t *(__cdecl *H5PL_get_filter_info_t)(void); /* Clear error */ #define H5PL_CLR_ERROR dlerror() -typedef const H5Z_class2_t *(*H5PL_get_filter_info_t)(void); +typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ /* Special symbol to indicate no plugin loading */ @@ -107,9 +107,9 @@ typedef struct H5PL_table_t { /********************/ static herr_t H5PL__init_path_table(void); -static htri_t H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, void **info); -static htri_t H5PL__open(H5PL_type_t pl_type, char *libname, int plugin_id, void **pl_info); -static htri_t H5PL__search_table(H5PL_type_t plugin_type, int type_id, void **info); +static htri_t H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info); +static htri_t H5PL__open(H5PL_type_t pl_type, char *libname, int plugin_id, const void **pl_info); +static htri_t H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info); static herr_t H5PL__close(H5PL_HANDLE handle); @@ -193,7 +193,7 @@ H5PL_no_plugin(void) FUNC_ENTER_NOAPI(FAIL) - ret_value = H5PL_no_plugin_g; + ret_value = (htri_t)H5PL_no_plugin_g; done: FUNC_LEAVE_NOAPI(ret_value) @@ -264,12 +264,12 @@ H5PL_term_interface(void) * *------------------------------------------------------------------------- */ -void * +const void * H5PL_load(H5PL_type_t type, int id) { - htri_t found; /* Whether the plugin was found */ - H5Z_class2_t *plugin_info = NULL; - void *ret_value = NULL; + htri_t found; /* Whether the plugin was found */ + const void *plugin_info = NULL; + const void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -281,7 +281,7 @@ H5PL_load(H5PL_type_t type, int id) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINIT, NULL, "can't initialize search path table") /* Search in the table of already loaded plugin libraries */ - if((found = H5PL__search_table(type, id, (void **)&plugin_info)) < 0) + if((found = H5PL__search_table(type, id, &plugin_info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in table failed") /* If not found, iterate through the path table to find the right dynamic library */ @@ -289,7 +289,7 @@ H5PL_load(H5PL_type_t type, int id) size_t i; /* Local index variable */ for(i = 0; i < H5PL_num_paths_g; i++) { - if((found = H5PL__find(type, id, H5PL_path_table_g[i], (void **)&plugin_info)) < 0) + if((found = H5PL__find(type, id, H5PL_path_table_g[i], &plugin_info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in paths failed") /* Break out if found */ @@ -383,7 +383,7 @@ done: */ #ifndef H5_HAVE_WIN32_API static htri_t -H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, void **info) +H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) { char *pathname = NULL; DIR *dirp = NULL; @@ -445,7 +445,7 @@ done: } /* end H5PL__find() */ #else /* H5_HAVE_WIN32_API */ static htri_t -H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, void **info) +H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) { WIN32_FIND_DATA fdFile; HANDLE hFind; @@ -518,7 +518,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, void **pl_info) +H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info) { H5PL_HANDLE handle = NULL; htri_t ret_value = FALSE; @@ -532,22 +532,22 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, void **pl_info) H5PL_CLR_ERROR; /* clear error */ } /* end if */ else { - H5PL_get_filter_info_t get_plugin_info = NULL; + H5PL_get_plugin_info_t get_plugin_info = NULL; - /* Return a handle for the function H5PL_get_plugin_info in the dynamic library. + /* 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_filter_info_t)H5PL_GET_LIB_FUNC(handle, "H5PL_get_plugin_info"))) { + if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info"))) { if(H5PL__close(handle) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") } /* end if */ else { - H5Z_class2_t *plugin_info; + const H5Z_class2_t *plugin_info; - /* Invoke H5PL_get_plugin_info to verify this is the right library we are looking for. + /* Invoke H5PLget_plugin_info to verify this is the right library we are looking for. * Move on if it isn't. */ - if(NULL == (plugin_info = (*get_plugin_info)())) { + if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) { if(H5PL__close(handle) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") @@ -573,7 +573,7 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, void **pl_info) H5PL_table_used_g++; /* Set the plugin info to return */ - *pl_info = (void *)plugin_info; + *pl_info = (const void *)plugin_info; /* Indicate success */ ret_value = TRUE; @@ -605,7 +605,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5PL__search_table(H5PL_type_t plugin_type, int type_id, void **info) +H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) { htri_t ret_value = FALSE; @@ -617,16 +617,16 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, void **info) for(i = 0; i < H5PL_table_used_g; i++) { if((plugin_type == (H5PL_table_g[i]).pl_type) && (type_id == (H5PL_table_g[i]).pl_id)) { - H5PL_get_filter_info_t get_plugin_info; - H5Z_class2_t *plugin_info; + H5PL_get_plugin_info_t get_plugin_info; + const H5Z_class2_t *plugin_info; - if(NULL == (get_plugin_info = (H5PL_get_filter_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PL_get_plugin_info"))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PL_get_plugin_info") + if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PLget_plugin_info"))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") - if(NULL == (plugin_info = (*get_plugin_info)())) + if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info") - *info = (void *)plugin_info; + *info = plugin_info; HGOTO_DONE(TRUE) } /* end if */ } /* end for */ diff --git a/src/H5PLpublic.h b/src/H5PLextern.h index 9b71164..943e3aa 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLextern.h @@ -16,22 +16,21 @@ * Programmer: Raymond Lu <songyulu@hdfgroup.org> * 13 February 2013 */ -#ifndef _H5PLpublic_H -#define _H5PLpublic_H +#ifndef _H5PLextern_H +#define _H5PLextern_H -/* Public headers needed by this file */ -#include "H5Zpublic.h" +/* Include HDF5 header */ +#include "hdf5.h" -/****************************/ -/* Library Public Typedefs */ -/****************************/ +/*******************/ +/* Public Typedefs */ +/*******************/ /* Plugin type */ typedef enum H5PL_type_t { H5PL_TYPE_ERROR = -1, /*error */ H5PL_TYPE_FILTER = 0, /*filter */ - H5PL_TYPE_VFD = 1, /*virtual file driver */ - H5PL_TYPE_NONE = 2 /*this must be last! */ + H5PL_TYPE_NONE = 1 /*this must be last! */ } H5PL_type_t; @@ -74,11 +73,12 @@ typedef enum H5PL_type_t { extern "C" { #endif - H5PLUGIN_DLL H5PL_type_t H5PL_get_plugin_type(void); - H5PLUGIN_DLL H5Z_class2_t* H5PL_get_plugin_info(void); +H5PLUGIN_DLL H5PL_type_t H5PLget_plugin_type(void); +H5PLUGIN_DLL const void *H5PLget_plugin_info(void); #ifdef __cplusplus } #endif -#endif /* _H5PLpublic_H */ +#endif /* _H5PLextern_H */ + diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 037a3ec..b117613 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -19,8 +19,8 @@ #ifndef _H5PLprivate_H #define _H5PLprivate_H -/* Include package's public header */ -#include "H5PLpublic.h" +/* Include package's "external" header */ +#include "H5PLextern.h" /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ @@ -46,7 +46,8 @@ /***************************************/ /* Internal API routines */ -H5_DLL void *H5PL_load(H5PL_type_t plugin_type, int type_id); +H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, int type_id); H5_DLL htri_t H5PL_no_plugin(void); #endif /* _H5PLprivate_H */ + diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 82c4b5d..880b46a 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -752,7 +752,6 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { H5P_genplist_t *plist; /* Property list */ - H5O_pline_t pline; /* Filter pipeline */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) @@ -830,9 +829,9 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, /* If filter is not available, try to dynamically load it */ if(!filter_avail) { - H5Z_class2_t *filter_info; + const H5Z_class2_t *filter_info; - if(NULL == (filter_info = (H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)filter))) + if(NULL == (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)filter))) HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, FAIL, "failed to load dynamically loaded plugin") if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") @@ -1126,10 +1126,10 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, if(H5PL_no_plugin()) issue_error = TRUE; else { - H5Z_class2_t *filter_info; + const H5Z_class2_t *filter_info; /* Try loading the filter */ - if(NULL != (filter_info = (H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { /* Register the filter we loaded */ if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") diff --git a/src/Makefile.am b/src/Makefile.am index a7f7bd9..5f383e0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,7 +119,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5FDmulti.h H5FDsec2.h H5FDstdio.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ - H5PLpublic.h \ + H5PLextern.h \ H5Rpublic.h H5Spublic.h \ H5Tpublic.h H5Zpublic.h diff --git a/src/Makefile.in b/src/Makefile.in index 5f3b2c4..e2495a1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -616,7 +616,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5FDmulti.h H5FDsec2.h H5FDstdio.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ - H5PLpublic.h \ + H5PLextern.h \ H5Rpublic.h H5Spublic.h \ H5Tpublic.h H5Zpublic.h @@ -34,7 +34,6 @@ #include "H5MMpublic.h" /* Memory management */ #include "H5Opublic.h" /* Object headers */ #include "H5Ppublic.h" /* Property lists */ -#include "H5PLpublic.h" /* Plugin */ #include "H5Rpublic.h" /* References */ #include "H5Spublic.h" /* Dataspaces */ #include "H5Tpublic.h" /* Datatypes */ |