tdf#120703 PVS: V1028 fix unexpected integer overflow
V1028 Possible overflow. Consider casting arguments of the operator
to the type instead of casting its result.
V547 Expression 'nNewSize > ((sal_Int32) 0x7FFFFFFF)' is always false.
Change-Id: I7107b162d88c9d3f97019effcac1f9cfab52a66c
Reviewed-on: https://gerrit.libreoffice.org/62846
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx
index 39b2fa0..77cb692 100644
--- a/comphelper/source/streaming/memorystream.cxx
+++ b/comphelper/source/streaming/memorystream.cxx
@@ -190,7 +190,7 @@
const sal_Int32 nBytesToWrite( aData.getLength() );
if( nBytesToWrite )
{
sal_Int64 nNewSize = static_cast< sal_Int64 >( mnCursor + nBytesToWrite );
sal_Int64 nNewSize = static_cast<sal_Int64>(mnCursor) + nBytesToWrite;
if( nNewSize > SAL_MAX_INT32 )
{
OSL_ASSERT(false);