diff --git a/src/add-ons/kernel/file_systems/ramfs/Attribute.cpp b/src/add-ons/kernel/file_systems/ramfs/Attribute.cpp index dc83f45c11..1ab167a228 100644 --- a/src/add-ons/kernel/file_systems/ramfs/Attribute.cpp +++ b/src/add-ons/kernel/file_systems/ramfs/Attribute.cpp @@ -7,7 +7,6 @@ #include "Attribute.h" #include "Misc.h" #include "Node.h" -#include "ramfs.h" #include "Volume.h" // constructor @@ -102,7 +101,7 @@ Attribute::_Changed(uint8* oldKey, size_t oldLength, off_t changeOffset, ssize_t // update live queries uint8 newKey[kMaxIndexKeyLength]; - size_t newLength = kMaxIndexKeyLength; + size_t newLength; GetKey(newKey, &newLength); GetVolume()->UpdateLiveQueries(NULL, fNode, GetName(), fType, oldKey, oldLength, newKey, newLength); @@ -125,10 +124,9 @@ Attribute::SetIndex(AttributeIndex *index, bool inIndex) // GetKey void -Attribute::GetKey(uint8 *key, size_t *length) +Attribute::GetKey(uint8 key[kMaxIndexKeyLength], size_t *length) { - *length = min(*length, kMaxIndexKeyLength); - ReadAt(0, key, *length, length); + ReadAt(0, key, kMaxIndexKeyLength, length); } // AttachAttributeIterator diff --git a/src/add-ons/kernel/file_systems/ramfs/Attribute.h b/src/add-ons/kernel/file_systems/ramfs/Attribute.h index 5cf007c673..9dca961985 100644 --- a/src/add-ons/kernel/file_systems/ramfs/Attribute.h +++ b/src/add-ons/kernel/file_systems/ramfs/Attribute.h @@ -11,6 +11,7 @@ #include "AttributeIterator.h" #include "DataContainer.h" #include "String.h" +#include "ramfs.h" class AllocationInfo; class Node; @@ -36,13 +37,13 @@ public: off_t GetSize() const { return DataContainer::GetSize(); } virtual status_t WriteAt(off_t offset, const void *buffer, size_t size, - size_t *bytesWritten); + size_t *bytesWritten); // index support void SetIndex(AttributeIndex *index, bool inIndex); AttributeIndex *GetIndex() const { return fIndex; } bool IsInIndex() const { return fInIndex; } - void GetKey(uint8 *key, size_t *length); + void GetKey(uint8 key[kMaxIndexKeyLength], size_t *length); // iterator management void AttachAttributeIterator(AttributeIterator *iterator);