diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-06-03 10:22:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-06-07 08:45:31 +0200 |
commit | f4b6cee77e1725837f9a6044fec0b561c7049c3b (patch) | |
tree | 1145b9d13f6e775a154cdfc9afa560d2ad6d82c9 /desktop | |
parent | f572585756494c59fb81f5d93c51cc2d35421f0e (diff) |
Use o3tl::make_unsigned, OString::getLength() is guaranteed to be non-negative
Change-Id: Ibddd4f2b3d8680c94fd0ab45f6ed6204215c6009
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135339
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/deployment/dp_persmap.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx index 652e5d2ea5ff..8b032fffb96e 100644 --- a/desktop/source/deployment/dp_persmap.cxx +++ b/desktop/source/deployment/dp_persmap.cxx @@ -23,6 +23,7 @@ #include <dp_misc.h> #include <dp_persmap.h> +#include <o3tl/safeint.hxx> #include <rtl/byteseq.hxx> #include <rtl/strbuf.hxx> #include <sal/log.hxx> @@ -243,13 +244,13 @@ void PersistentMap::flush() const OString aKeyString = encodeString( entry.first); const sal_Int32 nKeyLen = aKeyString.getLength(); m_MapFile.write( aKeyString.getStr(), nKeyLen, nBytesWritten); - OSL_ASSERT( nKeyLen == static_cast<sal_Int32>(nBytesWritten)); + OSL_ASSERT( o3tl::make_unsigned(nKeyLen) == nBytesWritten); m_MapFile.write( "\n", 1, nBytesWritten); // write line for value const OString& rValString = encodeString( entry.second); const sal_Int32 nValLen = rValString.getLength(); m_MapFile.write( rValString.getStr(), nValLen, nBytesWritten); - OSL_ASSERT( nValLen == static_cast<sal_Int32>(nBytesWritten)); + OSL_ASSERT( o3tl::make_unsigned(nValLen) == nBytesWritten); m_MapFile.write( "\n", 1, nBytesWritten); } |