[Libreoffice-commits] core.git: include/svl svl/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Nov 3 06:49:11 UTC 2016


 include/svl/itemset.hxx      |    2 +-
 svl/source/items/itemset.cxx |   16 ++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 8de24d16520b8ae95d793f3c804f1fc7294afbe7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Nov 3 08:47:47 2016 +0200

    Revert "remove unnecessary casts"
    
    This reverts commit fa80dae9a79a7414af8adcb91bc04dfff13bbb63.
    
    because current Clang master complains with
    
    /home/noel/libo3/svl/source/items/itemset.cxx:189:26: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
            va_start( pArgs, nNull );
                             ^
    /home/noel/libo3/svl/source/items/itemset.cxx:176:89: note: parameter of type 'sal_uInt16' (aka 'unsigned short') is declared here
    SfxItemSet::SfxItemSet(SfxItemPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2, sal_uInt16 nNull, ...)

diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index 5793007..f327f92 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -66,7 +66,7 @@ public:
 
                                 SfxItemSet( SfxItemPool&);
                                 SfxItemSet( SfxItemPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
-                                SfxItemSet( SfxItemPool&, sal_uInt16 nWh1, sal_uInt16 nWh2, sal_uInt16 nNull, ... );
+                                SfxItemSet( SfxItemPool&, int nWh1, int nWh2, int nNull, ... );
                                 SfxItemSet( SfxItemPool&, const sal_uInt16* nWhichPairTable );
     virtual                     ~SfxItemSet();
 
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index e47f3be..d2388c3 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -173,7 +173,7 @@ void SfxItemSet::InitRanges_Impl(va_list pArgs, sal_uInt16 nWh1, sal_uInt16 nWh2
     memset(static_cast<void*>(m_pItems), 0, sizeof(SfxPoolItem*) * nSize);
 }
 
-SfxItemSet::SfxItemSet(SfxItemPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2, sal_uInt16 nNull, ...)
+SfxItemSet::SfxItemSet(SfxItemPool& rPool, int nWh1, int nWh2, int nNull, ...)
     : m_pPool( &rPool )
     , m_pParent(nullptr)
     , m_pWhichRanges(nullptr)
@@ -181,13 +181,17 @@ SfxItemSet::SfxItemSet(SfxItemPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2, sal
 {
     assert(nWh1 <= nWh2);
 
-    if (nNull == 0) // delimiter
-        InitRanges_Impl(nWh1, nWh2);
-    else
-    {
+    if(!nNull)
+        InitRanges_Impl(
+            sal::static_int_cast< sal_uInt16 >(nWh1),
+            sal::static_int_cast< sal_uInt16 >(nWh2));
+    else {
         va_list pArgs;
         va_start( pArgs, nNull );
-        InitRanges_Impl(pArgs, nWh1, nWh2, nNull);
+        InitRanges_Impl(
+            pArgs, sal::static_int_cast< sal_uInt16 >(nWh1),
+            sal::static_int_cast< sal_uInt16 >(nWh2),
+            sal::static_int_cast< sal_uInt16 >(nNull));
         va_end(pArgs);
     }
 }


More information about the Libreoffice-commits mailing list