From 8277409a9b52049af6f18aa2a6688c85cebb7695 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 4 Apr 2013 15:57:59 -0500 Subject: [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) --- MANIFEST | 2 +- src/CMakeLists.txt | 2 +- src/H5PL.c | 58 ++++++++++++++++++------------------- src/H5PLextern.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5PLprivate.h | 7 +++-- src/H5PLpublic.h | 84 ------------------------------------------------------ src/H5Pocpl.c | 5 ++-- src/H5Z.c | 4 +-- src/Makefile.am | 2 +- src/Makefile.in | 2 +- src/hdf5.h | 1 - test/dynlib1.c | 25 ++++++++-------- test/dynlib2.c | 25 ++++++++-------- test/dynlib3.c | 18 ++++++------ test/plugin.c | 33 +++++++++------------ 15 files changed, 174 insertions(+), 178 deletions(-) create mode 100644 src/H5PLextern.h delete mode 100644 src/H5PLpublic.h diff --git a/MANIFEST b/MANIFEST index a1ae698..993c734 100644 --- a/MANIFEST +++ b/MANIFEST @@ -851,7 +851,7 @@ ./src/H5Ptest.c ./src/H5PL.c ./src/H5PLprivate.h -./src/H5PLpublic.h +./src/H5PLextern.h ./src/H5R.c ./src/H5Rdeprec.c ./src/H5Rpkg.h 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}" ) diff --git a/src/H5PL.c b/src/H5PL.c index ef470b7..07e90af 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -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/H5PLextern.h b/src/H5PLextern.h new file mode 100644 index 0000000..943e3aa --- /dev/null +++ b/src/H5PLextern.h @@ -0,0 +1,84 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic document set and is * + * linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * + * to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Raymond Lu + * 13 February 2013 + */ +#ifndef _H5PLextern_H +#define _H5PLextern_H + +/* Include HDF5 header */ +#include "hdf5.h" + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Plugin type */ +typedef enum H5PL_type_t { + H5PL_TYPE_ERROR = -1, /*error */ + H5PL_TYPE_FILTER = 0, /*filter */ + H5PL_TYPE_NONE = 1 /*this must be last! */ +} H5PL_type_t; + + +#ifdef H5_BUILT_AS_DYNAMIC_LIB + + #if defined (hdf5_EXPORTS) + /* hdf5 library imports from plugin */ + #if defined (_MSC_VER) /* MSVC Compiler Case */ + #define H5PLUGIN_DLL __declspec(dllimport) + #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ + #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) + #endif + #else + /* plugins always export */ + #if defined (_MSC_VER) /* MSVC Compiler Case */ + #define H5PLUGIN_DLL __declspec(dllexport) + #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ + #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) + #endif + #endif + +#elif defined(H5_BUILT_AS_STATIC_LIB) + #define H5PLUGIN_DLL +#else + + #if defined(H5_HAVE_WIN32_API) + #if defined(_HDF5DLL_) + #pragma warning(disable: 4273) /* Disable the dll linkage warnings */ + #define H5PLUGIN_DLL __declspec(dllimport) + #elif defined(_HDF5USEDLL_) + #define H5PLUGIN_DLL __declspec(dllexport) + #endif /* _HDF5DLL_ */ + #else /*H5_HAVE_WIN32_API*/ + #define H5PLUGIN_DLL + #endif /*H5_HAVE_WIN32_API*/ + +#endif /* H5_BUILT_AS_xxx_LIB */ + +#ifdef __cplusplus +extern "C" { +#endif + +H5PLUGIN_DLL H5PL_type_t H5PLget_plugin_type(void); +H5PLUGIN_DLL const void *H5PLget_plugin_info(void); + +#ifdef __cplusplus +} +#endif + +#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/H5PLpublic.h b/src/H5PLpublic.h deleted file mode 100644 index 9b71164..0000000 --- a/src/H5PLpublic.h +++ /dev/null @@ -1,84 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic document set and is * - * linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * - * to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Raymond Lu - * 13 February 2013 - */ -#ifndef _H5PLpublic_H -#define _H5PLpublic_H - -/* Public headers needed by this file */ -#include "H5Zpublic.h" - -/****************************/ -/* Library 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_t; - - -#ifdef H5_BUILT_AS_DYNAMIC_LIB - - #if defined (hdf5_EXPORTS) - /* hdf5 library imports from plugin */ - #if defined (_MSC_VER) /* MSVC Compiler Case */ - #define H5PLUGIN_DLL __declspec(dllimport) - #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #endif - #else - /* plugins always export */ - #if defined (_MSC_VER) /* MSVC Compiler Case */ - #define H5PLUGIN_DLL __declspec(dllexport) - #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #endif - #endif - -#elif defined(H5_BUILT_AS_STATIC_LIB) - #define H5PLUGIN_DLL -#else - - #if defined(H5_HAVE_WIN32_API) - #if defined(_HDF5DLL_) - #pragma warning(disable: 4273) /* Disable the dll linkage warnings */ - #define H5PLUGIN_DLL __declspec(dllimport) - #elif defined(_HDF5USEDLL_) - #define H5PLUGIN_DLL __declspec(dllexport) - #endif /* _HDF5DLL_ */ - #else /*H5_HAVE_WIN32_API*/ - #define H5PLUGIN_DLL - #endif /*H5_HAVE_WIN32_API*/ - -#endif /* H5_BUILT_AS_xxx_LIB */ - -#ifdef __cplusplus -extern "C" { -#endif - - H5PLUGIN_DLL H5PL_type_t H5PL_get_plugin_type(void); - H5PLUGIN_DLL H5Z_class2_t* H5PL_get_plugin_info(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _H5PLpublic_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") diff --git a/src/H5Z.c b/src/H5Z.c index 8095dce..9f8b59d 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -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 diff --git a/src/hdf5.h b/src/hdf5.h index c2e4866..a37329d 100644 --- a/src/hdf5.h +++ b/src/hdf5.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 */ diff --git a/test/dynlib1.c b/test/dynlib1.c index de14f6f..1ccc33a 100644 --- a/test/dynlib1.c +++ b/test/dynlib1.c @@ -20,7 +20,7 @@ #include #include -#include +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIB1 257 @@ -38,8 +38,8 @@ const H5Z_class2_t H5Z_DYNLIB1[1] = {{ (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ }}; -H5PL_type_t H5PL_get_plugin_type(void) {return H5PL_TYPE_FILTER;} -H5Z_class2_t* H5PL_get_plugin_info(void) {return H5Z_DYNLIB1;} +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} /*------------------------------------------------------------------------- * Function: H5Z_filter_dynlib1 @@ -63,34 +63,35 @@ H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - int *int_ptr=(int *)*buf; /* Pointer to the data values */ - size_t buf_left=*buf_size; /* Amount of data buffer left to process */ - int add_on = 0; + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + int add_on = 0; /* Check for the correct number of parameters */ - if(cd_nelmts==0) + if(cd_nelmts == 0) return(0); /* Check that permanent parameters are set correctly */ - if(cd_values[0]<0 || cd_values[0]>9) + if(cd_values[0] > 9) return(0); - add_on = cd_values[0]; + add_on = (int)cd_values[0]; if(flags & H5Z_FLAG_REVERSE) { /*read*/ /* Substract the "add on" value to all the data values */ - while(buf_left>0) { + while(buf_left > 0) { *int_ptr++ -= add_on; buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /*write*/ /* Add the "add on" value to all the data values */ - while(buf_left>0) { + while(buf_left > 0) { *int_ptr++ += add_on; buf_left -= sizeof(int); } /* end while */ } /* end else */ return nbytes; -} +} /* end H5Z_filter_dynlib1() */ + diff --git a/test/dynlib2.c b/test/dynlib2.c index 648f7e0..a853ed0 100644 --- a/test/dynlib2.c +++ b/test/dynlib2.c @@ -20,7 +20,7 @@ #include #include -#include +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIB2 258 #define MULTIPLIER 3 @@ -39,8 +39,8 @@ const H5Z_class2_t H5Z_DYNLIB2[1] = {{ (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */ }}; -H5PL_type_t H5PL_get_plugin_type(void) {return H5PL_TYPE_FILTER;} -H5Z_class2_t* H5PL_get_plugin_info(void) {return H5Z_DYNLIB2;} +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;} /*------------------------------------------------------------------------- * Function: H5Z_filter_dynlib2 @@ -64,29 +64,28 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - int *int_ptr=(int *)*buf; /* Pointer to the data values */ - size_t buf_left=*buf_size; /* Amount of data buffer left to process */ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ /* Check for the correct number of parameters */ - if(cd_nelmts>0) + if(cd_nelmts > 0) return(0); if(flags & H5Z_FLAG_REVERSE) { /*read*/ /* Divide the original value with MULTIPLIER */ - while(buf_left>0) { - *int_ptr /= MULTIPLIER; - *int_ptr++; + while(buf_left > 0) { + *int_ptr++ /= MULTIPLIER; buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /*write*/ /* Multiply the original value with MULTIPLIER */ - while(buf_left>0) { - *int_ptr *= MULTIPLIER; - *int_ptr++; + while(buf_left > 0) { + *int_ptr++ *= MULTIPLIER; buf_left -= sizeof(int); } /* end while */ } /* end else */ return nbytes; -} +} /* end H5Z_filter_dynlib2() */ + diff --git a/test/dynlib3.c b/test/dynlib3.c index 276a5b7..9560b86 100644 --- a/test/dynlib3.c +++ b/test/dynlib3.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include "H5PLextern.h" #define H5Z_FILTER_DYNLIB3 259 #define SUFFIX_LEN 8 @@ -41,8 +41,8 @@ const H5Z_class2_t H5Z_DYNLIB3[1] = {{ (H5Z_func_t)H5Z_filter_dynlib3, /* The actual filter function */ }}; -H5PL_type_t H5PL_get_plugin_type(void) {return H5PL_TYPE_FILTER;} -H5Z_class2_t* H5PL_get_plugin_info(void) {return H5Z_DYNLIB3;} +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB3;} /*------------------------------------------------------------------------- * Function: H5Z_filter_dynlib3 @@ -68,23 +68,24 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, size_t ret_value; /* Return value */ /* Check for the correct number of parameters */ - if(cd_nelmts>0) + if(cd_nelmts > 0) return(0); if(flags & H5Z_FLAG_REVERSE) { /*read*/ ret_value = *buf_size = nbytes - SUFFIX_LEN; - } else { /*write*/ + } /* end if */ + else { /*write*/ void *outbuf = NULL; /* Pointer to new buffer */ unsigned char *dst; /* Temporary pointer to destination buffer */ - dst=outbuf=malloc(nbytes+SUFFIX_LEN); + dst = (unsigned char *)(outbuf = malloc(nbytes + SUFFIX_LEN)); /* Copy raw data */ memcpy((void*)dst, (void*)(*buf), nbytes); /* Append suffix to raw data for storage */ dst += nbytes; - memcpy((void*)dst, (void*)GROUP_SUFFIX, SUFFIX_LEN); + memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN); /* Free input buffer */ free(*buf); @@ -97,4 +98,5 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, } /* end else */ return ret_value; -} +} /* H5Z_filter_dynlib3() */ + diff --git a/test/plugin.c b/test/plugin.c index b37cfa3..86bc952 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -34,9 +34,6 @@ #define H5Z_FILTER_DYNLIB2 258 #define H5Z_FILTER_DYNLIB3 259 -/* Bzip2 filter */ -#define H5Z_FILTER_BZIP2 307 - const char *FILENAME[] = { "plugin", NULL @@ -45,7 +42,6 @@ const char *FILENAME[] = { /* Dataset names for testing filters */ #define DSET_DEFLATE_NAME "deflate" -#define DSET_BZIP2_NAME "bzip2" #define DSET_DYNLIB1_NAME "dynlib1" #define DSET_DYNLIB2_NAME "dynlib2" @@ -156,7 +152,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) */ TESTING(" filters (write)"); - for(i=n=0; i