From 7db7fd437a84580ff766747220bd3967c403f487 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 11 Oct 2023 13:22:08 -0600 Subject: [PATCH] APREPRO: Clear possibly bad status of input stream IF using istringstream, then stream will be at end-of-string due to being parsed; clear the bad state before seeking. --- packages/seacas/libraries/aprepro_lib/apr_scanner.cc | 2 ++ packages/seacas/libraries/aprepro_lib/aprepro.ll | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/seacas/libraries/aprepro_lib/apr_scanner.cc b/packages/seacas/libraries/aprepro_lib/apr_scanner.cc index 8a644a03af..e288b946bc 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_scanner.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_scanner.cc @@ -3643,6 +3643,8 @@ namespace SEAMS { if (len <= 0) return; + // Clear any possible end-of-stream if e.g., reading from a istringstream. + yyin->clear(); // Go back in the stream to where we started keeping history. yyin->seekg(hist_start); if (!yyin->good()) { diff --git a/packages/seacas/libraries/aprepro_lib/aprepro.ll b/packages/seacas/libraries/aprepro_lib/aprepro.ll index 31c8aabda3..b882595298 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro.ll +++ b/packages/seacas/libraries/aprepro_lib/aprepro.ll @@ -1191,6 +1191,8 @@ integer {D}+({E})? if (len <= 0) return; + // Clear any possible end-of-stream if e.g., reading from a istringstream. + yyin->clear(); // Go back in the stream to where we started keeping history. yyin->seekg(hist_start); if (!yyin->good()) {