mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.4.0beta1.tar
This commit is contained in:
67
pngread.c
67
pngread.c
@@ -11,8 +11,8 @@
|
||||
* read a PNG file or stream.
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
#include "pngintrn.h"
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED)
|
||||
|
||||
@@ -55,11 +55,9 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
if (png_ptr == NULL)
|
||||
return (NULL);
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
@@ -113,15 +111,15 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
|
||||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
||||
{
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
#ifndef PNG_NO_STDIO
|
||||
char msg[80];
|
||||
if (user_png_ver)
|
||||
{
|
||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
png_sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
user_png_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_libpng_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
#endif
|
||||
@@ -171,61 +169,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
return (png_ptr);
|
||||
}
|
||||
|
||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
||||
/* Initialize PNG structure for reading, and allocate any memory needed.
|
||||
This interface is deprecated in favour of the png_create_read_struct(),
|
||||
and it will disappear as of libpng-1.3.0. */
|
||||
#undef png_read_init
|
||||
void PNGAPI
|
||||
png_read_init(png_structp png_ptr)
|
||||
{
|
||||
/* We only come here via pre-1.0.7-compiled applications */
|
||||
png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_size_t png_struct_size, png_size_t png_info_size)
|
||||
{
|
||||
/* We only come here via pre-1.0.12-compiled applications */
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
if(png_sizeof(png_struct) > png_struct_size ||
|
||||
png_sizeof(png_info) > png_info_size)
|
||||
{
|
||||
char msg[80];
|
||||
png_ptr->warning_fn=NULL;
|
||||
if (user_png_ver)
|
||||
{
|
||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
user_png_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_libpng_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
#endif
|
||||
if(png_sizeof(png_struct) > png_struct_size)
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
png_ptr->flags=0;
|
||||
#endif
|
||||
png_error(png_ptr,
|
||||
"The png struct allocated by the application for reading is too small.");
|
||||
}
|
||||
if(png_sizeof(png_info) > png_info_size)
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
png_ptr->flags=0;
|
||||
#endif
|
||||
png_error(png_ptr,
|
||||
"The info struct allocated by application for reading is too small.");
|
||||
}
|
||||
png_read_init_3(&png_ptr, user_png_ver, png_struct_size);
|
||||
}
|
||||
#endif /* PNG_1_0_X || PNG_1_2_X */
|
||||
|
||||
void PNGAPI
|
||||
png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
|
||||
Reference in New Issue
Block a user