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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 5 06:22:13 UTC 2018


 cui/source/options/optgdlg.cxx                      |   13 +++------
 shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx |   27 ++++++++------------
 shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx |    2 -
 3 files changed, 17 insertions(+), 25 deletions(-)

New commits:
commit 9bd60e28d8257f2cac1f4e0da89c75336910b197
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Nov 4 20:58:00 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Nov 5 07:21:22 2018 +0100

    tdf#120703 PVS: V547 Expression is always true/false
    
    Change-Id: I8217b1a0b6ccc29052257d54ba7844c0970ad9a4
    Reviewed-on: https://gerrit.libreoffice.org/62859
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index c6b01cd9754d..bc2510fb8e7a 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1785,16 +1785,13 @@ IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, ListBox&, rListBox, void )
         SupportHdl( m_pAsianSupportCB );
     }
 
-    const NfCurrencyEntry* pCurr = &SvNumberFormatter::GetCurrencyEntry(
+    const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
             (eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getSystemLanguage() : eLang);
     sal_Int32 nPos = m_pCurrencyLB->GetEntryPos( nullptr );
-    if (pCurr)
-    {
-        // Update the "Default ..." currency.
-        m_pCurrencyLB->RemoveEntry( nPos );
-        OUString aDefaultCurr = m_sSystemDefaultString + " - " + pCurr->GetBankSymbol();
-        nPos = m_pCurrencyLB->InsertEntry( aDefaultCurr );
-    }
+    // Update the "Default ..." currency.
+    m_pCurrencyLB->RemoveEntry(nPos);
+    OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
+    nPos = m_pCurrencyLB->InsertEntry(aDefaultCurr);
     m_pCurrencyLB->SelectEntryPos( nPos );
 
     // obtain corresponding locale data
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index 8f9ac227b137..c36fc6248ca6 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -78,7 +78,7 @@ COooFilter::COooFilter() :
     m_lRefs(1),
     m_pContentReader(nullptr),
     m_pMetaInfoReader(nullptr),
-    m_eState(FilteringContent),
+    m_eState(FilterState::FilteringContent),
     m_ulUnicodeBufferLen(0),
     m_ulUnicodeCharsRead(0),
     m_ulPropertyNum(0),
@@ -263,14 +263,14 @@ SCODE STDMETHODCALLTYPE COooFilter::Init(
         if ( m_fContents )
         {
             m_fEof = FALSE;
-            m_eState = FilteringContent;
+            m_eState = FilterState::FilteringContent;
             m_ulUnicodeCharsRead = 0;
             m_ChunkPosition = 0;
         }
         else
         {
             m_fEof = TRUE;
-            m_eState = FilteringProperty;
+            m_eState = FilterState::FilteringProperty;
         }
         m_ulChunkID = 1;
     }
@@ -307,7 +307,7 @@ SCODE STDMETHODCALLTYPE COooFilter::GetChunk(STAT_CHUNK * pStat)
     {
         switch ( m_eState )
         {
-        case FilteringContent:
+        case FilterState::FilteringContent:
         {
             if( m_ChunkPosition == m_pContentReader ->getChunkBuffer().size() )
             {
@@ -317,7 +317,7 @@ SCODE STDMETHODCALLTYPE COooFilter::GetChunk(STAT_CHUNK * pStat)
 
             if ( !m_fContents || m_fEof )
             {
-                m_eState = FilteringProperty;
+                m_eState = FilterState::FilteringProperty;
                 continue;
             }
             m_pwsBuffer = m_pContentReader -> getChunkBuffer()[m_ChunkPosition].second;
@@ -339,7 +339,7 @@ SCODE STDMETHODCALLTYPE COooFilter::GetChunk(STAT_CHUNK * pStat)
             m_ChunkPosition++;
             return S_OK;
         }
-        case FilteringProperty:
+        case FilterState::FilteringProperty:
         {
             if ( m_cAttributes ==  0 )
                 return FILTER_E_END_OF_CHUNKS;
@@ -377,8 +377,6 @@ SCODE STDMETHODCALLTYPE COooFilter::GetChunk(STAT_CHUNK * pStat)
                 return S_OK;
             }
         }
-        default:
-            return E_FAIL;
         }//switch(...)
     }//for(;;)
 }
@@ -401,9 +399,9 @@ SCODE STDMETHODCALLTYPE COooFilter::GetText(ULONG * pcwcBuffer, WCHAR * awcBuffe
 {
     switch ( m_eState )
     {
-    case FilteringProperty:
+    case FilterState::FilteringProperty:
         return FILTER_E_NO_TEXT;
-    case FilteringContent:
+    case FilterState::FilteringContent:
     {
         if ( !m_fContents || 0 == m_ulUnicodeBufferLen )
         {
@@ -425,9 +423,8 @@ SCODE STDMETHODCALLTYPE COooFilter::GetText(ULONG * pcwcBuffer, WCHAR * awcBuffe
         }
         return S_OK;
     }
-    default:
-        return E_FAIL;
     }
+    return E_FAIL; // Should not happen!
 }
 //M-------------------------------------------------------------------------
 //  Method:     GetMetaInfoNameFromPropertyId
@@ -463,9 +460,9 @@ static ::std::wstring GetMetaInfoNameFromPropertyId( ULONG ulPropID )
 
 SCODE STDMETHODCALLTYPE COooFilter::GetValue(PROPVARIANT ** ppPropValue)
 {
-    if (m_eState == FilteringContent)
+    if (m_eState == FilterState::FilteringContent)
         return FILTER_E_NO_VALUES;
-    else if (m_eState == FilteringProperty)
+    else // m_eState == FilteringProperty
     {
         if ( m_cAttributes == 0 || ( m_ulCurrentPropertyNum == m_ulPropertyNum ) )
             return FILTER_E_NO_MORE_VALUES;
@@ -489,8 +486,6 @@ SCODE STDMETHODCALLTYPE COooFilter::GetValue(PROPVARIANT ** ppPropValue)
         m_ulCurrentPropertyNum = m_ulPropertyNum;
         return S_OK;
     }
-    else
-        return E_FAIL;
 }
 //M-------------------------------------------------------------------------
 //  Method:     COooFilter::BindRegion          (IFilter::BindRegion)
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index f63b86f956fb..6a793d759f5e 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -64,7 +64,7 @@ const CLSID CLSID_PERSISTENT_HANDLER_ADDIN =
 const CLSID CLSID_FILTER_HANDLER =
 {0x7bc0e710, 0x5703, 0x45be, {0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62}};
 
-enum FilterState
+enum class FilterState
 {
     FilteringContent,                           // Filtering the content property
     FilteringProperty                           // Filtering the pseudo property


More information about the Libreoffice-commits mailing list