compression code unification

Unify the compression code so that inflate calls are localized to a common
routine.  Ground work for filter selection support.  Minor API changes to use
void* not byte* for data parameters.  Unification of some of the compression
code with the decompression code; IDAT_size replaces IDAT_read_size and
zbuffer_size, IDAT reading and writing is no longer controlled by the size of
the compression buffer.

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler
2015-11-30 13:39:49 -08:00
parent 6bbc74d880
commit 4792c8a751
15 changed files with 609 additions and 537 deletions

View File

@@ -569,15 +569,15 @@ struct png_struct_def
#endif /* TRANFORM_MECH */
#ifdef PNG_READ_SUPPORTED
/* These, and IDAT_read_size below, control how much input and output (at
* most) is available to zlib.
/* These, and IDAT_size below, control how much input and output (at most) is
* available to zlib during read decompression.
*/
png_alloc_size_t read_buffer_size; /* current size of the buffer */
#endif
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
uInt IDAT_read_size; /* limit on read buffer size for IDAT */
#endif
#if defined(PNG_SEQUENTIAL_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
uInt IDAT_size; /* limit on IDAT read and write IDAT size */
#endif /* SEQUENTIAL_READ || WRITE */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
int zlib_text_level; /* holds zlib compression level */
@@ -600,8 +600,10 @@ struct png_struct_def
int zlib_set_mem_level;
int zlib_set_strategy;
png_compression_bufferp zbuffer_list; /* Created on demand during write */
uInt zbuffer_size; /* size of the actual zlib buffer */
unsigned int zbuffer_start; /* Bytes written from start */
png_uint_32 zbuffer_len; /* Length of data in list */
png_compression_bufferp zbuffer_list; /* Created on demand during write */
png_compression_bufferp *zbuffer_end; /* 'next' field of current buffer */
#endif
/* ERROR HANDLING */