comphelper/qa/string/test_string.cxx | 20 -------------------- comphelper/source/misc/string.cxx | 8 -------- include/comphelper/string.hxx | 13 ------------- 3 files changed, 41 deletions(-)
New commits: commit 4f3a5acac5c1810d845e850f5199d9292c7fe1b6 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed May 24 09:35:10 2023 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed May 24 11:05:47 2023 +0200 Remove unused comphelper::adjustIndexToStartOfSurrogate ...introduced in 28cc0bff10f5dcec0c7b698ae7ba275845b2cad1 "Break comphelper::adjustIndexToStartOfSurrogate out of o3tl::iterateCodePoints" in preparation for bd5c3582581f37513f45b518e348f443d5d57334 "a11y: Fix returning unpaired surrogates when retrieving characters", but which never picked it up Change-Id: I5a10a3053d2f51333e27b74a808a41df7c1912ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152183 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 974673ca2940..58f9c3f63c16 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -50,7 +50,6 @@ public: void testReverseCodePoints(); void testSplit(); void testRemoveAny(); - void testAdjustIndexToStartOfSurrogate(); CPPUNIT_TEST_SUITE(TestString); CPPUNIT_TEST(testStripStart); @@ -64,7 +63,6 @@ public: CPPUNIT_TEST(testReverseCodePoints); CPPUNIT_TEST(testSplit); CPPUNIT_TEST(testRemoveAny); - CPPUNIT_TEST(testAdjustIndexToStartOfSurrogate); CPPUNIT_TEST_SUITE_END(); }; @@ -239,24 +237,6 @@ void TestString::testRemoveAny() CPPUNIT_ASSERT_EQUAL(OUString(), removeAny(in, test7)); } -void TestString::testAdjustIndexToStartOfSurrogate() { - CPPUNIT_ASSERT_EQUAL( - sal_Int32(0), - comphelper::string::adjustIndexToStartOfSurrogate("", 0)); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(0), - comphelper::string::adjustIndexToStartOfSurrogate(u"\U00010000", 0)); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(0), - comphelper::string::adjustIndexToStartOfSurrogate(u"\U00010000", 1)); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(2), - comphelper::string::adjustIndexToStartOfSurrogate(u"\U00010000", 2)); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(1), - comphelper::string::adjustIndexToStartOfSurrogate(u"\xD800", 1)); -} - CPPUNIT_TEST_SUITE_REGISTRATION(TestString); } diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index d5653522a229..e17951fc43be 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -673,14 +673,6 @@ OUString sanitizeStringSurrogates(const OUString& rString) return rString; } -sal_Int32 adjustIndexToStartOfSurrogate(OUString const & string, sal_Int32 index) { - assert(index >= 0 && index <= string.getLength()); - return - (index > 0 && rtl::isHighSurrogate(string[index - 1]) - && index < string.getLength() && rtl::isLowSurrogate(string[index])) - ? index - 1 : index; -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 2763ded2e9fd..bab63f06f034 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -384,19 +384,6 @@ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::u16string_view rString); */ COMPHELPER_DLLPUBLIC OUString sanitizeStringSurrogates(const OUString& rString); -/** Adjust an index in case it points into the middle of a surrogate pair. - - @param string An OUString - - @param index A valid index into the string or to its end (i.e., must be in the range from zero - to the length of string, inclusive) - - @return index - 1 if the original index pointed into the middle of a surrogate pair; otherwise - the unchanged index - */ -COMPHELPER_DLLPUBLIC sal_Int32 adjustIndexToStartOfSurrogate( - OUString const & string, sal_Int32 index); - } // namespace comphelper::string /* vim:set shiftwidth=4 softtabstop=4 expandtab: */