Skip to content

Commit

Permalink
APRERPO: Suggested fixes for cubit bw compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Oct 16, 2023
1 parent 162bbc9 commit 73cfb81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions packages/seacas/libraries/aprepro_lib/apr_scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,8 @@ namespace {
bool string_is_ascii(const char *line, size_t len)
{
for (size_t i = 0; i < len; i++) {
if (!(std::isspace(line[i]) || std::isprint(line[i]))) {
if (!(std::isspace(static_cast<unsigned char>(line[i])) ||
std::isprint(static_cast<unsigned char>(line[i])))) {
return false;
}
}
Expand Down Expand Up @@ -1901,9 +1902,9 @@ YY_DECL
pt = yytext;
}

add_include_file(pt, file_must_exist);
bool added = add_include_file(pt, file_must_exist);

if (!aprepro.doIncludeSubstitution)
if (added && !aprepro.doIncludeSubstitution)
yy_push_state(VERBATIM);

aprepro.ap_file_list.top().lineno++;
Expand Down
8 changes: 5 additions & 3 deletions packages/seacas/libraries/aprepro_lib/aprepro.ll
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace {
bool string_is_ascii(const char *line, size_t len)
{
for (size_t i = 0; i < len; i++) {
if (!(std::isspace(line[i]) || std::isprint(line[i]))) {
if (!(std::isspace(static_cast<unsigned char>(line[i])) || std::isprint(static_cast<unsigned char>(line[i])))) {
return false;
}
}
Expand Down Expand Up @@ -103,6 +103,8 @@ size_t hist_start = 0;
* versions. */
%option debug

%option flex bison

/* enables the use of start condition stacks */
%option stack

Expand Down Expand Up @@ -598,9 +600,9 @@ integer {D}+({E})?
pt = yytext;
}
add_include_file(pt, file_must_exist);
bool added = add_include_file(pt, file_must_exist);
if(!aprepro.doIncludeSubstitution)
if(added && !aprepro.doIncludeSubstitution)
yy_push_state(VERBATIM);
aprepro.ap_file_list.top().lineno++;
Expand Down

0 comments on commit 73cfb81

Please sign in to comment.