summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-04-20 19:12:19 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-04-20 19:12:19 (GMT)
commit8c074d5c03ccecf3c133208fdc603d55774e880a (patch)
tree3520d740df8cc3644de5b08244b7628a6d07712c
parentb8036fc5f6db4b6ddd528e741697224db7aba23a (diff)
downloadhdf5-8c074d5c03ccecf3c133208fdc603d55774e880a.zip
hdf5-8c074d5c03ccecf3c133208fdc603d55774e880a.tar.gz
hdf5-8c074d5c03ccecf3c133208fdc603d55774e880a.tar.bz2
[svn-r16807] Purpose: Fix bug 1533
Description: Previously, there was no versioning for H5Z_class_t. This prevented applications written for 1.6 using custom filters from being able to use the 1.8 library. There is now an H5Z_class1_t and H5Z_class2_t to enable compatibility. H5Zregister is *not* versioned, it determines which version of the struct has been passed in by the value of the first field (id or version, both are ints). Tested: jam, linew, smirom (h5committest), jam (--with-default-api-version=v16)
-rw-r--r--c++/test/dsets.cpp2
-rw-r--r--c++/test/tfilter.cpp2
-rw-r--r--perform/chunk.c2
-rw-r--r--release_docs/RELEASE.txt2
-rw-r--r--src/H5Opline.c4
-rw-r--r--src/H5Pdcpl.c2
-rw-r--r--src/H5Z.c66
-rw-r--r--src/H5Zdeflate.c2
-rw-r--r--src/H5Zfletcher32.c2
-rw-r--r--src/H5Znbit.c2
-rw-r--r--src/H5Zpkg.h14
-rw-r--r--src/H5Zprivate.h5
-rw-r--r--src/H5Zpublic.h26
-rw-r--r--src/H5Zscaleoffset.c2
-rw-r--r--src/H5Zshuffle.c2
-rw-r--r--src/H5Zszip.c2
-rw-r--r--src/H5trace.c2
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h16
-rw-r--r--test/dsets.c45
-rw-r--r--tools/h5dump/h5dumpgentest.c2
21 files changed, 151 insertions, 52 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 319f894..6a5f223 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -352,7 +352,7 @@ test_tconv( H5File& file)
} // test_tconv
/* This message derives from H5Z */
-const H5Z_class_t H5Z_BOGUS[1] = {{
+const H5Z_class2_t H5Z_BOGUS[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
H5Z_FILTER_BOGUS, /* Filter id number */
1, 1, /* Encode and decode enabled */
diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp
index 2f87feb..1d3cec2 100644
--- a/c++/test/tfilter.cpp
+++ b/c++/test/tfilter.cpp
@@ -60,7 +60,7 @@ static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl,
static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
-const H5Z_class_t H5Z_BOGUS[1] = {{
+const H5Z_class2_t H5Z_BOGUS[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_BOGUS, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
diff --git a/perform/chunk.c b/perform/chunk.c
index 2777da0..a3c11c1 100644
--- a/perform/chunk.c
+++ b/perform/chunk.c
@@ -83,7 +83,7 @@ counter (unsigned UNUSED flags, size_t cd_nelmts,
size_t *buf_size, void **buf);
/* This message derives from H5Z */
-const H5Z_class_t H5Z_COUNTER[1] = {{
+const H5Z_class2_t H5Z_COUNTER[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
FILTER_COUNTER, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 1802d27..b2c0bd3 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -162,6 +162,8 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
+ - Added versioning to H5Z_class_t struct to allow compatibility with 1.6
+ API. (NAF - 2009/04/20 - 1533)
- Fixed a problem with using data transforms with non-native types in the
file. (NAF - 2009/04/20 - 1548)
- Added direct.h include file to windows section of H5private.h
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 20a9d26..070ab87 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -273,7 +273,7 @@ H5O_pline_encode(H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg)
name = NULL;
} /* end if */
else {
- H5Z_class_t *cls; /* Filter class */
+ H5Z_class2_t *cls; /* Filter class */
/*
* Get the filter name. If the pipeline message has a name in it then
@@ -453,7 +453,7 @@ H5O_pline_size(const H5F_t UNUSED *f, const void *mesg)
if(pline->version > H5O_PLINE_VERSION_1 && pline->filter[i].id < H5Z_FILTER_RESERVED)
name_len = 0;
else {
- H5Z_class_t *cls; /* Filter class */
+ H5Z_class2_t *cls; /* Filter class */
/* Get the name of the filter, same as done with H5O_pline_encode() */
if(NULL == (name = pline->filter[i].name) && (cls = H5Z_find(pline->filter[i].id)))
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 43696fc..c64a70b 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1555,7 +1555,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
/* If there's no name on the filter, use the class's filter name */
if(!s) {
- H5Z_class_t *cls = H5Z_find(filter->id);
+ H5Z_class2_t *cls = H5Z_find(filter->id);
if(cls)
s = cls->name;
diff --git a/src/H5Z.c b/src/H5Z.c
index 4df6abd..80382f4 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -53,7 +53,7 @@ typedef enum {
/* Local variables */
static size_t H5Z_table_alloc_g = 0;
static size_t H5Z_table_used_g = 0;
-static H5Z_class_t *H5Z_table_g = NULL;
+static H5Z_class2_t *H5Z_table_g = NULL;
#ifdef H5Z_DEBUG
static H5Z_stats_t *H5Z_stat_table_g = NULL;
#endif /* H5Z_DEBUG */
@@ -191,7 +191,7 @@ H5Z_term_interface(void)
}
#endif /* H5Z_DEBUG */
/* Free the table of filters */
- H5Z_table_g = (H5Z_class_t *)H5MM_xfree(H5Z_table_g);
+ H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g);
#ifdef H5Z_DEBUG
H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g);
#endif /* H5Z_DEBUG */
@@ -220,32 +220,56 @@ H5Z_term_interface(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5Zregister(const H5Z_class_t *cls)
+H5Zregister(const void *cls)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ const H5Z_class2_t *cls_real = (const H5Z_class2_t *) cls; /* "Real" class pointer */
+ H5Z_class2_t cls_new; /* Translated class struct */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Zregister, FAIL)
H5TRACE1("e", "*Zc", cls);
/* Check args */
- if (cls==NULL)
+ if (cls_real==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class")
/* Check H5Z_class_t version number; this is where a function to convert
* from an outdated version should be called.
+ *
+ * If the version number is invalid, we assume that the target of cls is the
+ * old style "H5Z_class1_t" structure, which did not contain a version
+ * field. In this structure, the first field is the id. Since both version
+ * and id are integers they will have the same value, and since id must be
+ * at least 256, there should be no overlap and the version of the struct
+ * can be determined by the value of the first field.
*/
- if(cls->version != H5Z_CLASS_T_VERS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number");
+ if(cls_real->version != H5Z_CLASS_T_VERS) {
+ /* Assume it is an old "H5Z_class1_t" instead */
+ const H5Z_class1_t *cls_old = (const H5Z_class1_t *) cls;
+
+ /* Translate to new H5Z_class2_t */
+ cls_new.version = H5Z_CLASS_T_VERS;
+ cls_new.id = cls_old->id;
+ cls_new.encoder_present = 1;
+ cls_new.decoder_present = 1;
+ cls_new.name = cls_old->name;
+ cls_new.can_apply = cls_old->can_apply;
+ cls_new.set_local = cls_old->set_local;
+ cls_new.filter = cls_old->filter;
+
+ /* Set cls_real to point to the translated structure */
+ cls_real = &cls_new;
+ } /* end if */
- if (cls->id<0 || cls->id>H5Z_FILTER_MAX)
+ if (cls_real->id<0 || cls_real->id>H5Z_FILTER_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
- if (cls->id<H5Z_FILTER_RESERVED)
+ if (cls_real->id<H5Z_FILTER_RESERVED)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
- if (cls->filter==NULL)
+ if (cls_real->filter==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified")
/* Do it */
- if (H5Z_register (cls)<0)
+ if (H5Z_register (cls_real)<0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
done:
@@ -269,7 +293,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Z_register (const H5Z_class_t *cls)
+H5Z_register (const H5Z_class2_t *cls)
{
size_t i;
herr_t ret_value = SUCCEED; /* Return value */
@@ -288,7 +312,7 @@ H5Z_register (const H5Z_class_t *cls)
if(i >= H5Z_table_used_g) {
if(H5Z_table_used_g >= H5Z_table_alloc_g) {
size_t n = MAX(H5Z_MAX_NFILTERS, 2*H5Z_table_alloc_g);
- H5Z_class_t *table = (H5Z_class_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class_t));
+ H5Z_class2_t *table = (H5Z_class2_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
H5Z_stats_t *stat_table = (H5Z_stats_t *)H5MM_realloc(H5Z_stat_table_g, n * sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
@@ -305,7 +329,7 @@ H5Z_register (const H5Z_class_t *cls)
/* Initialize */
i = H5Z_table_used_g++;
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class_t));
+ HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
@@ -313,7 +337,7 @@ H5Z_register (const H5Z_class_t *cls)
/* Filter already registered */
else {
/* Replace old contents */
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class_t));
+ HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
} /* end else */
done:
@@ -394,7 +418,7 @@ H5Z_unregister (H5Z_filter_t id)
/* Remove filter from table */
/* Don't worry about shrinking table size (for now) */
- HDmemmove(&H5Z_table_g[i],&H5Z_table_g[i+1],sizeof(H5Z_class_t)*((H5Z_table_used_g-1)-i));
+ HDmemmove(&H5Z_table_g[i],&H5Z_table_g[i+1],sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-i));
#ifdef H5Z_DEBUG
HDmemmove(&H5Z_stat_table_g[i],&H5Z_stat_table_g[i+1],sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-i));
#endif /* H5Z_DEBUG */
@@ -516,7 +540,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
/* Iterate over filters */
for(u = 0; u < dcpl_pline.nused; u++) {
- H5Z_class_t *fclass; /* Individual filter information */
+ H5Z_class2_t *fclass; /* Individual filter information */
/* Get filter information */
if(NULL == (fclass = H5Z_find(dcpl_pline.filter[u].id))) {
@@ -890,11 +914,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5Z_class_t *
+H5Z_class2_t *
H5Z_find(H5Z_filter_t id)
{
int idx; /* Filter index in global table */
- H5Z_class_t *ret_value=NULL; /* Return value */
+ H5Z_class2_t *ret_value=NULL; /* Return value */
FUNC_ENTER_NOAPI(H5Z_find, NULL)
@@ -946,7 +970,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
{
size_t i, idx, new_nbytes;
int fclass_idx; /* Index of filter class in global table */
- H5Z_class_t *fclass=NULL; /* Filter class pointer */
+ H5Z_class2_t *fclass=NULL; /* Filter class pointer */
#ifdef H5Z_DEBUG
H5Z_stats_t *fstats=NULL; /* Filter stats pointer */
H5_timer_t timer;
@@ -1242,7 +1266,7 @@ done:
herr_t
H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
{
- H5Z_class_t *fclass;
+ H5Z_class2_t *fclass;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Zget_filter_info, FAIL)
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index 56b910b..7cda2c8 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -37,7 +37,7 @@ static size_t H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
-const H5Z_class_t H5Z_DEFLATE[1] = {{
+const H5Z_class2_t H5Z_DEFLATE[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DEFLATE, /* Filter id number */
1, /* encoder_present flag (set to true) */
diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c
index aa3a173..e3a77bd 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -34,7 +34,7 @@ static size_t H5Z_filter_fletcher32 (unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
-const H5Z_class_t H5Z_FLETCHER32[1] = {{
+const H5Z_class2_t H5Z_FLETCHER32[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_FLETCHER32, /* Filter id number */
1, /* encoder_present flag (set to true) */
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 97a00f0..6f090c3 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -80,7 +80,7 @@ static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned c
size_t *buffer_size, const unsigned parms[]);
/* This message derives from H5Z */
-H5Z_class_t H5Z_NBIT[1] = {{
+H5Z_class2_t H5Z_NBIT[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_NBIT, /* Filter id number */
1, /* Assume encoder present: check before registering */
diff --git a/src/H5Zpkg.h b/src/H5Zpkg.h
index 9cd126e..ae33def 100644
--- a/src/H5Zpkg.h
+++ b/src/H5Zpkg.h
@@ -42,46 +42,46 @@
/*
* Deflate filter
*/
-H5_DLLVAR const H5Z_class_t H5Z_DEFLATE[1];
+H5_DLLVAR const H5Z_class2_t H5Z_DEFLATE[1];
#endif /* H5_HAVE_FILTER_DEFLATE */
#ifdef H5_HAVE_FILTER_SHUFFLE
/*
* Shuffle filter
*/
-H5_DLLVAR const H5Z_class_t H5Z_SHUFFLE[1];
+H5_DLLVAR const H5Z_class2_t H5Z_SHUFFLE[1];
#endif /* H5_HAVE_FILTER_SHUFFLE */
#ifdef H5_HAVE_FILTER_FLETCHER32
/*
* Fletcher32 filter
*/
-H5_DLLVAR const H5Z_class_t H5Z_FLETCHER32[1];
+H5_DLLVAR const H5Z_class2_t H5Z_FLETCHER32[1];
#endif /* H5_HAVE_FILTER_FLETCHER32 */
#ifdef H5_HAVE_FILTER_SZIP
/*
* szip filter
*/
-H5_DLLVAR H5Z_class_t H5Z_SZIP[1];
+H5_DLLVAR H5Z_class2_t H5Z_SZIP[1];
#endif /* H5_HAVE_FILTER_SZIP */
#ifdef H5_HAVE_FILTER_NBIT
/*
* nbit filter
*/
-H5_DLLVAR H5Z_class_t H5Z_NBIT[1];
+H5_DLLVAR H5Z_class2_t H5Z_NBIT[1];
#endif /* H5_HAVE_FILTER_NBIT */
#ifdef H5_HAVE_FILTER_SCALEOFFSET
/*
* scaleoffset filter
*/
-H5_DLLVAR H5Z_class_t H5Z_SCALEOFFSET[1];
+H5_DLLVAR H5Z_class2_t H5Z_SCALEOFFSET[1];
#endif /* H5_HAVE_FILTER_SCALEOFFSET */
/* Package-local function prototypes */
-H5_DLL void H5Z_update_class_vers(H5Z_class_t * old_vers, H5Z_class_t * curr_vers);
+H5_DLL void H5Z_update_class_vers(H5Z_class2_t * old_vers, H5Z_class2_t * curr_vers);
#endif /* _H5Zpkg_H */
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index 15b7289..3ce0a0c 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -72,7 +72,8 @@ typedef struct {
struct H5O_pline_t; /*forward decl*/
/* Internal API routines */
-H5_DLL herr_t H5Z_register(const H5Z_class_t *cls);
+H5_DLL herr_t H5Z_init(void);
+H5_DLL herr_t H5Z_register(const H5Z_class2_t *cls);
H5_DLL herr_t H5Z_unregister(H5Z_filter_t id);
H5_DLL herr_t H5Z_append(struct H5O_pline_t *pline, H5Z_filter_t filter,
unsigned flags, size_t cd_nelmts, const unsigned int cd_values[]);
@@ -83,7 +84,7 @@ H5_DLL herr_t H5Z_pipeline(const struct H5O_pline_t *pline,
H5Z_EDC_t edc_read, H5Z_cb_t cb_struct,
size_t *nbytes/*in,out*/, size_t *buf_size/*in,out*/,
void **buf/*in,out*/);
-H5_DLL H5Z_class_t *H5Z_find(H5Z_filter_t id);
+H5_DLL H5Z_class2_t *H5Z_find(H5Z_filter_t id);
H5_DLL herr_t H5Z_can_apply(hid_t dcpl_id, hid_t type_id);
H5_DLL herr_t H5Z_set_local(hid_t dcpl_id, hid_t type_id);
H5_DLL H5Z_filter_info_t *H5Z_filter_info(const struct H5O_pline_t *pline,
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index ce60650..44d2bbb 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -206,7 +206,7 @@ typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts,
* The filter table maps filter identification numbers to structs that
* contain a pointers to the filter function and timing statistics.
*/
-typedef struct H5Z_class_t {
+typedef struct H5Z_class2_t {
int version; /* Version number of the H5Z_class_t struct */
H5Z_filter_t id; /* Filter ID number */
unsigned encoder_present; /* Does this filter have an encoder? */
@@ -215,13 +215,33 @@ typedef struct H5Z_class_t {
H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */
H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */
H5Z_func_t filter; /* The actual filter function */
-} H5Z_class_t;
+} H5Z_class2_t;
-H5_DLL herr_t H5Zregister(const H5Z_class_t *cls);
+H5_DLL herr_t H5Zregister(const void *cls);
H5_DLL herr_t H5Zunregister(H5Z_filter_t id);
H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id);
H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags);
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*
+ * The filter table maps filter identification numbers to structs that
+ * contain a pointers to the filter function and timing statistics.
+ */
+typedef struct H5Z_class1_t {
+ H5Z_filter_t id; /* Filter ID number */
+ const char *name; /* Comment for debugging */
+ H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */
+ H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */
+ H5Z_func_t filter; /* The actual filter function */
+} H5Z_class1_t;
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 10618c3..d59499c 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -80,7 +80,7 @@ static void H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, uns
size_t buffer_size, parms_atomic p);
/* This message derives from H5Z */
-H5Z_class_t H5Z_SCALEOFFSET[1] = {{
+H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_SCALEOFFSET, /* Filter id number */
1, /* Assume encoder present: check before registering */
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c
index 3f40707..2e4f1fa 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -32,7 +32,7 @@ static size_t H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
-const H5Z_class_t H5Z_SHUFFLE[1] = {{
+const H5Z_class2_t H5Z_SHUFFLE[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_SHUFFLE, /* Filter id number */
1, /* encoder_present flag (set to true) */
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index b40c028..5da92ac 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -40,7 +40,7 @@ static size_t H5Z_filter_szip (unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
-H5Z_class_t H5Z_SZIP[1] = {{
+H5Z_class2_t H5Z_SZIP[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_SZIP, /* Filter id number */
1, /* Assume encoder present: check before registering */
diff --git a/src/H5trace.c b/src/H5trace.c
index 4a42f0b..6e2578b 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1978,7 +1978,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5Z_class_t *filter = va_arg (ap, H5Z_class_t*); /*lint !e64 Type mismatch not really occuring */
+ H5Z_class2_t *filter = va_arg (ap, H5Z_class2_t*); /*lint !e64 Type mismatch not really occuring */
fprintf (out, "0x%lx", (unsigned long)filter);
}
break;
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 00ab84b..18a88d9 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -71,4 +71,5 @@ FUNCTION: H5Topen; ; v10, v18
# (although not required, it's easier to compare this file with the headers
# generated if the list below is in alphanumeric sort order - QAK)
TYPEDEF: H5E_auto; v10, v18
+TYPEDEF: H5Z_class; v16, v18
diff --git a/src/H5version.h b/src/H5version.h
index fd9e780..58de2ab 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -134,6 +134,10 @@
#define H5E_auto_t_vers 1
#endif /* !defined(H5E_auto_t_vers) */
+#if !defined(H5Z_class_t_vers)
+#define H5Z_class_t_vers 1
+#endif /* !defined(H5Z_class_t_vers) */
+
#endif /* H5_USE_16_API */
@@ -399,5 +403,17 @@
#error "H5E_auto_t_vers set to invalid value"
#endif /* H5E_auto_t_vers */
+
+#if !defined(H5Z_class_t_vers) || H5Z_class_t_vers == 2
+#ifndef H5Z_class_t_vers
+#define H5Z_class_t_vers 2
+#endif /* H5Z_class_t_vers */
+#define H5Z_class_t H5Z_class2_t
+#elif H5Z_class_t_vers == 1
+#define H5Z_class_t H5Z_class1_t
+#else /* H5Z_class_t_vers */
+#error "H5Z_class_t_vers set to invalid value"
+#endif /* H5Z_class_t_vers */
+
#endif /* H5version_H */
diff --git a/test/dsets.c b/test/dsets.c
index 060816d..78aa999 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -98,6 +98,7 @@ const char *FILENAME[] = {
#define DSET_DEPREC_NAME "deprecated"
#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
+#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
#define USER_BLOCK 1024
#define SIXTY_FOUR_KB 65536
@@ -106,6 +107,7 @@ const char *FILENAME[] = {
#define H5Z_FILTER_BOGUS 305
#define H5Z_FILTER_CORRUPT 306
#define H5Z_FILTER_BOGUS2 307
+#define H5Z_FILTER_DEPREC 308
/* Flags for testing filters */
#define DISABLE_FLETCHER32 0
@@ -1022,7 +1024,7 @@ test_tconv(hid_t file)
}
/* This message derives from H5Z */
-const H5Z_class_t H5Z_BOGUS[1] = {{
+const H5Z_class2_t H5Z_BOGUS[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_BOGUS, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
@@ -1196,7 +1198,7 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
}
/* This message derives from H5Z */
-const H5Z_class_t H5Z_CORRUPT[1] = {{
+const H5Z_class2_t H5Z_CORRUPT[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_CORRUPT, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
@@ -4793,7 +4795,7 @@ test_types(hid_t file)
}
/* This message derives from H5Z */
-const H5Z_class_t H5Z_CAN_APPLY_TEST[1] = {{
+const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
H5Z_CLASS_T_VERS,
H5Z_FILTER_BOGUS, /* Filter id number */
1, 1,
@@ -5153,7 +5155,7 @@ error:
/* This message derives from H5Z */
-const H5Z_class_t H5Z_SET_LOCAL_TEST[1] = {{
+const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{
H5Z_CLASS_T_VERS,
H5Z_FILTER_BOGUS2, /* Filter id number */
1, 1,
@@ -6181,6 +6183,28 @@ error:
} /* end test_random_chunks() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Empty can_apply and set_local callbacks */
+static herr_t
+can_apply_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id)
+{
+ return 1;
+}
+
+static herr_t
+set_local_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id)
+{
+ return(SUCCEED);
+}
+
+/* Old style H5Z_class_t, essentially a copy of the "bogus" filter */
+const H5Z_class1_t H5Z_DEPREC[1] = {{
+ H5Z_FILTER_DEPREC, /* Filter id number */
+ "deprec", /* Filter name for debugging */
+ can_apply_deprec, /* The "can apply" callback */
+ set_local_deprec, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
+}};
+
/*-------------------------------------------------------------------------
* Function: test_deprec
@@ -6198,8 +6222,9 @@ error:
static herr_t
test_deprec(hid_t file)
{
- hid_t dataset, space, small_space, create_parms;
+ hid_t dataset, space, small_space, create_parms, dcpl;
hsize_t dims[2], small_dims[2];
+ hsize_t deprec_size;
herr_t status;
hsize_t csize[2];
@@ -6353,6 +6378,16 @@ test_deprec(hid_t file)
if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0) goto error;
if(H5Dclose(dataset) < 0) goto error;
+ /* Test H5Zregister with deprecated H5Z_class1_t */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if(H5Pset_chunk(dcpl, 2, csize) < 0) goto error;
+ if(H5Zregister(H5Z_DEPREC) < 0) goto error;
+ if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error;
+
+ if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error;
+
+ if(H5Pclose(dcpl) < 0) goto error;
+
PASSED();
return 0;
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index b8a3753..c7e1445 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -122,7 +122,7 @@ set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t UNUSED sid);
#define MYFILTER_ID 405
/* This message derives from H5Z */
-const H5Z_class_t H5Z_MYFILTER[1] = {{
+const H5Z_class2_t H5Z_MYFILTER[1] = {{
H5Z_CLASS_T_VERS,
MYFILTER_ID, /* Filter id number */
1, 1,