KPath: Use a default buffer size of B_PATH_NAME_LENGTH without + 1.

B_PATH_NAME_LENGTH == PATH_MAX, and PATH_MAX is inclusive of the final
NULL terminator, so we don't need a + 1 here.

The original KPath default was to not use + 1, but that was changed in
42e3c6f978 due to all the consumers that did.

But all those consumers are wrong, it appears; they should just be
using the default length instead. So now we do that.
This commit is contained in:
Augustin Cavalier
2024-11-22 16:56:15 -05:00
parent cc9ea55c59
commit 9708b08060
3 changed files with 11 additions and 8 deletions
+4 -3
View File
@@ -22,15 +22,16 @@ public:
TRAVERSE_LEAF_LINK = 0x02,
LAZY_ALLOC = 0x04
};
public:
KPath(size_t bufferSize = B_PATH_NAME_LENGTH + 1);
KPath(size_t bufferSize = B_PATH_NAME_LENGTH);
KPath(const char* path, int32 flags = DEFAULT,
size_t bufferSize = B_PATH_NAME_LENGTH + 1);
size_t bufferSize = B_PATH_NAME_LENGTH);
KPath(const KPath& other);
~KPath();
status_t SetTo(const char* path, int32 flags = DEFAULT,
size_t bufferSize = B_PATH_NAME_LENGTH + 1);
size_t bufferSize = B_PATH_NAME_LENGTH);
void Adopt(KPath& other);
status_t InitCheck() const;