summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
15 files changed, 105 insertions, 43 deletions
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 */