blob: f9cf7a39b328d852708eed54b16833824016210b [file] [log] [blame]
From: pstew@chromium.org
To: png-mng-implement@lists.sourceforge.net
I'd like to suggest another small change to pnm2png to ignore comment
lines in get_token. This allows a header like:
P5
# PNG comment here
2524 3543
255
to correctly parse.
--- libpng-1.2.49/contrib/pngminus/pnm2png.c.orig 2013-05-07 11:40:07.447024688 -0700
+++ libpng-1.2.49/contrib/pngminus/pnm2png.c 2013-05-07 12:08:32.536645695 -0700
@@ -448,10 +448,18 @@
int i = 0;
int ret;
- /* remove white-space */
+ /* remove white-space and comment lines */
do
{
ret = fgetc(pnm_file);
+ if (ret == '#') {
+ /* the rest of this line is a comment */
+ do
+ {
+ ret = fgetc(pnm_file);
+ }
+ while ((ret != '\n') && (ret != '\r') && (ret != EOF));
+ }
if (ret == EOF) break;
token[i] = (unsigned char) ret;
}