[Libreoffice-commits] core.git: sw/source

Tor Lillqvist tml at collabora.com
Fri May 23 00:48:39 PDT 2014


 sw/source/filter/ww8/docxsdrexport.cxx |   26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 2a99a22af0062e9561046a4a00f12dc97e5bd4f4
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri May 23 10:33:09 2014 +0300

    WaE: comparison is always false due to limited range of data type
    
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>; plus some cosmetics to
    silence loplugin:bodynotinblock.
    
    Change-Id: I8ff9da84021635c9de66c9544b46834a2d9efcf7

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 50bfb7d..c8ffe94 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -536,19 +536,33 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS
     sal_uInt64 cx = 0 ;
     sal_uInt64 cy = 0 ;
     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)
         cx = MAX_INTEGER_VALUE ;
-    else if (0 > rSize.Width())
-        cx = 0 ;
     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)
         cy = MAX_INTEGER_VALUE ;
-    else if (0 > rSize.Height())
-        cy = 0 ;
     else
-        cy = rSize.Height();
+#endif
+    {
+        if (0 > rSize.Height())
+            cy = 0 ;
+        else
+            cy = rSize.Height();
+    }
 
     OString aWidth(OString::number(TwipsToEMU(cx)));
     //we explicitly check the converted EMU value for the range as mentioned in above comment.


More information about the Libreoffice-commits mailing list