[libpng16] Removed non-working progressive reader 'skip' function. This

function has apparently never been used. It was implemented
to support back-door modification of png_struct in libpng-1.4.x
but was apparently never tested (because it does nothing and cannot
do anything).
This commit is contained in:
John Bowler 2015-06-03 14:31:08 -05:00 committed by Glenn Randers-Pehrson
parent 1a6841c99c
commit 25bfb13770
4 changed files with 21 additions and 103 deletions

View File

@ -1,4 +1,4 @@
Libpng 1.6.18beta07 - June 1, 2015 Libpng 1.6.18beta07 - June 3, 2015
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -69,7 +69,12 @@ Version 1.6.18beta06 [June 1, 2015]
png_set_filter_heuristics_fixed() APIs are retained but deprecated png_set_filter_heuristics_fixed() APIs are retained but deprecated
and do nothing. and do nothing.
Version 1.6.18beta07 [June 1, 2015] Version 1.6.18beta07 [June 3, 2015]
Removed non-working progressive reader 'skip' function. This
function has apparently never been used. It was implemented
to support back-door modification of png_struct in libpng-1.4.x
but was apparently never tested (because it does nothing and cannot
do anything).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -5254,7 +5254,12 @@ Version 1.6.18beta06 [June 1, 2015]
png_set_filter_heuristics_fixed() APIs are retained but deprecated png_set_filter_heuristics_fixed() APIs are retained but deprecated
and do nothing. and do nothing.
Version 1.6.18beta07 [June 1, 2015] Version 1.6.18beta07 [June 3, 2015]
Removed non-working progressive reader 'skip' function. This
function has apparently never been used. It was implemented
to support back-door modification of png_struct in libpng-1.4.x
but was apparently never tested (because it does nothing and cannot
do anything).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -19,7 +19,6 @@
#define PNG_READ_SIG_MODE 0 #define PNG_READ_SIG_MODE 0
#define PNG_READ_CHUNK_MODE 1 #define PNG_READ_CHUNK_MODE 1
#define PNG_READ_IDAT_MODE 2 #define PNG_READ_IDAT_MODE 2
#define PNG_SKIP_MODE 3
#define PNG_READ_tEXt_MODE 4 #define PNG_READ_tEXt_MODE 4
#define PNG_READ_zTXt_MODE 5 #define PNG_READ_zTXt_MODE 5
#define PNG_READ_DONE_MODE 6 #define PNG_READ_DONE_MODE 6
@ -78,32 +77,14 @@ png_process_data_pause(png_structrp png_ptr, int save)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_process_data_skip(png_structrp png_ptr) png_process_data_skip(png_structrp png_ptr)
{ {
png_uint_32 remaining = 0; /* TODO: Deprecate and remove this API.
* Somewhere the implementation of this seems to have been lost,
if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE && * or abandoned. It was only to support some internal back-door access
png_ptr->skip_length > 0) * to png_struct) in libpng-1.4.x.
{ */
/* At the end of png_process_data the buffer size must be 0 (see the loop png_app_warning(png_ptr,
* above) so we can detect a broken call here: "png_process_data_skip is not implemented in any current version of libpng");
*/ return 0;
if (png_ptr->buffer_size != 0)
png_error(png_ptr,
"png_process_data_skip called inside png_process_data");
/* If is impossible for there to be a saved buffer at this point -
* otherwise we could not be in SKIP mode. This will also happen if
* png_process_skip is called inside png_process_data (but only very
* rarely.)
*/
if (png_ptr->save_buffer_size != 0)
png_error(png_ptr, "png_process_data_skip called with saved data");
remaining = png_ptr->skip_length;
png_ptr->skip_length = 0;
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
}
return remaining;
} }
/* What we do with the incoming data depends on what we were previously /* What we do with the incoming data depends on what we were previously
@ -135,12 +116,6 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
break; break;
} }
case PNG_SKIP_MODE:
{
png_push_crc_finish(png_ptr);
break;
}
default: default:
{ {
png_ptr->buffer_size = 0; png_ptr->buffer_size = 0;
@ -439,69 +414,6 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
} }
void /* PRIVATE */
png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
{
png_ptr->process_mode = PNG_SKIP_MODE;
png_ptr->skip_length = skip;
}
void /* PRIVATE */
png_push_crc_finish(png_structrp png_ptr)
{
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
{
png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'save_buffer_size', but
* they are of different types and we don't know which variable has the
* fewest bits. Carefully select the smaller and cast it to the type of
* the larger - this cannot overflow. Do not cast in the following test
* - it will break on either 16 or 64 bit platforms.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
else
skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size;
png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size;
}
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
{
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'current_buffer_size', here,
* the same problem exists as above and the same solution.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
else
skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size;
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
}
if (png_ptr->skip_length == 0)
{
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
png_crc_finish(png_ptr, 0);
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
}
}
void PNGCBAPI void PNGCBAPI
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
{ {

View File

@ -1392,10 +1392,6 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr,
PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
png_inforp info_ptr),PNG_EMPTY); png_inforp info_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_crc_skip,(png_structrp png_ptr,
png_uint_32 length),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_crc_finish,(png_structrp png_ptr),
PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr), PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
PNG_EMPTY); PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,