* Added Adopt() method that steals the other path's buffer.
* Fixed operator=(): the second argument of SetTo() is a boolean (normalize), not the length of the buffer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25382 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b1429e2a05
commit
56bbbbc9ca
@ -22,6 +22,7 @@ class KPath {
|
||||
|
||||
status_t SetTo(const char *path, bool normalize = false,
|
||||
size_t bufferSize = B_PATH_NAME_LENGTH);
|
||||
void Adopt(KPath& other);
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
|
@ -86,6 +86,18 @@ KPath::SetTo(const char* path, bool normalize, size_t bufferSize)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KPath::Adopt(KPath& other)
|
||||
{
|
||||
free(fBuffer);
|
||||
|
||||
fBuffer = other.fBuffer;
|
||||
fBufferSize = other.fBufferSize;
|
||||
|
||||
other.fBuffer = NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
KPath::InitCheck() const
|
||||
{
|
||||
@ -257,7 +269,7 @@ KPath::Append(const char *component, bool isComponent)
|
||||
KPath&
|
||||
KPath::operator=(const KPath& other)
|
||||
{
|
||||
SetTo(other.fBuffer, other.fBufferSize);
|
||||
SetTo(other.fBuffer, false, other.fBufferSize);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user