diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-03 14:35:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-04 18:49:40 +0200 |
commit | c344de1b9985b6ca10b354e24151d0bdf92dc20e (patch) | |
tree | f49f903855eb74de3dff83c3c7cc38f33e09dbc5 /svl/qa | |
parent | f31f903628d5e578b003524d62b905289f64e58f (diff) |
fix ubsan in SharedStringPool
with a slightly dodgy fix.
regression from
commit 3581f1d71ae0d431ba28c0f3b7b263ff6212ce7b
optimize SharedStringPool::purge() and fix tests
It's not ideal - we no longer have a way of purging uppercase keys that
are longer in use.
But that doesn't cost much memory, because we are sharing those strings.
We could potentially identify them with extra book-keeping in either
intern() or purge(), but since this class is performance-sensitive, best
just to sacrifice some space in the map.
Change-Id: I85a469448f5b36b1b6889da60280edd56bbcb083
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95432
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 4aa6ae8ba911bd3420d3b74c085aa69d87339f4d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95426
Diffstat (limited to 'svl/qa')
-rw-r--r-- | svl/qa/unit/svl.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 6b44a96729d1..2c266e4d9d31 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -392,10 +392,10 @@ void Test::testSharedStringPoolPurge() CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aPool.getCount()); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aPool.getCountIgnoreCase()); - // Ditto... + // Nothing changes, because the upper-string is still in the map pStr3.reset(); aPool.purge(); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aPool.getCount()); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aPool.getCount()); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aPool.getCountIgnoreCase()); // Again. |