Merge "Remove String16::makeLower()." into sc-dev

This commit is contained in:
TreeHugger Robot 2021-04-08 23:38:34 +00:00 committed by Android (Google) Code Review
commit 7c4fc3cbdc
4 changed files with 0 additions and 44 deletions

View file

@ -390,28 +390,6 @@ size_t String16::staticStringSize() const {
return static_cast<size_t>(*(p - 1));
}
status_t String16::makeLower()
{
const size_t N = size();
const char16_t* str = string();
char16_t* edited = nullptr;
for (size_t i=0; i<N; i++) {
const char16_t v = str[i];
if (v >= 'A' && v <= 'Z') {
if (!edited) {
SharedBuffer* buf = static_cast<SharedBuffer*>(edit());
if (!buf) {
return NO_MEMORY;
}
edited = (char16_t*)buf->data();
mString = str = edited;
}
edited[i] = tolower((char)v);
}
}
return OK;
}
status_t String16::replaceAll(char16_t replaceThis, char16_t withThis)
{
const size_t N = size();

View file

@ -34,11 +34,6 @@ std::vector<std::function<void(FuzzedDataProvider&, android::String16, android::
str1.size();
}),
// Casing
([](FuzzedDataProvider&, android::String16 str1, android::String16) -> void {
str1.makeLower();
}),
// Comparison
([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
str1.startsWith(str2);

View file

@ -111,13 +111,6 @@ TEST(String16Test, RemoveOutOfBounds) {
EXPECT_STR16EQ(u" me", tmp);
}
TEST(String16Test, MakeLower) {
String16 tmp("Verify Me!");
tmp.makeLower();
EXPECT_EQ(10U, tmp.size());
EXPECT_STR16EQ(u"verify me!", tmp);
}
TEST(String16Test, ReplaceAll) {
String16 tmp("Verify verify Verify");
tmp.replaceAll(u'r', u'!');
@ -190,14 +183,6 @@ TEST(String16Test, StaticStringRemove) {
EXPECT_FALSE(tmp.isStaticString());
}
TEST(String16Test, StaticStringMakeLower) {
StaticString16 tmp(u"Verify me!");
tmp.makeLower();
EXPECT_EQ(10U, tmp.size());
EXPECT_STR16EQ(u"verify me!", tmp);
EXPECT_FALSE(tmp.isStaticString());
}
TEST(String16Test, StaticStringReplaceAll) {
StaticString16 tmp(u"Verify verify Verify");
tmp.replaceAll(u'r', u'!');

View file

@ -85,8 +85,6 @@ public:
bool contains(const char16_t* chrs) const;
status_t makeLower();
status_t replaceAll(char16_t replaceThis,
char16_t withThis);