From 7217af55da2932fea518b6074eead127a41e95f3 Mon Sep 17 00:00:00 2001 From: Martin Duffy Date: Tue, 5 May 2026 01:42:38 -0400 Subject: [PATCH] pvs-studio: (V555) Clarify size_type comparison The expression 'r - l > 0' implies a sign to r and l that does not exist. --- .pvsconfig | 2 -- Source/cmStringReplaceHelper.cxx | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.pvsconfig b/.pvsconfig index 4d7413f0b4..ae3091a1fd 100644 --- a/.pvsconfig +++ b/.pvsconfig @@ -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. diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx index 0e1845776e..8ccc094b8d 100644 --- a/Source/cmStringReplaceHelper.cxx +++ b/Source/cmStringReplaceHelper.cxx @@ -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)); }