From 0ff2c6af823ce7712c06150c43c9b403846a035f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 7 Jan 2023 15:43:20 -0800 Subject: cxpm: getc/ungetc wrappers should not adjust position when c == EOF Signed-off-by: Alan Coopersmith --- cxpm/cxpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cxpm/cxpm.c') diff --git a/cxpm/cxpm.c b/cxpm/cxpm.c index 8b8af9a..94865e0 100644 --- a/cxpm/cxpm.c +++ b/cxpm/cxpm.c @@ -61,7 +61,7 @@ sGetc(xpmData *data, FILE *file) if (c == '\n') { data->lineNum++; data->charNum = 0; - } else { + } else if (c != EOF) { data->charNum++; } return c; @@ -74,7 +74,7 @@ sUngetc(xpmData *data, int c, FILE *file) if (c == '\n') { data->lineNum--; data->charNum = 0; - } else { + } else if (c != EOF) { data->charNum--; } } -- cgit v1.2.3