From 99778e17af5b1338d2f1534a7ab309f476b1e3ff Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 20 Apr 2011 17:43:52 -0500 Subject: [PATCH] [devel] Mention the reason to call png_read_end() in the libpng documentation. --- libpng-manual.txt | 14 ++++++++++---- libpng.3 | 22 ++++++++++++++-------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/libpng-manual.txt b/libpng-manual.txt index 718be5285..83e186e05 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.5.3beta04 - April 17, 2011 + libpng version 1.5.3beta04 - April 20, 2011 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.5.3beta04 - April 17, 2011 + libpng versions 0.97, January 1998, through 1.5.3beta04 - April 20, 2011 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson @@ -1824,10 +1824,16 @@ low-level interface, you can finish reading the file. If you are interested in comments or time, which may be stored either before or after the image data, you should pass the separate png_info struct if you want to keep the comments from before and after the image -separate. If you are not interested, you can pass NULL. +separate. If you are not interested, you should still call png_read_end() +but you can pass NULL, avoiding the need to create an end_info structure. png_read_end(png_ptr, end_info); +If you don't call png_read_end(), then your file pointer will be +left pointing to the first chunk after the last IDAT, which is probably +not what you want if you expect to read something beyond the end of +the PNG datastream. + When you are done, you can free all memory allocated by libpng like this: png_destroy_read_struct(&png_ptr, &info_ptr, @@ -4174,7 +4180,7 @@ Other rules can be inferred by inspecting the libpng source. XIV. Y2K Compliance in libpng -April 17, 2011 +April 20, 2011 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index 23b1f24a1..bb339f8ec 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "April 17, 2011" +.TH LIBPNG 3 "April 20, 2011" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.5.3beta04 .SH SYNOPSIS @@ -943,7 +943,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.5.3beta04 - April 17, 2011 + libpng version 1.5.3beta04 - April 20, 2011 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson @@ -954,7 +954,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.5.3beta04 - April 17, 2011 + libpng versions 0.97, January 1998, through 1.5.3beta04 - April 20, 2011 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson @@ -2767,10 +2767,16 @@ low-level interface, you can finish reading the file. If you are interested in comments or time, which may be stored either before or after the image data, you should pass the separate png_info struct if you want to keep the comments from before and after the image -separate. If you are not interested, you can pass NULL. +separate. If you are not interested, you should still call png_read_end() +but you can pass NULL, avoiding the need to create an end_info structure. png_read_end(png_ptr, end_info); +If you don't call png_read_end(), then your file pointer will be +left pointing to the first chunk after the last IDAT, which is probably +not what you want if you expect to read something beyond the end of +the PNG datastream. + When you are done, you can free all memory allocated by libpng like this: png_destroy_read_struct(&png_ptr, &info_ptr, @@ -5117,7 +5123,7 @@ Other rules can be inferred by inspecting the libpng source. .SH XIV. Y2K Compliance in libpng -April 17, 2011 +April 20, 2011 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -5369,7 +5375,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.5.3beta04 - April 17, 2011: +Libpng version 1.5.3beta04 - April 20, 2011: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -5392,7 +5398,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.5.3beta04, April 17, 2011, are +libpng versions 1.2.6, August 15, 2004, through 1.5.3beta04, April 20, 2011, 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 @@ -5491,7 +5497,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -April 17, 2011 +April 20, 2011 .\" end of man page