summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-07 15:43:20 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-10 08:55:37 -0800
commit0ff2c6af823ce7712c06150c43c9b403846a035f (patch)
tree0f5659a7b9b44834592f3ea6b47bee5cc443598a
parent501494c6c68a84114fdd0b44d4b67ef9cde776c9 (diff)
cxpm: getc/ungetc wrappers should not adjust position when c == EOF
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--cxpm/cxpm.c4
1 files changed, 2 insertions, 2 deletions
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--;
}
}