summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-18 16:10:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-18 16:10:46 (GMT)
commitb0eb42058c02bff41cacae11880b4fbf174821db (patch)
treec389ee389c680cccbd2a5c5f11107b588f4bcfa0 /src
parentdcf8866b6af90aa0bf50ebeceda6b0f184a07c17 (diff)
downloadhdf5-b0eb42058c02bff41cacae11880b4fbf174821db.zip
hdf5-b0eb42058c02bff41cacae11880b4fbf174821db.tar.gz
hdf5-b0eb42058c02bff41cacae11880b4fbf174821db.tar.bz2
[svn-r14208] Description:
Make H5Pget_filter_by_id() API versioned and switch internal usage to H5Pget_filter_by_id2(). Add simple regression test for H5Pget_filter_by_id1(). 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.c371
-rw-r--r--src/H5Pprivate.h12
-rw-r--r--src/H5Ppublic.h19
-rw-r--r--src/H5T.c32
-rw-r--r--src/H5Toffset.c66
-rw-r--r--src/H5Torder.c65
-rw-r--r--src/H5Tpkg.h7
-rw-r--r--src/H5Tprecis.c47
-rw-r--r--src/H5Tprivate.h15
-rw-r--r--src/H5Znbit.c282
-rw-r--r--src/H5Zscaleoffset.c226
-rw-r--r--src/H5Zshuffle.c31
-rw-r--r--src/H5Zszip.c92
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h15
15 files changed, 868 insertions, 413 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 9ef25b0..e335720 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1053,6 +1053,68 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P_modify_filter
+ *
+ * Purpose: Modifies the specified FILTER in the
+ * transient or permanent output filter pipeline
+ * depending on whether PLIST is a dataset creation or dataset
+ * transfer property list. The FLAGS argument specifies certain
+ * general properties of the filter and is documented below.
+ * The CD_VALUES is an array of CD_NELMTS integers which are
+ * auxiliary data for the filter. The integer vlues will be
+ * stored in the dataset object header as part of the filter
+ * information.
+ *
+ * The FLAGS argument is a bit vector of the following fields:
+ *
+ * H5Z_FLAG_OPTIONAL(0x0001)
+ * If this bit is set then the filter is optional. If the
+ * filter fails during an H5Dwrite() operation then the filter
+ * is just excluded from the pipeline for the chunk for which it
+ * failed; the filter will not participate in the pipeline
+ * during an H5Dread() of the chunk. If this bit is clear and
+ * the filter fails then the entire I/O operation fails.
+ * If this bit is set but encoding is disabled for a filter,
+ * attempting to write will generate an error.
+ *
+ * Note: This function currently supports only the permanent filter
+ * pipeline. That is, PLIST_ID must be a dataset creation
+ * property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags,
+ size_t cd_nelmts, const unsigned cd_values[/*cd_nelmts*/])
+{
+ H5O_pline_t pline;
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_NOAPI(H5P_modify_filter, FAIL)
+
+ /* Get the pipeline property to append to */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Modify the filter parameters of the I/O pipeline */
+ if(H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
+
+ /* Put the I/O pipeline information back into the property list */
+ if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_modify_filter() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pmodify_filter
*
* Purpose: Modifies the specified FILTER in the
@@ -1094,9 +1156,8 @@ herr_t
H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(H5Pmodify_filter, FAIL)
H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
@@ -1113,17 +1174,9 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Get the pipeline property to append to */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
-
/* Modify the filter parameters of the I/O pipeline */
- if(H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
-
- /* Put the I/O pipeline information back into the property list */
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+ if(H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't modify filter")
done:
FUNC_LEAVE_API(ret_value)
@@ -1427,7 +1480,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_filter_by_id
+ * Function: H5P_get_filter_by_id
*
* Purpose: This is an additional query counterpart of H5Pset_filter() and
* returns information about a particular filter in a permanent
@@ -1444,53 +1497,83 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * Friday, April 5, 2003
+ * Wednesday, October 17, 2007
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-herr_t
-H5Pget_filter_by_id(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/)
-#else
herr_t
-H5Pget_filter_by_id(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
+H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags/*out*/,
size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/, unsigned *_filter_config)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ size_t namelen, char name[]/*out*/, unsigned *filter_config)
{
H5O_pline_t pline; /* Filter pipeline */
H5Z_filter_info_t *filter; /* Pointer to filter information */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5P_get_filter_by_id, FAIL)
+
+ /* Get pipeline info */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Get pointer to filter in pipeline */
+ if(NULL == (filter = H5Z_filter_info(&pline, id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid")
+
+ /* Get filter information */
+ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_get_filter_by_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter_by_id2
+ *
+ * Purpose: This is an additional query counterpart of H5Pset_filter() and
+ * returns information about a particular filter 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. FILTER_CONFIG is a bit
+ * field contaning encode/decode flags from H5Zpublic.h. The ID
+ * should be the filter ID to retrieve the parameters for. If the
+ * filter is not set for the property list, an error will be returned.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, April 5, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/, unsigned *filter_config)
+{
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 */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_filter_by_id, FAIL)
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5TRACE7("e","iZfx*zxzx",plist_id,id,flags,cd_nelmts,cd_values,namelen,
- name);
-#else
+ FUNC_ENTER_API(H5Pget_filter_by_id2, FAIL)
H5TRACE8("e","iZfx*zxzx*Iu",plist_id,id,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
* is unimportant because the H5O layer will detect when a message
* is too large.
*/
- if(cd_nelmts && *cd_nelmts>256)
+ if(cd_nelmts && *cd_nelmts > 256)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument")
- if(cd_nelmts && *cd_nelmts>0 && !cd_values)
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied")
/*
@@ -1505,21 +1588,13 @@ H5Pget_filter_by_id(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "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, FAIL, "can't get pipeline")
-
- /* Get pointer to filter in pipeline */
- if(NULL == (filter = H5Z_filter_info(&pline, id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid")
-
- /* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
+ /* Get filter info */
+ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter_by_id() */
+} /* end H5Pget_filter_by_id2() */
/*-------------------------------------------------------------------------
@@ -2060,7 +2135,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_fill_value
+ * Function: H5P_get_fill_value
*
* Purpose: Queries the fill value property of a dataset creation
* property list. The fill value is returned through the VALUE
@@ -2070,35 +2145,24 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, October 1, 1998
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
*
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
+H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/,
+ hid_t dxpl_id)
{
- H5P_genplist_t *plist; /* Property list pointer */
H5O_fill_t fill; /* Fill value to retrieve */
- H5T_t *type; /*datatype */
H5T_path_t *tpath; /*type conversion info */
void *buf = NULL; /*conversion buffer */
void *bkg = NULL; /*conversion buffer */
hid_t src_id = -1; /*source datatype id */
+ hid_t dst_id = -1; /*destination datatype id */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_fill_value, FAIL)
- H5TRACE3("e", "iix", plist_id, type_id, value);
-
- /* Check arguments */
- if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if(!value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer")
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ FUNC_ENTER_NOAPI(H5P_get_fill_value, FAIL)
/*
* If no fill value is defined then return an error. We can't even
@@ -2120,10 +2184,9 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
/*
* Can we convert between the source and destination datatypes?
*/
- if(NULL == (tpath = H5T_path_find(fill.type, type, NULL, NULL, H5AC_dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(fill.type, type, NULL, NULL, dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
- src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill.type, H5T_COPY_TRANSIENT));
- if(src_id < 0)
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill.type, H5T_COPY_TRANSIENT))) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
/*
@@ -2145,7 +2208,9 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
/* Do the conversion */
- if(H5T_convert(tpath, src_id, type_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg, H5AC_dxpl_id) < 0)
+ if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT))) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
if(buf != value)
HDmemcpy(value, buf, H5T_get_size(type));
@@ -2157,6 +2222,54 @@ done:
H5MM_xfree(bkg);
if(src_id >= 0)
H5I_dec_ref(src_id);
+ if(dst_id >= 0)
+ H5I_dec_ref(dst_id);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_get_fill_value() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_fill_value
+ *
+ * Purpose: Queries the fill value property of a dataset creation
+ * property list. The fill value is returned through the VALUE
+ * pointer and the memory is allocated by the caller. The fill
+ * value will be converted from its current datatype to the
+ * specified TYPE.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Thursday, October 1, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5T_t *type; /* Datatype */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_fill_value, FAIL)
+ H5TRACE3("e", "iix", plist_id, type_id, value);
+
+ /* Check arguments */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(!value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer")
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the fill value */
+ if(H5P_get_fill_value(plist, type, value, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+
+done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_value() */
@@ -2203,6 +2316,41 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P_fill_value_defined
+ *
+ * Purpose: Check if fill value is defined.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status)
+{
+ H5O_fill_t fill; /* Fill value to query */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5P_fill_value_defined, FAIL)
+
+ HDassert(status);
+
+ /* Get the fill value struct */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
+
+ /* Get the fill-value status */
+ if(H5P_is_fill_value_defined(&fill, status) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_fill_value_defined() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pfill_value_defined
*
* Purpose: Check if fill value is defined.
@@ -2218,7 +2366,6 @@ herr_t
H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
{
H5P_genplist_t *plist; /* Property list to query */
- H5O_fill_t fill; /* Fill value to query */
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Pfill_value_defined, FAIL)
@@ -2230,12 +2377,8 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Get the fill value struct */
- if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
-
/* Get the fill-value status */
- if(H5P_is_fill_value_defined(&fill, status) < 0)
+ if(H5P_fill_value_defined(plist, status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status")
done:
@@ -2552,4 +2695,74 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_filter1() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter_by_id1
+ *
+ * Purpose: This is an additional query counterpart of H5Pset_filter() and
+ * returns information about a particular filter 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 ID
+ * should be the filter ID to retrieve the parameters for. If the
+ * filter is not set for the property list, an error will be returned.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, April 5, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, 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 */
+ H5Z_filter_info_t *filter; /* Pointer to filter information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_filter_by_id1, FAIL)
+ H5TRACE7("e","iZfx*zxzx",plist_id,id,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, FAIL, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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, FAIL, "can't find object for ID")
+
+ /* Get filter info */
+ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter_by_id1() */
+
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index f5fd438..a96df21 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -97,5 +97,17 @@ H5_DLL hid_t H5P_peek_hid_t(H5P_genplist_t *plist, const char *name);
H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name);
H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name);
+/* Private DCPL routines */
+H5_DLL herr_t H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter,
+ unsigned flags, size_t cd_nelmts, const unsigned cd_values[/*cd_nelmts*/]);
+H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id,
+ unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/,
+ unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/,
+ unsigned *filter_config);
+H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
+ H5D_fill_value_t *status);
+H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type,
+ void *value, hid_t dxpl_id);
+
#endif /* _H5Pprivate_H */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 327ebfa..f1e98af 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -292,20 +292,10 @@ H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned filter,
unsigned cd_values[]/*out*/,
size_t namelen, char name[],
unsigned *filter_config /*out*/);
-#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*/,
- size_t *cd_nelmts/*out*/,
- unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/);
-#else /* 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*/,
- size_t *cd_nelmts/*out*/,
- unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/,
+H5_DLL H5Z_filter_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id,
+ unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
+ unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/,
unsigned *filter_config/*out*/);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id);
H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter);
H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
@@ -415,6 +405,9 @@ H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size,
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[]);
+H5_DLL H5Z_filter_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id,
+ unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
+ unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5T.c b/src/H5T.c
index 4e6a7a6..de6822d 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2003,8 +2003,6 @@ done:
* Programmer: Raymond Lu
* November 4, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -2017,15 +2015,37 @@ H5Tis_variable_str(hid_t dtype_id)
H5TRACE1("t", "i", dtype_id);
/* Check args */
- if (NULL == (dt = H5I_object_verify(dtype_id,H5I_DATATYPE)))
+ if(NULL == (dt = H5I_object_verify(dtype_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
/* Set return value */
- ret_value=H5T_IS_VL_STRING(dt->shared);
+ if((ret_value = H5T_is_variable_str(dt)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't determine if datatype is VL-string");
done:
FUNC_LEAVE_API(ret_value);
-}
+} /* end H5Tis_variable_str() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_is_variable_str
+ *
+ * Purpose: Check whether a datatype is a variable-length string
+ *
+ * Return: TRUE (1) or FALSE (0) on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5T_is_variable_str(const H5T_t *dt)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_is_variable_str)
+
+ FUNC_LEAVE_NOAPI(H5T_IS_VL_STRING(dt->shared));
+} /* end H5T_is_variable_str() */
/*-------------------------------------------------------------------------
@@ -2191,7 +2211,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_super(H5T_t *dt)
+H5T_get_super(const H5T_t *dt)
{
H5T_t *ret_value=NULL;
diff --git a/src/H5Toffset.c b/src/H5Toffset.c
index 563e5cd..5495368 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -77,41 +77,83 @@ H5T_init_offset_interface(void)
* 3: [0x22] [ pad] [ pad] [0x11]
*
* Return: Success: The offset (non-negative)
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
- *
*-------------------------------------------------------------------------
*/
int
H5Tget_offset(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
int ret_value;
FUNC_ENTER_API(H5Tget_offset, -1)
H5TRACE1("Is", "i", type_id);
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type")
- while (dt->shared->parent)
- dt = dt->shared->parent; /*defer to parent*/
- if (!H5T_IS_ATOMIC(dt->shared))
+
+ /* Get offset */
+ if((ret_value = H5T_get_offset(dt)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "cant't get offset for specified datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Tget_offset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_get_offset
+ *
+ * Purpose: Retrieves the bit offset of the first significant bit. The
+ * signficant bits of an atomic datum can be offset from the
+ * beginning of the memory for that datum by an amount of
+ * padding. The `offset' property specifies the number of bits
+ * of padding that appear to the "right of" the value. That is,
+ * if we have a 32-bit datum with 16-bits of precision having
+ * the value 0x1122 then it will be layed out in memory as (from
+ * small byte address toward larger byte addresses):
+ *
+ * Big Big Little Little
+ * Endian Endian Endian Endian
+ * offset=0 offset=16 offset=0 offset=16
+ *
+ * 0: [ pad] [0x11] [0x22] [ pad]
+ * 1: [ pad] [0x22] [0x11] [ pad]
+ * 2: [0x11] [ pad] [ pad] [0x22]
+ * 3: [0x22] [ pad] [ pad] [0x11]
+ *
+ * Return: Success: The offset (non-negative)
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5T_get_offset(const H5T_t *dt)
+{
+ int ret_value;
+
+ FUNC_ENTER_NOAPI(H5T_get_offset, -1)
+
+ /* Defer to parent*/
+ while(dt->shared->parent)
+ dt = dt->shared->parent;
+ if(!H5T_IS_ATOMIC(dt->shared))
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
/* Offset */
ret_value = (int)dt->shared->u.atomic.offset;
done:
- FUNC_LEAVE_API(ret_value)
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_get_offset() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 02edc11..34dbd8e 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -55,7 +55,7 @@ H5T_init_order_interface(void)
/*-------------------------------------------------------------------------
* Function: H5Tget_order
*
- * Purpose: Returns the byte order of a data type.
+ * Purpose: Returns the byte order of a datatype.
*
* Return: Success: A byte order constant
*
@@ -64,41 +64,68 @@ H5T_init_order_interface(void)
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
- *
*-------------------------------------------------------------------------
*/
H5T_order_t
H5Tget_order(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
H5T_order_t ret_value;
FUNC_ENTER_API(H5Tget_order, H5T_ORDER_ERROR)
H5TRACE1("To", "i", type_id);
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not a data type")
- while (dt->shared->parent)
- dt = dt->shared->parent; /*defer to parent*/
- if (!H5T_IS_ATOMIC(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified data type")
+ if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
+
+ /* Get order */
+ if((ret_value = H5T_get_order(dt)) == H5T_ORDER_ERROR)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "cant't get order for specified datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Tget_order() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_get_order
+ *
+ * Purpose: Returns the byte order of a datatype.
+ *
+ * Return: Success: A byte order constant
+ * Failure: H5T_ORDER_ERROR (Negative)
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_order_t
+H5T_get_order(const H5T_t *dt)
+{
+ H5T_order_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5T_get_order, H5T_ORDER_ERROR)
+
+ /*defer to parent*/
+ while(dt->shared->parent)
+ dt = dt->shared->parent;
+ if(!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified datatype")
/* Order */
ret_value = dt->shared->u.atomic.order;
done:
- FUNC_LEAVE_API(ret_value)
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_get_order() */
/*-------------------------------------------------------------------------
* Function: H5Tset_order
*
- * Purpose: Sets the byte order for a data type.
+ * Purpose: Sets the byte order for a datatype.
*
* Return: Non-negative on success/Negative on failure
*
@@ -107,7 +134,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -122,9 +149,9 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
if (order < H5T_ORDER_LE || order > H5T_ORDER_NONE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order")
if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0)
@@ -132,7 +159,7 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (!H5T_IS_ATOMIC(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype")
/* Commit */
dt->shared->u.atomic.order = order;
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 4704288..5cb668d 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -503,7 +503,6 @@ H5_DLL H5T_t *H5T_alloc(void);
H5_DLL herr_t H5T_free(H5T_t *dt);
H5_DLL herr_t H5T_visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op,
void *op_value);
-H5_DLL H5T_t *H5T_get_super(H5T_t *dt);
H5_DLL herr_t H5T_set_size(H5T_t *dt, size_t size);
H5_DLL herr_t H5T_upgrade_version(H5T_t *dt, unsigned new_version);
@@ -1360,9 +1359,6 @@ H5_DLL htri_t H5T_bit_inc(uint8_t *buf, size_t start, size_t size);
H5_DLL htri_t H5T_bit_dec(uint8_t *buf, size_t start, size_t size);
H5_DLL void H5T_bit_neg(uint8_t *buf, size_t start, size_t size);
-/* Fixed-point functions */
-H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt);
-
/* VL functions */
H5_DLL H5T_t * H5T_vlen_create(const H5T_t *base);
H5_DLL htri_t H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc);
@@ -1376,8 +1372,6 @@ H5_DLL int H5T_get_array_dims(const H5T_t *dt, hsize_t dims[]);
/* Compound functions */
H5_DLL herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset,
const H5T_t *member);
-H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
-H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
H5_DLL size_t H5T_get_member_size(const H5T_t *dt, unsigned membno);
H5_DLL htri_t H5T_is_packed(const H5T_t *dt);
H5_DLL H5T_subset_t H5T_conv_struct_subset(const H5T_cdata_t *cdata);
@@ -1389,7 +1383,6 @@ H5_DLL herr_t H5T_get_member_value(const H5T_t *dt, unsigned membno, void *value
/* Field functions (for both compound & enumerated types) */
H5_DLL char *H5T_get_member_name(H5T_t const *dt, unsigned membno);
-H5_DLL int H5T_get_nmembers(const H5T_t *dt);
H5_DLL herr_t H5T_sort_value(const H5T_t *dt, int *map);
H5_DLL herr_t H5T_sort_name(const H5T_t *dt, int *map);
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index 4e55862..62493e9 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -80,7 +80,7 @@ H5T_init_precis_interface(void)
size_t
H5Tget_precision(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
size_t ret_value;
FUNC_ENTER_API(H5Tget_precision, 0)
@@ -89,17 +89,52 @@ H5Tget_precision(hid_t type_id)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
- while (dt->shared->parent)
- dt = dt->shared->parent; /*defer to parent*/
- if (!H5T_IS_ATOMIC(dt->shared))
+
+ /* Get precision */
+ if((ret_value = H5T_get_precision(dt)) == 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "cant't get precision for specified datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Tget_precision() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_get_precision
+ *
+ * Purpose: Gets the precision of a datatype. The precision is
+ * the number of significant bits which, unless padding is
+ * present, is 8 times larger than the value returned by
+ * H5Tget_size().
+ *
+ * Return: Success: Number of significant bits
+ * Failure: 0 (all atomic types have at least one
+ * significant bit)
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5T_get_precision(const H5T_t *dt)
+{
+ size_t ret_value;
+
+ FUNC_ENTER_NOAPI(H5T_get_precision, 0)
+
+ /* Defer to parent*/
+ while(dt->shared->parent)
+ dt = dt->shared->parent;
+ if(!H5T_IS_ATOMIC(dt->shared))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype")
/* Precision */
ret_value = dt->shared->u.atomic.prec;
done:
- FUNC_LEAVE_API(ret_value)
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_get_precision() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index deeb8ce..dfe2367 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -91,6 +91,7 @@ H5_DLL herr_t H5T_init(void);
H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
H5_DLL herr_t H5T_close(H5T_t *dt);
+H5_DLL H5T_t *H5T_get_super(const H5T_t *dt);
H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal);
H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls);
H5_DLL size_t H5T_get_size(const H5T_t *dt);
@@ -115,6 +116,7 @@ H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
H5_DLL herr_t H5T_set_latest_version(H5T_t *dt);
+H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
@@ -125,5 +127,18 @@ H5_DLL htri_t H5T_committed(const H5T_t *type);
H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id);
H5_DLL herr_t H5T_update_shared(H5T_t *type);
+/* Field functions (for both compound & enumerated types) */
+H5_DLL int H5T_get_nmembers(const H5T_t *dt);
+H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
+H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
+
+/* Atomic functions */
+H5_DLL H5T_order_t H5T_get_order(const H5T_t *dt);
+H5_DLL size_t H5T_get_precision(const H5T_t *dt);
+H5_DLL int H5T_get_offset(const H5T_t *dt);
+
+/* Fixed-point functions */
+H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt);
+
#endif /* _H5Tprivate_H */
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 62959d4..7a29d45 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -17,10 +17,12 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property lists */
#include "H5Oprivate.h" /* Object headers */
-#include "H5Tpublic.h" /* Datatype functions */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5Zpkg.h" /* Data filters */
#ifdef H5_HAVE_FILTER_NBIT
@@ -43,13 +45,13 @@ static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned c
static void H5Z_calc_parms_nooptype(void);
static void H5Z_calc_parms_atomic(void);
-static herr_t H5Z_calc_parms_array(hid_t type_id);
-static herr_t H5Z_calc_parms_compound(hid_t type_id);
+static herr_t H5Z_calc_parms_array(const H5T_t *type);
+static herr_t H5Z_calc_parms_compound(const H5T_t *type);
-static herr_t H5Z_set_parms_nooptype(hid_t type_id, unsigned cd_values[]);
-static herr_t H5Z_set_parms_atomic(hid_t type_id, unsigned cd_values[]);
-static herr_t H5Z_set_parms_array(hid_t type_id, unsigned cd_values[]);
-static herr_t H5Z_set_parms_compound(hid_t type_id, unsigned cd_values[]);
+static herr_t H5Z_set_parms_nooptype(const H5T_t *type, unsigned cd_values[]);
+static herr_t H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]);
+static herr_t H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]);
+static herr_t H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]);
static void H5Z_nbit_next_byte(size_t *j, int *buf_len);
static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i,
@@ -131,16 +133,21 @@ static unsigned parms_index = 0;
static herr_t
H5Z_can_apply_nbit(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
- herr_t ret_value=TRUE; /* Return value */
+ const H5T_t *type; /* Datatype */
+ herr_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_nbit, FAIL)
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get datatype's class, for checking the "datatype class" */
- if(H5Tget_class(type_id) == H5T_NO_CLASS )
+ if(H5T_get_class(type, TRUE) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class")
/* Get datatype's size, for checking the "datatype size" */
- if(H5Tget_size(type_id) == 0)
+ if(H5T_get_size(type) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
done:
@@ -222,11 +229,12 @@ static void H5Z_calc_parms_atomic(void)
*
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_calc_parms_array(hid_t type_id)
+static herr_t
+H5Z_calc_parms_array(const H5T_t *type)
{
- hid_t dtype_base; /* Array datatype's base datatype */
+ H5T_t *dtype_base = NULL; /* Array datatype's base datatype */
H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_calc_parms_array, FAIL)
@@ -237,11 +245,11 @@ static herr_t H5Z_calc_parms_array(hid_t type_id)
++cd_values_actual_nparms;
/* Get array datatype's base datatype */
- if((dtype_base=H5Tget_super(type_id))<0)
+ if(NULL == (dtype_base = H5T_get_super(type)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype")
/* Get base datatype's class */
- if((dtype_base_class=H5Tget_class(dtype_base))==H5T_NO_CLASS )
+ if((dtype_base_class = H5T_get_class(dtype_base, TRUE)) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype class")
/* Calculate number of the rest parameters according to base datatype's class */
@@ -250,20 +258,27 @@ static herr_t H5Z_calc_parms_array(hid_t type_id)
case H5T_FLOAT:
H5Z_calc_parms_atomic();
break;
+
case H5T_ARRAY:
- if(H5Z_calc_parms_array(dtype_base)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot compute parameters for datatype")
+ if(H5Z_calc_parms_array(dtype_base) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype")
break;
+
case H5T_COMPOUND:
- if(H5Z_calc_parms_compound(dtype_base)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot compute parameters for datatype")
+ if(H5Z_calc_parms_compound(dtype_base) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype")
break;
+
default: /* Other datatype class: nbit does no compression */
H5Z_calc_parms_nooptype();
break;
} /* end switch */
done:
+ if(dtype_base)
+ if(H5T_close(dtype_base) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_calc_parms_array() */
@@ -285,13 +300,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_calc_parms_compound(hid_t type_id)
+static herr_t
+H5Z_calc_parms_compound(const H5T_t *type)
{
- int i; /* local index variable */
int nmembers; /* Compound datatype's number of members */
- hid_t dtype_member; /* Compound datatype's member datatype */
+ H5T_t *dtype_member = NULL; /* Compound datatype's member datatype */
H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_calc_parms_compound, FAIL)
@@ -302,20 +318,20 @@ static herr_t H5Z_calc_parms_compound(hid_t type_id)
++cd_values_actual_nparms;
/* Get number of members */
- if((nmembers=H5Tget_nmembers(type_id))<0)
+ if((nmembers = H5T_get_nmembers(type)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members")
/* Store number of members */
++cd_values_actual_nparms;
/* For each member, calculate parameters */
- for(i = 0; i < nmembers; i++) {
+ for(u = 0; u < (unsigned)nmembers; u++) {
/* Get member datatype */
- if((dtype_member=H5Tget_member_type(type_id, (unsigned)i))<0)
+ if(NULL == (dtype_member = H5T_get_member_type(type, u)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
- if((dtype_member_class=H5Tget_member_class(type_id, (unsigned)i))<0)
+ if((dtype_member_class = H5T_get_class(dtype_member, TRUE)) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class")
/* Store member offset */
@@ -327,20 +343,33 @@ static herr_t H5Z_calc_parms_compound(hid_t type_id)
case H5T_FLOAT:
H5Z_calc_parms_atomic();
break;
+
case H5T_ARRAY:
- if(H5Z_calc_parms_array(dtype_member)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot compute parameters for datatype")
+ if(H5Z_calc_parms_array(dtype_member) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype")
break;
+
case H5T_COMPOUND:
- if(H5Z_calc_parms_compound(dtype_member)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot compute parameters for datatype")
+ if(H5Z_calc_parms_compound(dtype_member) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype")
break;
+
default: /* Other datatype class: nbit does no compression */
H5Z_calc_parms_nooptype();
break;
} /* end switch */
+
+ /* Close member datatype */
+ if(H5T_close(dtype_member) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype")
+ dtype_member = NULL;
} /* end for */
+
done:
+ if(dtype_member)
+ if(H5T_close(dtype_member) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_calc_params_compound */
@@ -363,10 +392,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_set_parms_nooptype(hid_t type_id, unsigned cd_values[])
+static herr_t
+H5Z_set_parms_nooptype(const H5T_t *type, unsigned cd_values[])
{
size_t dtype_size; /* No-op datatype's size (in bytes) */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_parms_nooptype, FAIL)
@@ -374,7 +404,7 @@ static herr_t H5Z_set_parms_nooptype(hid_t type_id, unsigned cd_values[])
cd_values[cd_values_index++] = H5Z_NBIT_NOOPTYPE;
/* Get datatype's size */
- if((dtype_size=H5Tget_size(type_id))==0)
+ if((dtype_size = H5T_get_size(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Set "local" parameter for datatype size */
@@ -401,13 +431,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_set_parms_atomic(hid_t type_id, unsigned cd_values[])
+static herr_t
+H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[])
{
H5T_order_t dtype_order; /* Atomic datatype's endianness order */
size_t dtype_size; /* Atomic datatype's size (in bytes) */
size_t dtype_precision; /* Atomic datatype's precision (in bits) */
int dtype_offset; /* Atomic datatype's offset (in bits) */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_parms_atomic, FAIL)
@@ -415,14 +446,14 @@ static herr_t H5Z_set_parms_atomic(hid_t type_id, unsigned cd_values[])
cd_values[cd_values_index++] = H5Z_NBIT_ATOMIC;
/* Get datatype's size */
- if((dtype_size=H5Tget_size(type_id))==0)
+ if((dtype_size = H5T_get_size(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Set "local" parameter for datatype size */
cd_values[cd_values_index++] = dtype_size;
/* Get datatype's endianness order */
- if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR)
+ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
/* Set "local" parameter for datatype endianness */
@@ -430,24 +461,26 @@ static herr_t H5Z_set_parms_atomic(hid_t type_id, unsigned cd_values[])
case H5T_ORDER_LE: /* Little-endian byte order */
cd_values[cd_values_index++] = H5Z_NBIT_ORDER_LE;
break;
+
case H5T_ORDER_BE: /* Big-endian byte order */
cd_values[cd_values_index++] = H5Z_NBIT_ORDER_BE;
break;
+
default:
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
} /* end switch */
/* Get datatype's precision */
- if((dtype_precision=H5Tget_precision(type_id))==0)
+ if((dtype_precision = H5T_get_precision(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision")
/* Get datatype's offset */
- if((dtype_offset=H5Tget_offset(type_id))<0)
+ if((dtype_offset = H5T_get_offset(type)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype offset")
/* Check values of precision and offset */
- if(dtype_precision>dtype_size*8 || (dtype_precision+dtype_offset)>dtype_size*8
- || dtype_precision<=0 || dtype_offset<0)
+ if(dtype_precision > dtype_size * 8 || (dtype_precision + dtype_offset) > dtype_size * 8
+ || dtype_precision <= 0 || dtype_offset < 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset")
/* Set "local" parameter for datatype precision */
@@ -484,9 +517,10 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_set_parms_array(hid_t type_id, unsigned cd_values[])
+static herr_t
+H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[])
{
- hid_t dtype_base; /* Array datatype's base datatype */
+ H5T_t *dtype_base = NULL; /* Array datatype's base datatype */
H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */
size_t dtype_size; /* Array datatype's size (in bytes) */
htri_t is_vlstring; /* flag indicating if datatype is varible-length string */
@@ -498,50 +532,57 @@ static herr_t H5Z_set_parms_array(hid_t type_id, unsigned cd_values[])
cd_values[cd_values_index++] = H5Z_NBIT_ARRAY;
/* Get array datatype's size */
- if((dtype_size=H5Tget_size(type_id))==0)
+ if((dtype_size = H5T_get_size(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Set "local" parameter for array datatype's size */
cd_values[cd_values_index++]=dtype_size;
/* Get array datatype's base datatype */
- if((dtype_base=H5Tget_super(type_id))<0)
+ if(NULL == (dtype_base = H5T_get_super(type)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype")
/* Get base datatype's class */
- if((dtype_base_class=H5Tget_class(dtype_base))==H5T_NO_CLASS )
+ if((dtype_base_class = H5T_get_class(dtype_base, TRUE)) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype class")
/* Call appropriate function according to base datatype's class */
switch(dtype_base_class) {
case H5T_INTEGER:
case H5T_FLOAT:
- if(H5Z_set_parms_atomic(dtype_base, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_atomic(dtype_base, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
+
case H5T_ARRAY:
- if(H5Z_set_parms_array(dtype_base, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_array(dtype_base, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
+
case H5T_COMPOUND:
- if(H5Z_set_parms_compound(dtype_base, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_compound(dtype_base, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
+
default: /* other datatype that nbit does no compression */
/* Check if base datatype is a variable-length string */
- if((is_vlstring=H5Tis_variable_str(dtype_base))<0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL,
- "cannot determine if datatype is a variable-length string")
+ if((is_vlstring = H5T_is_variable_str(dtype_base)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string")
/* base datatype of VL or VL-string is not supported */
if(dtype_base_class == H5T_VLEN || is_vlstring)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"datatype not supported by nbit")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype not supported by nbit")
- if(H5Z_set_parms_nooptype(dtype_base, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
} /* end switch */
+
done:
+ if(dtype_base)
+ if(H5T_close(dtype_base) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_set_parms_array() */
@@ -562,17 +603,18 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_set_parms_compound(hid_t type_id, unsigned cd_values[])
+static herr_t
+H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[])
{
- int i; /* local index variable */
int nmembers; /* Compound datatype's number of members */
- hid_t dtype_member; /* Compound datatype's member datatype */
+ H5T_t *dtype_member = NULL; /* Compound datatype's member datatype */
H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */
size_t dtype_member_offset; /* Compound datatype's current member datatype's offset (in bytes) */
size_t dtype_next_member_offset;/* Compound datatype's next member datatype's offset (in bytes) */
size_t dtype_size; /* Compound datatype's size (in bytes) */
htri_t is_vlstring; /* flag indicating if datatype is varible-length string */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_parms_compound, FAIL)
@@ -580,31 +622,31 @@ static herr_t H5Z_set_parms_compound(hid_t type_id, unsigned cd_values[])
cd_values[cd_values_index++] = H5Z_NBIT_COMPOUND;
/* Get datatype's size */
- if((dtype_size=H5Tget_size(type_id))==0)
+ if((dtype_size = H5T_get_size(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Set "local" parameter for compound datatype size */
cd_values[cd_values_index++] = dtype_size;
/* Get number of members */
- if((nmembers=H5Tget_nmembers(type_id))<0)
+ if((nmembers = H5T_get_nmembers(type)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members")
/* Set "local" parameter for number of members */
cd_values[cd_values_index++] = nmembers;
/* For each member, set parameters */
- for(i = 0; i < nmembers; i++) {
+ for(u = 0; u < (unsigned)nmembers; u++) {
/* Get member datatype */
- if((dtype_member=H5Tget_member_type(type_id, (unsigned)i))<0)
+ if(NULL == (dtype_member = H5T_get_member_type(type, u)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
- if((dtype_member_class=H5Tget_member_class(type_id, (unsigned)i))<0)
+ if((dtype_member_class = H5T_get_class(dtype_member, TRUE)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class")
- /* Get member offset, success if H5Tget_member_class() success */
- dtype_member_offset = H5Tget_member_offset(type_id, (unsigned)i);
+ /* Get member offset, success if H5T_get_class() success */
+ dtype_member_offset = H5T_get_member_offset(type, u);
/* Set "local" parameter for member offset */
cd_values[cd_values_index++] = dtype_member_offset;
@@ -613,25 +655,27 @@ static herr_t H5Z_set_parms_compound(hid_t type_id, unsigned cd_values[])
switch(dtype_member_class) {
case H5T_INTEGER:
case H5T_FLOAT:
- if(H5Z_set_parms_atomic(dtype_member, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_atomic(dtype_member, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
+
case H5T_ARRAY:
- if(H5Z_set_parms_array(dtype_member, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_array(dtype_member, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
+
case H5T_COMPOUND:
- if(H5Z_set_parms_compound(dtype_member, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_compound(dtype_member, cd_values) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
+
default: /* other datatype that nbit does no compression */
/* Check if datatype is a variable-length string */
- if((is_vlstring=H5Tis_variable_str(dtype_member))<0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL,
- "cannot determine if datatype is a variable-length string")
+ if((is_vlstring = H5T_is_variable_str(dtype_member)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string")
/* Because for some no-op datatype (VL datatype and VL string datatype), its
- * size can not be retrieved correctly by using function call H5Tget_size,
+ * size can not be retrieved correctly by using function call H5T_get_size,
* special handling is needed for getting the size. Here the difference between
* adjacent member offset is used (if alignment is present, the result can be
* larger, but it does not affect the nbit filter's correctness).
@@ -640,8 +684,8 @@ static herr_t H5Z_set_parms_compound(hid_t type_id, unsigned cd_values[])
/* Set datatype class code */
cd_values[cd_values_index++] = H5Z_NBIT_NOOPTYPE;
- if(i != nmembers - 1)
- dtype_next_member_offset = H5Tget_member_offset(type_id,(unsigned)i+1);
+ if(u != (unsigned)nmembers - 1)
+ dtype_next_member_offset = H5T_get_member_offset(type, u + 1);
else /* current member is the last member */
dtype_next_member_offset = dtype_size;
@@ -649,11 +693,21 @@ static herr_t H5Z_set_parms_compound(hid_t type_id, unsigned cd_values[])
cd_values[cd_values_index++] = dtype_next_member_offset - dtype_member_offset;
} else
if(H5Z_set_parms_nooptype(dtype_member, cd_values)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
} /* end switch */
+
+ /* Close member datatype */
+ if(H5T_close(dtype_member) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype")
+ dtype_member = NULL;
} /* end for */
+
done:
+ if(dtype_member)
+ if(H5T_close(dtype_member) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_set_params_compound */
@@ -676,17 +730,24 @@ done:
static herr_t
H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- unsigned flags; /* Filter flags */
- size_t cd_nelmts=H5Z_NBIT_USER_NPARMS; /* Number of filter parameters */
- unsigned *cd_values = NULL; /* Filter parameters */
- hssize_t npoints; /* Number of points in the dataspace */
- H5T_class_t dtype_class; /* Datatype's class */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5P_genplist_t *dcpl_plist; /* Property list pointer */
+ const H5T_t *type; /* Datatype */
+ const H5S_t *ds; /* Dataspace */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = H5Z_NBIT_USER_NPARMS; /* Number of filter parameters */
+ unsigned *cd_values = NULL; /* Filter parameters */
+ hssize_t npoints; /* Number of points in the dataspace */
+ H5T_class_t dtype_class; /* Datatype's class */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_local_nbit, FAIL)
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get datatype's class */
- if((dtype_class = H5Tget_class(type_id)) == H5T_NO_CLASS )
+ if((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class")
/* Calculate how many parameters will fill the cd_values array
@@ -701,14 +762,17 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
case H5T_FLOAT:
H5Z_calc_parms_atomic();
break;
+
case H5T_ARRAY:
- if(H5Z_calc_parms_array(type_id)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot compute parameters for datatype")
+ if(H5Z_calc_parms_array(type) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype")
break;
+
case H5T_COMPOUND:
- if(H5Z_calc_parms_compound(type_id)==FAIL)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot compute parameters for datatype")
+ if(H5Z_calc_parms_compound(type) == FAIL)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype")
break;
+
default: /* no need to calculate other datatypes at top level */
break;
} /* end switch */
@@ -721,16 +785,20 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
if(NULL == (cd_values = H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for cd_values[]")
+ /* Get the plist structure */
+ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
/* Get the filter's current parameters */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_NBIT, &flags, &cd_nelmts, cd_values, (size_t)0, NULL) < 0)
-#else
- if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_NBIT, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
-#endif
+ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_NBIT, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get nbit parameters")
+ /* Get dataspace */
+ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+
/* Get total number of elements in the chunk */
- if((npoints = H5Sget_simple_extent_npoints(space_id)) < 0)
+ if((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace")
/* Initialize index for cd_values array starting from the third entry */
@@ -746,18 +814,18 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
switch(dtype_class) {
case H5T_INTEGER:
case H5T_FLOAT:
- if(H5Z_set_parms_atomic(type_id, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_atomic(type, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
case H5T_ARRAY:
- if(H5Z_set_parms_array(type_id, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_array(type, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
case H5T_COMPOUND:
- if(H5Z_set_parms_compound(type_id, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE,H5E_BADTYPE,FAIL,"nbit cannot set parameters for datatype")
+ if(H5Z_set_parms_compound(type, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype")
break;
default: /* no need to set parameters for other datatypes at top level */
@@ -772,7 +840,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
cd_values[1] = need_not_compress;
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_NBIT, flags, cd_values_actual_nparms, cd_values) < 0)
+ if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_NBIT, flags, cd_values_actual_nparms, cd_values) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local nbit parameters")
done:
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 330f757..7482275 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -17,10 +17,12 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Ppublic.h" /* Property lists */
+#include "H5Pprivate.h" /* Property lists */
#include "H5Oprivate.h" /* Object headers */
-#include "H5Tpublic.h" /* Datatype functions */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5Zpkg.h" /* Data filters */
#ifdef H5_HAVE_FILTER_SCALEOFFSET
@@ -41,8 +43,9 @@ static double H5Z_scaleoffset_rnd(double val);
static herr_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static enum H5Z_scaleoffset_type H5Z_scaleoffset_get_type(unsigned dtype_class,
unsigned dtype_size, unsigned dtype_sign);
-static herr_t H5Z_scaleoffset_set_parms_fillval(hid_t dcpl_id, hid_t type_id,
- enum H5Z_scaleoffset_type type, unsigned cd_values[], int need_convert);
+static herr_t H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
+ const H5T_t *type, enum H5Z_scaleoffset_type scale_type, unsigned cd_values[],
+ int need_convert, hid_t dxpl_id);
static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
@@ -124,16 +127,16 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{
*/ \
for(i = 0; i < sizeof(type); i++) \
((unsigned char *)&cd_values[H5Z_SCALEOFFSET_PARM_FILVAL])[i] = \
- (unsigned char)((fill_val & ((type)0xff << i*8)) >> i*8); \
+ (unsigned char)((fill_val & ((type)0xff << i * 8)) >> i * 8); \
}
/* Set the fill value parameter in cd_values[] for unsigned integer type */
-#define H5Z_scaleoffset_set_filval_1(type, dcpl_id, type_id, cd_values, need_convert)\
+#define H5Z_scaleoffset_set_filval_1(type, dcpl_plist, dt, cd_values, need_convert, dxpl_id)\
{ \
type fill_val; \
\
/* Get dataset fill value */ \
- if(H5Pget_fill_value(dcpl_id, type_id, &fill_val)<0) \
+ if(H5P_get_fill_value(dcpl_plist, dt, &fill_val, dxpl_id) < 0) \
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \
\
if(need_convert) \
@@ -143,12 +146,12 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{
}
/* Set the fill value parameter in cd_values[] for signed integer type */
-#define H5Z_scaleoffset_set_filval_2(type, dcpl_id, type_id, cd_values, need_convert)\
+#define H5Z_scaleoffset_set_filval_2(type, dcpl_plist, dt, cd_values, need_convert, dxpl_id)\
{ \
type fill_val; \
\
/* Get dataset fill value */ \
- if(H5Pget_fill_value(dcpl_id, type_id, &fill_val)<0) \
+ if(H5P_get_fill_value(dcpl_plist, dt, &fill_val, dxpl_id) < 0) \
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \
\
if(need_convert) \
@@ -158,35 +161,35 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{
}
/* Set the fill value parameter in cd_values[] for character integer type */
-#define H5Z_scaleoffset_set_filval_3(type, dcpl_id, type_id, cd_values, need_convert)\
+#define H5Z_scaleoffset_set_filval_3(type, dcpl_plist, dt, cd_values, need_convert, dxpl_id)\
{ \
type fill_val; \
\
/* Get dataset fill value */ \
- if(H5Pget_fill_value(dcpl_id, type_id, &fill_val)<0) \
+ if(H5P_get_fill_value(dcpl_plist, dt, &fill_val, dxpl_id) < 0) \
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \
\
/* Store the fill value as the last entry in cd_values[] */ \
((unsigned char *)&cd_values[H5Z_SCALEOFFSET_PARM_FILVAL])[0] = fill_val; \
}
-/* Set the fill value parameter in cd_values[] for character floating-point type */
-#define H5Z_scaleoffset_set_filval_4(type, dcpl_id, type_id, cd_values, need_convert)\
+/* Set the fill value parameter in cd_values[] for floating-point type */
+#define H5Z_scaleoffset_set_filval_4(type, dcpl_plist, dt, cd_values, need_convert, dxpl_id)\
{ \
type fill_val; \
\
/* Get dataset fill value */ \
- if(H5Pget_fill_value(dcpl_id, type_id, &fill_val)<0) \
+ if(H5P_get_fill_value(dcpl_plist, dt, &fill_val, dxpl_id) < 0) \
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \
\
if(need_convert) \
H5Z_scaleoffset_convert(&fill_val, 1, sizeof(type)); \
\
- if(sizeof(type)==sizeof(int)) \
+ if(sizeof(type) == sizeof(int)) \
H5Z_scaleoffset_save_filval(unsigned int, cd_values, *(int *)&fill_val) \
- else if(sizeof(type)==sizeof(long)) \
+ else if(sizeof(type) == sizeof(long)) \
H5Z_scaleoffset_save_filval(unsigned long, cd_values, *(long *)&fill_val) \
- else if(sizeof(type)==sizeof(long_long)) \
+ else if(sizeof(type) == sizeof(long_long)) \
H5Z_scaleoffset_save_filval(unsigned long_long, cd_values, *(long_long *)&fill_val)\
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\
@@ -584,23 +587,28 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{
static herr_t
H5Z_can_apply_scaleoffset(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
+ const H5T_t *type; /* Datatype */
H5T_class_t dtype_class; /* Datatype's class */
H5T_order_t dtype_order; /* Datatype's endianness order */
- herr_t ret_value=TRUE; /* Return value */
+ herr_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_scaleoffset, FAIL)
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get datatype's class, for checking the "datatype class" */
- if((dtype_class = H5Tget_class(type_id)) == H5T_NO_CLASS )
+ if((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class")
/* Get datatype's size, for checking the "datatype size" */
- if(H5Tget_size(type_id) == 0)
+ if(H5T_get_size(type) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
if(dtype_class == H5T_INTEGER || dtype_class == H5T_FLOAT) {
/* Get datatype's endianness order */
- if((dtype_order = H5Tget_order(type_id)) == H5T_ORDER_ERROR)
+ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order")
/* Range check datatype's endianness order */
@@ -686,53 +694,41 @@ done:
* Programmer: Xiaowen Wu
* Monday, March 7, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static herr_t H5Z_scaleoffset_set_parms_fillval(hid_t dcpl_id, hid_t type_id,
- enum H5Z_scaleoffset_type type, unsigned cd_values[], int need_convert)
+static herr_t
+H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
+ const H5T_t *type, enum H5Z_scaleoffset_type scale_type,
+ unsigned cd_values[], int need_convert, hid_t dxpl_id)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_scaleoffset_set_parms_fillval, FAIL)
- if(type == t_uchar)
- H5Z_scaleoffset_set_filval_3(unsigned char, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_ushort)
- H5Z_scaleoffset_set_filval_1(unsigned short, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_uint)
- H5Z_scaleoffset_set_filval_1(unsigned int, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_ulong)
- H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_ulong_long)
- H5Z_scaleoffset_set_filval_1(unsigned long_long, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_schar)
- H5Z_scaleoffset_set_filval_3(signed char, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_short)
- H5Z_scaleoffset_set_filval_2(short, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_int)
- H5Z_scaleoffset_set_filval_2(int, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_long)
- H5Z_scaleoffset_set_filval_2(long, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_long_long)
- H5Z_scaleoffset_set_filval_2(long_long, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_float)
- H5Z_scaleoffset_set_filval_4(float, dcpl_id, type_id,
- cd_values, need_convert)
- else if(type == t_double)
- H5Z_scaleoffset_set_filval_4(double, dcpl_id, type_id,
- cd_values, need_convert)
+ if(scale_type == t_uchar)
+ H5Z_scaleoffset_set_filval_3(unsigned char, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_ushort)
+ H5Z_scaleoffset_set_filval_1(unsigned short, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_uint)
+ H5Z_scaleoffset_set_filval_1(unsigned int, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_ulong)
+ H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_ulong_long)
+ H5Z_scaleoffset_set_filval_1(unsigned long_long, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_schar)
+ H5Z_scaleoffset_set_filval_3(signed char, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_short)
+ H5Z_scaleoffset_set_filval_2(short, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_int)
+ H5Z_scaleoffset_set_filval_2(int, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_long)
+ H5Z_scaleoffset_set_filval_2(long, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_long_long)
+ H5Z_scaleoffset_set_filval_2(long_long, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_float)
+ H5Z_scaleoffset_set_filval_4(float, dcpl_plist, type, cd_values, need_convert, dxpl_id)
+ else if(scale_type == t_double)
+ H5Z_scaleoffset_set_filval_4(double, dcpl_plist, type, cd_values, need_convert, dxpl_id)
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -758,61 +754,75 @@ done:
static herr_t
H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- unsigned flags; /* Filter flags */
- size_t cd_nelmts=H5Z_SCALEOFFSET_USER_NPARMS; /* Number of filter parameters */
+ H5P_genplist_t *dcpl_plist; /* Property list pointer */
+ const H5T_t *type; /* Datatype */
+ const H5S_t *ds; /* Dataspace */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = H5Z_SCALEOFFSET_USER_NPARMS; /* Number of filter parameters */
unsigned cd_values[H5Z_SCALEOFFSET_TOTAL_NPARMS]; /* Filter parameters */
hssize_t npoints; /* Number of points in the dataspace */
H5T_class_t dtype_class; /* Datatype's class */
H5T_order_t dtype_order; /* Datatype's endianness order */
- H5T_order_t mem_order; /* Memory's endianness order */
int need_convert = FALSE; /* Flag indicating convertion of byte order */
size_t dtype_size; /* Datatype's size (in bytes) */
H5T_sign_t dtype_sign; /* Datatype's sign */
- enum H5Z_scaleoffset_type type; /* Specific datatype */
+ enum H5Z_scaleoffset_type scale_type; /* Specific datatype */
H5D_fill_value_t status; /* Status of fill value in property list */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_local_scaleoffset, FAIL)
+ /* Get the plist structure */
+ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get the filter's current parameters */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL) < 0)
-#else
- if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
-#endif
+ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters")
+ /* Get dataspace */
+ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+
/* Get total number of elements in the chunk */
- if ((npoints=H5Sget_simple_extent_npoints(space_id))<0)
+ if((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace")
/* Set "local" parameter for this dataset's number of elements */
H5_ASSIGN_OVERFLOW(cd_values[H5Z_SCALEOFFSET_PARM_NELMTS],npoints,hssize_t,unsigned);
/* Get datatype's class */
- if((dtype_class=H5Tget_class(type_id))==H5T_NO_CLASS )
+ if((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class")
/* Set "local" parameter for datatype's class */
switch(dtype_class) {
- case H5T_INTEGER: cd_values[H5Z_SCALEOFFSET_PARM_CLASS] = H5Z_SCALEOFFSET_CLS_INTEGER;
- break;
- case H5T_FLOAT: cd_values[H5Z_SCALEOFFSET_PARM_CLASS] = H5Z_SCALEOFFSET_CLS_FLOAT;
- break;
+ case H5T_INTEGER:
+ cd_values[H5Z_SCALEOFFSET_PARM_CLASS] = H5Z_SCALEOFFSET_CLS_INTEGER;
+ break;
+
+ case H5T_FLOAT:
+ cd_values[H5Z_SCALEOFFSET_PARM_CLASS] = H5Z_SCALEOFFSET_CLS_FLOAT;
+ break;
+
default:
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype class not supported by scaleoffset")
} /* end switch */
/* Get datatype's size */
- if((dtype_size=H5Tget_size(type_id))==0)
+ if((dtype_size = H5T_get_size(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Set "local" parameter for datatype size */
cd_values[H5Z_SCALEOFFSET_PARM_SIZE] = dtype_size;
- if(dtype_class==H5T_INTEGER) {
+ if(dtype_class == H5T_INTEGER) {
/* Get datatype's sign */
- if((dtype_sign=H5Tget_sign(type_id))==H5T_SGN_ERROR)
+ if((dtype_sign = H5T_get_sign(type)) == H5T_SGN_ERROR)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype sign")
/* Set "local" parameter for integer datatype sign */
@@ -820,16 +830,18 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
case H5T_SGN_NONE:
cd_values[H5Z_SCALEOFFSET_PARM_SIGN] = H5Z_SCALEOFFSET_SGN_NONE;
break;
+
case H5T_SGN_2:
cd_values[H5Z_SCALEOFFSET_PARM_SIGN] = H5Z_SCALEOFFSET_SGN_2;
break;
+
default:
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad integer sign")
} /* end switch */
- }
+ } /* end if */
/* Get datatype's endianness order */
- if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR)
+ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
/* Set "local" parameter for datatype endianness */
@@ -837,15 +849,17 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
case H5T_ORDER_LE: /* Little-endian byte order */
cd_values[H5Z_SCALEOFFSET_PARM_ORDER] = H5Z_SCALEOFFSET_ORDER_LE;
break;
+
case H5T_ORDER_BE: /* Big-endian byte order */
cd_values[H5Z_SCALEOFFSET_PARM_ORDER] = H5Z_SCALEOFFSET_ORDER_BE;
break;
+
default:
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
} /* end switch */
/* Check whether fill value is defined for dataset */
- if(H5Pfill_value_defined(dcpl_id, &status)<0)
+ if(H5P_fill_value_defined(dcpl_plist, &status) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to determine if fill value is defined")
/* Set local parameter for availability of fill value */
@@ -854,36 +868,22 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
else {
cd_values[H5Z_SCALEOFFSET_PARM_FILAVAIL] = H5Z_SCALEOFFSET_FILL_DEFINED;
- /* Get memory's endianness order */
- if((mem_order=H5Tget_order(H5T_NATIVE_INT))==H5T_ORDER_ERROR)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad H5T_NATIVE_INT endianness order")
-
/* Check if memory byte order matches dataset datatype byte order */
- switch(mem_order) {
- case H5T_ORDER_LE: /* memory is little-endian byte order */
- if(dtype_order == H5T_ORDER_BE)
- need_convert = TRUE;
- break;
- case H5T_ORDER_BE: /* memory is big-endian byte order */
- if(dtype_order == H5T_ORDER_LE)
- need_convert = TRUE;
- break;
- default:
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad H5T_NATIVE_INT endianness order")
- } /* end switch */
+ if(H5T_native_order_g != dtype_order)
+ need_convert = TRUE;
/* Before getting fill value, get its type */
- if((type = H5Z_scaleoffset_get_type(cd_values[H5Z_SCALEOFFSET_PARM_CLASS],
- cd_values[H5Z_SCALEOFFSET_PARM_SIZE], cd_values[H5Z_SCALEOFFSET_PARM_SIGN]))==0)
+ if((scale_type = H5Z_scaleoffset_get_type(cd_values[H5Z_SCALEOFFSET_PARM_CLASS],
+ cd_values[H5Z_SCALEOFFSET_PARM_SIZE], cd_values[H5Z_SCALEOFFSET_PARM_SIGN])) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast")
/* Get dataset fill value and store in cd_values[] */
- if(H5Z_scaleoffset_set_parms_fillval(dcpl_id, type_id, type, cd_values, need_convert)<0)
+ if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_ind_dxpl_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value")
- }
+ } /* end else */
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SCALEOFFSET, flags, (size_t)H5Z_SCALEOFFSET_TOTAL_NPARMS, cd_values) < 0)
+ if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_SCALEOFFSET, flags, (size_t)H5Z_SCALEOFFSET_TOTAL_NPARMS, cd_values) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters")
done:
@@ -923,7 +923,6 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu
uint32_t minbits = 0; /* minimum number of bits to store values */
unsigned long_long minval= 0; /* minimum value of input buffer */
enum H5Z_scaleoffset_type type; /* memory type corresponding to dataset datatype */
- H5T_order_t mem_order; /* memory's endianness order */
int need_convert = FALSE; /* flag indicating convertion of byte order */
unsigned char *outbuf = NULL; /* pointer to new output buffer */
unsigned buf_offset = 21; /* buffer offset because of parameters stored in file */
@@ -933,23 +932,21 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu
FUNC_ENTER_NOAPI(H5Z_filter_scaleoffset, 0)
/* check arguments */
- if (cd_nelmts!=H5Z_SCALEOFFSET_TOTAL_NPARMS)
+ if(cd_nelmts != H5Z_SCALEOFFSET_TOTAL_NPARMS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of paramters")
- /* get memory's endianness order */
- if((mem_order=H5Tget_order(H5T_NATIVE_INT))==H5T_ORDER_ERROR)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "bad H5T_NATIVE_INT endianness order")
-
- /* check if memory byte order matches dataset datatype byte order */
- switch(mem_order) {
+ /* Check if memory byte order matches dataset datatype byte order */
+ switch(H5T_native_order_g) {
case H5T_ORDER_LE: /* memory is little-endian byte order */
if(cd_values[H5Z_SCALEOFFSET_PARM_ORDER] == H5Z_SCALEOFFSET_ORDER_BE)
need_convert = TRUE;
break;
+
case H5T_ORDER_BE: /* memory is big-endian byte order */
if(cd_values[H5Z_SCALEOFFSET_PARM_ORDER] == H5Z_SCALEOFFSET_ORDER_LE)
need_convert = TRUE;
break;
+
default:
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "bad H5T_NATIVE_INT endianness order")
} /* end switch */
@@ -1005,7 +1002,7 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu
/* prepare paramters to pass to compress/decompress functions */
p.size = cd_values[H5Z_SCALEOFFSET_PARM_SIZE];
- p.mem_order = mem_order;
+ p.mem_order = H5T_native_order_g;
/* input; decompress */
if (flags & H5Z_FLAG_REVERSE) {
@@ -1551,3 +1548,4 @@ static void H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, uns
H5Z_scaleoffset_compress_one_atomic(data, i*p.size, buffer, &j, &buf_len, p);
}
#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c
index 190d0ea..c203ed9 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -18,9 +18,10 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Ppublic.h" /* Property lists */
-#include "H5Tpublic.h" /* Datatype functions */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5Zpkg.h" /* Data filters */
#ifdef H5_HAVE_FILTER_SHUFFLE
@@ -68,27 +69,33 @@ const H5Z_class_t H5Z_SHUFFLE[1] = {{
static herr_t
H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
- unsigned flags; /* Filter flags */
- size_t cd_nelmts=H5Z_SHUFFLE_USER_NPARMS; /* Number of filter parameters */
+ H5P_genplist_t *dcpl_plist; /* Property list pointer */
+ const H5T_t *type; /* Datatype */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = H5Z_SHUFFLE_USER_NPARMS; /* Number of filter parameters */
unsigned cd_values[H5Z_SHUFFLE_TOTAL_NPARMS]; /* Filter parameters */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_local_shuffle, FAIL)
+ /* Get the plist structure */
+ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get the filter's current parameters */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SHUFFLE,&flags,&cd_nelmts, cd_values,0,NULL)<0)
-#else
- if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SHUFFLE,&flags,&cd_nelmts, cd_values,(size_t)0,NULL,NULL)<0)
-#endif
+ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SHUFFLE, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters")
/* Set "local" parameter for this dataset */
- if((cd_values[H5Z_SHUFFLE_PARM_SIZE]=(unsigned)H5Tget_size(type_id))==0)
+ if((cd_values[H5Z_SHUFFLE_PARM_SIZE] = (unsigned)H5T_get_size(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SHUFFLE, flags, (size_t)H5Z_SHUFFLE_TOTAL_NPARMS, cd_values)<0)
+ if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_SHUFFLE, flags, (size_t)H5Z_SHUFFLE_TOTAL_NPARMS, cd_values) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters")
done:
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index 5b12a06..cdc26aa 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -19,10 +19,12 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
-#include "H5Ppublic.h" /* Property lists */
-#include "H5Tpublic.h" /* Datatype functions */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5Zpkg.h" /* Data filters */
#ifdef H5_HAVE_FILTER_SZIP
@@ -84,22 +86,27 @@ H5Z_class_t H5Z_SZIP[1] = {{
static herr_t
H5Z_can_apply_szip(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
+ const H5T_t *type; /* Datatype */
unsigned dtype_size; /* Datatype's size (in bits) */
H5T_order_t dtype_order; /* Datatype's endianness order */
- herr_t ret_value=TRUE; /* Return value */
+ herr_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL)
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get datatype's size, for checking the "bits-per-pixel" */
- if((dtype_size=(8*H5Tget_size(type_id)))==0)
+ if((dtype_size = (8 * H5T_get_size(type))) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Range check datatype's size */
- if(dtype_size>32 && dtype_size!=64)
+ if(dtype_size > 32 && dtype_size != 64)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size")
/* Get datatype's endianness order */
- if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR)
+ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order")
/* Range check datatype's endianness order */
@@ -136,8 +143,11 @@ done:
static herr_t
H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- unsigned flags; /* Filter flags */
- size_t cd_nelmts=H5Z_SZIP_USER_NPARMS; /* Number of filter parameters */
+ H5P_genplist_t *dcpl_plist; /* Property list pointer */
+ const H5T_t *type; /* Datatype */
+ const H5S_t *ds; /* Dataspace */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = H5Z_SZIP_USER_NPARMS; /* Number of filter parameters */
unsigned cd_values[H5Z_SZIP_TOTAL_NPARMS]; /* Filter parameters */
hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dataspace (i.e. chunk) dimensions */
int ndims; /* Number of (chunk) dimensions */
@@ -146,65 +156,71 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
size_t dtype_precision; /* Datatype's precision (in bits) */
size_t dtype_offset; /* Datatype's offset (in bits) */
hsize_t scanline; /* Size of dataspace's fastest changing dimension */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5Z_set_local_szip, FAIL)
+ /* Get the plist structure */
+ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get datatype */
+ if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
/* Get the filter's current parameters */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SZIP,&flags,&cd_nelmts, cd_values,0,NULL)<0)
-#else
- if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SZIP,&flags,&cd_nelmts, cd_values,0,NULL,NULL)<0)
-#endif
+ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SZIP, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters")
/* Get datatype's size, for checking the "bits-per-pixel" */
- if((dtype_size=(8*H5Tget_size(type_id)))==0)
+ if((dtype_size = (8 * H5T_get_size(type))) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size");
/* Get datatype's precision, in case is less than full bits */
- if((dtype_precision=H5Tget_precision(type_id))==0)
+ if((dtype_precision = H5T_get_precision(type)) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision");
- if(dtype_precision<dtype_size) {
- dtype_offset=H5Tget_offset(type_id);
- if(dtype_offset != 0) {
- dtype_precision=dtype_size;
- }
- }
- if (dtype_precision>24) {
- if (dtype_precision <= 32) {
- dtype_precision=32;
- } else if ( dtype_precision <= 64) {
- dtype_precision=64;
- }
- }
+ if(dtype_precision < dtype_size) {
+ dtype_offset = H5T_get_offset(type);
+ if(dtype_offset != 0)
+ dtype_precision = dtype_size;
+ } /* end if */
+ if(dtype_precision > 24) {
+ if(dtype_precision <= 32)
+ dtype_precision = 32;
+ else if(dtype_precision <= 64)
+ dtype_precision = 64;
+ } /* end if */
/* Set "local" parameter for this dataset's "bits-per-pixel" */
- cd_values[H5Z_SZIP_PARM_BPP]=dtype_precision;
+ cd_values[H5Z_SZIP_PARM_BPP] = dtype_precision;
+
+ /* Get dataspace */
+ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Get dimensions for dataspace */
- if ((ndims=H5Sget_simple_extent_dims(space_id, dims, NULL))<0)
+ if((ndims = H5S_get_simple_extent_dims(ds, dims, NULL)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions")
/* Set "local" parameter for this dataset's "pixels-per-scanline" */
/* (Use the chunk's fastest changing dimension size) */
- assert(ndims>0);
- scanline=dims[ndims-1];
+ assert(ndims > 0);
+ scanline = dims[ndims - 1];
/* Adjust scanline if it is smaller than number of pixels per block or
if it is bigger than maximum pixels per scanline, or there are more than
SZ_MAX_BLOCKS_PER_SCANLINE blocks per scanline */
/* Check the pixels per block against the 'scanline' size */
- if(scanline<cd_values[H5Z_SZIP_PARM_PPB]) {
+ if(scanline < cd_values[H5Z_SZIP_PARM_PPB]) {
hssize_t npoints; /* Number of points in the dataspace */
/* Get number of elements for the dataspace; use
total number of elements in the chunk to define the new 'scanline' size */
- if ((npoints=H5Sget_simple_extent_npoints(space_id))<0)
+ if((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace")
- if(npoints<cd_values[H5Z_SZIP_PARM_PPB])
+ if(npoints < cd_values[H5Z_SZIP_PARM_PPB])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels per block greater than total number of elements in the chunk")
scanline = MIN((cd_values[H5Z_SZIP_PARM_PPB] * SZ_MAX_BLOCKS_PER_SCANLINE), npoints);
}
@@ -219,7 +235,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
H5_ASSIGN_OVERFLOW(cd_values[H5Z_SZIP_PARM_PPS],scanline,hsize_t,unsigned);
/* Get datatype's endianness order */
- if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR)
+ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
/* Set the correct endianness flag for szip */
@@ -239,7 +255,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
} /* end switch */
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SZIP, flags, H5Z_SZIP_TOTAL_NPARMS, cd_values)<0)
+ if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_SZIP, flags, H5Z_SZIP_TOTAL_NPARMS, cd_values) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters")
done:
diff --git a/src/H5vers.txt b/src/H5vers.txt
index a48b613..4ef22d2 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -60,6 +60,7 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
FUNCTION: H5Pget_filter; ; v10, v18
+FUNCTION: H5Pget_filter_by_id; ; v16, 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 80bfb58..a9843bc 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -98,6 +98,10 @@
#define H5Pget_filter_vers 1
#endif /* !defined(H5Pget_filter_vers) */
+#if !defined(H5Pget_filter_by_id_vers)
+#define H5Pget_filter_by_id_vers 1
+#endif /* !defined(H5Pget_filter_by_id_vers) */
+
#if !defined(H5Pinsert_vers)
#define H5Pinsert_vers 1
#endif /* !defined(H5Pinsert_vers) */
@@ -310,6 +314,17 @@
#error "H5Pget_filter_vers set to invalid value"
#endif /* H5Pget_filter_vers */
+#if !defined(H5Pget_filter_by_id_vers) || H5Pget_filter_by_id_vers == 2
+#ifndef H5Pget_filter_by_id_vers
+#define H5Pget_filter_by_id_vers 2
+#endif /* H5Pget_filter_by_id_vers */
+#define H5Pget_filter_by_id H5Pget_filter_by_id2
+#elif H5Pget_filter_by_id_vers == 1
+#define H5Pget_filter_by_id H5Pget_filter_by_id1
+#else /* H5Pget_filter_by_id_vers */
+#error "H5Pget_filter_by_id_vers set to invalid value"
+#endif /* H5Pget_filter_by_id_vers */
+
#if !defined(H5Pinsert_vers) || H5Pinsert_vers == 2
#ifndef H5Pinsert_vers
#define H5Pinsert_vers 2