From 62a56d4fcc3e6d818c471a68347059c4483c0178 Mon Sep 17 00:00:00 2001 From: Willem van Schaik Date: Wed, 23 Jan 2019 06:05:54 -0800 Subject: [PATCH] pngminus: Change license to MIT, etc. Change the license to MIT. Move the license text from the source files to a LICENSE file. Move the change log from the source files to a CHANGES file. Delete the Turbo C makefile and simplify the Linux makefile heavily. Create explicitly named static and shared executables in the makefile. Refresh the README file a bit from the twenty year old one. Signed-off-by: Willem van Schaik Signed-off-by: Cosmin Truta --- contrib/pngminus/CHANGES.txt | 13 ++++ contrib/pngminus/LICENSE.txt | 22 +++++++ contrib/pngminus/Makefile | 57 +++++++++++++++++ contrib/pngminus/{README => README.txt} | 81 ++++++++----------------- contrib/pngminus/makefile.std | 66 -------------------- contrib/pngminus/makefile.tc3 | 38 ------------ contrib/pngminus/png2pnm.c | 17 +----- contrib/pngminus/pngminus.bat | 2 +- contrib/pngminus/pngminus.sh | 2 +- contrib/pngminus/pnm2png.c | 19 +----- 10 files changed, 124 insertions(+), 193 deletions(-) create mode 100644 contrib/pngminus/CHANGES.txt create mode 100644 contrib/pngminus/LICENSE.txt create mode 100644 contrib/pngminus/Makefile rename contrib/pngminus/{README => README.txt} (62%) delete mode 100644 contrib/pngminus/makefile.std delete mode 100644 contrib/pngminus/makefile.tc3 diff --git a/contrib/pngminus/CHANGES.txt b/contrib/pngminus/CHANGES.txt new file mode 100644 index 000000000..4e64e5ee6 --- /dev/null +++ b/contrib/pngminus/CHANGES.txt @@ -0,0 +1,13 @@ + +pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file +copyright (C) 1999-2019 by Willem van Schaik + +version 1.0 - 1999.10.15 - First version. + 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson) + 1.2 - 2017.04.22 - Add buffer-size check + 1.3 - 2017.08.24 - Fix potential overflow in buffer-size check + (Glenn Randers-Pehrson) + 1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse) + 1.5 - 2018.08.05 - Fix buffer overflow in tokenizer (Cosmin Truta) + 1.6 - 2018.08.05 - Improve portability and fix style (Cosmin Truta) + 1.7 - 2019.01.22 - Change license to MIT (Willem van Schaik) diff --git a/contrib/pngminus/LICENSE.txt b/contrib/pngminus/LICENSE.txt new file mode 100644 index 000000000..00878a9a6 --- /dev/null +++ b/contrib/pngminus/LICENSE.txt @@ -0,0 +1,22 @@ + +pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file + +copyright (C) 1999-2019 by Willem van Schaik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The software is provided "as is", without warranty of any kind, express or +implied, including but not limited to the warranties of merchantability, +fitness for a particular purpose and noninfringement. In no event shall the +authors or copyight holders be liable for any claim, damages or other +liability, whether in an action of contract, tort or otherwise, arising from, +out of or in connection with the software or the use or other dealings in the +software. diff --git a/contrib/pngminus/Makefile b/contrib/pngminus/Makefile new file mode 100644 index 000000000..7eb503a2b --- /dev/null +++ b/contrib/pngminus/Makefile @@ -0,0 +1,57 @@ +# Makefile for PngMinus (png2pnm and pnm2png) +# Linux / Unix + +#CC = cc +CC = gcc +LD = $(CC) + +RM = rm -f + +PNGINC = -I../.. +PNGLIB_SHARED = -L../.. -lpng +PNGLIB_STATIC = ../../libpng.a + +ZINC = -I../../../zlib +ZLIB_SHARED = -L../../../zlib -lz +ZLIB_STATIC = ../../../zlib/libz.a + +CPPFLAGS = $(PNGINC) $(ZINC) +CFLAGS = +LDFLAGS = +LIBS_SHARED = $(PNGLIB_SHARED) $(ZLIB_SHARED) +LIBS_STATIC = $(PNGLIB_STATIC) $(ZLIB_STATIC) + +EXEEXT = +#EXEEXT = .exe + +# dependencies + +all: png2pnm$(EXEEXT) pnm2png$(EXEEXT) png2pnm-static$(EXEEXT) pnm2png-static$(EXEEXT) + +png2pnm.o: png2pnm.c + $(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm.c + +pnm2png.o: pnm2png.c + $(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png.c + +png2pnm$(EXEEXT): png2pnm.o + $(LD) $(LDFLAGS) -o png2pnm$(EXEEXT) png2pnm.o $(LIBS_SHARED) -lm + +pnm2png$(EXEEXT): pnm2png.o + $(LD) $(LDFLAGS) -o pnm2png$(EXEEXT) pnm2png.o $(LIBS_SHARED) -lm + +png2pnm-static$(EXEEXT): png2pnm.o + $(LD) $(LDFLAGS) -o png2pnm-static$(EXEEXT) png2pnm.o $(LIBS_STATIC) -lm + +pnm2png-static$(EXEEXT): pnm2png.o + $(LD) $(LDFLAGS) -o pnm2png-static$(EXEEXT) pnm2png.o $(LIBS_STATIC) -lm + +clean: + $(RM) png2pnm.o + $(RM) pnm2png.o + $(RM) png2pnm$(EXEEXT) + $(RM) pnm2png$(EXEEXT) + $(RM) png2pnm-static$(EXEEXT) + $(RM) pnm2png-static$(EXEEXT) + +# End of makefile for png2pnm / pnm2png diff --git a/contrib/pngminus/README b/contrib/pngminus/README.txt similarity index 62% rename from contrib/pngminus/README rename to contrib/pngminus/README.txt index 23614a800..f7f6ecb3a 100644 --- a/contrib/pngminus/README +++ b/contrib/pngminus/README.txt @@ -1,26 +1,16 @@ PngMinus -------- -(copyright Willem van Schaik, 1999) +(copyright Willem van Schaik, 1999-2019) -License -------- - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and -that both that copyright notice and this permission notice appear in -supporting documentation. This software is provided "as is" without -express or implied warranty. - Some history ------------ Soon after the creation of PNG in 1995, the need was felt for a set of pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I (Willem van Schaik) started such a project. Luckily we discovered this -and merged the two together into pnmtopng.tar.gz, which is available -from a/o ftp://ftp.simplesystems.org/pub/libpng/png/. +and merged the two, which later became part of NetPBM, available from +SourceForge. These two utilities have many, many options and make use of most of the features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes @@ -35,8 +25,8 @@ makes the whole setup a bit bulky. But that's unavoidable given the many features of pnmtopng. -What now --------- +What now (1999) +--------------- At this moment libpng is in a very stable state and can do much of the work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new interface of libpng. Hence, it is time for a rewrite from the ground up @@ -49,8 +39,8 @@ a small prototype that contains only the basic functionality. It doesn't have any of the options to read or write special chunks and it will do no gamma correction. But this makes it also a simple program that is quite easy to understand and can serve well as a template for other -software developments. (By now there are of course a couple of programs, -like Greg Roelofs' rpng/wpng, that can be used just as good.) +software developments. By now there are of course a couple of programs, +like Greg Roelofs' rpng/wpng, that can be used just as good. Can and can not @@ -60,7 +50,8 @@ PngMinus. Because I started this development in good-old Turbo-C, I avoided the use the netpbm library, which requires DOS extenders. Again, another reason to call it PngMinus (minus netpbm :-). So, part of the program are some elementary routines to read / write pgm- and ppm-files. -It does not read b&w pbm-files. +It does not handle B&W pbm-files, but instead you could do pgm with bit- +depth 1. The downside of this approach is that you can not use them on images that require blocks of memory bigger than 64k (the DOS version). For @@ -96,58 +87,34 @@ To list the options type "png2pnm -h" or "pnm2png -h". Just like Scandinavian furniture -------------------------------- -You have to put it together yourself. I did test the software under -MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both -cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK, -however some older libpng versions have a bug in pngmem.c when using -Turbo-C 3.0 (see below). +You have to put it together yourself. I developed the software on MS-DOS +with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used +libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and +more current versions are OK. -You can build it using one of the two makefiles (make -f makefile.###) -or use the batch/script files pngminus.bat / pngminus.sh. This assumes -that you have built the libraries in ../libpng and ../zlib. Using Linux, -make sure that you have built libpng with makefile.std and not -makefile.linux (also called .lnx in earlier versions of libpng). The -latter creates a .so shared-library, while the PngMinus makefile assumes -a normal .a static library. +The makefile assumes that the libpng libraries can be found in ../.. and +libz in ../../../zlib. But you can change this to for example ../libpng +and ../zlib. The makefile creates two versions of each program, one with +static library support and the other using shared libraries. If you create a ../pngsuite directory and then store the basn####.png files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can -test in one go the proper functioning of PngMinus, see png2pnm.bat and -pnm2png.bat (or the .sh versions). +test the proper functioning of PngMinus by running pngminus.sh. Warranty ------- Please, remember that this was just a small experiment to learn a few -things. It will have many unforeseen features . Who said bugs? Use -it when you are in need for something simple or when you want to start -developing your own stuff. - - -The Turbo bug -------------- -** pngmem.old - hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); - hptr += 16L; -** pngmem.c - hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); - hptr = hptr + 16L; -** - -** pngmem.old - png_ptr->offset_table_ptr[i] = (png_bytep)hptr; - hptr += (png_uint_32)65536L; -** pngmem.c - png_ptr->offset_table_ptr[i] = (png_bytep)hptr; - hptr = hptr + 65536L; -** +things. It will have many unforeseen features ... who said bugs? Use +it when you are in need for something simple or when you want a starting +point for developing your own stuff. The end ------- Willem van Schaik -mailto:willem at schaik.com +mailto:willem at schaik dot com http://www.schaik.com/png/ -------- -Oct 1999 + +Oct 1999, Jan 2019 diff --git a/contrib/pngminus/makefile.std b/contrib/pngminus/makefile.std deleted file mode 100644 index 14e25cd64..000000000 --- a/contrib/pngminus/makefile.std +++ /dev/null @@ -1,66 +0,0 @@ -# Makefile for PngMinus (png2pnm and pnm2png) -# Linux / Unix - -#CC=cc -CC=gcc -LD=$(CC) - -RM=rm -f - -#PNGPATH = /usr/local -#PNGINC = -I$(PNGPATH)/include/libpng16 -#PNGLIB = -L$(PNGPATH)/lib -lpng16 -#PNGLIBS = $(PNGPATH)/lib/libpng16.a -PNGINC = -I../.. -PNGLIB = -L../.. -lpng -PNGLIBS = ../../libpng.a - -#ZPATH = /usr/local -#ZINC = -I$(ZPATH)/include -#ZLIB = -L$(ZPATH)/lib -lz -#ZLIBS = $(ZPATH)/lib/libz.a -ZINC = -I../../../zlib -ZLIB = -L../../../zlib -lz -ZLIBS = ../../../zlib/libz.a - -CPPFLAGS=$(PNGINC) $(ZINC) -CFLAGS= -LDLIBS=$(PNGLIB) $(ZLIB) -LDLIBSS=$(PNGLIBS) $(ZLIBS) -C=.c -O=.o -L=.a -E= - -# dependencies - -#all: png2pnm$(E) pnm2png$(E) -all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E) - -png2pnm$(O): png2pnm$(C) - $(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C) - -png2pnm$(E): png2pnm$(O) - $(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm - -png2pnm-static$(E): png2pnm$(O) - $(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm - -pnm2png$(O): pnm2png$(C) - $(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C) - -pnm2png$(E): pnm2png$(O) - $(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm - -pnm2png-static$(E): pnm2png$(O) - $(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm - -clean: - $(RM) png2pnm$(O) - $(RM) pnm2png$(O) - $(RM) png2pnm$(E) - $(RM) pnm2png$(E) - $(RM) png2pnm-static$(E) - $(RM) pnm2png-static$(E) - -# End of makefile for png2pnm / pnm2png diff --git a/contrib/pngminus/makefile.tc3 b/contrib/pngminus/makefile.tc3 deleted file mode 100644 index 6a2f4b985..000000000 --- a/contrib/pngminus/makefile.tc3 +++ /dev/null @@ -1,38 +0,0 @@ -# Makefile for PngMinus (png2pnm and pnm2png) -# TurboC++ 3.0 - -CC=tcc -Ic:\tc3\inc -LD=tcc -Lc:\tc3\lib -LB=tlib -RM=del -CP=copy -MODEL=l -CPPFLAGS=-I..\libpng -I..\zlib -CFLAGS=-O -m$(MODEL) -LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib -C=.c -O=.obj -L=.lib -E=.exe - -# dependencies - -all: png2pnm$(E) pnm2png$(E) - -png2pnm$(O): 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 $(CPPFLAGS) $(CFLAGS) pnm2png$(C) - -pnm2png$(E): pnm2png$(O) - $(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L) - -clean: - $(RM) *$(O) - $(RM) *$(E) - -# End of makefile for png2pnm / pnm2png diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c index 67d543071..5fef7ed14 100644 --- a/contrib/pngminus/png2pnm.c +++ b/contrib/pngminus/png2pnm.c @@ -1,20 +1,9 @@ /* * png2pnm.c --- conversion from PNG-file to PGM/PPM-file - * copyright (C) 1999,2017,2018 by Willem van Schaik + * copyright (C) 1999-2019 by Willem van Schaik * - * version 1.0 - 1999.10.15 - First version. - * 1.1 - 2017.04.22 - Add buffer-size check (Glenn Randers-Pehrson) - * 1.2 - 2017.08.24 - Fix potential overflow in buffer-size check - * (Glenn Randers-Pehrson) - * 1.3 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse) - * 1.4 - 2018.08.05 - Improve portability and fix style (Cosmin Truta) - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear in - * supporting documentation. This software is provided "as is" without - * express or implied warranty. + * This software is released under the MIT license. For conditions of + * distribution and use, see the LICENSE file part of this package. */ #include diff --git a/contrib/pngminus/pngminus.bat b/contrib/pngminus/pngminus.bat index 911bb8dff..fa60e7de0 100755 --- a/contrib/pngminus/pngminus.bat +++ b/contrib/pngminus/pngminus.bat @@ -1,4 +1,4 @@ -make -f makefile.tc3 +make call png2pnm.bat call pnm2png.bat diff --git a/contrib/pngminus/pngminus.sh b/contrib/pngminus/pngminus.sh index 2a0a9d8fb..cc9b4a56e 100755 --- a/contrib/pngminus/pngminus.sh +++ b/contrib/pngminus/pngminus.sh @@ -1,5 +1,5 @@ #!/bin/sh -make -f makefile.std +make sh png2pnm.sh sh pnm2png.sh diff --git a/contrib/pngminus/pnm2png.c b/contrib/pngminus/pnm2png.c index 3d4c6c5e7..a2c2551da 100644 --- a/contrib/pngminus/pnm2png.c +++ b/contrib/pngminus/pnm2png.c @@ -1,22 +1,9 @@ /* * pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file - * copyright (C) 1999,2015,2017,2018 by Willem van Schaik + * copyright (C) 1999-2019 by Willem van Schaik * - * version 1.0 - 1999.10.15 - First version. - * 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson) - * 1.2 - 2017.04.22 - Add buffer-size check - * 1.3 - 2017.08.24 - Fix potential overflow in buffer-size check - * (Glenn Randers-Pehrson) - * 1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse) - * 1.5 - 2018.08.05 - Fix buffer overflow in tokenizer (Cosmin Truta) - * 1.6 - 2018.08.05 - Improve portability and fix style (Cosmin Truta) - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear in - * supporting documentation. This software is provided "as is" without - * express or implied warranty. + * This software is released under the MIT license. For conditions of + * distribution and use, see the LICENSE file part of this package. */ #include