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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Mar 8 16:06:15 UTC 2019


 sc/source/filter/excel/xepivotxml.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit a507d54e4e0764de951ae3de5a0b8b994a4ce7d7
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Mar 8 15:49:56 2019 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Mar 8 17:05:41 2019 +0100

    Use std::set::count instead of std::set::find + iterator comparison
    
    std::set::contains from C++20 is not here yet :-)
    
    Change-Id: I50b5db2d44cb0effa64ab89a16205145883ce374
    Reviewed-on: https://gerrit.libreoffice.org/68922
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index eed70122dfd8..30fadd4ad722 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -279,8 +279,6 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
             }
         }
 
-        auto aDPTypeEnd = aDPTypes.cend();
-
         auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList();
         // TODO In same cases, disable listing of items, as it is done in MS Excel.
         // Exporting savePivotCacheRecordsXml method needs to be updated accordingly
@@ -289,10 +287,10 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
         std::set<ScDPItemData::Type> aDPTypesWithoutBlank = aDPTypes;
         aDPTypesWithoutBlank.erase(ScDPItemData::Empty);
 
-        const bool isContainsString
-            = aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end();
-        bool isContainsBlank = aDPTypes.find(ScDPItemData::Empty) != aDPTypeEnd;
-        bool isContainsNumber = !isContainsDate && aDPTypesWithoutBlank.find(ScDPItemData::Value) != aDPTypesWithoutBlank.end();
+        const bool isContainsString = aDPTypesWithoutBlank.count(ScDPItemData::String) > 0;
+        const bool isContainsBlank = aDPTypes.count(ScDPItemData::Empty) > 0;
+        const bool isContainsNumber
+            = !isContainsDate && aDPTypesWithoutBlank.count(ScDPItemData::Value) > 0;
         bool isContainsNonDate = !(isContainsDate && aDPTypesWithoutBlank.size() <= 1);
 
         // XML_containsSemiMixedTypes possible values:


More information about the Libreoffice-commits mailing list