summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2016-10-30 09:20:04 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2016-10-30 09:20:04 -0500
commit6b7c27341e681ddf74998ecc6be16cf5b143af4a (patch)
treef1b94dbeb95c969fe1d1c232b58fbb8c9ea422b8
parent5a945f3393014649c23a189ea688adbeb2d2f6d4 (diff)
downloadlibpng-6b7c27341e681ddf74998ecc6be16cf5b143af4a.tar.gz
[libpng15] Merge with libpng16/pngminus
-rw-r--r--ANNOUNCE3
-rw-r--r--CHANGES3
-rw-r--r--contrib/pngminus/README2
-rw-r--r--contrib/pngminus/makefile.std7
-rw-r--r--contrib/pngminus/makefile.tc38
-rw-r--r--contrib/pngminus/png2pnm.c34
-rw-r--r--contrib/pngminus/pnm2png.c2
7 files changed, 35 insertions, 24 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index ec9290122..26550b34b 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -27,7 +27,8 @@ Other information:
Changes since the last public release (1.5.27):
version 1.5.28beta01 [October 30, 2016]
- Merge with current libpng16 gregbook, pngvalid.c, pngtest.c
+ Merged with current libpng16 gregbook, pngvalid.c, pngtest.c, pngminim,
+ pngminus
Fixed undefined behavior in png_push_save_buffer(). Do not call
memcpy() with a null source, even if count is zero (Leon Scroggins III).
Added "Common linking failures" section to INSTALL.
diff --git a/CHANGES b/CHANGES
index 758872674..2457cd82f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4497,7 +4497,8 @@ version 1.5.27 [May 26, 2016]
No changes.
version 1.5.28beta01 [October 30, 2016]
- Merge with current libpng16 gregbook, pngvalid.c, pngtest.c
+ Merged with current libpng16 gregbook, pngvalid.c, pngtest.c, pngminim,
+ pngminus
Fixed undefined behavior in png_push_save_buffer(). Do not call
memcpy() with a null source, even if count is zero (Leon Scroggins III).
Added "Common linking failures" section to INSTALL.
diff --git a/contrib/pngminus/README b/contrib/pngminus/README
index bbe7407ec..fbcfc9861 100644
--- a/contrib/pngminus/README
+++ b/contrib/pngminus/README
@@ -146,7 +146,7 @@ The Turbo bug
The end
-------
Willem van Schaik
-mailto:willem@schaik.com
+mailto:willem at schaik.com
http://www.schaik.com/png/
-------
Oct 1999
diff --git a/contrib/pngminus/makefile.std b/contrib/pngminus/makefile.std
index fa7b5909f..0bfc1dd07 100644
--- a/contrib/pngminus/makefile.std
+++ b/contrib/pngminus/makefile.std
@@ -23,7 +23,8 @@ ZINC = -I../../../zlib
ZLIB = -L../../../zlib -lz
ZLIBS = ../../../zlib/libz.a
-CFLAGS=$(PNGINC) $(ZINC)
+CPPFLAGS=$(PNGINC) $(ZINC)
+CFLAGS=
LDLIBS=$(PNGLIB) $(ZLIB)
LDLIBSS=$(PNGLIBS) $(ZLIBS)
C=.c
@@ -37,7 +38,7 @@ E=
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
png2pnm$(O): png2pnm$(C)
- $(CC) -c $(CFLAGS) png2pnm$(C)
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O)
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
@@ -46,7 +47,7 @@ png2pnm-static$(E): png2pnm$(O)
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
pnm2png$(O): pnm2png$(C)
- $(CC) -c $(CFLAGS) pnm2png$(C)
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O)
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
diff --git a/contrib/pngminus/makefile.tc3 b/contrib/pngminus/makefile.tc3
index 404f18d5b..6a2f4b985 100644
--- a/contrib/pngminus/makefile.tc3
+++ b/contrib/pngminus/makefile.tc3
@@ -7,7 +7,8 @@ LB=tlib
RM=del
CP=copy
MODEL=l
-CCFLAGS=-O -m$(MODEL) -I..\libpng -I..\zlib
+CPPFLAGS=-I..\libpng -I..\zlib
+CFLAGS=-O -m$(MODEL)
LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib
C=.c
O=.obj
@@ -19,13 +20,13 @@ E=.exe
all: png2pnm$(E) pnm2png$(E)
png2pnm$(O): png2pnm$(C)
- $(CC) -c $(CCFLAGS) png2pnm$(C)
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O)
$(LD) $(LDFLAGS) png2pnm$(O) libpng$(L) zlib$(L)
pnm2png$(O): pnm2png$(C)
- $(CC) -c $(CCFLAGS) pnm2png$(C)
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O)
$(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L)
@@ -35,4 +36,3 @@ clean:
$(RM) *$(E)
# End of makefile for png2pnm / pnm2png
-
diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c
index 228142943..995fddf37 100644
--- a/contrib/pngminus/png2pnm.c
+++ b/contrib/pngminus/png2pnm.c
@@ -1,6 +1,6 @@
/*
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
- * copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
+ * copyright (C) 1999 by Willem van Schaik <willem at schaik.com>
*
* version 1.0 - 1999.10.15 - First version.
*
@@ -18,6 +18,7 @@
#include <mem.h>
#include <fcntl.h>
#endif
+#include <zlib.h>
#ifndef BOOL
#define BOOL unsigned char
@@ -51,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
@@ -84,7 +86,8 @@ int main(int argc, char *argv[])
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;
@@ -175,9 +178,11 @@ void usage()
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");
}
@@ -185,7 +190,8 @@ void usage()
* 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;
@@ -217,7 +223,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
/* 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 */
@@ -260,7 +266,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
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 */
@@ -314,12 +320,14 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
/* 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);
@@ -328,7 +336,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
}
/* 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 */
@@ -371,9 +379,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
/* 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++)
{
diff --git a/contrib/pngminus/pnm2png.c b/contrib/pngminus/pnm2png.c
index 8fa64cd1f..5de828a74 100644
--- a/contrib/pngminus/pnm2png.c
+++ b/contrib/pngminus/pnm2png.c
@@ -1,6 +1,6 @@
/*
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
- * copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
+ * copyright (C) 1999 by Willem van Schaik <willem at schaik.com>
*
* version 1.0 - 1999.10.15 - First version.
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)