From b35feda8f1c32e4a21ef689033d42768c2ce9937 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 24 Feb 2014 18:40:37 -0600 Subject: [PATCH] [libpng16] Imported from libpng-1.6.10beta03.tar --- LICENSE | 4 +- README | 2 +- libpngpf.3 | 2 +- png.5 | 2 +- png.c | 4 +- pngconf.h | 2 +- pngtopng.c | 92 +++++++++++++++++++++++++++++++++++ projects/vstudio/readme.txt | 2 +- projects/vstudio/zlib.props | 2 +- scripts/README.txt | 2 +- scripts/pnglibconf.h.prebuilt | 2 +- 11 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 pngtopng.c diff --git a/LICENSE b/LICENSE index 02d0e8968..b81ca9558 100644 --- a/LICENSE +++ b/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.6.10beta03, February 23, 2014, are +libpng versions 1.2.6, August 15, 2004, through 1.6.10beta03, February 25, 2014, are Copyright (c) 2004, 2006-2014 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 @@ -108,4 +108,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -February 23, 2014 +February 25, 2014 diff --git a/README b/README index c81f456f7..4b0f64c4f 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.10beta03 - February 23, 2014 (shared library 16.0) +README for libpng version 1.6.10beta03 - February 25, 2014 (shared library 16.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. diff --git a/libpngpf.3 b/libpngpf.3 index 370a82263..3062fd97c 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,4 +1,4 @@ -.TH LIBPNGPF 3 "February 23, 2014" +.TH LIBPNGPF 3 "February 25, 2014" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.6.10beta03 (private functions) diff --git a/png.5 b/png.5 index d1f0faf84..773b07f63 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "February 23, 2014" +.TH PNG 5 "February 25, 2014" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index de93589a7..fd7f27989 100644 --- a/png.c +++ b/png.c @@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.10beta03 - February 23, 2014" PNG_STRING_NEWLINE \ + "libpng version 1.6.10beta03 - February 25, 2014" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2014 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 "libpng version 1.6.10beta03 - February 23, 2014\ + return "libpng version 1.6.10beta03 - February 25, 2014\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; diff --git a/pngconf.h b/pngconf.h index f085d7c3f..daea415e4 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.10beta03 - February 23, 2014 + * libpng version 1.6.10beta03 - February 25, 2014 * * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngtopng.c b/pngtopng.c new file mode 100644 index 000000000..b1b3be677 --- /dev/null +++ b/pngtopng.c @@ -0,0 +1,92 @@ +/*- pngtopng + * + * COPYRIGHT: Written by John Cunningham Bowler, 2011. + * To the extent possible under law, the author has waived all copyright and + * related or neighboring rights to this work. This work is published from: + * United States. + * + * Read a PNG and write it out in a fixed format, using the 'simplified API' + * that was introduced in libpng-1.6.0. + * + * This sample code is just the code from the top of 'example.c' with some error + * handling added. See example.c for more comments. + */ +#include +#include +#include +#include + +/* Normally use here to get the installed libpng, but this is done to + * ensure the code picks up the local libpng implementation: + */ +#include "../../png.h" + +int main(int argc, const char **argv) +{ + int result = 1; + + if (argc == 3) + { + png_image image; + + /* Only the image structure version number needs to be set. */ + memset(&image, 0, sizeof image); + image.version = PNG_IMAGE_VERSION; + + if (png_image_begin_read_from_file(&image, argv[1])) + { + png_bytep buffer; + + /* Change this to try different formats! If you set a colormap format + * then you must also supply a colormap below. + */ + image.format = PNG_FORMAT_RGBA; + + buffer = malloc(PNG_IMAGE_SIZE(image)); + + if (buffer != NULL) + { + if (png_image_finish_read(&image, NULL/*background*/, buffer, + 0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */)) + { + if (png_image_write_to_file(&image, argv[2], + 0/*convert_to_8bit*/, buffer, 0/*row_stride*/, + NULL/*colormap*/)) + result = 0; + + else + fprintf(stderr, "pngtopng: write %s: %s\n", argv[2], + image.message); + + free(buffer); + } + + else + { + fprintf(stderr, "pngtopng: read %s: %s\n", argv[1], + image.message); + + /* This is the only place where a 'free' is required; libpng does + * the cleanup on error and success, but in this case we couldn't + * complete the read because of running out of memory. + */ + png_image_free(&image); + } + } + + else + fprintf(stderr, "pngtopng: out of memory: %lu bytes\n", + (unsigned long)PNG_IMAGE_SIZE(image)); + } + + else + /* Failed to read the first argument: */ + fprintf(stderr, "pngtopng: %s: %s\n", argv[1], image.message); + } + + else + /* Wrong number of arguments */ + fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n"); + + return result; +} diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt index 983955ae8..470944bf5 100644 --- a/projects/vstudio/readme.txt +++ b/projects/vstudio/readme.txt @@ -1,7 +1,7 @@ VisualStudio instructions -libpng version 1.6.10beta03 - February 23, 2014 +libpng version 1.6.10beta03 - February 25, 2014 Copyright (c) 1998-2010 Glenn Randers-Pehrson diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props index 4b4630811..a76de0812 100644 --- a/projects/vstudio/zlib.props +++ b/projects/vstudio/zlib.props @@ -2,7 +2,7 @@