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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 2 15:57:46 UTC 2019


 sc/inc/patattr.hxx              |    2 --
 sc/source/core/data/patattr.cxx |   40 ----------------------------------------
 2 files changed, 42 deletions(-)

New commits:
commit 585e0ac43b9bd8a2f714903034e435c84ae3fc96
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 2 15:47:27 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 2 17:56:53 2019 +0200

    revert part of "tdf#81765 slow loading of .ods"
    
    it turns out that
        soffice --headless --convert-to pdf tdf89833-2.xlsm
    semi-reliably fails with
    stl concept checking "Error: attempt to compare a dereferenceable
    iterator to a singular iterator"
    because we are modifying ScPatternAttr all over the place, which messes
    with the sorted list in the pool.
    
    Change-Id: Id662ac32b024c2c60b32b6cf433c12deb614f0fa
    Reviewed-on: https://gerrit.libreoffice.org/71677
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 52fd8536d861..8004a57c3a26 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -65,8 +65,6 @@ public:
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
 
     virtual bool            operator==(const SfxPoolItem& rCmp) const override;
-    virtual bool            operator<(const SfxPoolItem& rCmp) const override;
-    virtual bool            IsSortable() const override { return true; }
 
     const SfxPoolItem&      GetItem( sal_uInt16 nWhichP ) const
                                         { return GetItemSet().Get(nWhichP); }
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index fbf6d33e4a6c..52bdfcda5b27 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -120,17 +120,6 @@ static bool StrCmp( const OUString* pStr1, const OUString* pStr2 )
     return *pStr1 == *pStr2;
 }
 
-static bool StrLess( const OUString* pStr1, const OUString* pStr2 )
-{
-    if (pStr1 == pStr2)
-        return false;
-    if (pStr1 && !pStr2)
-        return false;
-    if (!pStr1 && pStr2)
-        return true;
-    return *pStr1 < *pStr2;
-}
-
 static bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
 {
     // #i62090# The SfxItemSet in the SfxSetItem base class always has the same ranges
@@ -146,23 +135,6 @@ static bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
     return ( 0 == memcmp( pItems1, pItems2, (ATTR_PATTERN_END - ATTR_PATTERN_START + 1) * sizeof(pItems1[0]) ) );
 }
 
-static int CmpPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
-{
-    // #i62090# The SfxItemSet in the SfxSetItem base class always has the same ranges
-    // (single range from ATTR_PATTERN_START to ATTR_PATTERN_END), and the items are pooled,
-    // so it's enough to compare just the pointers (Count just because it's even faster).
-
-    if ( rSet1.Count() < rSet2.Count() )
-        return -1;
-    if ( rSet1.Count() > rSet2.Count() )
-        return 1;
-
-    SfxPoolItem const ** pItems1 = rSet1.GetItems_Impl();   // inline method of SfxItemSet
-    SfxPoolItem const ** pItems2 = rSet2.GetItems_Impl();
-
-    return memcmp( pItems1, pItems2, (ATTR_PATTERN_END - ATTR_PATTERN_START + 1) * sizeof(pItems1[0]) );
-}
-
 bool ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const
 {
     // #i62090# Use quick comparison between ScPatternAttr's ItemSets
@@ -171,18 +143,6 @@ bool ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const
              StrCmp( GetStyleName(), static_cast<const ScPatternAttr&>(rCmp).GetStyleName() ) );
 }
 
-bool ScPatternAttr::operator<( const SfxPoolItem& rCmp ) const
-{
-    // #i62090# Use quick comparison between ScPatternAttr's ItemSets
-    auto const & rOtherAttr = static_cast<const ScPatternAttr&>(rCmp);
-    int cmp = CmpPatternSets( GetItemSet(), rOtherAttr.GetItemSet() );
-    if (cmp < 0)
-        return true;
-    if (cmp > 0)
-        return false;
-    return StrLess(GetStyleName(), rOtherAttr.GetStyleName());
-}
-
 SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet )
 {
     SvxCellOrientation eOrient = SvxCellOrientation::Standard;


More information about the Libreoffice-commits mailing list