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

Noel Grandin noel at peralex.com
Fri Jun 19 04:13:39 PDT 2015


 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   10 ++++++++--
 sdext/source/pdfimport/tree/writertreevisiting.cxx |    9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 1352d166748ff730b11d9e165e302f7e9a1dc090
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jun 19 13:12:06 2015 +0200

    workaround older compilers that do not have std::list::erase(const_iterator)
    
    Change-Id: Iaa1164904febd8e97d4962e4004ec4719a1f4a42

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 0b2fad3..66d20b4 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -452,8 +452,14 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
 
         elem.Children.splice( elem.Children.end(), pNext->Children );
         // workaround older compilers that do not have std::list::erase(const_iterator)
-        std::list< Element* > tmp;
-        tmp.splice( tmp.begin(), elem.Parent->Children, next_it, next_it);
+#if defined __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+        std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
+        std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
+        elem.Parent->Children.erase(tmpIt);
+#else
+        elem.Parent->Children.erase(next_it);
+#endif
+
         delete pNext;
     }
 }
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 73d4d19..4759b19 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -403,8 +403,13 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
 
         elem.Children.splice( elem.Children.end(), pNext->Children );
         // workaround older compilers that do not have std::list::erase(const_iterator)
-        std::list< Element* > tmp;
-        tmp.splice( tmp.begin(), elem.Parent->Children, next_it, next_it);
+#if defined __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+        std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
+        std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
+        elem.Parent->Children.erase(tmpIt);
+#else
+        elem.Parent->Children.erase(next_it);
+#endif
         delete pNext;
     }
 }


More information about the Libreoffice-commits mailing list