summaryrefslogtreecommitdiffstats
path: root/src/H5Zdeflate.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2003-02-04 18:50:56 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2003-02-04 18:50:56 (GMT)
commit3879dcce1b831fd553ff15256661ca7cc23ca70d (patch)
treef4a6ed3b08b7ac2926b396f497fdd62faf35bb6c /src/H5Zdeflate.c
parent092a41fe51ea58ab388d5f5d577f7d4a16a1f5b8 (diff)
downloadhdf5-3879dcce1b831fd553ff15256661ca7cc23ca70d.zip
hdf5-3879dcce1b831fd553ff15256661ca7cc23ca70d.tar.gz
hdf5-3879dcce1b831fd553ff15256661ca7cc23ca70d.tar.bz2
[svn-r6375]
Purpose: New feature Description: Added Adler32 checksum as a filter in pipeline Platforms tested: arabica (fortran), eirene (, C++), modi4 (parallel, fortran) Misc. update: Update release_docs/RELEASE.
Diffstat (limited to 'src/H5Zdeflate.c')
-rw-r--r--src/H5Zdeflate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index 3c91836..c147533 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -21,6 +21,8 @@
#define INTERFACE_INIT NULL
static int interface_initialize_g = 0;
+#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil((double)((s)*1.001))+12)
+
/*-------------------------------------------------------------------------
* Function: H5Z_filter_deflate
@@ -103,10 +105,10 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
*/
const Bytef *z_src = (const Bytef*)(*buf);
Bytef *z_dst; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)nbytes;
+ uLongf z_dst_nbytes = (uLongf)H5Z_DEFLATE_SIZE_ADJUST(nbytes);
uLong z_src_nbytes = (uLong)nbytes;
-
- if (NULL==(z_dst=outbuf=H5MM_malloc(nbytes)))
+
+ if (NULL==(z_dst=outbuf=H5MM_malloc(z_dst_nbytes)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer");
status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
if (Z_BUF_ERROR==status) {
@@ -114,7 +116,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
} else if (Z_MEM_ERROR==status) {
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error");
} else if (Z_OK!=status) {
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate error");
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "other deflate error");
} else {
H5MM_xfree(*buf);
*buf = outbuf;