* Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27076 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-20 08:32:44 +00:00
parent 8c3921d063
commit 743b3f1527
@@ -186,11 +186,11 @@ class Inode {
Attribute* FindAttribute(const char* name) const; Attribute* FindAttribute(const char* name) const;
status_t AddAttribute(Attribute* attribute, bool overwrite); status_t AddAttribute(Attribute* attribute, bool overwrite);
status_t AddAttribute(const char* name, type_code type, status_t AddAttribute(const char* name, type_code type,
bool overwrite, const uint8 *data = 0, bool overwrite, const uint8* data, size_t length);
size_t length = 0);
status_t AddAttribute(const char* name, type_code type, status_t AddAttribute(const char* name, type_code type,
const char* string); const char* string);
status_t AddAttribute(const char *name, int32 value); status_t AddAttribute(const char* name, type_code type,
uint32 value);
status_t RemoveAttribute(const char* name); status_t RemoveAttribute(const char* name);
void AddAttrCookie(attr_cookie* cookie); void AddAttrCookie(attr_cookie* cookie);
@@ -499,7 +499,8 @@ Volume::~Volume()
delete fRootNode; delete fRootNode;
Inode *inode, *next; Inode* inode;
Inode* next;
for (inode = fFirstEntry; inode != NULL; inode = next) { for (inode = fFirstEntry; inode != NULL; inode = next) {
next = inode->Next(); next = inode->Next();
@@ -625,7 +626,7 @@ Volume::Mount(const char* device)
text.artists[i] != NULL ? text.artists[i] : text.artist); text.artists[i] != NULL ? text.artists[i] : text.artist);
inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]); inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]);
inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre); inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre);
inode->AddAttribute("Audio:Track", track); inode->AddAttribute("Audio:Track", B_INT32_TYPE, track);
snprintf(title, sizeof(title), "%02lu:%02lu", snprintf(title, sizeof(title), "%02lu:%02lu",
uint32(inode->FrameCount() / kFramesPerMinute), uint32(inode->FrameCount() / kFramesPerMinute),
@@ -639,8 +640,7 @@ Volume::Mount(const char* device)
// Only add CD:cddbid attribute if it does not exist yet. // Only add CD:cddbid attribute if it does not exist yet.
if (fRootNode->FindAttribute(kCddbIdAttribute) == NULL) if (fRootNode->FindAttribute(kCddbIdAttribute) == NULL)
fRootNode->AddAttribute(kCddbIdAttribute, B_UINT32_TYPE, true, fRootNode->AddAttribute(kCddbIdAttribute, B_UINT32_TYPE, fDiscID);
(const uint8 *)&fDiscID, 4);
free(toc); free(toc);
@@ -678,7 +678,8 @@ Volume::_CreateNode(Inode *parent, const char *name, off_t start, off_t frames,
if (S_ISREG(type)) { if (S_ISREG(type)) {
// we need to order it by track for compatibility with BeOS' cdda // we need to order it by track for compatibility with BeOS' cdda
Inode *last = NULL, *current = fFirstEntry; Inode* current = fFirstEntry;
Inode* last = NULL;
while (current != NULL) { while (current != NULL) {
last = current; last = current;
current = current->Next(); current = current->Next();
@@ -1186,10 +1187,9 @@ Inode::AddAttribute(const char *name, type_code type, const char *string)
status_t status_t
Inode::AddAttribute(const char *name, int32 value) Inode::AddAttribute(const char* name, type_code type, uint32 value)
{ {
return AddAttribute(name, B_INT32_TYPE, true, return AddAttribute(name, type, true, (const uint8*)&value, sizeof(uint32));
(const uint8 *)&value, sizeof(int32));
} }
@@ -1381,7 +1381,7 @@ cdda_write_fs_stat(fs_volume *_volume, const struct fs_info *info, uint32 mask)
status_t status = B_BAD_VALUE; status_t status = B_BAD_VALUE;
if (mask & FS_WRITE_FSINFO_NAME) if ((mask & FS_WRITE_FSINFO_NAME) != 0)
status = volume->SetName(info->volume_name); status = volume->SetName(info->volume_name);
return status; return status;
@@ -1625,8 +1625,8 @@ cdda_rename(fs_volume *_volume, fs_vnode *_oldDir, const char *oldName,
fs_vnode* _newDir, const char* newName) fs_vnode* _newDir, const char* newName)
{ {
if (_oldDir != _newDir if (_oldDir != _newDir
|| oldName == NULL || *oldName == '\0' || oldName == NULL || oldName[0] == '\0'
|| newName == NULL || *newName == '\0' || newName == NULL || newName[0] == '\0'
|| !strcmp(oldName, ".") || !strcmp(oldName, "..") || !strcmp(oldName, ".") || !strcmp(oldName, "..")
|| !strcmp(newName, ".") || !strcmp(newName, "..") || !strcmp(newName, ".") || !strcmp(newName, "..")
|| strchr(newName, '/') != NULL) || strchr(newName, '/') != NULL)
@@ -1885,7 +1885,7 @@ cdda_create_attr(fs_volume *_volume, fs_vnode *_node, const char *name,
Attribute* attribute = inode->FindAttribute(name); Attribute* attribute = inode->FindAttribute(name);
if (attribute == NULL) { if (attribute == NULL) {
status_t status = inode->AddAttribute(name, type, ""); status_t status = inode->AddAttribute(name, type, true, NULL, 0);
if (status < B_OK) if (status < B_OK)
return status; return status;
} else if ((openMode & O_EXCL) == 0) { } else if ((openMode & O_EXCL) == 0) {