diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2022-10-28 04:00:00 +0200 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2022-10-29 11:57:20 +0200 |
commit | 8df721df25864f89772c58a4486314855bf1a37e (patch) | |
tree | 7c89253922a8f09b964876b438056e2655cc9062 /src/io | |
parent | 467b6fb9eeb12d064c1f6fa4d7f87638e49685ca (diff) | |
download | open-axiom-8df721df25864f89772c58a4486314855bf1a37e.tar.gz |
Fix some compiler warnings & buffer overflows
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/InputFragment.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/io/InputFragment.cxx b/src/io/InputFragment.cxx index 595b88b1..827aa372 100644 --- a/src/io/InputFragment.cxx +++ b/src/io/InputFragment.cxx @@ -76,16 +76,18 @@ namespace OpenAxiom { // Return true if line is entirely a positive comment, i.e. a description. static bool positive_comment(const Line& line) { - if (line.indent + 1 >= line.length()) + std::size_t i = line.indent + 1; + if (i >= line.length()) return false; - return line[line.indent] == '+' and line[line.indent + 1] == '+'; + return line[line.indent] == '+' and line[i] == '+'; } // Return true if line is entirely a negative comment. static bool negative_comment(const Line& line) { - if (line.indent + 1 >= line.length()) + std::size_t i = line.indent + 1; + if (i >= line.length()) return false; - return line[line.indent] == '-' and line[line.indent + 1] == '-'; + return line[line.indent] == '-' and line[i] == '-'; } // Clean up and dress up the line with indentation information. |