pvs-studio: (V555) Clarify size_type comparison

The expression 'r - l > 0' implies a sign to r and l that does not exist.
This commit is contained in:
Martin Duffy
2026-05-05 01:42:38 -04:00
parent 88072f17fe
commit 7217af55da
2 changed files with 1 additions and 3 deletions

View File

@@ -14,8 +14,6 @@
//-V::539
# Expression is always true/false.
//-V::547
# Expression of the 'A - B > 0' kind will work as 'A != B'.
//-V::555
# Possible array overrun.
//-V::557
# Part of conditional expression is always true/false.

View File

@@ -93,7 +93,7 @@ void cmStringReplaceHelper::ParseReplaceExpression()
this->Replacements.emplace_back(
this->ReplaceExpression.substr(l, r - l));
} else {
if (r - l > 0) {
if (r != l) {
this->Replacements.emplace_back(
this->ReplaceExpression.substr(l, r - l));
}