summaryrefslogtreecommitdiffstats
path: root/src/H5P.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-21 20:32:07 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-21 20:32:07 (GMT)
commit91a34f543da20aee0de3ad2ec2cc58f86750bcf6 (patch)
treed538ec3a0fba6996818c33ee57661bb1cc4ce209 /src/H5P.c
parent54256b22c0fb6a38d1b33e531ef617b00c013ea6 (diff)
downloadhdf5-91a34f543da20aee0de3ad2ec2cc58f86750bcf6.zip
hdf5-91a34f543da20aee0de3ad2ec2cc58f86750bcf6.tar.gz
hdf5-91a34f543da20aee0de3ad2ec2cc58f86750bcf6.tar.bz2
[svn-r355] Changes since 19980417
---------------------- This checkin completes the compression stuff almost two weeks ahead of schedule. It should now all be working and documented. ./Makefile.in ./config/commence.in A distclean causes the distribution makefile to be copied to Makefile again. ./src/H5D.c Opening a compressed dataset now works properly. ./src/H5P.c ./src/H5Ppublic.h The H5Pset_compression() and H5Pget_compression() now work as documented. ./src/H5T.c Fixed a bug that causes the library to crash sometimes if debugging is turned on for the `t' package. ./src/H5Z.c Fixed a bug where the number of bytes attributed to compression overruns was too low in the debugging output. ./test/dsets.c More compression tests: reading of uninitialized data, opening an existing dataset and reading it, partial I/O which isn't aligned on chunk boundaries, and use of application-defined compression methods. ./MANIFEST Removed ./test/dspace.c.
Diffstat (limited to 'src/H5P.c')
-rw-r--r--src/H5P.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/H5P.c b/src/H5P.c
index b141853..3c802e4 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1859,6 +1859,10 @@ H5Pget_preserve (hid_t plist_id)
* specific compression initialization functions like
* H5Pset_deflate().
*
+ * The FLAGS, CD_SIZE, and CLIENT_DATA are copied to the
+ * property list and eventually to the file and passed to the
+ * compression functions.
+ *
* Return: Success: SUCCEED
*
* Failure: FAIL
@@ -1871,7 +1875,8 @@ H5Pget_preserve (hid_t plist_id)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_compression (hid_t plist_id, H5Z_method_t method)
+H5Pset_compression (hid_t plist_id, H5Z_method_t method, unsigned int flags,
+ size_t cd_size, const void *client_data)
{
H5D_create_t *plist = NULL;
@@ -1891,7 +1896,12 @@ H5Pset_compression (hid_t plist_id, H5Z_method_t method)
/* Clear any previous compression method info, then set new value */
H5O_reset (H5O_COMPRESS, &(plist->compress));
plist->compress.method = method;
-
+ plist->compress.flags = flags;
+ plist->compress.cd_size = cd_size;
+ if (cd_size) {
+ plist->compress.client_data = H5MM_xmalloc (cd_size);
+ HDmemcpy (plist->compress.client_data, client_data, cd_size);
+ }
FUNC_LEAVE (SUCCEED);
}
@@ -1900,7 +1910,11 @@ H5Pset_compression (hid_t plist_id, H5Z_method_t method)
* Function: H5Pget_compression
*
* Purpose: Gets the compression method information from a dataset
- * creation property list.
+ * creation property list. The CLIENT_DATA buffer is initially
+ * CD_SIZE bytes. On return, CLIENT_DATA will be initialized
+ * with at most that many bytes, and CD_SIZE will contain the
+ * actual size of the client data, which might be larger than
+ * its original value.
*
* Return: Success: Compression method.
*
@@ -1914,7 +1928,8 @@ H5Pset_compression (hid_t plist_id, H5Z_method_t method)
*-------------------------------------------------------------------------
*/
H5Z_method_t
-H5Pget_compression (hid_t plist_id)
+H5Pget_compression (hid_t plist_id, unsigned int *flags/*out*/,
+ size_t *cd_size/*in,out*/, void *client_data/*out*/)
{
H5D_create_t *plist = NULL;
@@ -1927,6 +1942,16 @@ H5Pget_compression (hid_t plist_id)
"not a dataset creation property list");
}
+ /* Output values */
+ if (flags) *flags = plist->compress.flags;
+ if (cd_size) {
+ if (*cd_size>0 && client_data) {
+ HDmemcpy (client_data, plist->compress.client_data,
+ MIN(plist->compress.cd_size, *cd_size));
+ }
+ *cd_size = plist->compress.cd_size;
+ }
+
FUNC_LEAVE (plist->compress.method);
}