summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-02 09:52:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-03 13:54:12 +0100
commitd4f61a594608219d08b489205ebb5569d905f444 (patch)
tree8dca491703de6a4aa329ec1e68e3374e57834755 /svl
parenta5eddf3b047dca78ea321005cc6dc5e92914e032 (diff)
no point in mapping SID to itself
and once we remove that self mapping, no need to call GetWhich for those IDs either Change-Id: Ia881328a29bb022dace8d5f25c57279a381e0377 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/qa/unit/items/stylepool.cxx2
-rw-r--r--svl/qa/unit/items/test_itempool.cxx8
-rw-r--r--svl/source/items/itempool.cxx18
3 files changed, 23 insertions, 5 deletions
diff --git a/svl/qa/unit/items/stylepool.cxx b/svl/qa/unit/items/stylepool.cxx
index 01f0d8867b48..94ff91aea73c 100644
--- a/svl/qa/unit/items/stylepool.cxx
+++ b/svl/qa/unit/items/stylepool.cxx
@@ -26,7 +26,7 @@ CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder)
// Set up a style pool with multiple parents.
SfxStringItem aDefault1(1);
std::vector<SfxPoolItem*> aDefaults{ &aDefault1 };
- SfxItemInfo const aItems[] = { { 1, false } };
+ SfxItemInfo const aItems[] = { { 2, false } };
rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test", 1, 1, aItems);
pPool->SetDefaults(&aDefaults);
diff --git a/svl/qa/unit/items/test_itempool.cxx b/svl/qa/unit/items/test_itempool.cxx
index 4d15edaffd86..6868999f0f76 100644
--- a/svl/qa/unit/items/test_itempool.cxx
+++ b/svl/qa/unit/items/test_itempool.cxx
@@ -34,10 +34,10 @@ class PoolItemTest : public CppUnit::TestFixture
void PoolItemTest::testPool()
{
SfxItemInfo const aItems[] =
- { { 1, true },
- { 2, false /* not poolable */ },
- { 3, false },
- { 4, false /* not poolable */}
+ { { 4, true },
+ { 3, false /* not poolable */ },
+ { 2, false },
+ { 1, false /* not poolable */}
};
rtl::Reference<SfxItemPool> pPool = new SfxItemPool("testpool", 1, 4, aItems);
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index fe13cfb96a32..8d4aa074e4f5 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -167,6 +167,24 @@ SfxItemPool::SfxItemPool
if ( pDefaults )
SetDefaults(pDefaults);
+
+#ifdef DBG_UTIL
+ if (pItemInfos)
+ {
+ auto p = pItemInfos;
+ auto nWhich = nStartWhich;
+ while (nWhich <= nEndWhich)
+ {
+ if (p->_nSID == nWhich)
+ {
+ SAL_WARN("svl.items", "No point mapping a SID to itself, just put a 0 here in the SfxItemInfo array, at index " << (p - pItemInfos));
+ assert(false);
+ }
+ ++p;
+ ++nWhich;
+ }
+ }
+#endif
}