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.30beta04.tar
This commit is contained in:
20
pngwrite.c
20
pngwrite.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.30 [July 6, 2008]
|
||||
* Last changed in libpng 1.2.30 [July 10, 2008]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -32,7 +32,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
png_write_sig(png_ptr); /* write PNG signature */
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
|
||||
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
|
||||
{
|
||||
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
|
||||
png_ptr->mng_features_permitted=0;
|
||||
@@ -491,12 +491,12 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
|
||||
|
||||
if(user_png_ver)
|
||||
if (user_png_ver)
|
||||
{
|
||||
i=0;
|
||||
do
|
||||
{
|
||||
if(user_png_ver[i] != png_libpng_ver[i])
|
||||
if (user_png_ver[i] != png_libpng_ver[i])
|
||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||
} while (png_libpng_ver[i++]);
|
||||
}
|
||||
@@ -579,9 +579,9 @@ png_write_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(png_ptr == NULL) return;
|
||||
if (png_ptr == NULL) return;
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
if(png_sizeof(png_struct) > png_struct_size ||
|
||||
if (png_sizeof(png_struct) > png_struct_size ||
|
||||
png_sizeof(png_info) > png_info_size)
|
||||
{
|
||||
char msg[80];
|
||||
@@ -599,7 +599,7 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
#endif
|
||||
if(png_sizeof(png_struct) > png_struct_size)
|
||||
if (png_sizeof(png_struct) > png_struct_size)
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
@@ -608,7 +608,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(png_sizeof(png_info) > png_info_size)
|
||||
if (png_sizeof(png_info) > png_info_size)
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
@@ -910,7 +910,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
||||
* 4. The filter_method is 64 and
|
||||
* 5. The color_type is RGB or RGBA
|
||||
*/
|
||||
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
|
||||
{
|
||||
/* Intrapixel differencing */
|
||||
@@ -1137,7 +1137,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
(method == PNG_INTRAPIXEL_DIFFERENCING))
|
||||
method = PNG_FILTER_TYPE_BASE;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user