[devel] Mention the reason to call png_read_end() in the libpng documentation.

This commit is contained in:
Glenn Randers-Pehrson 2011-04-20 17:43:52 -05:00
parent cf78aee1c4
commit 99778e17af
2 changed files with 24 additions and 12 deletions

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng 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 Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 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: 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 Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 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 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 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 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); 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: When you are done, you can free all memory allocated by libpng like this:
png_destroy_read_struct(&png_ptr, &info_ptr, 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 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 Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "April 17, 2011" .TH LIBPNG 3 "April 20, 2011"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.3beta04 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.3beta04
.SH SYNOPSIS .SH SYNOPSIS
@ -943,7 +943,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng 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 Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 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: 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 Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 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 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 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 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); 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: When you are done, you can free all memory allocated by libpng like this:
png_destroy_read_struct(&png_ptr, &info_ptr, 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 .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 Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
@ -5369,7 +5375,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. 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. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). 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. 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 Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors 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 Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
April 17, 2011 April 20, 2011
.\" end of man page .\" end of man page