summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-06-01 09:09:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-06-01 10:49:20 +0200
commite89e3a8b5a7639f14833d066e8a6c445dca97cc0 (patch)
tree6cabe68756d6491658a7789deca6f0a3e3afdc16 /reportdesign
parent6dbccf3d9344be0c2ba162a8df5fc0bf425cb84e (diff)
The return value of those getLength functions is guaranteed to be non-negative
...so use o3tl::make_unsigned when comparing it against an expression of unsigned integer type, instead of casting that expression to a signed type Change-Id: Ic47c6d96919b2aba2d16ce6d1a2a8e4c5761a480 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135219 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/core/misc/conditionalexpression.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/reportdesign/source/core/misc/conditionalexpression.cxx b/reportdesign/source/core/misc/conditionalexpression.cxx
index d8f37efc9578..0fe6dbb40702 100644
--- a/reportdesign/source/core/misc/conditionalexpression.cxx
+++ b/reportdesign/source/core/misc/conditionalexpression.cxx
@@ -19,6 +19,7 @@
#include <conditionalexpression.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
@@ -108,7 +109,7 @@ namespace rptui
bool bHaveRHS( nRHSIndex != -1 );
sal_Int32 nRightMostIndex( bHaveRHS ? nRHSIndex : nLHSIndex );
const std::u16string_view sMatchExprPart3( sMatchExpression.subView( nRightMostIndex + 2 ) );
- if ( _rExpression.getLength() < static_cast<sal_Int32>(sMatchExprPart3.size()) )
+ if ( o3tl::make_unsigned(_rExpression.getLength()) < sMatchExprPart3.size() )
// the expression is not even long enough to hold the right-most part of the match expression
return false;
const std::u16string_view sExprPart3( _rExpression.subView( _rExpression.getLength() - sMatchExprPart3.size() ) );