summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--c++/src/H5DcreatProp.cpp6
-rw-r--r--fortran/src/H5Pf.c70
-rw-r--r--src/H5Pdcpl.c119
-rw-r--r--src/H5Ppublic.h13
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h15
-rw-r--r--test/dsets.c20
-rw-r--r--test/tsohm.c66
-rw-r--r--tools/h5dump/h5dump.c15
-rw-r--r--tools/h5ls/h5ls.c49
-rw-r--r--tools/h5repack/h5repack_copy.c37
-rw-r--r--tools/h5repack/h5repack_filters.c36
-rw-r--r--tools/h5repack/h5repack_verify.c37
-rw-r--r--tools/h5stat/h5stat.c6
-rw-r--r--tools/lib/h5tools_filters.c14
15 files changed, 254 insertions, 250 deletions
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index e09c22e..52de150 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -362,13 +362,11 @@ H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
size_t namelen, char name[], unsigned int& filter_config) const
{
H5Z_filter_t filter_id;
- filter_id = H5Pget_filter( id, filter_number, &flags, &cd_nelmts,
+ filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
cd_values, namelen, name, &filter_config);
if( filter_id == H5Z_FILTER_ERROR )
- {
throw PropListIException("DSetCreatPropList::getFilter",
- "H5Pget_filter returned H5Z_FILTER_ERROR");
- }
+ "H5Pget_filter2 returned H5Z_FILTER_ERROR");
else
return(filter_id);
}
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 3f8bebf..02864fe 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1520,7 +1520,7 @@ nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters)
/*----------------------------------------------------------------------------
* Name: h5pget_filter_c
- * Purpose: Call H5Pget_filter to get information about a filter
+ * Purpose: Call H5Pget_filter2 to get information about a filter
* in a pipeline
* Inputs: prp_id - property list identifier
* filter_number - Sequence number within the filter
@@ -1541,51 +1541,43 @@ nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters)
int_f
nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id)
{
- int ret_value = -1;
- hid_t c_prp_id;
- unsigned c_filter_number;
- unsigned int c_flags;
- size_t c_cd_nelmts, c_namelen;
- size_t c_cd_nelmts_in;
- H5Z_filter_t c_filter;
- unsigned int * c_cd_values;
- char* c_name;
- unsigned i;
-
- c_cd_nelmts_in = (size_t)*cd_nelmts;
- c_namelen = (size_t)*namelen;
- c_name = (char*)malloc(sizeof(char)*c_namelen);
- if (!c_name) return ret_value;
-
- c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts_in));
- if (!c_cd_values) {HDfree(c_name);
- return ret_value;
- }
+ unsigned int c_flags;
+ size_t c_cd_nelmts;
+ size_t c_cd_nelmts_in = (size_t)*cd_nelmts;
+ H5Z_filter_t c_filter;
+ unsigned int *c_cd_values = NULL;
+ char *c_name = NULL;
+ unsigned i;
+ int ret_value = -1;
+ if(NULL == (c_name = (char *)malloc((size_t)*namelen)))
+ goto DONE;
- /*
- * Call H5Pget_filter function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_filter_number = (unsigned)*filter_number;
- c_filter = H5Pget_filter(c_prp_id, c_filter_number, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name, NULL);
+ if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts_in)))
+ goto DONE;
- if (c_filter < 0) goto DONE;
+ /*
+ * Call H5Pget_filter2 function.
+ */
+ if((c_filter = H5Pget_filter2((hid_t)*prp_id, (unsigned)*filter_number, &c_flags, &c_cd_nelmts, c_cd_values, (size_t)*namelen, c_name, NULL)) < 0)
+ goto DONE;
- *filter_id = (int_f)c_filter;
- *cd_nelmts = (size_t_f)c_cd_nelmts;
- *flags = (int_f)c_flags;
- HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
+ *filter_id = (int_f)c_filter;
+ *cd_nelmts = (size_t_f)c_cd_nelmts;
+ *flags = (int_f)c_flags;
+ HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
- for (i = 0; i < c_cd_nelmts_in; i++)
- cd_values[i] = (int_f)c_cd_values[i];
+ for(i = 0; i < c_cd_nelmts_in; i++)
+ cd_values[i] = (int_f)c_cd_values[i];
- ret_value = 0;
+ ret_value = 0;
DONE:
- HDfree(c_name);
- HDfree(c_cd_values);
- return ret_value;
+ if(c_name)
+ HDfree(c_name);
+ if(c_cd_values)
+ HDfree(c_cd_values);
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -3328,7 +3320,7 @@ nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f
/*
- * Call H5Pget_filter function.
+ * Call H5Pget_filter_by_id function.
*/
c_prp_id = (hid_t)*prp_id;
c_filter_id = (H5Z_filter_t)*filter_id;
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
diff --git a/test/dsets.c b/test/dsets.c
index 8125d75..68fe47f 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -5545,11 +5545,7 @@ test_filter_delete(hid_t file)
/* check if filter was deleted */
for(i=0; i<nfilters; i++) {
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl1, (unsigned)i, NULL, NULL, NULL, (size_t)0, NULL);
-#else
- filtn = H5Pget_filter(dcpl1, (unsigned)i, NULL, NULL, NULL, (size_t)0, NULL, NULL);
-#endif
+ filtn = H5Pget_filter2(dcpl1, (unsigned)i, NULL, NULL, NULL, (size_t)0, NULL, NULL);
if(H5Z_FILTER_DEFLATE==filtn)
goto error;
}
@@ -6281,6 +6277,20 @@ test_deprec(hid_t file)
create_parms = H5Pcreate(H5P_DATASET_CREATE);
assert(create_parms >= 0);
+ /* Add the deflate filter, if available */
+#if defined H5_HAVE_FILTER_DEFLATE
+{
+ H5Z_filter_t filtn; /* filter identification number */
+
+ if(H5Pset_deflate(create_parms, 6) < 0) goto error;
+
+ /* Check for the deflate filter */
+ filtn = H5Pget_filter1(create_parms, (unsigned)0, NULL, NULL, NULL, (size_t)0, NULL);
+ if(H5Z_FILTER_DEFLATE!=filtn)
+ goto error;
+}
+#endif /* H5_HAVE_FILTER_DEFLATE */
+
/* Attempt to create a dataset with invalid chunk sizes */
csize[0] = dims[0]*2;
csize[1] = dims[1]*2;
diff --git a/test/tsohm.c b/test/tsohm.c
index e99a1f1..94ffe11 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -1199,25 +1199,25 @@ static void size2_verify_plist1(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter");
- VERIFY(cd_value, 1, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
+ VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_FLETCHER32, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_FLETCHER32, "H5Pget_filter2");
/* Check fill value */
@@ -1258,34 +1258,34 @@ static void size2_verify_plist2(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter");
- VERIFY(cd_value, 1, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
+ VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter");
- VERIFY(cd_value, 2, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
+ VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter");
- VERIFY(cd_value, 2, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
+ VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter");
- VERIFY(cd_value, 1, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
+ VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter(plist, 4, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
- CHECK_I(filter, "H5Pget_filter");
- VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter");
- VERIFY(cd_value, 5, "H5Pget_filter");
+ filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ CHECK_I(filter, "H5Pget_filter2");
+ VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
+ VERIFY(cd_value, 5, "H5Pget_filter2");
/* Check fill value */
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2d1ac7c..a46054d 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2571,13 +2571,8 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
if (nfilters) {
for (i=0; i<nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name);
-#else
- filtn = H5Pget_filter(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
switch (filtn) {
case H5Z_FILTER_DEFLATE:
@@ -5776,15 +5771,9 @@ check_filters(hid_t dcpl)
if (nfilt <= 0)
return;
for (i = 0; i < nfilt; i++) {
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
- (size_t *) &cd_nelmts,
- cd_values, 120, namebuf);
-#else
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
+ filter = H5Pget_filter2(dcpl, (unsigned)i, &flags,
(size_t *) &cd_nelmts,
cd_values, 120, namebuf, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
if (filter == H5Z_FILTER_DEFLATE) {
indentation(indent + COL);
printf("<%sDeflate Level=\"",xmlnsprefix);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 06de2bc..f98a84b 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1530,7 +1530,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
double utilization; /* percent utilization of storage */
int i;
- if (verbose_g>0) {
+ if(verbose_g > 0) {
dcpl = H5Dget_create_plist(dset);
space = H5Dget_space(dset);
type = H5Dget_type(dset);
@@ -1565,12 +1565,12 @@ dataset_list2(hid_t dset, const char UNUSED *name)
putchar('\n');
/* Print information about external strorage */
- if ((nf = H5Pget_external_count(dcpl))>0) {
- for (i=0, max_len=0; i<nf; i++) {
+ if((nf = H5Pget_external_count(dcpl)) > 0) {
+ for(i = 0, max_len = 0; i < nf; i++) {
H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL);
n = display_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
- }
+ } /* end for */
printf(" %-10s %d external file%s\n",
"Extern:", nf, 1==nf?"":"s");
printf(" %4s %10s %10s %10s %s\n",
@@ -1599,32 +1599,28 @@ dataset_list2(hid_t dset, const char UNUSED *name)
}
printf(" %4s %10s %10s %10s ",
"----", "----------", "----------", "----------");
- for (i=0; i<max_len; i++) putchar('-');
+ for (i=0; i<max_len; i++)
+ putchar('-');
putchar('\n');
- }
+ } /* end if */
/* Print information about raw data filters */
- if ((nf = H5Pget_nfilters(dcpl))>0) {
- for (i=0; i<nf; i++) {
+ if((nf = H5Pget_nfilters(dcpl)) > 0) {
+ for(i = 0; i < nf; i++) {
cd_nelmts = NELMTS(cd_values);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filt_id = H5Pget_filter(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name);
-#else
- filt_id = H5Pget_filter(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
+ filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
- f_name[sizeof(f_name)-1] = '\0';
+ f_name[sizeof(f_name) - 1] = '\0';
sprintf(s, "Filter-%d:", i);
printf(" %-10s %s-%u %s {", s,
- f_name[0]?f_name:"method",
+ (f_name[0] ? f_name : "method"),
(unsigned)filt_id,
- filt_flags & H5Z_FLAG_OPTIONAL?"OPT":"");
- for (cd_num=0; cd_num<cd_nelmts; cd_num++)
- printf("%s%u", cd_num?", ":"", cd_values[cd_num]);
+ ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
+ for(cd_num = 0; cd_num < cd_nelmts; cd_num++)
+ printf("%s%u", (cd_num ? ", " : ""), cd_values[cd_num]);
printf("}\n");
- }
- }
+ } /* end for */
+ } /* end if */
/* Print data type */
printf(" %-10s ", "Type:");
@@ -1632,17 +1628,20 @@ dataset_list2(hid_t dset, const char UNUSED *name)
printf("\n");
/* Print address information */
- if (address_g) H5Ddebug(dset);
+ if(address_g)
+ H5Ddebug(dset);
/* Close stuff */
H5Tclose(type);
H5Sclose(space);
H5Pclose(dcpl);
- }
+ } /* end if */
+
+ if(data_g)
+ dump_dataset_values(dset);
- if (data_g) dump_dataset_values(dset);
return 0;
-}
+} /* end dataset_list2() */
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index b1417e1..e6c32c6 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -1053,36 +1053,19 @@ static void print_dataset_info(hid_t dcpl_id,
strcpy(strfilter,"\0");
/* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return;
- for ( i=0; i<nfilters; i++)
- {
+ for(i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_objname),
- f_objname);
-#else
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_objname),
- f_objname,
- NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
-
- switch (filtn)
- {
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_objname), f_objname, NULL);
+
+ switch(filtn) {
default:
break;
+
case H5Z_FILTER_DEFLATE:
strcat(strfilter,"GZIP ");
@@ -1093,8 +1076,8 @@ static void print_dataset_info(hid_t dcpl_id,
strcat(strfilter,temp);
}
#endif
-
break;
+
case H5Z_FILTER_SZIP:
strcat(strfilter,"SZIP ");
@@ -1114,15 +1097,19 @@ static void print_dataset_info(hid_t dcpl_id,
#endif
break;
+
case H5Z_FILTER_SHUFFLE:
strcat(strfilter,"SHUF ");
break;
+
case H5Z_FILTER_FLETCHER32:
strcat(strfilter,"FLET ");
break;
+
case H5Z_FILTER_NBIT:
strcat(strfilter,"NBIT ");
break;
+
case H5Z_FILTER_SCALEOFFSET:
strcat(strfilter,"SCALEOFFSET ");
break;
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index a2d86fa..0e7a557 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -412,8 +412,6 @@ int apply_filters(const char* name, /* object name from traverse list */
return 0;
}
-
-
/*-------------------------------------------------------------------------
* Function: print_filters
*
@@ -437,47 +435,25 @@ int print_filters(hid_t dcpl_id)
int i;
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
- for (i=0; i<nfilters; i++)
- {
+ for(i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_name),
- f_name);
-#else
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_name),
- f_name,
- NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
f_name[sizeof(f_name)-1] = '\0';
sprintf(s, "Filter-%d:", i);
printf(" %-10s %s-%u %s {", s,
- f_name[0]?f_name:"method",
+ f_name[0] ? f_name : "method",
(unsigned)filtn,
filt_flags & H5Z_FLAG_OPTIONAL?"OPT":"");
- for (cd_num=0; cd_num<cd_nelmts; cd_num++) {
+ for(cd_num = 0; cd_num < cd_nelmts; cd_num++)
printf("%s%u", cd_num?", ":"", cd_values[cd_num]);
- }
printf("}\n");
}
return 0;
-
-
}
-
-
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index e87d318..995aca1 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -37,53 +37,34 @@ extern char *progname;
static int
has_filter(hid_t dcpl_id, H5Z_filter_t filtnin)
{
-
int nfilters; /* number of filters */
unsigned filt_flags; /* filter flags */
H5Z_filter_t filtn; /* filter identification number */
unsigned cd_values[20]; /* filter client data values */
size_t cd_nelmts; /* filter client number of values */
char f_name[256]; /* filter name */
- int have=0; /* flag, filter is present */
+ int have = 0; /* flag, filter is present */
int i; /* index */
/* if no information about the input filter is requested return exit */
- if (filtnin==-1)
+ if(filtnin == -1)
return 1;
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
/* if we do not have filters and the requested filter is NONE, return 1 */
- if (!nfilters && filtnin==H5Z_FILTER_NONE)
+ if(!nfilters && filtnin == H5Z_FILTER_NONE)
return 1;
- for (i=0; i<nfilters; i++)
- {
+ for(i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_name),
- f_name);
-#else
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_name),
- f_name,
- NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
-
- if (filtnin==filtn)
- have=1;
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
+ if(filtnin == filtn)
+ have = 1;
}
return have;
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index ed6c6c4..fbf38bd 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -691,11 +691,7 @@ dataset_stats(hid_t group, const char *name, const H5O_info_t *oi, iter_t *iter)
if(nfltr == 0)
iter->dset_comptype[0]++;
for(u = 0; u < (unsigned)nfltr; u++) {
-#ifdef H5_WANT_H5_V1_6_COMPAT
- fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0);
-#else /* H5_WANT_H5_V1_6_COMPAT */
- fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL);
if(fltr < (H5_NFILTERS_IMPL - 1))
iter->dset_comptype[fltr]++;
else
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 9ba9492..325023d 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -85,24 +85,20 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
return 1;
/* check availability of filters */
- for (i=0; i<nfilters; i++)
+ for(i = 0; i < nfilters; i++)
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0)
-#else
- if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0,NULL))<0)
-#endif
+ if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, 0, 0, NULL)) < 0)
return -1;
- switch (filtn)
+ switch(filtn)
{
/*-------------------------------------------------------------------------
* user defined filter
*-------------------------------------------------------------------------
*/
default:
- if (name)
- print_warning(name,"user defined");
+ if(name)
+ print_warning(name, "user defined");
return 0;
/*-------------------------------------------------------------------------