Added buffer size parameter to Inode::GetName().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10409 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-12-13 02:43:02 +00:00
parent c838911b01
commit 299e521546
2 changed files with 4 additions and 4 deletions

View File

@ -695,11 +695,11 @@ Inode::Name(const bfs_inode *node) const
/** Copies the node's name into the provided buffer. /** Copies the node's name into the provided buffer.
* The buffer must be B_FILE_NAME_LENGTH bytes large. * The buffer should be B_FILE_NAME_LENGTH bytes large.
*/ */
status_t status_t
Inode::GetName(char *buffer) const Inode::GetName(char *buffer, size_t size) const
{ {
NodeGetter node(fVolume, this); NodeGetter node(fVolume, this);
SimpleLocker locker(fSmallDataLock); SimpleLocker locker(fSmallDataLock);
@ -708,7 +708,7 @@ Inode::GetName(char *buffer) const
if (name == NULL) if (name == NULL)
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
strlcpy(buffer, name, B_FILE_NAME_LENGTH); strlcpy(buffer, name, size);
return B_OK; return B_OK;
} }

View File

@ -100,7 +100,7 @@ class Inode {
status_t GetNextSmallData(bfs_inode *node, small_data **_smallData) const; status_t GetNextSmallData(bfs_inode *node, small_data **_smallData) const;
small_data *FindSmallData(const bfs_inode *node, const char *name) const; small_data *FindSmallData(const bfs_inode *node, const char *name) const;
const char *Name(const bfs_inode *node) const; const char *Name(const bfs_inode *node) const;
status_t GetName(char *buffer) const; status_t GetName(char *buffer, size_t bufferSize = B_FILE_NAME_LENGTH) const;
status_t SetName(Transaction &transaction, const char *name); status_t SetName(Transaction &transaction, const char *name);
// high-level attribute methods // high-level attribute methods