Skip to content

Commit

Permalink
Per issue #1950, modified and added better debugging to figure out cu…
Browse files Browse the repository at this point in the history
…rrent issue with ascii2nc. SL
  • Loading branch information
Seth Linden committed Apr 4, 2022
1 parent bbb7f1d commit c78f894
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions met/src/basic/vx_log/string_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,16 @@ bool StringArray::has(const std::string text) const
bool found = false;
bool forward = true;

mlog << Debug(9) << "In has() for Sorted=true and IgnoreCase=false: searching for text = " << text.c_str() << "\n";
mlog << Debug(9) << "In new has() searching for text = " << text.c_str() << "\n";

if (Sorted && !IgnoreCase) {
mlog << Debug(9) << " Sorted is true and IgnoreCase is false" << "\n";
found = binary_search(s.begin(), s.end(), text);
mlog << Debug(9) << " After binary_search, found = " << found << "\n";
}
else {
mlog << Debug(9) << " Sorted = " << Sorted << " IgnoreCase = " << IgnoreCase << "\n";
mlog << Debug(9) << " Calling middle has() function" << "\n";
return ( has(text, forward) );
}

Expand Down Expand Up @@ -431,7 +434,7 @@ bool StringArray::has(const std::string text, int & index, bool forward) const
bool found = false;
index = -1;

mlog << Debug(9) << "In has() for Sorted=false or IgnoreCase=true: searching for text = " << text.c_str() << "\n";
mlog << Debug(9) << "In original has() searching for text = " << text.c_str() << "\n";

if (!s.empty()) {
int count;
Expand All @@ -447,13 +450,15 @@ bool StringArray::has(const std::string text, int & index, bool forward) const
mlog << Debug(9) << " Sorted is false, IgnoreCase is true, forward is true, lower_s (*it) = " << lower_s.c_str() << "\n";
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
if ( lower_s == lower_text) {
mlog << Debug(9) << " found lower_text = " << lower_text.c_str() << "\n";
found = true;
break;
}
}
else {
mlog << Debug(9) << " Sorted is false, IgnoreCase is false, forward is true, *it = " << (*it).c_str() << "\n";
if ( *it == text ) {
mlog << Debug(9) << " found text = " << text.c_str() << "\n";
found = true;
break;
}
Expand Down Expand Up @@ -496,6 +501,8 @@ bool StringArray::has(const std::string text, int & index, bool forward) const
// << " for " << text << ", found: " << (found ? "true" : "false")
// << ", forward: " << (forward ? "yes" : "no") << "\n";

mlog << Debug(9) << "\n";

return found;
}

Expand Down

0 comments on commit c78f894

Please sign in to comment.