summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-17 12:48:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-17 12:48:04 (GMT)
commit13c484162cc9098e6538deec931563848011bdb5 (patch)
treec33201bfab0f74c7e3bff9b17a55d92deb852118 /src
parentbe729e5f78ae9308dd4a305039e8ddd58068d477 (diff)
downloadhdf5-13c484162cc9098e6538deec931563848011bdb5.zip
hdf5-13c484162cc9098e6538deec931563848011bdb5.tar.gz
hdf5-13c484162cc9098e6538deec931563848011bdb5.tar.bz2
[svn-r14206] Description:
Make H5Pget_filter API versioned and switch internal usage to H5Pget_filter2. Add regression test for H5Pget_filter1. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'src')
-rw-r--r--src/H5Pdcpl.c119
-rw-r--r--src/H5Ppublic.h13
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h15
4 files changed, 114 insertions, 34 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index e9ed6c5..9ef25b0 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1340,7 +1340,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
/*-------------------------------------------------------------------------
- * Function: H5Pget_filter
+ * Function: H5Pget_filter2
*
* Purpose: This is the query counterpart of H5Pset_filter() and returns
* information about a particular filter number in a permanent
@@ -1363,41 +1363,23 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
H5Z_filter_t
-H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/)
-#else /* H5_WANT_H5_V1_6_COMPAT */
-H5Z_filter_t
-H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
+H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
size_t namelen, char name[]/*out*/,
- unsigned *_filter_config /*out*/)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ unsigned *filter_config /*out*/)
{
H5O_pline_t pline; /* Filter pipeline */
const H5Z_filter_info_t *filter; /* Pointer to filter information */
H5P_genplist_t *plist; /* Property list pointer */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned *filter_config = NULL; /* Filter configuration */
-#else /* H5_WANT_H5_V1_6_COMPAT */
- unsigned *filter_config = _filter_config; /* Filter configuration */
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5Z_filter_t ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR)
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
- name);
-#else /* H5_WANT_H5_V1_6_COMPAT */
+ FUNC_ENTER_API(H5Pget_filter2, H5Z_FILTER_ERROR)
H5TRACE8("Zf","iIux*zxzx*Iu",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
- name,_filter_config);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ name,filter_config);
/* Check args */
- if(cd_nelmts || cd_values)
-{
+ if(cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
* we'll check that it has a reasonable value. The actual number
@@ -1441,7 +1423,7 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter() */
+} /* end H5Pget_filter2() */
/*-------------------------------------------------------------------------
@@ -2484,3 +2466,90 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_time() */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter1
+ *
+ * Purpose: This is the query counterpart of H5Pset_filter() and returns
+ * information about a particular filter number in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. The IDX
+ * should be a value between zero and N-1 as described for
+ * H5Pget_nfilters() and the function will return failure if the
+ * filter number is out of range.
+ *
+ * Return: Success: Filter identification number.
+ *
+ * Failure: H5Z_FILTER_ERROR (Negative)
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+H5Z_filter_t
+H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/)
+{
+ H5O_pline_t pline; /* Filter pipeline */
+ const H5Z_filter_info_t *filter; /* Pointer to filter information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5Z_filter_t ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_filter1, H5Z_FILTER_ERROR)
+ H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
+ name);
+
+ /* Check args */
+ if(cd_nelmts || cd_values) {
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ if(cd_nelmts && *cd_nelmts > 256)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied")
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if(!cd_nelmts)
+ cd_values = NULL;
+ } /* end if */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
+
+ /* Get pipeline info */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
+
+ /* Check more args */
+ if(idx >= pline.nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid")
+
+ /* Set pointer to particular filter to query */
+ filter = &pline.filter[idx];
+
+ /* Get filter information */
+ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
+
+ /* Set return value */
+ ret_value = filter->id;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 297798f..327ebfa 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -286,20 +286,12 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter,
unsigned int flags, size_t cd_nelmts,
const unsigned int c_values[]);
H5_DLL int H5Pget_nfilters(hid_t plist_id);
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, unsigned filter,
- unsigned int *flags/*out*/,
- size_t *cd_nelmts/*out*/,
- unsigned cd_values[]/*out*/,
- size_t namelen, char name[]);
-#else /* H5_WANT_H5_V1_6_COMPAT */
-H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, unsigned filter,
+H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned filter,
unsigned int *flags/*out*/,
size_t *cd_nelmts/*out*/,
unsigned cd_values[]/*out*/,
size_t namelen, char name[],
unsigned *filter_config /*out*/);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
#ifdef H5_WANT_H5_V1_6_COMPAT
H5_DLL H5Z_filter_t H5Pget_filter_by_id(hid_t plist_id, H5Z_filter_t id,
unsigned int *flags/*out*/,
@@ -420,6 +412,9 @@ H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
H5P_prp_close_func_t prp_close);
+H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter,
+ unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
+ unsigned cd_values[]/*out*/, size_t namelen, char name[]);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 81e5656..a48b613 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -59,6 +59,7 @@ FUNCTION: H5Eset_auto; ; v10, v18
FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
+FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pinsert; ; v14, v18
FUNCTION: H5Pregister; ; v14, v18
FUNCTION: H5Rget_obj_type; ; v16, v18
diff --git a/src/H5version.h b/src/H5version.h
index 7f48122..80bfb58 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -94,6 +94,10 @@
#define H5Gopen_vers 1
#endif /* !defined(H5Gopen_vers) */
+#if !defined(H5Pget_filter_vers)
+#define H5Pget_filter_vers 1
+#endif /* !defined(H5Pget_filter_vers) */
+
#if !defined(H5Pinsert_vers)
#define H5Pinsert_vers 1
#endif /* !defined(H5Pinsert_vers) */
@@ -295,6 +299,17 @@
#error "H5Gopen_vers set to invalid value"
#endif /* H5Gopen_vers */
+#if !defined(H5Pget_filter_vers) || H5Pget_filter_vers == 2
+#ifndef H5Pget_filter_vers
+#define H5Pget_filter_vers 2
+#endif /* H5Pget_filter_vers */
+#define H5Pget_filter H5Pget_filter2
+#elif H5Pget_filter_vers == 1
+#define H5Pget_filter H5Pget_filter1
+#else /* H5Pget_filter_vers */
+#error "H5Pget_filter_vers set to invalid value"
+#endif /* H5Pget_filter_vers */
+
#if !defined(H5Pinsert_vers) || H5Pinsert_vers == 2
#ifndef H5Pinsert_vers
#define H5Pinsert_vers 2