diff options
author | David Tardon <dtardon@redhat.com> | 2013-08-05 09:09:00 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-06 16:43:33 +0200 |
commit | 85a7606366b73d2adf03f685d2c3331a03f8fca0 (patch) | |
tree | e9ee92a36fc744a261a617abf477faf5d4ca38e0 /sc | |
parent | 37552212689157d87a04bb4ea5a6fc312c5b04e0 (diff) |
fix build with debug STL
Failed with:
/usr/include/c++/4.8.1/debug/safe_iterator.h:510:error: attempt to compare
iterators from different sequences.
Objects involved in the operation:
...
The problem is that miPos in _copied_ object points ot maAttrs in the
original object, not in the copy (and std::for_each takes a copy of the
functor). This could be solved by defining copy constructor and
operator=, but given the limited usage of the class, it is simpler to
let copies share the state.
(cherry picked from commit 95d1b05430d0d6384c6910fa9dfdd3c703201d34)
Conflicts:
sc/source/core/data/documentimport.cxx
Change-Id: Icf3f02ecd2fe4ce6dd77f3cde226d32beb4d4b3f
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/documentimport.cxx | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index 77687166dc43..0078db4eb7cf 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -252,23 +252,33 @@ namespace { class CellTextAttrInitializer { - sc::CellTextAttrStoreType maAttrs; - sc::CellTextAttrStoreType::iterator miPos; - sal_uInt16 mnScriptNumeric; + struct Impl + { + sc::CellTextAttrStoreType maAttrs; + sc::CellTextAttrStoreType::iterator miPos; + sal_uInt16 mnScriptNumeric; + + Impl(const sal_uInt32 nMaxRowCount, const sal_uInt16 nScriptNumeric) + : maAttrs(nMaxRowCount), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric) + {} + }; + + boost::shared_ptr<Impl> mpImpl; + public: - CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : maAttrs(MAXROWCOUNT), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric) {} + CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : mpImpl(new Impl(MAXROWCOUNT, nScriptNumeric)) {} void operator() (const ColEntry& rEntry) { sc::CellTextAttr aDefault; if (rEntry.pCell->GetCellType() == CELLTYPE_VALUE) - aDefault.mnScriptType = mnScriptNumeric; - miPos = maAttrs.set(miPos, rEntry.nRow, aDefault); + aDefault.mnScriptType = mpImpl->mnScriptNumeric; + mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, rEntry.nRow, aDefault); } void swap(sc::CellTextAttrStoreType& rAttrs) { - maAttrs.swap(rAttrs); + mpImpl->maAttrs.swap(rAttrs); } }; |