/* pngpread.c - read a png file in push mode
*
* libpng version 1.2.8 - December 3, 2004
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
#define PNG_INTERNAL
#include "png.h"
/* push model modes */
#define PNG_READ_SIG_MODE 0
void PNGAPI
{
while (png_ptr->buffer_size)
{
}
}
/* What we do with the incoming data depends on what we were previously
* doing before we ran out of data...
*/
void /* PRIVATE */
{
switch (png_ptr->process_mode)
{
case PNG_READ_SIG_MODE:
{
break;
}
case PNG_READ_CHUNK_MODE:
{
break;
}
case PNG_READ_IDAT_MODE:
{
break;
}
#if defined(PNG_READ_tEXt_SUPPORTED)
case PNG_READ_tEXt_MODE:
{
break;
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
case PNG_READ_zTXt_MODE:
{
break;
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
case PNG_READ_iTXt_MODE:
{
break;
}
#endif
case PNG_SKIP_MODE:
{
break;
}
default:
{
png_ptr->buffer_size = 0;
break;
}
}
}
/* Read any remaining signature bytes from the stream and compare them with
* the correct PNG signature. It is possible that this routine is called
* with bytes already read from the signature, either because they have been
* checked by the calling application, or because of multiple calls to this
* routine.
*/
void /* PRIVATE */
{
{
}
{
if (num_checked < 4 &&
else
}
else
{
{
}
}
}
void /* PRIVATE */
{
#ifdef PNG_USE_LOCAL_ARRAYS
#if defined(PNG_READ_bKGD_SUPPORTED)
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#endif
#endif /* PNG_USE_LOCAL_ARRAYS */
/* First we make sure we have enough data for the 4 byte chunk name
* and the 4 byte chunk length before proceeding with decoding the
* chunk data. To fully decode each of these chunks, we also make
* sure we have enough data in the buffer for the 4 byte CRC at the
* end of every chunk (except IDAT, which is handled separately).
*/
{
{
return;
}
}
{
{
return;
}
}
{
{
return;
}
}
{
{
return;
}
{
}
}
#endif
{
{
return;
}
}
{
/* If we reach an IDAT chunk, this means we have read all of the
* header chunks, and we can start reading the image (or if this
* is called after the image has been read - we have an error).
*/
{
if (png_ptr->push_length == 0)
return;
}
return;
}
#if defined(PNG_READ_gAMA_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
{
{
return;
}
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
{
{
return;
}
}
#endif
else
{
{
return;
}
}
}
void /* PRIVATE */
{
}
void /* PRIVATE */
{
{
else
}
{
else
}
if (!png_ptr->skip_length)
{
{
return;
}
png_crc_finish(png_ptr, 0);
}
}
void PNGAPI
{
if (png_ptr->save_buffer_size)
{
else
}
{
else
}
}
void /* PRIVATE */
{
if (png_ptr->save_buffer_size)
{
{
{
}
}
}
{
{
}
}
if (png_ptr->current_buffer_size)
{
png_ptr->current_buffer_size = 0;
}
png_ptr->buffer_size = 0;
}
void /* PRIVATE */
{
}
void /* PRIVATE */
{
#ifdef PNG_USE_LOCAL_ARRAYS
#endif
{
{
return;
}
{
return;
}
}
{
{
/* check for overflow */
}
else
}
{
{
/* check for overflow */
}
else
}
{
{
return;
}
png_crc_finish(png_ptr, 0);
}
}
void /* PRIVATE */
{
int ret;
for(;;)
{
{
if (ret == Z_STREAM_END)
{
{
}
break;
}
else if (ret == Z_BUF_ERROR)
break;
else
}
{
if ((
#if defined(PNG_READ_INTERLACING_SUPPORTED)
(!png_ptr->interlaced &&
#endif
{
break;
}
}
else
break;
}
}
void /* PRIVATE */
{
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* blow up interlaced rows to full size */
{
/* old interface (pre-1.0.9):
png_do_read_interlace(&(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/
{
case 0:
{
int i;
{
}
{
{
}
}
{
{
}
}
{
}
break;
}
case 1:
{
int i;
{
}
{
{
}
}
break;
}
case 2:
{
int i;
{
}
{
}
{
{
}
}
break;
}
case 3:
{
int i;
{
}
{
{
}
}
break;
}
case 4:
{
int i;
{
}
{
}
{
}
break;
}
case 5:
{
int i;
{
}
{
}
break;
}
case 6:
{
break;
}
}
}
else
#endif
{
}
}
void /* PRIVATE */
{
#ifdef PNG_USE_LOCAL_ARRAYS
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
/* offset to next interlace block */
/* start of interlace block in the y direction */
/* offset to next interlace block in the y direction */
/* Width of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
*/
/* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/
#endif
png_ptr->row_number++;
return;
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
do
{
break;
break;
}
}
#if defined(PNG_READ_tEXt_SUPPORTED)
void /* PRIVATE */
{
{
/* to quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
{
}
#endif
}
void /* PRIVATE */
{
{
else
}
if (!(png_ptr->current_text_left))
{
int ret;
{
return;
}
#if defined(PNG_MAX_MALLOC_64K)
if (png_ptr->skip_length)
return;
#endif
/* empty loop */ ;
text++;
#ifdef PNG_iTXt_SUPPORTED
#endif
if (ret)
}
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
void /* PRIVATE */
{
{
/* to quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
/* We can't handle zTXt chunks > 64K, since we don't have enough space
* to be able to store the uncompressed data. Actually, the threshold
* is probably around 32K, but it isn't as definite as 64K is.
*/
{
return;
}
#endif
}
void /* PRIVATE */
{
{
else
}
if (!(png_ptr->current_text_left))
{
int ret;
{
return;
}
/* empty loop */ ;
/* zTXt can't have zero text */
{
return;
}
text++;
{
return;
}
text++;
text_size = 0;
ret = Z_STREAM_END;
{
{
return;
}
{
{
+ key_size + 1));
}
else
{
+ 1));
}
if (ret != Z_STREAM_END)
{
}
}
else
{
break;
}
if (ret == Z_STREAM_END)
break;
}
if (ret != Z_STREAM_END)
{
return;
}
#ifdef PNG_iTXt_SUPPORTED
#endif
if (ret)
}
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
void /* PRIVATE */
{
{
/* to quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
{
}
#endif
}
void /* PRIVATE */
{
{
else
}
if (!(png_ptr->current_text_left))
{
int comp_flag;
int ret;
{
return;
}
#if defined(PNG_MAX_MALLOC_64K)
if (png_ptr->skip_length)
return;
#endif
/* empty loop */ ;
lang++;
lang++; /* skip comp_type, always zero */
/* empty loop */ ;
lang_key++; /* skip NUL separator */
/* empty loop */ ;
text++;
text_ptr->text_length = 0;
if (ret)
}
}
#endif
/* This function is called when we haven't found a handler for this
* chunk. If there isn't a problem with the chunk itself (ie a bad chunk
* name or a critical chunk), the chunk is (currently) silently ignored.
*/
void /* PRIVATE */
{
{
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#endif
)
#endif
/* to quiet compiler warnings about unused info_ptr */
return;
}
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
{
#ifdef PNG_MAX_MALLOC_64K
{
}
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
{
/* callback to user unknown chunk handler */
{
}
}
else
#endif
}
else
#endif
}
void /* PRIVATE */
{
}
void /* PRIVATE */
{
}
void /* PRIVATE */
{
}
void PNGAPI
{
#ifdef PNG_USE_LOCAL_ARRAYS
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif
}
void PNGAPI
{
}
{
}
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */