[Libreoffice-commits] core.git: include/rtl sal/qa sot/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 15 07:48:57 UTC 2021
include/rtl/ustring.hxx | 20 --------------------
sal/qa/rtl/oustring/rtl_OUString2.cxx | 19 -------------------
sot/source/base/exchange.cxx | 2 +-
3 files changed, 1 insertion(+), 40 deletions(-)
New commits:
commit 846bcc5adb82b601937681da7cec96c40253c2e7
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Jan 14 22:18:20 2021 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Jan 15 08:48:20 2021 +0100
OUString::matchAsciiL() can be used instead of the fresh startsWithAsciiL()
Revert the addition of the latter.
Change-Id: I93636a901cde401b0b7d923e052887f57dd58212
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109315
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 3a7f8bd5654f..ee3cfe170555 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -1419,26 +1419,6 @@ public:
return b;
}
- /**
- Check whether this string starts with a given ASCII string.
-
- @param asciiStr a sequence of at least asciiStrLength ASCII characters
- (bytes in the range 0x00--0x7F)
- @param asciiStrLength the length of asciiStr; must be non-negative
- @return true if this string starts with asciiStr; otherwise, false is
- returned
-
- @since LibreOffice 7.2
- */
- bool startsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
- const
- {
- return asciiStrLength <= pData->length
- && rtl_ustr_asciil_reverseEquals_WithLength(
- pData->buffer, asciiStr,
- asciiStrLength);
- }
-
/**
Check whether this string starts with a given string, ignoring the case of
ASCII letters.
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
index d2223511f92a..516378dc14a7 100644
--- a/sal/qa/rtl/oustring/rtl_OUString2.cxx
+++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx
@@ -881,24 +881,6 @@ void indexOfAscii::test() {
sal_Int32(3), OUString("foofoobar").indexOf("foo", 1));
}
-class startsWithAsciiL: public CppUnit::TestFixture {
-public:
- void test();
-
- CPPUNIT_TEST_SUITE(startsWithAsciiL);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void startsWithAsciiL::test() {
- CPPUNIT_ASSERT_EQUAL(true, OUString().startsWithAsciiL("", 0));
- CPPUNIT_ASSERT_EQUAL(false, OUString().startsWithAsciiL("x", 1));
- CPPUNIT_ASSERT_EQUAL(true, OUString("bar").startsWithAsciiL("bar", 3));
- CPPUNIT_ASSERT_EQUAL(false, OUString("bar").startsWithAsciiL("foobar", 6));
- CPPUNIT_ASSERT_EQUAL(true, OUString("foobar").startsWithAsciiL("foo", 3));
- CPPUNIT_ASSERT_EQUAL(false, OUString("FOOBAR").startsWithAsciiL("foo", 3));
-}
-
class endsWith: public CppUnit::TestFixture {
public:
void test();
@@ -1051,7 +1033,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::getToken);
CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::convertToString);
CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::construction);
CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::indexOfAscii);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::startsWithAsciiL);
CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::endsWith);
CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::isEmpty);
CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::createFromCodePoints);
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 84a2427d334b..d00565d618fd 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -442,7 +442,7 @@ SotClipboardFormatId SotExchange::GetFormat( const DataFlavor& rFlavor )
{
const char* const pFormatMimeType = pFormatArray_Impl[ static_cast<int>(i) ].pMimeType;
const sal_Int32 nFormatMimeTypeLen = rtl_str_getLength( pFormatMimeType );
- if( rMimeType.startsWithAsciiL( pFormatMimeType, nFormatMimeTypeLen ) &&
+ if( rMimeType.matchAsciiL( pFormatMimeType, nFormatMimeTypeLen ) &&
( rMimeType.getLength() == nFormatMimeTypeLen ||
rMimeType[ nFormatMimeTypeLen ] == ';' ) )
return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50)
More information about the Libreoffice-commits
mailing list