summaryrefslogtreecommitdiffstats
path: root/src/H5Zdeflate.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-09-01 10:27:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-09-01 10:27:45 (GMT)
commit642f392ba3e2d30ae2a82e32f249461121d17cbc (patch)
treebbce1ae1606153f323156f207b50d88d7fba2ddf /src/H5Zdeflate.c
parentc034336452ee48574f0dd65bf053079f9801e269 (diff)
downloadhdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.zip
hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.tar.gz
hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.tar.bz2
[svn-r19330] Description:
Bring r19109:19328 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5Zdeflate.c')
-rw-r--r--src/H5Zdeflate.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index c490720..598aa97 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -28,8 +28,11 @@
#ifdef H5_HAVE_FILTER_DEFLATE
-#ifdef H5_HAVE_ZLIB_H
-# include "zlib.h"
+#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
+# define H5_ZLIB_HEADER "zlib.h"
+#endif
+#if defined(H5_ZLIB_HEADER)
+# include H5_ZLIB_HEADER /* "zlib.h" */
#endif
/* Local function prototypes */
@@ -98,9 +101,9 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Set the uncompression parameters */
HDmemset(&z_strm, 0, sizeof(z_strm));
- z_strm.next_in = *buf;
+ z_strm.next_in = (Bytef *)*buf;
H5_ASSIGN_OVERFLOW(z_strm.avail_in,nbytes,size_t,unsigned);
- z_strm.next_out = outbuf;
+ z_strm.next_out = (Bytef *)outbuf;
H5_ASSIGN_OVERFLOW(z_strm.avail_out,nalloc,size_t,unsigned);
/* Initialize the uncompression routines */
@@ -152,7 +155,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Finish uncompressing the stream */
(void)inflateEnd(&z_strm);
- }
+ } /* end if */
else {
/*
* Output; compress but fail if the result would be larger than the
@@ -169,19 +172,20 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
H5_ASSIGN_OVERFLOW(aggression,cd_values[0],unsigned,int);
/* Allocate output (compressed) buffer */
- if (NULL==(z_dst=outbuf=H5MM_malloc(z_dst_nbytes)))
+ if(NULL == (outbuf = H5MM_malloc(z_dst_nbytes)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer")
+ z_dst = (Bytef *)outbuf;
/* Perform compression from the source to the destination buffer */
- status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
+ status = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
/* Check for various zlib errors */
- if (Z_BUF_ERROR==status)
+ if(Z_BUF_ERROR == status)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
- 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, "other deflate error")
+ 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, "other deflate error")
/* Successfully uncompressed the buffer */
else {
/* Free the input buffer */
@@ -192,8 +196,8 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
outbuf = NULL;
*buf_size = nbytes;
ret_value = z_dst_nbytes;
- }
- }
+ } /* end else */
+ } /* end else */
done:
if(outbuf)