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

Caolán McNamara caolanm at redhat.com
Tue Aug 29 13:08:54 UTC 2017


 sw/source/filter/xml/xmltbli.cxx |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit 384abc0615b22c586544689d5e28e92c0e74481e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 29 12:22:12 2017 +0100

    Related: tdf#112018 limit to min of 1 before conversion from signed int
    
    Change-Id: I1a27f9ebfbe70891d64afa9553f37f565f2d49bf
    Reviewed-on: https://gerrit.libreoffice.org/41689
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 698564ecb960..5ada656f30de 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -470,19 +470,13 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
             GetImport().GetTextImport()->SetCellParaStyleDefault(rValue);
             break;
         case XML_TOK_TABLE_NUM_COLS_SPANNED:
-            nColSpan = (sal_uInt32)rValue.toInt32();
-            if( nColSpan < 1 )
-                nColSpan = 1;
+            nColSpan = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32());
             break;
         case XML_TOK_TABLE_NUM_ROWS_SPANNED:
-            nRowSpan = (sal_uInt32)rValue.toInt32();
-            if( nRowSpan < 1 )
-                nRowSpan = 1;
+            nRowSpan = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32());
             break;
         case XML_TOK_TABLE_NUM_COLS_REPEATED:
-            nColRepeat = (sal_uInt32)rValue.toInt32();
-            if( nColRepeat < 1 )
-                nColRepeat = 1;
+            nColRepeat = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32());
             break;
         case XML_TOK_TABLE_FORMULA:
             {
@@ -897,9 +891,7 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( SwXMLImport& rImport,
             }
             else if( IsXMLToken( aLocalName, XML_NUMBER_ROWS_REPEATED ) )
             {
-                nRowRepeat = (sal_uInt32)rValue.toInt32();
-                if( nRowRepeat < 1 )
-                    nRowRepeat = 1;
+                nRowRepeat = (sal_uInt32)std::max<sal_Int32>(1, rValue.toInt32());
             }
             else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) )
             {


More information about the Libreoffice-commits mailing list