Kaydet (Commit) 2a99a22a authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Stephan Bergmann

WaE: comparison is always false due to limited range of data type

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>; plus some cosmetics to
silence loplugin:bodynotinblock.

Change-Id: I8ff9da84021635c9de66c9544b46834a2d9efcf7
üst e6300f83
...@@ -536,19 +536,33 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS ...@@ -536,19 +536,33 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS
sal_uInt64 cx = 0 ; sal_uInt64 cx = 0 ;
sal_uInt64 cy = 0 ; sal_uInt64 cy = 0 ;
const sal_Int64 MAX_INTEGER_VALUE = 2147483647; const sal_Int64 MAX_INTEGER_VALUE = 2147483647;
// the 'Size' type uses 'long' for width and height, so on
// platforms where 'long' is 32 bits they can obviously never be
// larger than the max signed 32-bit integer.
#if SAL_TYPES_SIZEOFLONG > 4
if (rSize.Width() > MAX_INTEGER_VALUE) if (rSize.Width() > MAX_INTEGER_VALUE)
cx = MAX_INTEGER_VALUE ; cx = MAX_INTEGER_VALUE ;
else if (0 > rSize.Width())
cx = 0 ;
else else
cx = rSize.Width(); #endif
{
if (0 > rSize.Width())
cx = 0 ;
else
cx = rSize.Width();
}
#if SAL_TYPES_SIZEOFLONG > 4
if (rSize.Height() > MAX_INTEGER_VALUE) if (rSize.Height() > MAX_INTEGER_VALUE)
cy = MAX_INTEGER_VALUE ; cy = MAX_INTEGER_VALUE ;
else if (0 > rSize.Height())
cy = 0 ;
else else
cy = rSize.Height(); #endif
{
if (0 > rSize.Height())
cy = 0 ;
else
cy = rSize.Height();
}
OString aWidth(OString::number(TwipsToEMU(cx))); OString aWidth(OString::number(TwipsToEMU(cx)));
//we explicitly check the converted EMU value for the range as mentioned in above comment. //we explicitly check the converted EMU value for the range as mentioned in above comment.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment