Merge "Remove String16::makeLower()." am: c33f57b7f9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1666087 Change-Id: I4f2085a36f0f62c19497310ba34c8730e08b4616
This commit is contained in:
commit
d5da89bd7e
4 changed files with 0 additions and 44 deletions
|
|
@ -390,28 +390,6 @@ size_t String16::staticStringSize() const {
|
||||||
return static_cast<size_t>(*(p - 1));
|
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)
|
status_t String16::replaceAll(char16_t replaceThis, char16_t withThis)
|
||||||
{
|
{
|
||||||
const size_t N = size();
|
const size_t N = size();
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,6 @@ std::vector<std::function<void(FuzzedDataProvider&, android::String16, android::
|
||||||
str1.size();
|
str1.size();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Casing
|
|
||||||
([](FuzzedDataProvider&, android::String16 str1, android::String16) -> void {
|
|
||||||
str1.makeLower();
|
|
||||||
}),
|
|
||||||
|
|
||||||
// Comparison
|
// Comparison
|
||||||
([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
|
([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
|
||||||
str1.startsWith(str2);
|
str1.startsWith(str2);
|
||||||
|
|
|
||||||
|
|
@ -97,13 +97,6 @@ TEST(String16Test, Remove) {
|
||||||
EXPECT_STR16EQ(u" m", tmp);
|
EXPECT_STR16EQ(u" m", tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(String16Test, MakeLower) {
|
|
||||||
String16 tmp("Verify Me!");
|
|
||||||
tmp.makeLower();
|
|
||||||
EXPECT_EQ(10U, tmp.size());
|
|
||||||
EXPECT_STR16EQ(u"verify me!", tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(String16Test, ReplaceAll) {
|
TEST(String16Test, ReplaceAll) {
|
||||||
String16 tmp("Verify verify Verify");
|
String16 tmp("Verify verify Verify");
|
||||||
tmp.replaceAll(u'r', u'!');
|
tmp.replaceAll(u'r', u'!');
|
||||||
|
|
@ -176,14 +169,6 @@ TEST(String16Test, StaticStringRemove) {
|
||||||
EXPECT_FALSE(tmp.isStaticString());
|
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) {
|
TEST(String16Test, StaticStringReplaceAll) {
|
||||||
StaticString16 tmp(u"Verify verify Verify");
|
StaticString16 tmp(u"Verify verify Verify");
|
||||||
tmp.replaceAll(u'r', u'!');
|
tmp.replaceAll(u'r', u'!');
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,6 @@ public:
|
||||||
|
|
||||||
bool contains(const char16_t* chrs) const;
|
bool contains(const char16_t* chrs) const;
|
||||||
|
|
||||||
status_t makeLower();
|
|
||||||
|
|
||||||
status_t replaceAll(char16_t replaceThis,
|
status_t replaceAll(char16_t replaceThis,
|
||||||
char16_t withThis);
|
char16_t withThis);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue