From 6ab1f4903f51e071c2a09f8bb12c247524c52e26 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 7 May 2013 14:25:21 -0500 Subject: [PATCH] [libpng16] Ignore "#" delimited comments in input file to pnm2png.c. --- ANNOUNCE | 1 + CHANGES | 1 + contrib/pngminus/pnm2png.c | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ANNOUNCE b/ANNOUNCE index baafd51cb..de4f88b08 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -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 diff --git a/CHANGES b/CHANGES index a263feb12..72c987411 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/contrib/pngminus/pnm2png.c b/contrib/pngminus/pnm2png.c index 76f394fbb..953011223 100644 --- a/contrib/pngminus/pnm2png.c +++ b/contrib/pngminus/pnm2png.c @@ -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; }