Imported from libpng-1.4.0beta61.tar

This commit is contained in:
Glenn Randers-Pehrson 2009-05-20 12:45:29 -05:00
parent b205f291f6
commit 4bb4d01681
32 changed files with 370 additions and 346 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.4.0beta61 - May 18, 2009
Libpng 1.4.0beta61 - May 20, 2009
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.
@ -454,12 +454,18 @@ version 1.4.0beta59 [May 15, 2009]
documentation
Relocated misplaced #endif in pngwrite.c, sCAL chunk handler.
version 1.4.0beta60 [May 18, 2009]
version 1.4.0beta60 [May 19, 2009]
Conditionally compile png_read_finish_row() which is not used by
progressive readers.
Added contrib/pngminim/preader to demonstrate building minimal progressive
decoder, based on contrib/gregbook with embedded libpng and zlib.
version 1.4.0beta61 [May 20, 2009]
In contrib/pngminim/*, renamed "makefile.std" to "makefile", since there
is only one makefile in those directories, and revised the README files
accordingly.
More reformatting of comments, mostly to capitalize sentences.
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.

View File

@ -2131,12 +2131,18 @@ version 1.4.0beta59 [May 15, 2009]
documentation
Relocated misplaced #endif in pngwrite.c, sCAL chunk handler.
version 1.4.0beta60 [May 18, 2009]
version 1.4.0beta60 [May 19, 2009]
Conditionally compile png_read_finish_row() which is not used by
progressive readers.
Added contrib/pngminim/preader to demonstrate building minimal progressive
decoder, based on contrib/gregbook with embedded libpng and zlib.
version 1.4.0beta61 [May 20, 2009]
In contrib/pngminim/*, renamed "makefile.std" to "makefile", since there
is only one makefile in those directories, and revised the README files
accordingly.
More reformatting of comments, mostly to capitalize sentences.
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.

View File

@ -1,5 +1,5 @@
Installing libpng version 1.4.0beta61 - May 18, 2009
Installing libpng version 1.4.0beta61 - May 20, 2009
On Unix/Linux and similar systems, you can simply type

View File

@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta61, May 18, 2009, are
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta61, May 20, 2009, are
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
May 18, 2009
May 20, 2009

2
README
View File

@ -1,4 +1,4 @@
README for libpng version 1.4.0beta61 - May 18, 2009 (shared library 14.0)
README for libpng version 1.4.0beta61 - May 20, 2009 (shared library 14.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.

View File

@ -1,7 +1,9 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only decoder, run
To build a minimal read-only decoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib
make
If you prefer to use the shared libraries, go to contrib/pngminus
and build the png2pnm application there.

View File

@ -1,7 +1,9 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal write-only encoder, run
To build a minimal write-only decoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib
make
If you prefer to use the shared libraries, go to contrib/pngminus
and build the pnm2png application there.

View File

@ -1,6 +1,7 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only progressive decoder with X display, run
To build a minimal read-only progressive decoder embedded libpng and
zlib and with your system's X library, run
gather.sh # to collect needed files from gregbook, libpng, and zlib
@ -9,3 +10,5 @@ then
make
If you prefer to use the shared libraries, go to contrib/gregbook
and build the rpng2-x application there.

View File

@ -2,7 +2,7 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2009 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
@ -93,13 +93,13 @@ void read_png(char *file_name) /* We need to open the file */
return (ERROR);
#else no_open_file /* prototype 2 */
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
{
png_structp png_ptr;
png_infop info_ptr;
png_uint_32 width, height;
int bit_depth, color_type, interlace_type;
#endif no_open_file /* only use one prototype! */
#endif no_open_file /* Only use one prototype! */
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
@ -280,7 +280,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_colorp palette;
/* This reduces the image to the application supplied palette */
if (/* we have our own palette */)
if (/* We have our own palette */)
{
/* An array of colors to which the image should be dithered */
png_color std_color_cube[MAX_SCREEN_COLORS];
@ -377,13 +377,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
#else no_sparkle /* Read the image using the "rectangle" effect */
png_read_rows(png_ptr, NULL, &row_pointers[y],
number_of_rows);
#endif no_sparkle /* use only one of these two methods */
#endif no_sparkle /* Use only one of these two methods */
}
/* if you want to display the image after every pass, do so here */
#endif no_single /* use only one of these two methods */
/* If you want to display the image after every pass, do so here */
#endif no_single /* Use only one of these two methods */
}
#endif no_entire /* use only one of these two methods */
#endif no_entire /* Use only one of these two methods */
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
@ -397,7 +397,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* Close the file */
fclose(fp);
/* that's it */
/* That's it */
return (OK);
}
@ -621,7 +621,7 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
user_IO_flush_function);
/* where user_io_ptr is a structure you want available to the callbacks */
#endif no_streams /* only use one initialization method */
#endif no_streams /* Only use one initialization method */
#ifdef hilevel
/* This is the easy way. Use it if you already have all the
@ -773,7 +773,7 @@ void write_png(char *file_name /* , ... other image information ... */)
#ifdef entire /* Write out the entire image data in one call */
png_write_image(png_ptr, row_pointers);
/* the other way to write the image - deal with interlacing */
/* The other way to write the image - deal with interlacing */
#else no_entire /* Write out the image data by one or more scanlines */

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.4.0beta61 - May 18, 2009
libpng version 1.4.0beta61 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@ -9,7 +9,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.4.0beta61 - May 18, 2009
libpng versions 0.97, January 1998, through 1.4.0beta61 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@ -3151,7 +3151,7 @@ source.
XII. Y2K Compliance in libpng
May 18, 2009
May 20, 2009
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "May 18, 2009"
.TH LIBPNG 3 "May 20, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta61
.SH SYNOPSIS
@ -809,7 +809,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.4.0beta61 - May 18, 2009
libpng version 1.4.0beta61 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@ -818,7 +818,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.4.0beta61 - May 18, 2009
libpng versions 0.97, January 1998, through 1.4.0beta61 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@ -3960,7 +3960,7 @@ source.
.SH XII. Y2K Compliance in libpng
May 18, 2009
May 20, 2009
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@ -4190,7 +4190,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.4.0beta61 - May 18, 2009:
Libpng version 1.4.0beta61 - May 20, 2009:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -4211,7 +4211,7 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta61, May 18, 2009, are
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta61, May 20, 2009, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@ -4310,7 +4310,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
May 18, 2009
May 20, 2009
.\" end of man page

