Merge "Remove unused String8::setPathName." am: 40a0664b84
am: 5f7d548dc6
am: 941b1a61b0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1765465 Change-Id: I2fcc66e3bf09f9b317c32833df03cd3950ce74ce
This commit is contained in:
commit
5c5854a383
3 changed files with 7 additions and 26 deletions
|
@ -431,24 +431,17 @@ void String8::toLower()
|
|||
// ---------------------------------------------------------------------------
|
||||
// Path functions
|
||||
|
||||
void String8::setPathName(const char* name)
|
||||
{
|
||||
setPathName(name, strlen(name));
|
||||
}
|
||||
|
||||
void String8::setPathName(const char* name, size_t len)
|
||||
{
|
||||
char* buf = lockBuffer(len);
|
||||
static void setPathName(String8& s, const char* name) {
|
||||
size_t len = strlen(name);
|
||||
char* buf = s.lockBuffer(len);
|
||||
|
||||
memcpy(buf, name, len);
|
||||
|
||||
// remove trailing path separator, if present
|
||||
if (len > 0 && buf[len-1] == OS_PATH_SEPARATOR)
|
||||
len--;
|
||||
|
||||
if (len > 0 && buf[len - 1] == OS_PATH_SEPARATOR) len--;
|
||||
buf[len] = '\0';
|
||||
|
||||
unlockBuffer(len);
|
||||
s.unlockBuffer(len);
|
||||
}
|
||||
|
||||
String8 String8::getPathLeaf(void) const
|
||||
|
@ -561,7 +554,7 @@ String8& String8::appendPath(const char* name)
|
|||
size_t len = length();
|
||||
if (len == 0) {
|
||||
// no existing filename, just use the new one
|
||||
setPathName(name);
|
||||
setPathName(*this, name);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -581,7 +574,7 @@ String8& String8::appendPath(const char* name)
|
|||
|
||||
return *this;
|
||||
} else {
|
||||
setPathName(name);
|
||||
setPathName(*this, name);
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,10 +89,6 @@ std::vector<std::function<void(FuzzedDataProvider*, android::String8*, android::
|
|||
str1->walkPath(path_out_str.get());
|
||||
path_out_str->clear();
|
||||
},
|
||||
[](FuzzedDataProvider* dataProvider, android::String8* str1,
|
||||
android::String8*) -> void {
|
||||
str1->setPathName(dataProvider->ConsumeBytesWithTerminator<char>(5).data());
|
||||
},
|
||||
[](FuzzedDataProvider* dataProvider, android::String8* str1,
|
||||
android::String8*) -> void {
|
||||
str1->appendPath(dataProvider->ConsumeBytesWithTerminator<char>(5).data());
|
||||
|
|
|
@ -136,14 +136,6 @@ public:
|
|||
* These methods operate on the string as if it were a path name.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set the filename field to a specific value.
|
||||
*
|
||||
* Normalizes the filename, removing a trailing '/' if present.
|
||||
*/
|
||||
void setPathName(const char* name);
|
||||
void setPathName(const char* name, size_t numChars);
|
||||
|
||||
/*
|
||||
* Get just the filename component.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue