FPII-2034: DO NOT MERGE Update libpng to 1.6.20
DO NOT MERGE Update libpng to 1.6.20
BUG:23265085
Change-Id: I2fc2106965c789a54f04412e9c63a0901b0c1e71
(cherry picked from commit 0b39f202aaedd3029e4270d2af7d58ba6634f9cd)
diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c
index aa9513d..f68d7ff 100644
--- a/contrib/pngminus/png2pnm.c
+++ b/contrib/pngminus/png2pnm.c
@@ -52,7 +52,8 @@
int main (int argc, char *argv[]);
void usage ();
-BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha);
+BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
+ BOOL alpha);
/*
* main
@@ -85,7 +86,8 @@
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
{
fprintf (stderr, "PNM2PNG\n");
- fprintf (stderr, "Error: can not create alpha-channel file %s\n", argv[argi]);
+ fprintf (stderr, "Error: can not create alpha-channel file %s\n",
+ argv[argi]);
exit (1);
}
break;
@@ -176,9 +178,11 @@
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
fprintf (stderr, " or: ... | png2pnm [options]\n");
fprintf (stderr, "Options:\n");
- fprintf (stderr, " -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
+ fprintf (stderr,
+ " -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
- fprintf (stderr, " -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
+ fprintf (stderr,
+ " -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
fprintf (stderr, " -h | -? print this help-information\n");
}
@@ -186,7 +190,8 @@
* png2pnm
*/
-BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
+BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
+ volatile BOOL raw, BOOL alpha)
{
png_struct *png_ptr = NULL;
png_info *info_ptr = NULL;
@@ -218,7 +223,7 @@
/* create png and info structures */
- png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
+ png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
NULL, NULL, NULL);
if (!png_ptr)
return FALSE; /* out of memory */
@@ -261,7 +266,7 @@
png_set_expand (png_ptr);
#ifdef NJET
- /* downgrade 16-bit images to 8 bit */
+ /* downgrade 16-bit images to 8-bit */
if (bit_depth == 16)
png_set_strip_16 (png_ptr);
/* transform grayscale images into full-color */
@@ -315,12 +320,14 @@
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
- if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
+ if ((png_pixels = (png_byte *)
+ malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE;
}
- if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
+ if ((row_pointers = (png_byte **)
+ malloc (height * sizeof (png_bytep))) == NULL)
{
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
free (png_pixels);
@@ -329,7 +336,7 @@
}
/* set the individual row_pointers to point at the correct offsets */
- for (i = 0; i < (height); i++)
+ for (i = 0; i < ((int) height); i++)
row_pointers[i] = png_pixels + i * row_bytes;
/* now we can go ahead and just read the whole image */
@@ -372,9 +379,9 @@
/* write data to PNM file */
pix_ptr = png_pixels;
- for (row = 0; row < height; row++)
+ for (row = 0; row < (int) height; row++)
{
- for (col = 0; col < width; col++)
+ for (col = 0; col < (int) width; col++)
{
for (i = 0; i < (channels - alpha_present); i++)
{