summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2016-12-07 16:05:42 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2016-12-07 16:05:42 (GMT)
commit286e0d744d970777284b616e8ec9e7c96344ac66 (patch)
tree102dc026ed2a22505b57af732ed6d560616f0588 /test
parenteb3e1c2192193c9a97d49ae06d96972272319efc (diff)
downloadhdf5-286e0d744d970777284b616e8ec9e7c96344ac66.zip
hdf5-286e0d744d970777284b616e8ec9e7c96344ac66.tar.gz
hdf5-286e0d744d970777284b616e8ec9e7c96344ac66.tar.bz2
HDFFV-10046 Add callback functions to plugin test
Diffstat (limited to 'test')
-rw-r--r--test/dynlib4.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/test/dynlib4.c b/test/dynlib4.c
index 8da0270..316962a 100644
--- a/test/dynlib4.c
+++ b/test/dynlib4.c
@@ -25,6 +25,8 @@
static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+herr_t H5Z_filter_can_apply(hid_t dcpl, hid_t type, hid_t space);
+herr_t H5Z_filter_set_local(hid_t dcpl, hid_t type, hid_t space);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB4[1] = {{
@@ -32,14 +34,41 @@ const H5Z_class2_t H5Z_DYNLIB4[1] = {{
H5Z_FILTER_DYNLIB4, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
"dynlib4", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
+ (H5Z_can_apply_func_t)(H5Z_filter_can_apply), /* The "can apply" callback */
+ (H5Z_set_local_func_t)(H5Z_filter_set_local), /* The "set local" callback */
(H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
}};
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
+herr_t H5Z_filter_can_apply(hid_t dcpl, hid_t type, hid_t space) {
+ H5I_type_t dcpl_type;
+
+ dcpl_type = H5Iget_type(dcpl);
+ if (dcpl_type < 0) {
+ PUSH_ERR("H5Z_filter_can_apply", H5E_CALLBACK, "dcpl not valid");
+ return -1;
+ }
+
+ return 1;
+}
+
+herr_t H5Z_filter_set_local(hid_t dcpl, hid_t type, hid_t space) {
+ herr_t r;
+ unsigned int flags;
+ size_t nelements = 4;
+ unsigned int values[] = {0,0,0,0};
+
+ r = H5Pget_filter_by_id2(dcpl, H5Z_FILTER_DYNLIB4, &flags, &nelements, values, 0, NULL, NULL);
+ if (r < 0) {
+ PUSH_ERR("H5Z_filter_set_local", H5E_CALLBACK, "dcpl fails get_filter_by_id2");
+ return -1;
+ }
+
+ return 1;
+}
+
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib4
*