diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-06-01 09:09:46 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-06-01 10:49:20 +0200 |
commit | e89e3a8b5a7639f14833d066e8a6c445dca97cc0 (patch) | |
tree | 6cabe68756d6491658a7789deca6f0a3e3afdc16 /binaryurp | |
parent | 6dbccf3d9344be0c2ba162a8df5fc0bf425cb84e (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 'binaryurp')
-rw-r--r-- | binaryurp/source/reader.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx index 91f2e51a0f25..7cabbd41c8a1 100644 --- a/binaryurp/source/reader.cxx +++ b/binaryurp/source/reader.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/uno/XCurrentContext.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <cppu/unotype.hxx> +#include <o3tl/safeint.hxx> #include <rtl/byteseq.h> #include <rtl/ustring.hxx> #include <sal/log.hxx> @@ -74,7 +75,7 @@ css::uno::Sequence< sal_Int8 > read( throw css::io::IOException( "binaryurp::Reader: premature end of input"); } - assert(buf.getLength() == static_cast< sal_Int32 >(size)); + assert(o3tl::make_unsigned(buf.getLength()) == size); return buf; } |