View File

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "May 18, 2009"
.TH LIBPNGPF 3 "May 20, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta61
(private functions)

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "May 18, 2009"
.TH PNG 5 "May 20, 2009"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

48
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -53,18 +53,18 @@ PNG_tRNS;
PNG_zTXt;
#ifdef PNG_READ_SUPPORTED
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
/* Start of interlace block */
PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* offset to next interlace block */
/* Offset to next interlace block */
PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* start of interlace block in the y direction */
/* Start of interlace block in the y direction */
PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* offset to next interlace block in the y direction */
/* Offset to next interlace block in the y direction */
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* Height of interlace block. This is not currently used - if you need
@ -155,7 +155,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
return ((voidpf)ptr);
}
/* function to free memory for zlib */
/* Function to free memory for zlib */
void /* private */
png_zfree(voidpf png_ptr, voidpf ptr)
{
@ -275,7 +275,7 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
*ptr_ptr = info_ptr;
}
/* set everything to 0 */
/* Set everything to 0 */
png_memset(info_ptr, 0, png_sizeof(png_info));
}
@ -306,7 +306,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
return;
#if defined(PNG_TEXT_SUPPORTED)
/* free text item num or (if num == -1) all text items */
/* Free text item num or (if num == -1) all text items */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
#else
@ -334,7 +334,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif
#if defined(PNG_tRNS_SUPPORTED)
/* free any tRNS entry */
/* Free any tRNS entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
#else
@ -351,7 +351,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif
#if defined(PNG_sCAL_SUPPORTED)
/* free any sCAL entry */
/* Free any sCAL entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
#else
@ -369,7 +369,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif
#if defined(PNG_pCAL_SUPPORTED)
/* free any pCAL entry */
/* Free any pCAL entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
#else
@ -396,7 +396,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif
#if defined(PNG_iCCP_SUPPORTED)
/* free any iCCP entry */
/* Free any iCCP entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
#else
@ -412,7 +412,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif
#if defined(PNG_sPLT_SUPPORTED)
/* free a given sPLT entry, or (if num == -1) all sPLT entries */
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
#else
@ -485,7 +485,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif
#if defined(PNG_hIST_SUPPORTED)
/* free any hIST entry */
/* Free any hIST entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
#else
@ -501,7 +501,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
/* free any PLTE entry that was internally allocated */
/* Free any PLTE entry that was internally allocated */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
#else
@ -518,7 +518,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#if defined(PNG_INFO_IMAGE_SUPPORTED)
/* free any image bits attached to the info structure */
/* Free any image bits attached to the info structure */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
#else
@ -643,19 +643,19 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version x 1.4.0beta61 - May 18, 2009" PNG_STRING_NEWLINE \
"libpng version x 1.4.0beta61 - May 20, 2009" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
return ((png_charp) "libpng version 1.4.0beta61 - May 18, 2009\
return ((png_charp) "libpng version 1.4.0beta61 - May 20, 2009\
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
@ -675,7 +675,7 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@ -683,7 +683,7 @@ png_charp PNGAPI
png_get_header_ver(png_structp png_ptr)
{
/* Version of *.h files used when building libpng */
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@ -691,7 +691,7 @@ png_charp PNGAPI
png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED
@ -708,7 +708,7 @@ png_get_header_version(png_structp png_ptr)
int PNGAPI
png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
{
/* check chunk_name and return "keep" value if it's on the list, else 0 */
/* Check chunk_name and return "keep" value if it's on the list, else 0 */
int i;
png_bytep p;
if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0)

8
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.4.0beta61 - May 18, 2009
* libpng version 1.4.0beta61 - May 20, 2009
* Copyright (c) 1998-2009 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.)
@ -9,7 +9,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.4.0beta61 - May 18, 2009: Glenn
* libpng versions 0.97, January 1998, through 1.4.0beta61 - May 20, 2009: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -157,7 +157,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* libpng versions 1.2.6, August 15, 2004, through 1.4.0beta61, May 18, 2009, are
* libpng versions 1.2.6, August 15, 2004, through 1.4.0beta61, May 20, 2009, are
* Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -333,7 +333,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.4.0beta61"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.4.0beta61 - May 18, 2009\n"
" libpng version 1.4.0beta61 - May 20, 2009\n"
#define PNG_LIBPNG_VER_SONUM 14
#define PNG_LIBPNG_VER_DLLNUM 14

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.4.0beta61 - May 18, 2009
* libpng version 1.4.0beta61 - May 20, 2009
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -39,37 +39,37 @@ png_error(png_structp png_ptr, png_const_charp error_message)
char msg[16];
if (png_ptr != NULL)
{
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{
if (*error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
for (offset = 1; offset<15; offset++)
if (error_message[offset] == ' ')
break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
int i;
for (i = 0; i < offset - 1; i++)
msg[i] = error_message[i + 1];
msg[i - 1] = '\0';
error_message = msg;
}
else
error_message += offset;
}
else
{
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
msg[0] = '0';
msg[1] = '\0';
error_message = msg;
}
}
}
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
for (offset = 1; offset<15; offset++)
if (error_message[offset] == ' ')
break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
int i;
for (i = 0; i < offset - 1; i++)
msg[i] = error_message[i + 1];
msg[i - 1] = '\0';
error_message = msg;
}
else
error_message += offset;
}
else
{
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
msg[0] = '0';
msg[1] = '\0';
error_message = msg;
}
}
}
}
#endif
if (png_ptr != NULL && png_ptr->error_fn != NULL)
@ -108,14 +108,14 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif
{
if (*warning_message == PNG_LITERAL_SHARP)
{
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
break;
}
}
{
if (*warning_message == PNG_LITERAL_SHARP)
{
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
break;
}
}
}
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
@ -128,10 +128,10 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
void PNGAPI
png_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
}
#endif
@ -189,11 +189,11 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
png_error(png_ptr, error_message);
png_error(png_ptr, error_message);
else
{
png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg);
png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg);
}
}
#endif /* PNG_READ_SUPPORTED */
@ -205,11 +205,11 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
png_warning(png_ptr, warning_message);
png_warning(png_ptr, warning_message);
else
{
png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg);
png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg);
}
}
#endif /* PNG_NO_WARNINGS */
@ -219,10 +219,10 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
void PNGAPI
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
}
#endif
#endif /* PNG_READ_SUPPORTED */
@ -239,28 +239,28 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
char error_number[16];
for (offset = 0; offset<15; offset++)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
char error_number[16];
for (offset = 0; offset<15; offset++)
{
error_number[offset] = error_message[offset + 1];
if (error_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s",
error_number, error_message + offset + 1);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
if ((offset > 1) && (offset < 15))
{
error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s",
error_number, error_message + offset + 1);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
#endif
@ -287,7 +287,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
PNG_ABORT();
#endif
#ifdef PNG_NO_CONSOLE_IO
error_message = error_message; /* make compiler happy */
error_message = error_message; /* Make compiler happy */
#endif
}
@ -304,38 +304,38 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == PNG_LITERAL_SHARP)
{
int offset;
char warning_number[16];
for (offset = 0; offset < 15; offset++)
{
warning_number[offset] = warning_message[offset + 1];
if (warning_message[offset] == ' ')
int offset;
char warning_number[16];
for (offset = 0; offset < 15; offset++)
{
warning_number[offset] = warning_message[offset + 1];
if (warning_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s",
warning_number, warning_message + offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
if ((offset > 1) && (offset < 15))
{
warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s",
warning_number, warning_message + offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
# endif
{
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
warning_message = warning_message; /* make compiler happy */
warning_message = warning_message; /* Make compiler happy */
#endif
png_ptr = png_ptr; /* make compiler happy */
png_ptr = png_ptr; /* Make compiler happy */
}
#endif /* PNG_NO_WARNINGS */
@ -375,7 +375,7 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
{
if (png_ptr != NULL)
{
png_ptr->flags &=
png_ptr->flags &=
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
}
}

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -510,8 +510,9 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_debug1(1, "in %s retrieval function", "iCCP");
*name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile;
/* compression_type is a dummy so the API won't have to change
if we introduce multiple compression types later. */
/* Compression_type is a dummy so the API won't have to change
* if we introduce multiple compression types later.
*/
*proflen = (int)info_ptr->iccp_proflen;
*compression_type = (int)info_ptr->iccp_compression;
return (PNG_INFO_iCCP);

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -20,7 +20,7 @@
/* Borland DOS special memory handler */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* if you change this, be sure to change the one in png.h also */
/* If you change this, be sure to change the one in png.h also */
/* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */
@ -166,7 +166,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
{
if (png_ptr->offset_table == NULL)
{
/* try to see if we need to do any of this fancy stuff */
/* Try to see if we need to do any of this fancy stuff */
ret = farmalloc(size);
if (ret == NULL || ((png_size_t)ret & 0xffff))
{
@ -281,7 +281,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
return (ret);
}
/* free a pointer allocated by png_malloc(). In the default
/* Free a pointer allocated by png_malloc(). In the default
* configuration, png_ptr is not used, but is passed in case it
* is needed. If ptr is NULL, return without taking any action.
*/

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -12,7 +12,7 @@
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
#include "pngpriv.h"
/* push model modes */
/* Push model modes */
#define PNG_READ_SIG_MODE 0
#define PNG_READ_CHUNK_MODE 1
#define PNG_READ_IDAT_MODE 2
@ -762,7 +762,7 @@ png_push_read_IDAT(png_structp png_ptr)
{
save_size = (png_size_t)png_ptr->idat_size;
/* check for overflow */
/* Check for overflow */
if ((png_uint_32)save_size != png_ptr->idat_size)
png_error(png_ptr, "save_size overflowed in pngpread");
}
@ -787,7 +787,7 @@ png_push_read_IDAT(png_structp png_ptr)
{
save_size = (png_size_t)png_ptr->idat_size;
/* check for overflow */
/* Check for overflow */
if ((png_uint_32)save_size != png_ptr->idat_size)
png_error(png_ptr, "save_size overflowed in pngpread");
}
@ -899,7 +899,7 @@ png_push_process_row(png_structp png_ptr)
png_do_read_transformations(png_ptr);
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* blow up interlaced rows to full size */
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
if (png_ptr->pass < 6)
@ -917,10 +917,10 @@ png_push_process_row(png_structp png_ptr)
for (i = 0; i < 8 && png_ptr->pass == 0; i++)
{
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */
png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */
}
if (png_ptr->pass == 2) /* pass 1 might be empty */
if (png_ptr->pass == 2) /* Pass 1 might be empty */
{
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
{
@ -956,7 +956,7 @@ png_push_process_row(png_structp png_ptr)
png_read_push_finish_row(png_ptr);
}
if (png_ptr->pass == 2) /* skip top 4 generated rows */
if (png_ptr->pass == 2) /* Skip top 4 generated rows */
{
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
{
@ -984,7 +984,7 @@ png_push_process_row(png_structp png_ptr)
png_read_push_finish_row(png_ptr);
}
if (png_ptr->pass == 4) /* pass 3 might be empty */
if (png_ptr->pass == 4) /* Pass 3 might be empty */
{
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
{
@ -1006,7 +1006,7 @@ png_push_process_row(png_structp png_ptr)
png_read_push_finish_row(png_ptr);
}
if (png_ptr->pass == 4) /* skip top two generated rows */
if (png_ptr->pass == 4) /* Skip top two generated rows */
{
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
{
@ -1034,7 +1034,7 @@ png_push_process_row(png_structp png_ptr)
png_read_push_finish_row(png_ptr);
}
if (png_ptr->pass == 6) /* pass 5 might be empty */
if (png_ptr->pass == 6) /* Pass 5 might be empty */
{
png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr);
@ -1053,7 +1053,7 @@ png_push_process_row(png_structp png_ptr)
png_read_push_finish_row(png_ptr);
}
if (png_ptr->pass == 6) /* skip top generated row */
if (png_ptr->pass == 6) /* Skip top generated row */
{
png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr);
@ -1159,7 +1159,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
png_error(png_ptr, "Out of place tEXt");
info_ptr = info_ptr; /* to quiet some compiler warnings */
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
@ -1222,7 +1222,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
key = png_ptr->current_text;
for (text = key; *text; text++)
/* empty loop */ ;
/* Empty loop */ ;
if (text < key + png_ptr->current_text_size)
text++;
@ -1257,7 +1257,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
png_error(png_ptr, "Out of place zTXt");
info_ptr = info_ptr; /* to quiet some compiler warnings */
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
@ -1318,7 +1318,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
key = png_ptr->current_text;
for (text = key; *text; text++)
/* empty loop */ ;
/* Empty loop */ ;
/* zTXt can't have zero text */
if (text >= key + png_ptr->current_text_size)
@ -1330,7 +1330,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
text++;
if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */
if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */
{
png_ptr->current_text = NULL;
png_free(png_ptr, key);
@ -1458,7 +1458,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
png_error(png_ptr, "Out of place iTXt");
info_ptr = info_ptr; /* to quiet some compiler warnings */
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
@ -1525,25 +1525,25 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
key = png_ptr->current_text;
for (lang = key; *lang; lang++)
/* empty loop */ ;
/* Empty loop */ ;
if (lang < key + png_ptr->current_text_size - 3)
lang++;
comp_flag = *lang++;
lang++; /* skip comp_type, always zero */
lang++; /* Skip comp_type, always zero */
for (lang_key = lang; *lang_key; lang_key++)
/* empty loop */ ;
/* Empty loop */ ;
lang_key++; /* skip NUL separator */
lang_key++; /* Skip NUL separator */
text=lang_key;
if (lang_key < key + png_ptr->current_text_size - 1)
{
for (; *text; text++)
/* empty loop */ ;
/* Empty loop */ ;
}
if (text < key + png_ptr->current_text_size)
@ -1593,7 +1593,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif
png_chunk_error(png_ptr, "unknown critical chunk");
info_ptr = info_ptr; /* to quiet some compiler warnings */
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
@ -1628,7 +1628,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if (png_ptr->read_user_chunk_fn != NULL)
{
/* callback to user unknown chunk handler */
/* Callback to user unknown chunk handler */
int ret;
ret = (*(png_ptr->read_user_chunk_fn))
(png_ptr, &png_ptr->unknown_chunk);

View File

@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.4.0beta61 - May 18, 2009
* libpng version 1.4.0beta61 - May 20, 2009
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -27,24 +27,24 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
return;
switch (crit_action)
{
case PNG_CRC_NO_CHANGE: /* leave setting as is */
case PNG_CRC_NO_CHANGE: /* Leave setting as is */
break;
case PNG_CRC_WARN_USE: /* warn/use data */
case PNG_CRC_WARN_USE: /* Warn/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK;
png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE;
break;
case PNG_CRC_QUIET_USE: /* quiet/use data */
case PNG_CRC_QUIET_USE: /* Quiet/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK;
png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE |
PNG_FLAG_CRC_CRITICAL_IGNORE;
break;
case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr,
"Can't discard critical data on CRC error");
case PNG_CRC_ERROR_QUIT: /* error/quit */
case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT:
default:
@ -54,26 +54,26 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
switch (ancil_action)
{
case PNG_CRC_NO_CHANGE: /* leave setting as is */
case PNG_CRC_NO_CHANGE: /* Leave setting as is */
break;
case PNG_CRC_WARN_USE: /* warn/use data */
case PNG_CRC_WARN_USE: /* Warn/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE;
break;
case PNG_CRC_QUIET_USE: /* quiet/use data */
case PNG_CRC_QUIET_USE: /* Quiet/use data */
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE |
PNG_FLAG_CRC_ANCILLARY_NOWARN;
break;
case PNG_CRC_ERROR_QUIT: /* error/quit */
case PNG_CRC_ERROR_QUIT: /* Error/quit */
png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK;
png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN;
break;
case PNG_CRC_WARN_DISCARD: /* warn/discard data */
case PNG_CRC_WARN_DISCARD: /* Warn/discard data */
case PNG_CRC_DEFAULT:
default:
@ -84,7 +84,7 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
/* handle alpha and tRNS via a background color */
/* Handle alpha and tRNS via a background color */
void PNGAPI
png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
@ -195,11 +195,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
int i;
/* initialize an array to sort colors */
/* Initialize an array to sort colors */
png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(num_palette * png_sizeof(png_byte)));
/* initialize the dither_sort array */
/* Initialize the dither_sort array */
for (i = 0; i < num_palette; i++)
png_ptr->dither_sort[i] = (png_byte)i;
@ -212,7 +212,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
for (i = num_palette - 1; i >= maximum_colors; i--)
{
int done; /* to stop early if the list is pre-sorted */
int done; /* To stop early if the list is pre-sorted */
int j;
done = 1;
@ -885,7 +885,7 @@ png_init_read_transformations(png_structp png_ptr)
for (i=0; i<png_ptr->num_trans; i++)
{
if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff)
k=1; /* partial transparency is present */
k=1; /* Partial transparency is present */
}
if (k == 0)
png_ptr->transformations &= ~PNG_GAMMA;
@ -1066,7 +1066,7 @@ png_init_read_transformations(png_structp png_ptr)
}
}
else
/* transformation does not include PNG_BACKGROUND */
/* Transformation does not include PNG_BACKGROUND */
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
@ -1528,7 +1528,7 @@ png_do_read_transformations(png_structp png_ptr)
if (png_ptr->transformations & PNG_USER_TRANSFORM)
{
if (png_ptr->read_user_transform_fn != NULL)
(*(png_ptr->read_user_transform_fn)) /* user read transform function */
(*(png_ptr->read_user_transform_fn)) /* User read transform function */
(png_ptr, /* png_ptr */
&(png_ptr->row_info), /* row_info: */
/* png_uint_32 width; width of row */
@ -2242,7 +2242,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
#endif
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
/* expand grayscale files to RGB, with or without alpha */
/* Expand grayscale files to RGB, with or without alpha */
void /* PRIVATE */
png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
{
@ -2322,7 +2322,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
/* reduce RGB files to grayscale, with or without alpha
/* Reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
* New link:
@ -4009,7 +4009,7 @@ png_build_gamma_table(png_structp png_ptr)
g = 1.0 / png_ptr->screen_gamma;
else
g = png_ptr->gamma; /* probably doing rgb_to_gray */
g = png_ptr->gamma; /* Probably doing rgb_to_gray */
for (i = 0; i < 256; i++)
{
@ -4164,7 +4164,7 @@ png_build_gamma_table(png_structp png_ptr)
g = 1.0 / png_ptr->screen_gamma;
else
g = png_ptr->gamma; /* probably doing rgb_to_gray */
g = png_ptr->gamma; /* Probably doing rgb_to_gray */
#ifdef PNG_CALLOC_SUPPORTED
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_calloc(png_ptr,
@ -4200,7 +4200,7 @@ png_build_gamma_table(png_structp png_ptr)
#endif
#if defined(PNG_MNG_FEATURES_SUPPORTED)
/* undoes intrapixel differencing */
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
{

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -179,7 +179,7 @@ png_crc_error(png_structp png_ptr)
}
#ifdef PNG_IO_STATE_SUPPORTED
/* inform the I/O callback that the chunk CRC is being read */
/* Inform the I/O callback that the chunk CRC is being read */
/* PNG_IO_CHUNK_CRC requires the I/O to be done at once */
png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
#endif
@ -523,7 +523,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_byte buf[3];
png_crc_read(png_ptr, buf, 3);
/* don't depend upon png_color being any order */
/* Don't depend upon png_color being any order */
palette[i].red = buf[0];
palette[i].green = buf[1];
palette[i].blue = buf[2];
@ -609,7 +609,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
png_crc_finish(png_ptr, length);
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
}
#if defined(PNG_READ_gAMA_SUPPORTED)
@ -659,7 +659,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
igamma = (png_fixed_point)png_get_uint_32(buf);
/* check for zero gamma */
/* Check for zero gamma */
if (igamma == 0)
{
png_warning(png_ptr,
@ -923,7 +923,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
intent = buf[0];
/* check for bad intent */
/* Check for bad intent */
if (intent >= PNG_sRGB_INTENT_LAST)
{
png_warning(png_ptr, "Unknown sRGB intent");
@ -1038,12 +1038,13 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata[slength] = 0x00;
for (profile = png_ptr->chunkdata; *profile; profile++)
/* empty loop to find end of name */ ;
/* Empty loop to find end of name */ ;
++profile;
/* there should be at least one zero (the compression type byte)
following the separator, and we should be on it */
/* There should be at least one zero (the compression type byte)
* following the separator, and we should be on it
*/
if ( profile >= png_ptr->chunkdata + slength - 1)
{
png_free(png_ptr, png_ptr->chunkdata);
@ -1052,7 +1053,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
/* compression_type should always be zero */
/* Compression_type should always be zero */
compression_type = *profile++;
if (compression_type)
{
@ -1167,10 +1168,10 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata[slength] = 0x00;
for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; entry_start++)
/* empty loop to find end of name */ ;
/* Empty loop to find end of name */ ;
++entry_start;
/* a sample depth should follow the separator, and we should be on it */
/* A sample depth should follow the separator, and we should be on it */
if (entry_start > (png_bytep)png_ptr->chunkdata + slength - 2)
{
png_free(png_ptr, png_ptr->chunkdata);
@ -1183,7 +1184,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
entry_size = (new_palette.depth == 8 ? 6 : 10);
data_length = (slength - (entry_start - (png_bytep)png_ptr->chunkdata));
/* integrity-check the data length */
/* Integrity-check the data length */
if (data_length % entry_size)
{
png_free(png_ptr, png_ptr->chunkdata);
@ -1251,7 +1252,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
/* discard all chunk data except the name and stash that */
/* Discard all chunk data except the name and stash that */
new_palette.name = png_ptr->chunkdata;
png_set_sPLT(png_ptr, info_ptr, &new_palette, 1);
@ -1587,7 +1588,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
/* read the pCAL chunk (described in the PNG Extensions document) */
/* Read the pCAL chunk (described in the PNG Extensions document) */
void /* PRIVATE */
png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1634,11 +1635,11 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
png_ptr->chunkdata[slength] = 0x00; /* null terminate the last string */
png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
png_debug(3, "Finding end of pCAL purpose string");
for (buf = png_ptr->chunkdata; *buf; buf++)
/* empty loop */ ;
/* Empty loop */ ;
endptr = png_ptr->chunkdata + slength;
@ -1721,7 +1722,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
/* read the sCAL chunk */
/* Read the sCAL chunk */
void /* PRIVATE */
png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1771,9 +1772,9 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
png_ptr->chunkdata[slength] = 0x00; /* null terminate the last string */
png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
ep = png_ptr->chunkdata + 1; /* skip unit byte */
ep = png_ptr->chunkdata + 1; /* Skip unit byte */
#ifdef PNG_FLOATING_POINT_SUPPORTED
width = png_strtod(png_ptr, ep, &vp);
@ -1795,7 +1796,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
for (ep = png_ptr->chunkdata; *ep; ep++)
/* empty loop */ ;
/* Empty loop */ ;
ep++;
if (png_ptr->chunkdata + slength < ep)
@ -1975,7 +1976,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
key[slength] = 0x00;
for (text = key; *text; text++)
/* empty loop to find end of key */ ;
/* Empty loop to find end of key */ ;
if (text != key + slength)
text++;
@ -2010,7 +2011,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
/* note: this does not correctly handle chunks that are > 64K under DOS */
/* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -2075,7 +2076,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata[slength] = 0x00;
for (text = png_ptr->chunkdata; *text; text++)
/* empty loop */ ;
/* Empty loop */ ;
/* zTXt must have some text after the chunkdataword */
if (text >= png_ptr->chunkdata + slength - 2)
@ -2093,7 +2094,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "Unknown compression type in zTXt chunk");
comp_type = PNG_TEXT_COMPRESSION_zTXt;
}
text++; /* skip the compression_method byte */
text++; /* Skip the compression_method byte */
}
prefix_len = text - png_ptr->chunkdata;
@ -2130,7 +2131,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
/* note: this does not correctly handle chunks that are > 64K under DOS */
/* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -2196,12 +2197,13 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata[slength] = 0x00;
for (lang = png_ptr->chunkdata; *lang; lang++)
/* empty loop */ ;
lang++; /* skip NUL separator */
/* Empty loop */ ;
lang++; /* Skip NUL separator */
/* iTXt must have a language tag (possibly empty), two compression bytes,
translated keyword (possibly empty), and possibly some text after the
keyword */
* translated keyword (possibly empty), and possibly some text after the
* keyword
*/
if (lang >= png_ptr->chunkdata + slength - 3)
{
@ -2217,8 +2219,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
for (lang_key = lang; *lang_key; lang_key++)
/* empty loop */ ;
lang_key++; /* skip NUL separator */
/* Empty loop */ ;
lang_key++; /* Skip NUL separator */
if (lang_key >= png_ptr->chunkdata + slength)
{
@ -2229,8 +2231,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
for (text = lang_key; *text; text++)
/* empty loop */ ;
text++; /* skip NUL separator */
/* Empty loop */ ;
text++; /* Skip NUL separator */
if (text >= png_ptr->chunkdata + slength)
{
png_warning(png_ptr, "Malformed iTXt chunk");
@ -2308,7 +2310,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_USE_LOCAL_ARRAYS
PNG_CONST PNG_IDAT;
#endif
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* not an IDAT */
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* Not an IDAT */
png_ptr->mode |= PNG_AFTER_IDAT;
}
@ -2352,7 +2354,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if (png_ptr->read_user_chunk_fn != NULL)
{
/* callback to user unknown chunk handler */
/* Callback to user unknown chunk handler */
int ret;
ret = (*(png_ptr->read_user_chunk_fn))
(png_ptr, &png_ptr->unknown_chunk);
@ -2381,7 +2383,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, skip);
#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
#endif
}
@ -2629,8 +2631,8 @@ png_do_read_interlace(png_structp png_ptr)
int pass = png_ptr->pass;
png_uint_32 transformations = png_ptr->transformations;
#ifdef PNG_USE_LOCAL_ARRAYS
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* offset to next interlace block */
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Offset to next interlace block */
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
#endif
@ -2838,7 +2840,7 @@ png_do_read_interlace(png_structp png_ptr)
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
}
#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
transformations = transformations; /* silence compiler warning */
transformations = transformations; /* Silence compiler warning */
#endif
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */
@ -2922,7 +2924,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
rp++;
}
for (i = 0; i < istop; i++) /* use leftover rp,pp */
for (i = 0; i < istop; i++) /* Use leftover rp,pp */
{
int a, b, c, pa, pb, pc, p;
@ -2972,18 +2974,18 @@ png_read_finish_row(png_structp png_ptr)
{
#ifdef PNG_USE_LOCAL_ARRAYS
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
/* Start of interlace block */
PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* offset to next interlace block */
/* Offset to next interlace block */
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* start of interlace block in the y direction */
/* Start of interlace block in the y direction */
PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* offset to next interlace block in the y direction */
/* Offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif /* PNG_READ_INTERLACING_SUPPORTED */
#endif
@ -3105,18 +3107,18 @@ png_read_start_row(png_structp png_ptr)
{
#ifdef PNG_USE_LOCAL_ARRAYS
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
/* Start of interlace block */
PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* offset to next interlace block */
/* Offset to next interlace block */
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* start of interlace block in the y direction */
/* Start of interlace block in the y direction */
PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* offset to next interlace block in the y direction */
/* Offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
#endif
@ -3253,11 +3255,13 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
}
#endif
/* align the width on the next larger 8 pixels. Mainly used
for interlacing */
/* Align the width on the next larger 8 pixels. Mainly used
* for interlacing
*/
row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
/* calculate the maximum bytes needed, adding a byte and a pixel
for safety's sake */
/* Calculate the maximum bytes needed, adding a byte and a pixel
* for safety's sake
*/
row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) +
1 + ((max_pixel_depth + 7) >> 3);
#ifdef PNG_MAX_MALLOC_64K

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -221,7 +221,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
/* check for width and height valid values */
/* Check for width and height valid values */
if (width == 0 || height == 0)
png_error(png_ptr, "Image width or height is zero in IHDR");
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
@ -241,7 +241,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
- 8) /* extra max_pixel_depth pad */
png_warning(png_ptr, "Width is too large for libpng to process pixels");
/* check other values */
/* Check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
bit_depth != 8 && bit_depth != 16)
png_error(png_ptr, "Invalid bit depth in IHDR");
@ -307,7 +307,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->channels++;
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
/* check for potential overflow */
/* Check for potential overflow */
if (width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RGBA pixels */
- 64 /* bigrowbuf hack */
@ -774,7 +774,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
else
#ifdef PNG_iTXt_SUPPORTED
{
/* set iTXt data */
/* Set iTXt data */
if (text_ptr[i].lang != NULL)
lang_len = png_strlen(text_ptr[i].lang);
else
@ -1044,7 +1044,7 @@ png_set_unknown_chunks(png_structp png_ptr,
png_sizeof(from->name));
to->name[png_sizeof(to->name)-1] = '\0';
to->size = from->size;
/* note our location in the read or write sequence */
/* Note our location in the read or write sequence */
to->location = (png_byte)(png_ptr->mode & 0xff);
if (from->size == 0)
@ -1196,7 +1196,7 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
/* this function was added to libpng 1.2.6 */
/* This function was added to libpng 1.2.6 */
void PNGAPI
png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
png_uint_32 user_height_max)
@ -1210,7 +1210,7 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
png_ptr->user_width_max = user_width_max;
png_ptr->user_height_max = user_height_max;
}
/* this function was added to libpng 1.4.0 */
/* This function was added to libpng 1.4.0 */
void PNGAPI
png_set_chunk_cache_max (png_structp png_ptr,
png_uint_32 user_chunk_cache_max)

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -45,7 +45,7 @@
#endif
#if !PNG_DEBUG
# define SINGLE_ROWBUF_ALLOC /* makes buffer overruns easier to nail */
# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */
#endif
/* Turn on CPU timing
@ -75,9 +75,9 @@ int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname));
#include <mem.h>
#endif
/* defined so I can write to a file on gui/windowing platforms */
/* Defined so I can write to a file on gui/windowing platforms */
/* #define STDERR stderr */
#define STDERR stdout /* for DOS */
#define STDERR stdout /* For DOS */
/* In case a system header (e.g., on AIX) defined jmpbuf */
#ifdef jmpbuf
@ -89,7 +89,7 @@ int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname));
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
#endif
/* example of using row callbacks to make a simple progress meter */
/* Example of using row callbacks to make a simple progress meter */
static int status_pass = 1;
static int status_dots_requested = 0;
static int status_dots = 1;
@ -144,7 +144,7 @@ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
/* example of using user transform callback (we don't transform anything,
/* Example of using user transform callback (we don't transform anything,
* but merely count the zero samples)
*/
@ -158,7 +158,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
png_bytep dp = data;
if (png_ptr == NULL)return;
/* contents of row_info:
/* Contents of row_info:
* png_uint_32 width width of row
* png_uint_32 rowbytes number of bytes in row
* png_byte color_type color type of pixels
@ -167,7 +167,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
* png_byte pixel_depth bits per pixel (depth*channels)
*/
/* counts the number of zero samples (or zero pixels if color_type is 3 */
/* Counts the number of zero samples (or zero pixels if color_type is 3 */
if (row_info->color_type == 0 || row_info->color_type == 3)
{
@ -215,7 +215,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
}
}
}
else /* other color types */
else /* Other color types */
{
png_uint_32 n, nstop;
int channel;
@ -307,7 +307,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
read = MIN(NEAR_BUF_SIZE, remaining);
err = fread(buf, 1, 1, io_ptr);
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
png_memcpy(data, buf, read); /* Copy far buffer to near buffer */
if (err != read)
break;
else
@ -327,7 +327,7 @@ static void
pngtest_flush(png_structp png_ptr)
{
/* Do nothing; fflush() is said to be just a waste of energy. */
png_ptr = png_ptr; /* stifle compiler warning */
png_ptr = png_ptr; /* Stifle compiler warning */
}
#endif
@ -380,7 +380,7 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
do
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
err = fwrite(buf, 1, written, io_ptr);
if (err != written)
break;
@ -884,8 +884,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_gAMA(write_ptr, write_info_ptr, gamma);
}
#endif
#endif /* floating point */
#endif /* fixed point */
#endif /* Floating point */
#endif /* Fixed point */
#if defined(PNG_iCCP_SUPPORTED)
{
png_charp name;
@ -1025,7 +1025,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{
png_set_tIME(write_ptr, write_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED)
/* we have to use png_memcpy instead of "=" because the string
/* We have to use png_memcpy instead of "=" because the string
* pointed to by png_convert_to_rfc1123() gets free'ed before
* we use it.
*/
@ -1070,7 +1070,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_size_t i;
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
num_unknowns);
/* copy the locations from the read_info_ptr. The automatically
/* Copy the locations from the read_info_ptr. The automatically
* generated locations in write_info_ptr are wrong because we
* haven't written anything yet.
*/
@ -1213,7 +1213,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED)
/* we have to use png_memcpy instead of "=" because the string
/* We have to use png_memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */
png_memcpy(tIME_string,
@ -1236,7 +1236,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_size_t i;
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
num_unknowns);
/* copy the locations from the read_info_ptr. The automatically
/* Copy the locations from the read_info_ptr. The automatically
* generated locations in write_end_info_ptr are wrong because we
* haven't written the end_info yet.
*/
@ -1352,7 +1352,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (0);
}
/* input and output filenames */
/* Input and output filenames */
#ifdef RISCOS
static PNG_CONST char *inname = "pngtest/png";
static PNG_CONST char *outname = "pngout/png";

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -25,7 +25,7 @@ png_set_bgr(png_structp png_ptr)
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* turn on 16 bit byte swapping */
/* Turn on 16 bit byte swapping */
void PNGAPI
png_set_swap(png_structp png_ptr)
{
@ -38,7 +38,7 @@ png_set_swap(png_structp png_ptr)
#endif
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
/* turn on pixel packing */
/* Turn on pixel packing */
void PNGAPI
png_set_packing(png_structp png_ptr)
{
@ -54,7 +54,7 @@ png_set_packing(png_structp png_ptr)
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
/* turn on packed pixel swapping */
/* Turn on packed pixel swapping */
void PNGAPI
png_set_packswap(png_structp png_ptr)
{
@ -179,7 +179,7 @@ png_set_invert_mono(png_structp png_ptr)
png_ptr->transformations |= PNG_INVERT_MONO;
}
/* invert monochrome grayscale data */
/* Invert monochrome grayscale data */
void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row)
{
@ -230,7 +230,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* swaps byte order on 16 bit depth images */
/* Swaps byte order on 16 bit depth images */
void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row)
{

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -85,7 +85,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
do
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
err = fwrite(buf, 1, written, io_ptr);
if (err != written)
break;

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -618,7 +618,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
png_debug(1, "in png_write_image");
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
/* intialize interlace handling. If image is not interlaced,
/* Initialize interlace handling. If image is not interlaced,
* this will set pass to 1
*/
num_pass = png_set_interlace_handling(png_ptr);

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -26,7 +26,7 @@ png_do_write_transformations(png_structp png_ptr)
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* user write transform function */
(*(png_ptr->write_user_transform_fn)) /* User write transform function */
(png_ptr, /* png_ptr */
&(png_ptr->row_info), /* row_info: */
/* png_uint_32 width; width of row */
@ -241,7 +241,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
channels++;
}
/* with low row depths, could only be grayscale, so one channel */
/* With low row depths, could only be grayscale, so one channel */
if (row_info->bit_depth < 8)
{
png_bytep bp = row;
@ -426,7 +426,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
/* does nothing
/* Does nothing
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
@ -444,7 +444,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
for (i = 0, sp = dp = row; i < row_width; i++)
{
/* does nothing
/* Does nothing
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
@ -482,7 +482,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
for (i = 0, sp = dp = row; i < row_width; i++)
{
/* does nothing
/* Does nothing
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*/
@ -497,7 +497,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
#endif
#if defined(PNG_MNG_FEATURES_SUPPORTED)
/* undoes intrapixel differencing */
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.4.0 [May 18, 2009]
* Last changed in libpng 1.4.0 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -63,7 +63,7 @@ png_write_sig(png_structp png_ptr)
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
#ifdef PNG_IO_STATE_SUPPORTED
/* inform the I/O callback that the signature is being written */
/* Inform the I/O callback that the signature is being written */
png_ptr->io_state = PNG_IO_WRITING | PNG_IO_SIGNATURE;
#endif
@ -185,14 +185,14 @@ png_write_chunk_end(png_structp png_ptr)
typedef struct
{
char *input; /* the uncompressed input data */
int input_len; /* its length */
int num_output_ptr; /* number of output pointers used */
int max_output_ptr; /* size of output_ptr */
png_charpp output_ptr; /* array of pointers to output */
char *input; /* The uncompressed input data */
int input_len; /* Its length */
int num_output_ptr; /* Number of output pointers used */
int max_output_ptr; /* Size of output_ptr */
png_charpp output_ptr; /* Array of pointers to output */
} compression_state;
/* compress given text into storage in the png_ptr structure */
/* Compress given text into storage in the png_ptr structure */
static int /* PRIVATE */
png_text_compress(png_structp png_ptr,
png_charp text, png_size_t text_len, int compression,
@ -249,11 +249,11 @@ png_text_compress(png_structp png_ptr,
/* This is the same compression loop as in png_write_row() */
do
{
/* compress the data */
/* Compress the data */
ret = deflate(&png_ptr->zstream, Z_NO_FLUSH);
if (ret != Z_OK)
{
/* error */
/* Error */
if (png_ptr->zstream.msg != NULL)
png_error(png_ptr, png_ptr->zstream.msg);
else
@ -370,7 +370,7 @@ png_text_compress(png_structp png_ptr,
return((int)text_len);
}
/* ship the compressed text out via chunk writes */
/* Ship the compressed text out via chunk writes */
static void /* PRIVATE */
png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
{
@ -418,7 +418,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
#endif
int ret;
png_byte buf[13]; /* buffer to store the IHDR info */
png_byte buf[13]; /* Buffer to store the IHDR info */
png_debug(1, "in png_write_IHDR");
/* Check that we have valid input data from the application info */
@ -517,7 +517,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels);
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
/* set the usr info, so any transformations can modify it */
/* Set the usr info, so any transformations can modify it */
png_ptr->usr_width = png_ptr->width;
png_ptr->usr_bit_depth = png_ptr->bit_depth;
png_ptr->usr_channels = png_ptr->channels;
@ -577,7 +577,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
/* libpng is not interested in zstream.data_type */
/* set it to a predefined value, to avoid its evaluation inside zlib */
/* Set it to a predefined value, to avoid its evaluation inside zlib */
png_ptr->zstream.data_type = Z_BINARY;
png_ptr->mode = PNG_HAVE_IHDR;
@ -830,7 +830,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
profile_len = png_text_compress(png_ptr, profile,
(png_size_t)profile_len, PNG_COMPRESSION_TYPE_BASE, &comp);
/* make sure we include the NULL after the name and the compression type */
/* Make sure we include the NULL after the name and the compression type */
png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
(png_uint_32)(name_len + profile_len + 2));
new_name[name_len + 1] = 0x00;
@ -926,7 +926,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
#endif
#if defined(PNG_WRITE_sBIT_SUPPORTED)
/* write the sBIT chunk */
/* Write the sBIT chunk */
void /* PRIVATE */
png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
{
@ -982,7 +982,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
#endif
#if defined(PNG_WRITE_cHRM_SUPPORTED)
/* write the cHRM chunk */
/* Write the cHRM chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
@ -1013,7 +1013,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
{
/* each value is saved in 1/100,000ths */
/* Each value is saved in 1/100,000ths */
png_save_uint_32(buf, int_white_x);
png_save_uint_32(buf + 4, int_white_y);
@ -1044,7 +1044,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
png_byte buf[32];
png_debug(1, "in png_write_cHRM");
/* each value is saved in 1/100,000ths */
/* Each value is saved in 1/100,000ths */
#if !defined(PNG_NO_CHECK_cHRM)
if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
green_x, green_y, blue_x, blue_y))
@ -1087,13 +1087,13 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
png_warning(png_ptr, "Invalid number of transparent colors specified");
return;
}
/* write the chunk out as it is */
/* Write the chunk out as it is */
png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans,
(png_size_t)num_trans);
}
else if (color_type == PNG_COLOR_TYPE_GRAY)
{
/* one 16 bit value */
/* One 16 bit value */
if (tran->gray >= (1 << png_ptr->bit_depth))
{
png_warning(png_ptr,
@ -1105,7 +1105,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
}
else if (color_type == PNG_COLOR_TYPE_RGB)
{
/* three 16 bit values */
/* Three 16 bit values */
png_save_uint_16(buf, tran->red);
png_save_uint_16(buf + 2, tran->green);
png_save_uint_16(buf + 4, tran->blue);
@ -1359,7 +1359,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
else
text_len = png_strlen(text);
/* make sure we include the 0 after the key */
/* Make sure we include the 0 after the key */
png_write_chunk_start(png_ptr, (png_bytep)png_tEXt,
(png_uint_32)(key_len + text_len + 1));
/*
@ -1658,8 +1658,8 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
}
buf[0] = (png_byte)unit;
png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */
png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */
png_memcpy(buf + 1, width, wlen + 1); /* Append the '\0' here */
png_memcpy(buf + wlen + 2, height, hlen); /* Do NOT append the '\0' here */
png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len);
@ -1769,7 +1769,7 @@ png_write_start_row(png_structp png_ptr)
/* We only need to keep the previous row if we are using one of these. */
if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
{
/* set up previous row buffer */
/* Set up previous row buffer */
#ifdef PNG_CALLOC_SUPPORTED
png_ptr->prev_row = (png_bytep)png_calloc(png_ptr,
(png_alloc_size_t)buf_size);
@ -1854,7 +1854,7 @@ png_write_finish_row(png_structp png_ptr)
int ret;
png_debug(1, "in png_write_finish_row");
/* next row */
/* Next row */
png_ptr->row_number++;
/* See if we are done */
@ -2130,7 +2130,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#endif
png_debug(1, "in png_write_find_filter");
/* find out how many bytes offset each pixel is */
/* Find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3;
prev_row = png_ptr->prev_row;