mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.6beta4.tar
This commit is contained in:
37
pngwrite.c
37
pngwrite.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* libpng 1.2.6beta3 - July 18, 2004
|
||||
* libpng 1.2.6beta4 - July 28, 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)
|
||||
@@ -471,7 +471,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
return (NULL);
|
||||
}
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -538,7 +538,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
PNG_ABORT();
|
||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
|
||||
#else
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
PNG_ABORT();
|
||||
@@ -562,7 +562,8 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
{
|
||||
/* We only come here via pre-1.0.12-compiled applications */
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
if(sizeof(png_struct) > png_struct_size || sizeof(png_info) > png_info_size)
|
||||
if(png_sizeof(png_struct) > png_struct_size ||
|
||||
png_sizeof(png_info) > png_info_size)
|
||||
{
|
||||
char msg[80];
|
||||
png_ptr->warning_fn=NULL;
|
||||
@@ -577,7 +578,7 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
#endif
|
||||
if(sizeof(png_struct) > png_struct_size)
|
||||
if(png_sizeof(png_struct) > png_struct_size)
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
@@ -586,7 +587,7 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_error(png_ptr,
|
||||
"The png struct allocated by the application for writing is too small.");
|
||||
}
|
||||
if(sizeof(png_info) > png_info_size)
|
||||
if(png_sizeof(png_info) > png_info_size)
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
@@ -627,10 +628,10 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* save jump buffer and error functions */
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
if (sizeof(png_struct) > png_struct_size)
|
||||
if (png_sizeof(png_struct) > png_struct_size)
|
||||
{
|
||||
png_destroy_struct(png_ptr);
|
||||
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
|
||||
@@ -638,7 +639,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
}
|
||||
|
||||
/* reset all variables to 0 */
|
||||
png_memset(png_ptr, 0, sizeof (png_struct));
|
||||
png_memset(png_ptr, 0, png_sizeof (png_struct));
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
@@ -648,7 +649,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* restore jump buffer */
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
|
||||
@@ -1050,7 +1051,7 @@ png_write_destroy(png_structp png_ptr)
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* reset structure */
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
error_fn = png_ptr->error_fn;
|
||||
@@ -1060,7 +1061,7 @@ png_write_destroy(png_structp png_ptr)
|
||||
free_fn = png_ptr->free_fn;
|
||||
#endif
|
||||
|
||||
png_memset(png_ptr, 0, sizeof (png_struct));
|
||||
png_memset(png_ptr, 0, png_sizeof (png_struct));
|
||||
|
||||
png_ptr->error_fn = error_fn;
|
||||
png_ptr->warning_fn = warning_fn;
|
||||
@@ -1070,7 +1071,7 @@ png_write_destroy(png_structp png_ptr)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1212,7 +1213,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
if (png_ptr->prev_filters == NULL)
|
||||
{
|
||||
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_byte) * num_weights));
|
||||
(png_uint_32)(png_sizeof(png_byte) * num_weights));
|
||||
|
||||
/* To make sure that the weighting starts out fairly */
|
||||
for (i = 0; i < num_weights; i++)
|
||||
@@ -1224,10 +1225,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
if (png_ptr->filter_weights == NULL)
|
||||
{
|
||||
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
|
||||
|
||||
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
@@ -1258,10 +1259,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
if (png_ptr->filter_costs == NULL)
|
||||
{
|
||||
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||
|
||||
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||
|
||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user