Revert "Revert "Remove unused String8::setPathName.""
This reverts commit 70d9fb63e6
.
Reason for revert: Outstanding usage of this method removed internally
Change-Id: Idcc00ec261aa1d97f11e47abdb08b10a37b5d20f
Test: Local build; treehugger (which I'll manually confirm runs on the appropriate targets)
This commit is contained in:
parent
70d9fb63e6
commit
d03851e549
3 changed files with 7 additions and 26 deletions
|
@ -429,24 +429,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
|
||||
|
@ -559,7 +552,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;
|
||||
}
|
||||
|
||||
|
@ -579,7 +572,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