[Libreoffice-commits] core.git: 2 commits - editeng/source idlc/inc include/codemaker lingucomponent/source linguistic/source sc/source sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Sat Sep 24 12:27:03 UTC 2016


 editeng/source/misc/hangulhanja.cxx                   |    4 +-
 idlc/inc/idlctypes.hxx                                |   10 -------
 include/codemaker/global.hxx                          |   10 -------
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |    4 +-
 lingucomponent/source/lingutil/lingutil.hxx           |    8 -----
 lingucomponent/source/spellcheck/spell/sspellimp.cxx  |    4 +-
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx   |    4 +-
 linguistic/source/convdic.hxx                         |   25 ++----------------
 sc/source/filter/excel/xeescher.cxx                   |   10 -------
 sfx2/source/view/viewfrm.cxx                          |    3 --
 sw/source/filter/ww8/ww8par.cxx                       |    2 -
 sw/source/filter/ww8/ww8par.hxx                       |   12 +-------
 sw/source/filter/ww8/ww8par5.cxx                      |    4 +-
 13 files changed, 20 insertions(+), 80 deletions(-)

New commits:
commit 88c7f08c49642ed14e62e96f63cae00ef608cbbb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Sep 24 12:17:59 2016 +0100

    coverity#1373358 Unchecked dynamic_cast
    
    Change-Id: I96526a735c0adb4c20c463f73c34701a9fafb76b

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 197b842..b9e6280 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1175,9 +1175,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
         return;
 
     // we know only SfxEventHint or simple SfxHint
-    if ( dynamic_cast<const SfxEventHint*>(&rHint) )
+    if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint))
     {
-        const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
         // When the Document is loaded asynchronously, was the Dispatcher
         // set as ReadOnly, to what must be returned when the document itself
         // is not read only, and the loading is finished.
commit dd691312a3a0e0e18ade5c64a3c4f5115c3fde0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Sep 23 20:55:37 2016 +0100

    we shouldn't need explicit lt_rtl_OUString, etc things anymore
    
    Change-Id: Ibeec3fcc353e07e61fb2c838b318e0a04081ce2c

diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx
index b9d34a0..c0338ef 100644
--- a/editeng/source/misc/hangulhanja.cxx
+++ b/editeng/source/misc/hangulhanja.cxx
@@ -58,8 +58,8 @@ namespace editeng
     class HangulHanjaConversion_Impl
     {
     private:
-        typedef ::std::set< OUString, ::std::less< OUString > >                   StringBag;
-        typedef ::std::map< OUString, OUString, ::std::less< OUString > >  StringMap;
+        typedef std::set<OUString>            StringBag;
+        typedef std::map<OUString, OUString>  StringMap;
 
     private:
         StringBag               m_sIgnoreList;
diff --git a/idlc/inc/idlctypes.hxx b/idlc/inc/idlctypes.hxx
index ec8d004..12c665c 100644
--- a/idlc/inc/idlctypes.hxx
+++ b/idlc/inc/idlctypes.hxx
@@ -30,17 +30,9 @@
 #include <sal/types.h>
 #include <rtl/ustring.hxx>
 
-struct LessString
-{
-    bool operator()(const OString& str1, const OString& str2) const
-    {
-        return (str1 < str2);
-    }
-};
-
 typedef ::std::list< OString >               StringList;
 typedef ::std::vector< OString >             StringVector;
-typedef ::std::set< OString, LessString >    StringSet;
+typedef ::std::set< OString >    StringSet;
 
 class AstDeclaration;
 
diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx
index 964c84c..d9dc636 100644
--- a/include/codemaker/global.hxx
+++ b/include/codemaker/global.hxx
@@ -30,17 +30,9 @@
 #include <rtl/ustring.hxx>
 #include <rtl/strbuf.hxx>
 
-struct LessString
-{
-    bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
-    {
-        return (str1 < str2);
-    }
-};
-
 typedef ::std::list< ::rtl::OString >               StringList;
 typedef ::std::vector< ::rtl::OString >             StringVector;
-typedef ::std::set< ::rtl::OString, LessString >    StringSet;
+typedef ::std::set< ::rtl::OString >    StringSet;
 
 
 // FileStream
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 29c8c25..d4bc22e 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -149,7 +149,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
         {
             // get supported locales from the dictionaries-to-use...
             sal_Int32 k = 0;
-            std::set< OUString, lt_rtl_OUString > aLocaleNamesSet;
+            std::set<OUString> aLocaleNamesSet;
             std::list< SvtLinguConfigDictionaryEntry >::const_iterator aDictIt;
             for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
             {
@@ -162,7 +162,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
             }
             // ... and add them to the resulting sequence
             aSuppLocales.realloc( aLocaleNamesSet.size() );
-            std::set< OUString, lt_rtl_OUString >::const_iterator aItB;
+            std::set<OUString>::const_iterator aItB;
             k = 0;
             for (aItB = aLocaleNamesSet.begin();  aItB != aLocaleNamesSet.end();  ++aItB)
             {
diff --git a/lingucomponent/source/lingutil/lingutil.hxx b/lingucomponent/source/lingutil/lingutil.hxx
index 299762d..d3bf821 100644
--- a/lingucomponent/source/lingutil/lingutil.hxx
+++ b/lingucomponent/source/lingutil/lingutil.hxx
@@ -33,14 +33,6 @@
 
 struct SvtLinguConfigDictionaryEntry;
 
-struct lt_rtl_OUString
-{
-    bool operator() (const OUString &r1, const OUString &r2) const
-    {
-        return r1 < r2;
-    }
-};
-
 #if defined(_WIN32)
 
 // to be use to get a path name with long path prefix
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 1d291f1..db690ae 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -147,7 +147,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
             uno::Reference< ucb::XSimpleFileAccess > xAccess(xServiceFactory->createInstance("com.sun.star.ucb.SimpleFileAccess"), uno::UNO_QUERY);
             // get supported locales from the dictionaries-to-use...
             sal_Int32 k = 0;
-            std::set< OUString, lt_rtl_OUString > aLocaleNamesSet;
+            std::set<OUString> aLocaleNamesSet;
             std::list< SvtLinguConfigDictionaryEntry >::const_iterator aDictIt;
             for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
             {
@@ -176,7 +176,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
             }
             // ... and add them to the resulting sequence
             aSuppLocales.realloc( aLocaleNamesSet.size() );
-            std::set< OUString, lt_rtl_OUString >::const_iterator aItB;
+            std::set<OUString>::const_iterator aItB;
             k = 0;
             for (aItB = aLocaleNamesSet.begin();  aItB != aLocaleNamesSet.end();  ++aItB)
             {
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 08296b4..f8a66da 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -164,7 +164,7 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales()
         {
             // get supported locales from the dictionaries-to-use...
             sal_Int32 k = 0;
-            std::set< OUString, lt_rtl_OUString > aLocaleNamesSet;
+            std::set<OUString> aLocaleNamesSet;
             std::list< SvtLinguConfigDictionaryEntry >::const_iterator aDictIt;
             for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
             {
@@ -177,7 +177,7 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales()
             }
             // ... and add them to the resulting sequence
             aSuppLocales.realloc( aLocaleNamesSet.size() );
-            std::set< OUString, lt_rtl_OUString >::const_iterator aItB;
+            std::set<OUString>::const_iterator aItB;
             k = 0;
             for (aItB = aLocaleNamesSet.begin();  aItB != aLocaleNamesSet.end();  ++aItB)
             {
diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx
index 1ed4856..4481551 100644
--- a/linguistic/source/convdic.hxx
+++ b/linguistic/source/convdic.hxx
@@ -41,30 +41,11 @@
 
 bool    IsConvDic( const OUString &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvType );
 
-struct StrLT
-{
-    bool operator()( const OUString &rTxt1, const OUString &rTxt2 ) const
-    {
-        return rTxt1 < rTxt2;
-    }
-};
-
-struct StrEQ
-{
-    bool operator()( const OUString &rTxt1, const OUString &rTxt2 ) const
-    {
-        return rTxt1 == rTxt2;
-    }
-};
-
-typedef std::unordered_multimap< OUString, OUString,
-                       const OUStringHash, StrEQ > ConvMap;
-
-typedef std::set< OUString, StrLT > ConvMapKeySet;
+typedef std::unordered_multimap<OUString, OUString, const OUStringHash> ConvMap;
 
-typedef std::unordered_multimap< OUString, sal_Int16,
-                       OUStringHash, StrEQ > PropTypeMap;
+typedef std::set<OUString> ConvMapKeySet;
 
+typedef std::unordered_multimap<OUString, sal_Int16, OUStringHash> PropTypeMap;
 
 class ConvDic :
     public ::cppu::WeakImplHelper
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index e340ff8..6e2ee06 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1399,14 +1399,6 @@ XclExpComments::XclExpComments( SCTAB nTab, XclExpRecordList< XclExpNote >& rNot
 {
 }
 
-struct OUStringLess : public std::binary_function<OUString, OUString, bool>
-{
-    bool operator()(const OUString& x, const OUString& y) const
-    {
-        return x.compareTo( y ) < 0;
-    }
-};
-
 void XclExpComments::SaveXml( XclExpXmlStream& rStrm )
 {
     if( mrNotes.IsEmpty() )
@@ -1436,7 +1428,7 @@ void XclExpComments::SaveXml( XclExpXmlStream& rStrm )
 
     rComments->startElement( XML_authors, FSEND );
 
-    typedef std::set< OUString, OUStringLess > Authors;
+    typedef std::set<OUString> Authors;
     Authors aAuthors;
 
     size_t nNotes = mrNotes.GetSize();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 1d176f2..f3f7df9 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1396,7 +1396,7 @@ void SwWW8ReferencedFltEndStack::SetAttrInDoc( const SwPosition& rTmpPos,
             if ( pFltBookmark != nullptr && pFltBookmark->IsTOCBookmark() )
             {
                 const OUString& rName = pFltBookmark->GetName();
-                std::set< OUString, SwWW8::ltstr >::const_iterator aResult = aReferencedTOCBookmarks.find(rName);
+                std::set<OUString>::const_iterator aResult = aReferencedTOCBookmarks.find(rName);
                 if ( aResult == aReferencedTOCBookmarks.end() )
                 {
                     bInsertBookmarkIntoDoc = false;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 39c7df7..c5f42b1 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -428,14 +428,6 @@ private:
 
 namespace SwWW8
 {
-    struct ltstr
-    {
-        bool operator()(const OUString &r1, const OUString &r2) const
-        {
-            return r1.compareToIgnoreAsciiCase(r2)<0;
-        }
-    };
-
     struct ltnode
     {
         bool operator()(const SwTextNode *r1, const SwTextNode *r2) const
@@ -455,7 +447,7 @@ public:
 
     // Keep track of referenced TOC bookmarks in order to suppress the import
     // of unreferenced ones.
-    std::set<OUString, SwWW8::ltstr> aReferencedTOCBookmarks;
+    std::set<OUString> aReferencedTOCBookmarks;
 protected:
     virtual void SetAttrInDoc( const SwPosition& rTmpPos,
                                SwFltStackEntry& rEntry ) override;
@@ -473,7 +465,7 @@ public:
     //Keep track of variable names created with fields, and the bookmark
     //mapped to their position, hopefully the same, but very possibly
     //an additional pseudo bookmark
-    std::map<OUString, OUString, SwWW8::ltstr> aFieldVarNames;
+    std::map<OUString, OUString> aFieldVarNames;
 protected:
     SwFltStackEntry *RefToVar(const SwField* pField,SwFltStackEntry& rEntry);
     virtual void SetAttrInDoc(const SwPosition& rTmpPos,
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index aef81a9..82af4ab 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1273,7 +1273,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField,
     {
         //Get the name of the ref field, and see if actually a variable
         const OUString sName = pField->GetPar1();
-        std::map<OUString, OUString, SwWW8::ltstr>::const_iterator
+        std::map<OUString, OUString>::const_iterator
             aResult = aFieldVarNames.find(sName);
 
         if (aResult != aFieldVarNames.end())
@@ -1297,7 +1297,7 @@ OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName)
 
     //See if there has been a variable set with this name, if so get
     //the pseudo bookmark name that was set with it.
-    std::map<OUString, OUString, SwWW8::ltstr>::const_iterator aResult =
+    std::map<OUString, OUString>::const_iterator aResult =
             m_pReffingStck->aFieldVarNames.find(sName);
 
     return (aResult == m_pReffingStck->aFieldVarNames.end())


More information about the Libreoffice-commits mailing list