[Libreoffice-commits] core.git: cui/source i18npool/source xmlsecurity/source

Stephan Bergmann sbergman at redhat.com
Wed Apr 22 13:53:14 PDT 2015


 cui/source/tabpages/tparea.cxx                                    |    9 ++++-----
 cui/source/tabpages/tpline.cxx                                    |    4 ++--
 i18npool/source/breakiterator/xdictionary.cxx                     |    2 +-
 i18npool/source/localedata/localedata.cxx                         |    7 +++----
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |    4 ++--
 5 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 1a31dd5ec4ede142044eb58d2d1e03709a6d12cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Apr 22 21:40:50 2015 +0200

    Clean up odd sal::static_int_cast<sal_Bool> uses
    
    Change-Id: Idbd1cdb06315b96dc9f45e34108a1af45229ed2f
    Reviewed-on: https://gerrit.libreoffice.org/15484
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index ed8c5cf..882f185 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -1200,8 +1200,7 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
             TriState eState = m_pTsbTile->GetState();
             if( m_pTsbTile->IsValueChangedFromSaved() )
             {
-                XFillBmpTileItem aFillBmpTileItem(
-                    sal::static_int_cast< sal_Bool >( eState ) );
+                XFillBmpTileItem aFillBmpTileItem( eState != TRISTATE_FALSE );
                 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_TILE );
                 if ( !pOld || !( *static_cast<const XFillBmpTileItem*>(pOld) == aFillBmpTileItem ) )
                 {
@@ -1217,7 +1216,7 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
             if( m_pTsbStretch->IsValueChangedFromSaved() )
             {
                 XFillBmpStretchItem aFillBmpStretchItem(
-                    sal::static_int_cast< sal_Bool >( eState ) );
+                    eState != TRISTATE_FALSE );
                 pOld = GetOldItem( *rAttrs, XATTR_FILLBMP_STRETCH );
                 if ( !pOld || !( *static_cast<const XFillBmpStretchItem*>(pOld) == aFillBmpStretchItem ) )
                 {
@@ -2244,12 +2243,12 @@ IMPL_LINK_NOARG(SvxAreaTabPage, ModifyTileHdl_Impl)
         m_pMtrFldYSize->SetValue( m_pMtrFldYSize->GetValue() );
     }
 
-    rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< sal_Bool >( eState ) ) );
+    rXFSet.Put( XFillBmpTileItem( eState != TRISTATE_FALSE ) );
 
     if( m_pTsbStretch->IsEnabled() )
         rXFSet.Put(
             XFillBmpStretchItem(
-                sal::static_int_cast< sal_Bool >( m_pTsbStretch->GetState() ) ) );
+                m_pTsbStretch->GetState() != TRISTATE_FALSE ) );
 
     if( m_pTsbScale->IsEnabled() )
         rXFSet.Put( XFillBmpSizeLogItem( m_pTsbScale->GetState() == TRISTATE_FALSE ) );
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index ce3668f..0ebcf15 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -805,7 +805,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
     TriState eState = m_pTsbCenterStart->GetState();
     if( m_pTsbCenterStart->IsValueChangedFromSaved() )
     {
-        XLineStartCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
+        XLineStartCenterItem aItem( eState != TRISTATE_FALSE );
         pOld = GetOldItem( *rAttrs, XATTR_LINESTARTCENTER );
         if ( !pOld || !( *static_cast<const XLineStartCenterItem*>(pOld) == aItem ) )
         {
@@ -816,7 +816,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
     eState = m_pTsbCenterEnd->GetState();
     if( m_pTsbCenterEnd->IsValueChangedFromSaved() )
     {
-        XLineEndCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
+        XLineEndCenterItem aItem( eState != TRISTATE_FALSE );
         pOld = GetOldItem( *rAttrs, XATTR_LINEENDCENTER );
         if ( !pOld || !( *static_cast<const XLineEndCenterItem*>(pOld) == aItem ) )
         {
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx
index 5f14995..ec9f630 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -196,7 +196,7 @@ void xdictionary::setJapaneseWordBreak()
 bool xdictionary::exists(const sal_uInt32 c)
 {
     // 0x1FFF is the hardcoded limit in gendict for data.existMarks
-    bool exist = (data.existMark && ((c>>3) < 0x1FFF)) ? sal::static_int_cast<sal_Bool>((data.existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False;
+    bool exist = data.existMark && (c>>3) < 0x1FFF && (data.existMark[c>>3] & (1<<(c&0x07))) != 0;
     if (!exist && japaneseWordBreak)
         return BreakIteratorImpl::getScriptClass(c) == ScriptType::ASIAN;
     else
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 56d8fc8..4ab8cd2 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -710,7 +710,7 @@ LocaleDataImpl::getAllCalendars2( const Locale& rLocale ) throw(RuntimeException
         for(sal_Int16 i = 0; i < calendarsCount; i++) {
             OUString calendarID(allCalendars[offset]);
             offset++;
-            bool defaultCalendar = sal::static_int_cast<sal_Bool>( allCalendars[offset][0] );
+            bool defaultCalendar = allCalendars[offset][0] != 0;
             offset++;
             Sequence< CalendarItem2 > days = getCalendarItems( allCalendars, offset, REF_DAYS, i,
                     rLocale, calendarsSeq);
@@ -879,7 +879,7 @@ LocaleDataImpl::getAllFormats( const Locale& rLocale ) throw(RuntimeException, s
                         formatArray[nOff + 3],
                         formatArray[nOff + 4],
                         formatArray[nOff + 5][0],
-                        sal::static_int_cast<sal_Bool>(formatArray[nOff + 6][0]));
+                        formatArray[nOff + 6][0] != 0);
                 seq[f] = elem;
             }
         }
@@ -943,8 +943,7 @@ LocaleDataImpl::getCollatorImplementations( const Locale& rLocale ) throw(Runtim
         Sequence< Implementation > seq(collatorCount);
         for(sal_Int16 i = 0; i < collatorCount; i++) {
             Implementation impl(collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_ALGO],
-                    sal::static_int_cast<sal_Bool>(
-                        collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_DEFAULT][0]));
+                    collatorArray[i * COLLATOR_ELEMENTS + COLLATOR_OFFSET_DEFAULT][0] != 0);
             seq[i] = impl;
         }
         return seq;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 8faef3a..2259c1d 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -380,7 +380,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl :: getSubjectName() throw ( ::com:
             if( xExtn == NULL )
                 throw RuntimeException() ;
 
-            xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, ( unsigned char* )pExtn->pszObjId, strlen( pExtn->pszObjId ), sal::static_int_cast<sal_Bool>(pExtn->fCritical) ) ;
+            xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, ( unsigned char* )pExtn->pszObjId, strlen( pExtn->pszObjId ), pExtn->fCritical ) ;
 
             xExtns[i] = xExtn ;
         }
@@ -406,7 +406,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl :: getSubjectName() throw ( ::com:
                 if( xExtn == NULL )
                     throw RuntimeException() ;
 
-                xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, ( unsigned char* )pExtn->pszObjId, strlen( pExtn->pszObjId ), sal::static_int_cast<sal_Bool>(pExtn->fCritical) ) ;
+                xExtn->setCertExtn( pExtn->Value.pbData, pExtn->Value.cbData, ( unsigned char* )pExtn->pszObjId, strlen( pExtn->pszObjId ), pExtn->fCritical ) ;
             }
         }
 


More information about the Libreoffice-commits mailing list