[libpng16] Ignore "#" delimited comments in input file to pnm2png.c.

This commit is contained in:
Glenn Randers-Pehrson 2013-05-07 14:25:21 -05:00
parent 34df4eb5ad
commit 6ab1f4903f
3 changed files with 11 additions and 1 deletions

View File

@ -52,6 +52,7 @@ Version 1.6.3beta05 [May 7, 2013]
Zlib-1.2.8 and earlier don't allow us to decrease the windowBits, so
undid the improvement in beta04.
Check for EOF in contrib/pngminus/pnm2png.c (Paul Stewart).
Ignore "#" delimited comments in input file to pnm2png.c.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4535,6 +4535,7 @@ Version 1.6.3beta05 [May 7, 2013]
Zlib-1.2.8 and earlier don't allow us to decrease the windowBits, so
undid the improvement in beta04.
Check for EOF in contrib/pngminus/pnm2png.c (Paul Stewart).
Ignore "#" delimited comments in input file to pnm2png.c.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -462,10 +462,18 @@ void get_token(FILE *pnm_file, char *token)
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;
}